Welcome, Guest
You have to register before you can post on our site.

Username
  

Password
  





Search Forums



(Advanced Search)

Forum Statistics
» Members: 39,322
» Latest member: DishisdesignJewellery
» Forum threads: 929
» Forum posts: 6,494

Full Statistics

Online Users
There are currently 296 online users.
» 1 Member(s) | 295 Guest(s)
beerycloth

Latest Threads
Gekko 0.6 released
Forum: Announcements
Last Post: lsm99dna
Yesterday, 08:15 PM
» Replies: 124
» Views: 332,140
An official Gekko service...
Forum: Announcements
Last Post: Ruslanjoshua
07-24-2025, 06:27 AM
» Replies: 111
» Views: 246,515
New Gekko UI in the works
Forum: Announcements
Last Post: celemtine
07-03-2025, 07:24 AM
» Replies: 185
» Views: 323,367
Gekko with malware spotte...
Forum: Announcements
Last Post: pugoing
07-01-2025, 02:29 AM
» Replies: 212
» Views: 274,814
Gekko development status ...
Forum: Announcements
Last Post: sanmarconns
10-21-2024, 06:34 PM
» Replies: 744
» Views: 1,466,280
How to add Binance Future...
Forum: Technical Support
Last Post: Xavier32
10-07-2021, 02:20 PM
» Replies: 47
» Views: 133,895
Bittrex Configuration hel...
Forum: Bittrex
Last Post: yirzolusto
10-07-2021, 07:39 AM
» Replies: 6
» Views: 22,865
[Question] Why does gekko...
Forum: General Discussion
Last Post: cryptocurrency0
10-06-2021, 01:16 PM
» Replies: 16
» Views: 57,106
a couple of technical Que...
Forum: Technical Support
Last Post: mtom78632
10-06-2021, 11:08 AM
» Replies: 25
» Views: 71,740
crex24
Forum: Other exchanges
Last Post: marketingseo
10-05-2021, 09:47 AM
» Replies: 216
» Views: 511,668

 
  Playlist of all my Gekko Trading Bot videos
Posted by: crypto49er - 11-27-2018, 11:37 PM - Forum: Guides - Replies (3)

I have been creating videos on the Gekko Trading Bot since the beginning of this year. I covered everything from installing it on Windows, Mac, Linux, Docker, and backtesting, running various plugins like Telegram and Twitter. I'm sure some of you have watched some of my videos. I figured I probably should have a playlist of all the videos here so you can reference them at your leisure. 

https://www.youtube.com/playlist?list=PL...lPyy9Qa3aY

In addition, I get asked what Gekko topics I should cover next. I don't always respond to PMs (sorry, my inbox is inundated) so it might be better to leave a comment here and I will let you know if that is something that I will cover in a future video.


  [Share] RSI-BB-ADX with candlebatcher
Posted by: Gryphon - 11-27-2018, 09:37 AM - Forum: Strategy Development - Replies (30)

This is more a share of the method I'm using for candle batching than of the strategy, but as Tommies RSI strat is rather excellent and so widely known it seemed a good demonstrator.

This strategy runs on 1 minute candles and batches them in the update function. 
The less obvious bit is that instead of keeping one copy of each indicator, it keeps an array of each indicator as long as the candle size for that indicator. Each new minute candle, the next indicator in the array is updated and read. 
The upshot of this is that each minute there is an up to date result of the longer term indicator, allowing far more accurate entry and exit points checked every minute, instead of every 5, 10, 30, 60 etc minutes. This also makes a strategy less sensitive to start time - although it still makes more of a difference than I'd expect!

The timeframe for each indicator is also independent so different candle sizes can be used for bear and bull market indicators - however the indicator candle size and indicator period do become a little interchangeable as they're both changing the amount of time that the indicator is watching the market over.

Other benefits of running at 1 minute is that any stop losses or take profits that you might add can be checked that much more frequently, so are that much more useful at catching quick market movements.

