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

Username
  

Password
  





Search Forums



(Advanced Search)

Forum Statistics
» Members: 5,623
» Latest member: Mike20
» Forum threads: 909
» Forum posts: 4,323

Full Statistics

Online Users
There are currently 69 online users.
» 0 Member(s) | 69 Guest(s)

Latest Threads
Please give me a clue wha...
Forum: Strategy Development
Last Post: Mike20
4 hours ago
» Replies: 3
» Views: 1,455
Extract difficult market ...
Forum: Strategy Development
Last Post: Mike20
4 hours ago
» Replies: 1
» Views: 779
How to stop and then re-r...
Forum: Strategy Development
Last Post: elliesmith
07-11-2020, 06:06 AM
» Replies: 4
» Views: 1,600
Custom Strategy ( bounty ...
Forum: Strategy Development
Last Post: Adriane Demiter
07-04-2020, 07:31 AM
» Replies: 6
» Views: 5,219
Howto: auto re-run Gekko ...
Forum: Guides
Last Post: Kaieysen
07-02-2020, 05:18 AM
» Replies: 5
» Views: 5,712
Chinese ATV Batteries
Forum: General Discussion
Last Post: StvenMartinezz
06-30-2020, 06:55 AM
» Replies: 0
» Views: 145
Best Website Designing Co...
Forum: General Discussion
Last Post: jeewangarg
06-20-2020, 09:58 AM
» Replies: 0
» Views: 160
Bittrex bug fixed?
Forum: General Discussion
Last Post: denvajo
06-19-2020, 11:29 AM
» Replies: 2
» Views: 1,394
Gekko with malware spotte...
Forum: Announcements
Last Post: ArthurJarvis
06-17-2020, 11:37 AM
» Replies: 2
» Views: 3,950
The Framing Effect and Co...
Forum: General Discussion
Last Post: freeforex20
06-14-2020, 01:34 AM
» Replies: 0
» Views: 145

 
  Indicators based on HIGH and LOW values
Posted by: chbinder - 02-11-2018, 12:25 PM - Forum: Strategy Development - Replies (2)

Hi all,

first of all, after having some issues with older gekko versions the current one is working like a charm. Thanks for all the great work!

I created some strategies that work fine and sure, after successfully testing more deeply I will share those here...

For my next "project" I want to create a trading strategy that works great in FOREX markets to verify if it can be used for crypto currencies, too. This strategy is based on two SMAs with the same period but calculated based on the HIGH and LOW values of the candles.

And that's why I kindly ask the community to point me to the right direction:

As I've seen all indicators (gekko, talib, tulip) are calculated based on the CLOSE values (please correct me if I'm wrong). 

Is there a way to do what I explained above? If yes, how can this be achieved?

Many thanks for your support.

Best regards,
Christian


  talib candle recognition
Posted by: zappra - 02-11-2018, 11:14 AM - Forum: Strategy Development - Replies (2)

Hello! First post  Big Grin

I'd like to know if it's possible to use ta-lib's candle recognition in Gekko?

Best,
z


  Running gekko on a ubuntu server with apache
Posted by: SettusBlake - 02-10-2018, 08:35 PM - Forum: Technical Discussion - Replies (19)

Hello!

My knowledge of linux, apache and nodejs is not that great.
But has someone a good detail description for me, how I can run it on an apache server (linux)?


Question Default included CCI strat values wrong? Or i did not understand something...
Posted by: piactif - 02-10-2018, 05:45 PM - Forum: General Discussion - Replies (4)

Hi Mike and others, and first really thank you for the great work on Gekko bot and its additions !

Perhaps i misunderstood something, and perhaps somebody could explain why the CCI results are not the same as i can see on tradingview with the same settings.

Here is what i did to verifiy gekko CCI indicator value against Tradingview CCI value on same period : 

1/ Choose a pair (NEO/ETH) on an exchange (BINANCE) and import 1 month data

