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

Username
  

Password
  





Search Forums



(Advanced Search)

Forum Statistics
» Members: 4,275
» Latest member: phukientubep
» Forum threads: 776
» Forum posts: 3,885

Full Statistics

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

Latest Threads
can you recommend suitabl...
Forum: General Discussion
Last Post: ankasem
Yesterday, 08:39 PM
» Replies: 0
» Views: 10
Pairs Trading with Backtr...
Forum: Alternative Software
Last Post: deandree
Yesterday, 08:09 PM
» Replies: 0
» Views: 2
Is there a way to disable...
Forum: Technical Discussion
Last Post: clriesco
Yesterday, 10:56 AM
» Replies: 7
» Views: 1,168
What precautions should b...
Forum: General Discussion
Last Post: oliviajosie
Yesterday, 09:10 AM
» Replies: 0
» Views: 20
What is a generic medicin...
Forum: General Discussion
Last Post: oliviajosie
Yesterday, 09:04 AM
» Replies: 0
» Views: 12
Setting up a Selling Thre...
Forum: Automated Trading
Last Post: spoons24
05-20-2019, 10:35 PM
» Replies: 0
» Views: 28
[SHARE] Simple RSI BULL/B...
Forum: Strategy Development
Last Post: tommiehansen
05-19-2019, 08:44 AM
» Replies: 366
» Views: 304,228
Using Gekko for forex tra...
Forum: Technical Discussion
Last Post: Cat944
05-18-2019, 07:54 AM
» Replies: 3
» Views: 783
My Latest Thoughts about ...
Forum: General Discussion
Last Post: herve76
05-17-2019, 10:01 AM
» Replies: 9
» Views: 945
after restart traders los...
Forum: Technical Support
Last Post: PesiHUN
05-16-2019, 01:36 PM
» Replies: 0
» Views: 55

 
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: 56)

  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


  how to new updates
Posted by: ankasem - 02-09-2018, 05:18 PM - Forum: General Discussion - No Replies

hi
how to new updates binance  =   npm install binance Wink

how to gekko new updates gekko

new gekko 0.5.13 update

run terminal
Exit in the gekko folder
cd ..
gekko folder rename

git clone git://github.com/askmike/gekko.git
cd gekko
npm install --only=production
node gekko --ui
--------------------------------------
first copy the history folder to another if there are downloaded data


  i can't see my new strategy
Posted by: remony - 02-09-2018, 06:01 AM - Forum: Technical Support - Replies (2)

can u explain how to embed in new strategy. 
i create a .js file under gekko/strategies
i create a .toml file under gekko/config/strategies but
i can't see it under the strategy menu. what i am missing?


  a couple of technical Questions
Posted by: Derbeweis - 02-09-2018, 05:08 AM - Forum: Technical Support - Replies (10)

Hello, 
first of all I want to thank you all here for the great work... I have been researching trading bots along time now, and I have to admit your work here is great... so thanks... and keep up the great work... 
also looking forward for the hosted Gekko that you announced... that could be great for a lot of us... 

now to my questions... 
I am setting Gekko up to run in an VPS on Linux, and I am convinced with a good strategy that I want to try now live... 
And after reading the comments of ASKMIKE I decided to run Gekko from the CL 
but I still have some Questions: 

1. the ORDERS: 
how will Gekko perform the orders on the exchanges ? are they market orders or limit orders ? and if they are limit orders, and they don't trigger (the price moved very fast) will it cancel the order or not? and if they are Market Orders, will it consider the Advice price as the start or the real price that it was able to get on the exchange ? 

and because we are in Exchanges (not CFDs) does this mean Gekko will never be able to run a Short before it had a Long right? 

2. Margin: 
is it possible to make Gekko run Margin Orders (in Bitfinix for example!) or will it always run an exchange order?

3. Multiplie instances: 
I understood from multiple  comments from Mike, that Gekko always uses 100% of the asset to run a strategy, so if I want trade more than one trader on the same exchange I should use disjunct couples i.e. BTC/USD , ETH/EUR for example... and I need to start a different Terminal window and a Gekko in every one... the main Question now: 
do I need to make a different copy of Gekko (different folder) for every Livetrade Gekko?  I understand that I have to change the config files for every Livetrade Setup (to add the different APIs if I am using different exchanges, and to add different parameters for the same strategy or different strategies.. IS THIS right? 
so for example If I want to run 3 Pairs (BTC/USD, ETH/EUR on Bitfiniex and BTC/LTC on Binance) I make 3 copies of Gekko, run every one separate  in a terminal window and leave it working... 
Am I right? 


I appreciate your help very much... 
thanks..