Downsides:
> As with any strategy running on very short timeframes trying to tune it with GA style optimisers can results in huge profits with hundreds of trades per day that will perform absolutely miserably if ran live as the orders simply can't be filled. Tuning requires a little more understanding of what the strategy is doing and inputting sensible parameters.
> Gekko currently has a limitation on the number of candles it can pre-seed a strategy with of around 4000. When running at 1 minute, this is 2.7 days of history so you need to shrink those long SMAs


So - here's a quick example backtest from 6 months history on an alt, with Tommie's original strategy first, candlebatched second. Both have exactly the same parameters, as in the TOML file below.

Original:
[Image: DJkIwSX.png]

Candlebatched:
[Image: fBuUMVB.png]
Paper trading settings are at their defaults. These two are purely intended as a relative comparison. I obviously can't promise any results but hope it shows that there is potential!


I'm sharing this under the same CC-BY-SA 4.0 license that Tommie shared his under - I learnt a lot from that bit of code, so hopefully giving a little back.
Run the strategy in 1 minute candles in gekko and specify the candle sizes you want each indicator to run at with the timeframe parameter in the TOML.

TOML: Github

Code:
# SMA INDICATOR
SMA_long = 1000
SMA_short = 50
SMA_Timeframe = 10

# RSI BULL / BEAR
BULL_RSI = 10
BULL_RSI_high = 80
BULL_RSI_low = 45
BULL_RSI_Timeframe = 10

BEAR_RSI = 15
BEAR_RSI_high = 50
BEAR_RSI_low = 20
BEAR_RSI_Timeframe = 10

# MODIFY RSI (depending on ADX)
BULL_MOD_high = 5
BULL_MOD_low = -5
BEAR_MOD_high = 15
BEAR_MOD_low = -5

# ADX
ADX = 3
ADX_high = 70
ADX_low = 50
ADX_Timeframe = 10

Strategy: Github
Code:
/*
    Adapted to run on 1 Minute candles with candle batching
    by Gryphon/RJPGriffin Nov'18

    RSI Bull and Bear + ADX modifier
    1. Use different RSI-strategies depending on a longer trend
    2. But modify this slighly if shorter BULL/BEAR is detected
    -
    (CC-BY-SA 4.0) Tommie Hansen
    https://creativecommons.org/licenses/by-sa/4.0/
    -
    NOTE: Requires custom indicators found here:
    https://github.com/Gab0/Gekko-extra-indicators
    (c) Gabriel Araujo
    Howto: Download + add to gekko/strategies/indicators
*/

// req's
var log = require('../core/log.js');
var config = require('../core/util.js').getConfig();
var RSI = require('./indicators/RSI.js')
var ADX = require('./indicators/ADX.js')
var SMA = require('./indicators/SMA.js')