2/ Choose an indicator (CCI), a candle size (4 hours) and history size (20 everywhere, so supposed to be 20 * 4hours candle if i'm right)

3/ Make the corresponding graph on tradingview :

[Image: Capture_du_2018_02_10_18_13_32.png]

4/ Just modify the CCI.js strat file to write date and cci value in a csv file on each candle :

Code:
       log.debug('\t', 'CCI:\t\t', cci.result.toFixed(2));
   grreadtime = candle.start.toDate();
   outtxt = grreadtime+","+0+","+cci.result.toFixed(2)+","+"-"+"\n";
    fsw.appendFileSync(this.fname, outtxt, encoding='utf8');

5/ Launch backtest (UI or CLI) and compare values to see they not correspond

examples :
  • on 2018-02-05 5:00, tradingview CCI was -58, but for Gekko it was -93 !?
  • on 2018-02-06 5:00, tradingview CCI was -176, but for Gekko it was -38 !?
  • on 2018-02-07 9:00, tradingview CCI wast +170, but for Gekko it was +134


Thanks if somewhone can explain me why or what i did wrong, all is configured with 4hours candle, 20 history : or prhaps on Tradingview it is 20 DAYS history ?
So to have same results in Gekko i should put 280 (4*6*20) to have 20 days ?


  [HELP] StochRSI_MACD_BB start no trades
Posted by: johnnash - 02-10-2018, 12:47 PM - Forum: Strategy Development - No Replies

Hi friends, I'm looking for someone who can help me with the implementation of my first gekko strategy. I managed to add all the necessary files to the gekko directory so that I do not give an error once started. the problem is that the bot makes zero trade.
[node version:9.5.0 ; npm version:5.6.0; gekko version:0.5.12]
these are the files I used:


This is BB.js (/strategies/indicators/)

Code:
// no required indicators
// Bollinger Bands - Okibcn implementation 2018-01-02
// hand0722 customized 2019-01-09

var Indicator = function(BBSettings) {
this.input = 'price';
this.settings = BBSettings;
// Settings:
// TimePeriod: The amount of samples used for the average.
// NbDevUp: The distance in stdev of the upper band from the SMA.
// NbDevDn: The distance in stdev of the lower band from the SMA.
this.prices = [];
this.diffs = [];
this.age = 0;   // age = Warm Up Period
this.sum = 0;
this.sumsq = 0;
this.upper = 0;
this.middle = 0;
this.lower = 0;
}

Indicator.prototype.update = function(price) {

var tail = this.prices[this.age] || 0; // oldest price in window
var diffsTail = this.diffs[this.age] || 0; // oldest average in window

this.prices[this.age] = price;
this.sum += price - tail;
this.middle = this.sum / this.prices.length; // SMA value

// your code:
// this.diffs[this.age] = (price - this.middle);
// customized code (see formula), we have to build a math.pow:
this.diffs[this.age] = Math.pow((price - this.middle), 2);

// your code:
// this.sumsq += this.diffs[this.age] ** 2 - diffsTail ** 2;
// customized code:
this.sumsq += this.diffs[this.age] - diffsTail;

// your code:
// var stdev = Math.sqrt(this.sumsq) / this.prices.length;
// customized code (see formula), we have to build a math.sqrt over the whole expression:
var stdev = Math.sqrt(this.sumsq / this.prices.length);

this.upper = this.middle + this.settings.NbDevUp * stdev;
this.lower = this.middle - this.settings.NbDevDn * stdev;

this.age = (this.age + 1) % this.settings.TimePeriod;

}
module.exports = Indicator;


This is StochRSI_MACD_BB.js in / strategies /:

Code:
/*

 StochRSI - SamThomp 11/06/2014

 (updated by askmike) @ 30/07/2016

*/
// helpers
var _ = require('lodash');
var log = require('../core/log.js');

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

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

// prepare everything our method needs
method.init = function() {
    this.interval = this.settings.interval;

 this.trend = {
   direction: 'none',
   duration: 0,
   persisted: false,
   adviced: false
 };

 this.requiredHistory = this.tradingAdvisor.historySize;

 // define the indicators we need
    this.addIndicator('rsi', 'RSI', { interval: this.interval });
    this.addIndicator('macd', 'MACD', this.settings);
    this.addIndicator('bb', 'BB', this.settings.bbands);
    this.RSIhistory = [];
}

// what happens on every new candle?
method.update = function(candle) {
    this.rsi = this.indicators.rsi.result;

    this.RSIhistory.push(this.rsi);

    if(_.size(this.RSIhistory) > this.interval)
        // remove oldest RSI value
        this.RSIhistory.shift();

    this.lowestRSI = _.min(this.RSIhistory);
    this.highestRSI = _.max(this.RSIhistory);
    this.stochRSI = ((this.rsi - this.lowestRSI) / (this.highestRSI - this.lowestRSI)) * 100;
    
    
}

// for debugging purposes log the last
// calculated parameters.
method.log = function(candle) {
 var digits = 8;

    log.debug('calculated StochRSI properties for candle:');
    log.debug('\t', 'rsi:', this.rsi.toFixed(digits));
    log.debug("StochRSI min:\t\t" + this.lowestRSI.toFixed(digits));
    log.debug("StochRSI max:\t\t" + this.highestRSI.toFixed(digits));
    log.debug("StochRSI Value:\t\t" + this.stochRSI.toFixed(2));
    //MACD

    var macd = this.indicators.macd;
    var diff = macd.diff;
    var signal = macd.signal.result;
       var BB = this.indicators.bb;
    var price = candle.close;
    var macddiff = this.indicators.macd.result;
       //BB
       var BB = this.indicators.bb;
      //BB.lower; BB.upper; BB.middle are your line values
   
    var MACDsaysBUY = macddiff > this.settings.thresholds.up;
    var MACDsaysSELL = macddiff <= this.settings.thresholds.down;
    var StochRSIsaysBUY = this.stochRSI < this.settings.thresholds.low;
    var StochRSIsaysSELL = this.stochRSI >= this.settings.thresholds.high;
    var BBsayBUY=price >= (BB.middle-(BB.middle-BB.lower)/4);
    var BBsaySELL=price <= BB.lower; //>= BB.upper || price <= BB.lower

    log.debug('calculated MACD properties for candle:');
    log.debug('\t', 'short:', macd.short.result.toFixed(digits));
    log.debug('\t', 'long:', macd.long.result.toFixed(digits));
    log.debug('\t', 'macd:', diff.toFixed(digits));
    log.debug('\t', 'signal:', signal.toFixed(digits));
    log.debug('\t', 'macdiff:', macd.result.toFixed(digits));

       log.debug('\t', 'BB.lower:', BB.lower.toFixed(digits));
    log.debug('\t', 'BB.middle:', BB.middle.toFixed(digits));
    log.debug('\t', 'BB.upper:', BB.upper.toFixed(digits));
    log.debug('\t', 'price', price.toFixed(digits));
    if(BBsayBUY) {
        log.debug('\t', 'BBsaysBUY');
    }
    if(MACDsaysBUY) {
        log.debug('\t', 'MACDsaysBUY');
    }
    if(StochRSIsaysBUY) {
        log.debug('\t', 'StochRSIsaysBUY');
    }
    if(BBsaySELL) {
        log.debug('\t', 'BBsaysSELL');
    }
    if(MACDsaysSELL) {
        log.debug('\t', 'MACDsaysSELL');
    }
    if(StochRSIsaysSELL) {
        log.debug('\t', 'StochRSIsaysSELL');
    }
    if(MACDsaysSELL && StochRSIsaysSELL) {
              log.debug('\t', 'StochRSIsaysSELL and MACDsaysSELL');
    }
    if(MACDsaysBUY && StochRSIsaysBUY && BBsayBUY) {
              log.debug('\t', 'MACDsaysBUY and StochRSIsaysBUY and BBsaysBUY');
    }
}

method.check = function(candle) {
    //MACD
    var macddiff = this.indicators.macd.result;
       //BB
       var BB = this.indicators.bb;
      //BB.lower; BB.upper; BB.middle are your line values
    var price = candle.close;
       //buy when stochRSI in low and MACD in up
    //short->sell, long->buy
   
    var MACDsaysBUY = macddiff > this.settings.thresholds.up;
    var MACDsaysSELL = macddiff <= this.settings.thresholds.down;
    var StochRSIsaysBUY = this.stochRSI < this.settings.thresholds.low;
    var StochRSIsaysSELL = this.stochRSI >= this.settings.thresholds.high;
    var BBsayBUY=price >= (BB.middle-(BB.middle-BB.lower)/4);
    var BBsaySELL=price <= BB.lower; //>= BB.upper || price <= BB.lower
       if(MACDsaysSELL && StochRSIsaysSELL) {
        // new trend detected
        if(this.trend.direction !== 'high')
            this.trend = {
                duration: 0,
                persisted: false,
                direction: 'high',
                adviced: false
            };

        this.trend.duration++;

        log.debug('In high since', this.trend.duration, 'candle(s)');

        if(this.trend.duration >= this.settings.thresholds.persistence )
            this.trend.persisted = true;

        if(this.trend.persisted && !this.trend.adviced) {
            this.trend.adviced = true;
            this.advice('short');
        } else
            this.advice();

    }
    //buy when stochRSI in high and MACD in low    
    else if(MACDsaysBUY && StochRSIsaysBUY && BBsayBUY) {

        // new trend detected
        if(this.trend.direction !== 'low')
            this.trend = {
                duration: 0,
                persisted: false,
                direction: 'low',
                adviced: false
            };

        this.trend.duration++;

        log.debug('In low since', this.trend.duration, 'candle(s)');

        if(this.trend.duration >= this.settings.thresholds.persistence)
            this.trend.persisted = true;

        if(this.trend.persisted && !this.trend.adviced) {
            this.trend.adviced = true;
            this.advice('long');
        } else
            this.advice();

    } else {
        // trends must be on consecutive candles
        this.trend.duration = 0;
        log.debug('In no trend');

        this.advice();
    }

}

module.exports = method;

and this is  toml in / config / strategies /:

Code:
interval = 14
short = 12
long = 26
signal = 9

[bbands]
TimePeriod = 20
NbDevDn = 2
NbDevUp = 2
persistence_upper = 10
persistence_lower = 10  

[thresholds]
low = 20
high = 80
down = 0.1
persistence = 2



Attached Files
.png   Schermata 2018-02-10 alle 13.53.42.png (Size: 66.99 KB / Downloads: 58)

  Gekko encountered an error and can't continue
Posted by: ankasem - 02-10-2018, 12:38 PM - Forum: Binance - No Replies

hi all

RECEIVED ERROR IN GEKKO 1991000840668331


Gekko encountered an error and can't continue


Gekko encountered an error and can't continue

Error:

[binance.js] Response code 401

Meta debug info:

Gekko version: v0.5.12
Nodejs version: v8.9.4
----------------------------  
terminal image
 


what is this


----------------------
Binance -API available-trade bot experiment-


hi
IP Access Restriction: Restrict access to trusted IPs only (Recommended)
IP Access Restriction: Restrict access to trusted IPs only (Recommended)
rope changed


self catering


  Genetic "algo"
Posted by: tommiehansen - 02-10-2018, 01:32 AM - Forum: Feature Requests - Replies (19)

Implement a genetic algo.

It may sound complex but is basically this:

1. Allow settings to be ranges of min/max so instead of this in the 'Parameters' (UI) @ backtest:

short = 20
long = 50

...it could instead be this:

short = 20,40:5
long = 50,100:10


where X,Y = min/max
and :Z = stepping (in what amounts of steps this value should be changed; this since one woulnd't want to change every possible value by e.g. 1)

Above would simply translate to:

short = min: 20, max: 40, stepping: 5
long = min: 50, max: 100, stepping: 10

2. If there's ranges etc: Run backtests and change value(s) each time (if not, just do a regular backtest)
3. Have the ability to define max amount of runs (where -1 = infinite (or until number of tests runs out); custom setting that works for all strategies e.g. ga_runs = -1

4. Output best performing results -or- output the results that beat the market in some sorted .log or .csv (the latter for easy import/manipulation in 3rd party app e.g. Excel or whatever)

5. Output runs to the log() (so that one know what's happening etc...)

Doable in a reasonably amount of time?
Problem is that the GA-stuff that exist now is tedious, doesn't really work, requires other stuff that doesn't work etc etc ... (tl;dr -- tedious).


Exclamation Need help with trading bot functionality
Posted by: BitPerson - 02-09-2018, 10:26 PM - Forum: Technical Support - Replies (4)

Hey there!

I developed my working strategy and I like how it works good sometimes.

Here there are some problems with my usage of Gekko (trading bot with API from exchanges):

1) I save the last price I bought/sold like:


Code:
this.lastprice = candle.close;


This is a big problem when you buy/sell at a price xx% (where xx is big) higher/lower from the price that triggered the advice.

Example: 
Advice: buy @0.00015 -> lastprice = 0.00015 but then it buys @0.00019 -> sell @0.00017 -> I expect +0.00002 but I'm like -0.00002. 

Is there a solution? Is there the possibility to get the last price traded instead of the way I use?

2) I also would like to stop orders repetition (for example: if there's a long advice when price is 0.00015 and then price goes to 0.00030 while the order is not yet satisfied, I would like to cancel the order, not changing it to buy @0.00030). Is it possible?

3) Am I right to use advices (this.advice("long"); / this.advice("short")Wink even if I'm using trading bot and not paper trader? Or is it possible to use something more useful? For example:

3.a) Is it possible to suggest prices instead of using the best to buy/sell?

3.b) Is it possible to force some (or any, but I would prefer just some) order to "taker" instead of "maker" (market price usage) in Gdax?



Sorry for my bad english, hope everything is clear!   Tongue 
Sorry if there is an obvious solution but I'm not a developer  Sad 


Thank you for your software and your time, you already made a fantastic work!


  Anybody know paid strategies?
Posted by: xFFFFF - 02-09-2018, 10:13 PM - Forum: General Discussion - Replies (1)

If price and results will be on good level maybe I will pay for it Big Grin


  Change forum stuff
Posted by: tommiehansen - 02-09-2018, 09:18 PM - Forum: General Discussion - Replies (21)

1. Add section 'Other' or similar since this thread really doesn't fit anywhere

2. Make the forum prettier so that the eyes bleed less when looking at this forum, maybe something like:
https://community.mybb.com/mods.php?action=view&pid=617

3. Allow attaching filetypes .js, .toml and .zip (maybe)

4. Add Syntax highlightning (since this is basically a forum about code) e.g:
https://community.mybb.com/mods.php?action=view&pid=843