Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cloggy45/Gekko-Bot-Resources
Gekko bot resources.
https://github.com/cloggy45/Gekko-Bot-Resources
Last synced: 7 days ago
JSON representation
Gekko bot resources.
- Host: GitHub
- URL: https://github.com/cloggy45/Gekko-Bot-Resources
- Owner: cloggy45
- Archived: true
- Created: 2018-01-18T04:42:23.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2020-02-07T22:36:14.000Z (over 4 years ago)
- Last Synced: 2024-08-01T10:21:54.444Z (3 months ago)
- Language: JavaScript
- Homepage:
- Size: 467 KB
- Stars: 198
- Watchers: 55
- Forks: 76
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-ai-in-finance - Gekko-Bot-Resources - Gekko bot resources. (Strategies & Research / Technical Analysis)
README
# Gekko Trading Strategies
## How to install strategies
```
$ git clone https://github.com/cloggy45/Gekko-Bot-Resources.git
$ cp -r Gekko-Bot-Resources/gekko/strategies/* gekko/strategies
$ cd gekko && npm i convnetjs moment gauss lodash.ismatch cluster mathjs numbro stats-lite zero-fill convnetjs tulind
```
# helper.js GuideThe ```helper.js``` includes a collection of modules that I find myself creating each time I make a strategy.
## How to install helper.js
You need to add the ```helper.js``` file to the root of your Gekko folder, then add ``var helper = require('../helper.js');`` to the top of your strategy.
### Trailing Stop Loss
>"A trailing stop order sets the stop price at a fixed amount below the market price with an attached "trailing" amount. As the market price rises, the stop price rises by the trail amount, but if the stock price falls, the stop loss price doesn't change, and a market order is submitted when the stop price is hit."
#### Instructions
We initialize our trailing stop loss in our init function in our strategy like so:
```javascript
strat.init = function() {
this.stopLoss = helper.trailingStopLoss();
.....
```
We create a trailing stop anytime we make a purchase according to the various indicators we set up in our strategy.```javascript
this.stopLoss.create(somePercentage, currentPrice);
```We destroy our trailing stop after any time we call ```this.advice('short')```
```javascript
this.stopLoss.destroy();
```
We must also check on each candle to see if our trailing stop loss has triggered, we can do it like so:
```javascript
strat.check = function(candle) {
const currentPrice = candle.close;
if(this.stopLoss.isTriggered(currentPrice)) {
this.advice('short');
this.stopLoss.destroy();
} else {
this.stopLoss.update(currentPrice);
}
.....
```
We would place the above code in our check function in our strategy.