// strategy
var strat = {

 /* INIT */
 init: function() {
   // core
   this.name = 'RSI Bull and Bear + ADX M1';
   this.requiredHistory = config.tradingAdvisor.historySize;
   this.resetTrend();

   // debug? set to false to disable all logging/messages/stats (improves performance in backtests)
   this.debug = false;

   // performance
   config.backtest.batchSize = 1000; // increase performance
   config.silent = true; // NOTE: You may want to set this to 'false' @ live
   config.debug = false;

   //Add Custom Timeframe indicators
   //SMA
   this.maSlow = new SMA(this.settings.SMA_long);
   this.maFast = new SMA(this.settings.SMA_short)

   // RSI
   this.BULL_RSI = [];
   for (let i = 0; i < this.settings.BULL_RSI_Timeframe; i++) {
     this.BULL_RSI[i] = new RSI({
       interval: this.settings.BULL_RSI
     });
   }

   this.BEAR_RSI = [];
   for (let i = 0; i < this.settings.BEAR_RSI_Timeframe; i++) {
     this.BEAR_RSI[i] = new RSI({
       interval: this.settings.BEAR_RSI
     });
   }

   // ADX
   this.ADX = new ADX(this.settings.ADX);

   this.timeframes = {
     SMA: this.settings.SMA_Timeframe,
     SMA_Count: 0,
     BULL_RSI: this.settings.BULL_RSI_Timeframe,
     BULL_RSI_Count: 0,
     BEAR_RSI: this.settings.BEAR_RSI_Timeframe,
     BEAR_RSI_Count: 0,
     ADX: this.settings.ADX_Timeframe,
     ADX_Count: 0
   };

   // ADX
   this.addIndicator('ADX', 'ADX', this.settings.ADX);

   // MOD (RSI modifiers)
   this.BULL_MOD_high = this.settings.BULL_MOD_high;
   this.BULL_MOD_low = this.settings.BULL_MOD_low;
   this.BEAR_MOD_high = this.settings.BEAR_MOD_high;
   this.BEAR_MOD_low = this.settings.BEAR_MOD_low;


   // debug stuff
   this.startTime = new Date();

   // add min/max if debug
   if (this.debug) {
     this.stat = {
       adx: {
         min: 1000,
         max: 0
       },
       bear: {
         min: 1000,
         max: 0
       },
       bull: {
         min: 1000,
         max: 0
       }
     };
   }

   /* MESSAGES */

   // message the user about required history
   log.info("====================================");
   log.info('Running', this.name);
   log.info('====================================');
   log.info("Make sure your warmup period matches SMA_long and that Gekko downloads data if needed");

   // warn users
   if (this.requiredHistory < this.settings.SMA_long) {
     log.warn("*** WARNING *** Your Warmup period is lower then SMA_long. If Gekko does not download data automatically when running LIVE the strategy will default to BEAR-mode until it has enough data.");
   }

 }, // init()


 /* RESET TREND */
 resetTrend: function() {
   var trend = {
     duration: 0,
     direction: 'none',
     longPos: false,
   };

   this.trend = trend;
 },


 /* get low/high for backtest-period */
 lowHigh: function(val, type) {
   let cur;
   if (type == 'bear') {
     cur = this.stat.bear;
     if (val < cur.min) this.stat.bear.min = val; // set new
     else if (val > cur.max) this.stat.bear.max = val;
   } else if (type == 'bull') {
     cur = this.stat.bull;
     if (val < cur.min) this.stat.bull.min = val; // set new
     else if (val > cur.max) this.stat.bull.max = val;
   } else {
     cur = this.stat.adx;
     if (val < cur.min) this.stat.adx.min = val; // set new
     else if (val > cur.max) this.stat.adx.max = val;
   }
 },

 //Update all of the non gekko managed indicators here
 update: function(candle) {
   tf = this.timeframes;
   if (tf.SMA_Count >= tf.SMA) {
     this.maSlow.update(candle.close);
     this.maFast.update(candle.close);
     tf.SMA_Count = 0;
   } else {
     tf.SMA_Count++;
   }

   tf.BULL_RSI_Count = (tf.BULL_RSI_Count + 1) % (tf.BULL_RSI - 1);
   this.BULL_RSI[tf.BULL_RSI_Count].update(candle);


   tf.BEAR_RSI_Count = (tf.BEAR_RSI_Count + 1) % (tf.BEAR_RSI - 1);
   this.BEAR_RSI[tf.BEAR_RSI_Count].update(candle);

   if (tf.ADX_Count >= tf.ADX) {
     this.ADX.update(candle);
     tf.ADX_Count = 0;
   } else {
     tf.ADX_Count++;
   }
 },


 /* CHECK */
 check: function(candle) {
   // get all indicators

   var maSlow = this.maSlow.result,
     maFast = this.maFast.result,
     rsi,
     adx = this.ADX.result;

   // BEAR TREND
   // NOTE: maFast will always be under maSlow if maSlow can't be calculated
   if (maFast < maSlow) {
     rsi = this.BEAR_RSI[this.timeframes.BEAR_RSI_Count].result;
     let rsi_hi = this.settings.BEAR_RSI_high,
       rsi_low = this.settings.BEAR_RSI_low;

     // ADX trend strength?
     if (adx > this.settings.ADX_high) rsi_hi = rsi_hi + this.BEAR_MOD_high;
     else if (adx < this.settings.ADX_low) rsi_low = rsi_low + this.BEAR_MOD_low;

     if (rsi > rsi_hi) this.short();
     else if (rsi < rsi_low) this.long();

     if (this.debug) this.lowHigh(rsi, 'bear');
   }

   // BULL TREND
   else {
     rsi = this.BULL_RSI[this.timeframes.BULL_RSI_Count].result;
     let rsi_hi = this.settings.BULL_RSI_high,
       rsi_low = this.settings.BULL_RSI_low;

     // ADX trend strength?
     if (adx > this.settings.ADX_high) rsi_hi = rsi_hi + this.BULL_MOD_high;
     else if (adx < this.settings.ADX_low) rsi_low = rsi_low + this.BULL_MOD_low;

     if (rsi > rsi_hi) this.short();
     else if (rsi < rsi_low) this.long();
     if (this.debug) this.lowHigh(rsi, 'bull');
   }

   // add adx low/high if debug
   if (this.debug) this.lowHigh(adx, 'adx');

 }, // check()


 /* LONG */
 long: function() {
   if (this.trend.direction !== 'up') // new trend? (only act on new trends)
   {
     this.resetTrend();
     this.trend.direction = 'up';
     this.advice('long');
     if (this.debug) log.info('Going long');
   }

   if (this.debug) {
     this.trend.duration++;
     log.info('Long since', this.trend.duration, 'candle(s)');
   }
 },


 /* SHORT */
 short: function() {
   // new trend? (else do things)
   if (this.trend.direction !== 'down') {
     this.resetTrend();
     this.trend.direction = 'down';
     this.advice('short');
     if (this.debug) log.info('Going short');
   }

   if (this.debug) {
     this.trend.duration++;
     log.info('Short since', this.trend.duration, 'candle(s)');
   }
 },


 /* END backtest */
 end: function() {
   let seconds = ((new Date() - this.startTime) / 1000),
     minutes = seconds / 60,
     str;

   minutes < 1 ? str = seconds.toFixed(2) + ' seconds' : str = minutes.toFixed(2) + ' minutes';

   log.info('====================================');
   log.info('Finished in ' + str);
   log.info('====================================');

   // print stats and messages if debug
   if (this.debug) {
     let stat = this.stat;
     log.info('BEAR RSI low/high: ' + stat.bear.min + ' / ' + stat.bear.max);
     log.info('BULL RSI low/high: ' + stat.bull.min + ' / ' + stat.bull.max);
     log.info('ADX min/max: ' + stat.adx.min + ' / ' + stat.adx.max);
   }

 }

};

module.exports = strat;


  [TECH TUT] Updating a old exchange integration to Gekko 0.6+
Posted by: askmike - 11-26-2018, 11:34 AM - Forum: Guides - Replies (4)

This is a technical guide that explains how to migrate legacy exchange wrapper files to new Gekko Broker wrapper files used by Gekko +0.6. This is meant for technical contributors to Gekko who want to update an old exchange integration into Gekko. This isn't an exact guide but it roughly covers the things you need to fix.

All exchange wrappers can be found here: https://github.com/askmike/gekko/tree/de...e/wrappers

- All files ending with .js.old are old wrappers not updated yet.
- All files ending with .js are new wrappers not are working with Gekko 0.6 or higher.

If you want to update an outdated wrapper you need to do a few things:

- Remove all requires to any files outside the `gekko/exchange` directory, such as log and util (the wrappers are now part of a standalone library called Gekko Broker).
- Some function signatures have changed, such as:
  - checkOrder: the callback needs to be passed on object describing partial fills & order rejection
  - cancelOrder: the callback needs to be passed err as well as a "filled" boolean and optionally more data regarding partial fills.
- Error handling works different now, you need to create a function that will handle correct (non error result) and you will need to create a global function that will process the exchange SDK output and normalize error types for the new retry system.

You can look at existing updated implementations for example, and be sure to check out the wrapper reference here: https://gekko.wizb.it/docs/extending/add...hange.html


  Looking for support installing on Windows 10
Posted by: francesco marzolo - 11-24-2018, 08:35 AM - Forum: Technical Support - Replies (3)

Hi

I'm trying to install Gekko on Windows 10.

I'm getting 

gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64", you can set the PYTHON env variable.

I have PATH,  PYTHON and PYTHONENV:
PATH=...;C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64
PYTHON=C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64
PYTHONENV=C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64

Please see the complete log attached


  Last candle data
Posted by: Kris191 - 11-23-2018, 10:47 PM - Forum: Technical Discussion - Replies (4)

Hi all,

Can someone help me please. I want to pull the low and high of the last candle into my strat and log in console, for some reason i cannot figure out how to get the data pulled through, can anyone help me out please.

Thanks


  Bollinger Band question
Posted by: Kris191 - 11-22-2018, 10:43 AM - Forum: Strategy Development - No Replies

Hi all,

I want to use gekko as a signal bot for my BBrsi strat, i thought i had got it, but i got a long advice and the price never touched the the lower band. Has anyone got experience in getting the BB system to work? Do i need to get Gekko to signal when the price is greater than or less than the lower band?

thanks

This is my code:

Code:
var _ = require('lodash');
var log = require('../core/log.js');

var BB = require('./indicators/BB.js');
var rsi = require('./indicators/RSI.js');

// let's create our own method
var method = {};

// prepare everything our method needs
method.init = function () {
 this.name = 'BB';
 this.nsamples = 0;
 this.trend = {
   zone: 'none',  // none, top, high, low, bottom
   duration: 0,
   persisted: false
 };

 this.requiredHistory = this.tradingAdvisor.historySize;

 // define the indicators we need
 this.addIndicator('bb', 'BB', this.settings.bbands);
 this.addIndicator('rsi', 'RSI', this.settings);
  logic = {longpos: false};
  this.logic = logic;
  this.lastCandle;
  this.currentCandle;
}


// for debugging purposes log the last
// calculated parameters.
method.log = function (candle) {
 // var digits = 8;
 // var BB = this.indicators.bb;
 // //BB.lower; BB.upper; BB.middle are your line values

 // log.debug('______________________________________');
 // log.debug('calculated BB properties for candle ', this.nsamples);

 // if (BB.upper > candle.close) log.debug('\t', 'Upper BB:', BB.upper.toFixed(digits));
 // if (BB.middle > candle.close) log.debug('\t', 'Mid   BB:', BB.middle.toFixed(digits));
 // if (BB.lower >= candle.close) log.debug('\t', 'Lower BB:', BB.lower.toFixed(digits));
 // log.debug('\t', 'price:', candle.close.toFixed(digits));
 // if (BB.upper <= candle.close) log.debug('\t', 'Upper BB:', BB.upper.toFixed(digits));
 // if (BB.middle <= candle.close) log.debug('\t', 'Mid   BB:', BB.middle.toFixed(digits));
 // if (BB.lower < candle.close) log.debug('\t', 'Lower BB:', BB.lower.toFixed(digits));
 // log.debug('\t', 'Band gap: ', BB.upper.toFixed(digits) - BB.lower.toFixed(digits));

 // var rsi = this.indicators.rsi;

 // log.debug('calculated RSI properties for candle:');
 // log.debug('\t', 'rsi:', rsi.result.toFixed(digits));
 // log.debug('\t', 'price:', candle.close.toFixed(digits));
}

method.check = function (candle) {
 var BB = this.indicators.bb;
 var price = candle.close;
 this.nsamples++;
 var rsi = this.indicators.rsi;
 var rsiVal = rsi.result;
 var Trend = 'none';
 if (candle.open <= candle.close) Trend = 'Bearish';
 if (candle.open >= candle.close) Trend = 'Bullish';

 
 // price Zone detection
 var zone = 'none';
 if (price >= BB.upper) zone = 'top';
 if ((price < BB.upper) && (price >= BB.middle)) zone = 'high';
 if ((price > BB.lower) && (price < BB.middle)) zone = 'low';
 if (price <= BB.lower) zone = 'bottom';
 //log.debug('current zone:  ', zone);
 //log.debug('current trend duration:  ', this.trend.duration);

 if (this.trend.zone == zone) {
   this.trend = {
     zone: zone,  // none, top, high, low, bottom
     duration: this.trend.duration+1,
     persisted: true
   }
 }
 else {
   this.trend = {
     zone: zone,  // none, top, high, low, bottom
     duration: 0,
     persisted: false
   }
 }
// <= less than or equal to & >= greater than or equal to

 if (price < BB.lower && rsiVal >= this.settings.thresholds.low && this.logic.longpos !== true){ // && rsiVal <= this.settings.thresholds.low) { // && this.trend.duration >= this.settings.thresholds.persistence) {
   this.logic.longpos = true;
   this.advice('long')
   log.info('Price has crossed Lower band at ' + price,);
   log.info('Current RSI is ' + rsiVal.toFixed(2));
   log.info('New Candle is a a ' + Trend, 'Candle');
 }
 //else if (price > BB.lower && rsiVal >= this.settings.thresholds.high && this.logic.longpos !== false) { // rsiVal <= this.settings.thresholds.low) { // && this.trend.duration >= this.settings.thresholds.persistence) {
   //this.logic.longpos = false;
   //this.advice('short')
//}
 else if (price > BB.upper && rsiVal >= this.settings.thresholds.low && this.logic.longpos !== false) { // && rsiVal >= this.settings.thresholds.high) { // && this.trend.duration >= this.settings.thresholds.persistence) {
   this.logic.longpos = false;
   this.advice('short')
   log.info('Price has crossed Lower band at ' + price,);
   log.info('Current RSI is ' + rsiVal.toFixed(2));
   log.info('New Candle is a  ' + Trend, 'Candle');
}
    else {log.info ('Nothing todo!')
        log.info('Current Price is ' + price,);
        log.info('New Candle is a  ' + Trend, 'Candle');}


  CLI Auto start at time
Posted by: Kris191 - 11-21-2018, 09:34 PM - Forum: Technical Discussion - Replies (1)

Hi all,

I'm using a PI3 to run Gekko bots and i want to sync the start time to the chart time on Tradingview, can someone help me? i want to schedule the bots to execute at midnight in CLI.

Can anyone help me with this?

Thanks


  Gekko Config Generator
Posted by: daniikun - 11-21-2018, 09:13 PM - Forum: Third Party Software - Replies (1)

Hey Guys,

I wrote a small tool to automatically generate the configs for gekko's backtest.

I describe it in detail in my repo: https://github.com/danisenpai/gekko-config-generator


  Big difference in live papertrader & live tradingbot
Posted by: CryptoAlpha - 11-21-2018, 01:54 PM - Forum: Technical Support - Replies (4)

Hello!

I just started using gekko and deployed my first live trading bot yesterday. At the same time i started a live paper trader with the same strategy.

When i checked the results today i saw that the paper trader had made twice the amount of trades and the profits are insane.
I'm running the exact same strategy so why am i getting such a big difference?  I use the bot on Binance, and set the paper traders trading fee to 0.1,  is that the right value? Binance fee is 0.1%?  Also paying fees with BNB giving a discount of 25%.

The trades being done by the two are similar when it comes to profit target and duration, but i do see that the trading bot is closing more orders at the same price it bought compared to the paper trader.


exchange  currency  asset         status duration                          strategy      PnL      type trades
binance      BTC VET                  running 19 hours, 57 minutes     -----          -0.044      tradebot 82
binance      BTC VET                  running 19 hours, 52 minutes     -----           45.374    papertrader 206



Hope someone can help me with this, i have no idea what causes the difference.

Thanks!  Big Grin


  real profit?
Posted by: barrubba - 11-21-2018, 01:34 PM - Forum: Strategy Development - No Replies

can someone pubblish some real profit and strat used?
i've read only about backtest and papertrading...would be interesting speaking about real results... 
thanks to everyone want to share! Wink