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

Username
  

Password
  





Search Forums



(Advanced Search)

Forum Statistics
» Members: 20,656
» Latest member: bestmelbourneblogaus
» Forum threads: 1,541
» Forum posts: 7,730

Full Statistics

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

Latest Threads
An official Gekko service...
Forum: Announcements
Last Post: CaroleDennis
2 hours ago
» Replies: 85
» Views: 139,331
New Gekko UI in the works
Forum: Announcements
Last Post: ankitkkc
04-18-2024, 01:09 PM
» Replies: 136
» Views: 154,777
Gekko with malware spotte...
Forum: Announcements
Last Post: alisonagron
04-18-2024, 08:05 AM
» Replies: 130
» Views: 90,587
Gekko development status ...
Forum: Announcements
Last Post: ameliezilber
04-16-2024, 11:19 AM
» Replies: 805
» Views: 527,698
Gekko 0.6 released
Forum: Announcements
Last Post: sabinaholt
03-27-2024, 12:10 PM
» Replies: 104
» Views: 214,253
How to Soft Reset or Hard...
Forum: General Discussion
Last Post: lucifar
10-07-2021, 07:18 PM
» Replies: 22
» Views: 39,142
How to add Binance Future...
Forum: Technical Support
Last Post: Xavier32
10-07-2021, 02:20 PM
» Replies: 47
» Views: 81,375
Bittrex Configuration hel...
Forum: Bittrex
Last Post: yirzolusto
10-07-2021, 07:39 AM
» Replies: 6
» Views: 15,101
[Question] Why does gekko...
Forum: General Discussion
Last Post: cryptocurrency0
10-06-2021, 01:16 PM
» Replies: 16
» Views: 34,458
a couple of technical Que...
Forum: Technical Support
Last Post: mtom78632
10-06-2021, 11:08 AM
» Replies: 25
» Views: 45,459

 
  How to synchronize gekko clock to local time
Posted by: ankasem - 05-06-2018, 12:06 PM - Forum: Technical Support - Replies (3)

hi

How to synchronize gekko clock to local time
thank you


  Bulk TOML to JSON config converter
Posted by: thegamecat - 05-05-2018, 10:19 AM - Forum: Third Party Software - Replies (7)

I've knocked this up because frankly life is too short to change TOML files into JSON and copy/paste them into the gekko config. 
Bulk TOML to JSON config converter


  I found a profitable strategy How I go Live?
Posted by: neodavidson - 05-04-2018, 10:52 PM - Forum: Technical Discussion - Replies (4)

Hello, I just follow the tutorials provided, now I decide to use RSI_BULL_BEAR strategie, but it generates problems when I try to run in online...

$ node gekko --config config.js

    ______   ________  __    __  __    __   ______
   /      \ /        |/  |  /  |/  |  /  | /      \
  /$$$$$$  |$$$$$$$$/ $$ | /$$/ $$ | /$$/ /$$$$$$  |
  $$ | _$$/ $$ |__    $$ |/$$/  $$ |/$$/  $$ |  $$ |
  $$ |/    |$$    |   $$  $$<   $$  $$<   $$ |  $$ |
  $$ |$$$$ |$$$$$/    $$$$$  \  $$$$$  \  $$ |  $$ |
  $$ \__$$ |$$ |_____ $$ |$$  \ $$ |$$  \ $$ \__$$ |
  $$    $$/ $$       |$$ | $$  |$$ | $$  |$$    $$/
   $$$$$$/  $$$$$$$$/ $$/   $$/ $$/   $$/  $$$$$$/

        Gekko v0.5.14
        I'm gonna make you rich, Bud Fox.


2018-05-04 22:49:45 (INFO):     Setting up Gekko in realtime mode
2018-05-04 22:49:45 (INFO):
2018-05-04 22:49:45 (INFO):     Setting up:
2018-05-04 22:49:45 (INFO):              Candle writer
2018-05-04 22:49:45 (INFO):              Store candles in a database
2018-05-04 22:49:45 (INFO):

2018-05-04 22:49:45 (INFO):     Setting up:
2018-05-04 22:49:45 (INFO):              Trading Advisor
2018-05-04 22:49:45 (INFO):              Calculate trading advice
2018-05-04 22:49:45 (INFO):              Using the strategy: RSI_BULL_BEAR
2018-05-04 22:49:45 (WARN):     TALIB indicators could not be loaded, they will be unavailable.
2018-05-04 22:49:45 (WARN):     TULIP indicators could not be loaded, they will be unavailable.
2018-05-04 22:49:45 (ERROR):    Failed to load indicator STC
C:\Users\Administrator\documents\gekko-0.5.14\strategies\RSI_BULL_BEAR.js:34
                this.addIndicator('maSlow', 'SMA', this.settings.SMA_long );
                                                                 ^

TypeError: Cannot read property 'SMA_long' of undefined
    at Base.init (C:\Users\Administrator\documents\gekko-0.5.14\strategies\RSI_BULL_BEAR.js:34:52)
    at Base.bound [as init] (C:\Users\Administrator\documents\gekko-0.5.14\node_modules\lodash\dist\lod
ash.js:729:21)
    at new Base (C:\Users\Administrator\documents\gekko-0.5.14\plugins\tradingAdvisor\baseTradingMethod
.js:87:8)
    at Actor.setupTradingMethod (C:\Users\Administrator\documents\gekko-0.5.14\plugins\tradingAdvisor\t
radingAdvisor.js:62:17)
    at Actor.bound [as setupTradingMethod] (C:\Users\Administrator\documents\gekko-0.5.14\node_modules\
lodash\dist\lodash.js:729:21)
    at new Actor (C:\Users\Administrator\documents\gekko-0.5.14\plugins\tradingAdvisor\tradingAdvisor.j
s:23:8)
    at load (C:\Users\Administrator\documents\gekko-0.5.14\core\pluginUtil.js:95:22)
    at C:\Users\Administrator\documents\gekko-0.5.14\node_modules\async\dist\async.js:1156:9
    at replenish (C:\Users\Administrator\documents\gekko-0.5.14\node_modules\async\dist\async.js:1030:1
7)
    at iterateeCallback (C:\Users\Administrator\documents\gekko-0.5.14\node_modules\async\dist\async.js
:1015:17)

Administrator@EC2AMAZ-ROGIEU5 MINGW64 ~/documents/gekko-0.5.14

Please give me some advice Smile


  Bruteforce node app
Posted by: thegamecat - 05-04-2018, 04:56 PM - Forum: Third Party Software - Replies (6)

I really liked the Perl tool xffffffff wrote but it uses sqlite for a few things which caused me issues so I wrote my own bruteforce backtester in node. It's not elegant but it's pretty powerful and runs backtests in parallel across the Gekko API.

From the read.me:

Gekko Warez Bruteforce Backtester
A swiss army nodejs brute force backtester for Gekko trading bot. Saves time so you can spend more time looking good.
Here's what you can do:


  1. Set multiple history periods

  2. Set multiple candle sizes

  3. Set multiple strategies

  4. Set multiple exchange and trading pairs

  5. Set random ranges for each strategy config

  6. Writes all outputs and strategy configs out into a csv so you can review what strat and related settings are going to make you the most cold hard crypto
Installation: (You can install Bruteforce wherever you like)
git clone https://github.com/gekkowarez/bruteforce.git cd bruteforce npm install
Setup: Open bruteforce.js and setup paths and configs from line 20. Instructions are in the doc. If you keep the resultCsv path the same make a "results" folder in the same place you installed the repo.
To run:
You must have the Gekko api server running so type the following into a console: node gekko --ui
Then type the following to run the bruteforce app: node bruteforce.js


https://github.com/gekkowarez/bruteforce


  [SHARE] dynamic Stoploss/Stopwait
Posted by: susitronix - 05-03-2018, 10:26 PM - Forum: Strategy Development - No Replies

The dynamic approch of a stoploss seems to bring better results.
I designed my own stop indicator by using the candle.trades amount as signal.
Since this is a simple calculation it basicly can be eny
x **= candle.data;

4 month
1 month

Binance
BTC/Usdt
candlesize 1min
warmup 10min

For the 4 month period with such a difficult trend, its not bad.
>>>>>>>>its only a rsi and a stoploss...<<<<<<<<<
the one month as expected, is a bit less then the bulltrend

here is the finished code:

Code:

Code:
/*
Tutorial:     trendatron #5
           rsi trader
philipp wyler
2018-04-25
*/

var _ = require('lodash');
var log = require('../core/log.js');
var config = require('../core/util.js').getConfig();

var trenda = {};
//<<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><
//>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>
//<<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><

trenda.init = function () {

   this.name = 'trendatron_2';

   this.allInit();

   this.userMap();

   this.cpuTime();

   this.indInit();

   this.setupLog();
}

trenda.update = function (candle) {

   this.timeCursor();

   this.priceUpdate();

   this.calculus();

   this.resultRSI = this.tulipIndicators.myrsi.result.result;
}

trenda.log = function () {

}
trenda.check = function (candle) {

   this.stop();
   //lets trade...
   if (this.logic.stopabs !== true && this.resultRSI > this.settings.trsRSI.high && this.logic.longpos !== false) {
       this.goShort();
   }
   else if (this.logic.stopabs !== true && this.resultRSI < this.settings.trsRSI.low && this.logic.longpos !== true) {
       this.goLong();
   }
}
//<<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><
//>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>
//<<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><
trenda.stop = function () {
   if (this.logic.stopabs !== false) {
       if (this.logic.lock !== false && this.resultRSI > this.settings.trsRSI.high) {
           this.logic.lock = false;
       }
       if (this.logic.lock !== true && this.resultRSI < this.settings.trsRSI.low) {
           this.logic.stopabs = false;
           log.debug('-  ' + this.timearr + ' zz---unlock ' + '  stop ' + this.logic.stopabs + '  pc ' + this.price.close.toFixed(2) + '  exp ' + this.price.exp.toFixed(2));
       }
   }
   //SIDECHAIN STOP
   if (this.logic.stopabs !== true && this.logic.longpos !== false && this.stopabsset > this.price.abs) {
       if (this.stopabsexpset > this.price.exp) {
           this.logic.stopabs = true;
           this.logic.lock = true;
           this.goShort();
           this.logic.stopcount++;
           log.debug('-  ' + this.timearr + ' xxxxxxxxxxx ' + '  stop ' + this.logic.stopabs + '  pc ' + this.price.close.toFixed(2) + '  exp ' + this.price.exp.toFixed(2));
       }
   }
   if (this.logic.stopabs !== true && this.logic.longpos !== true && this.stopabsset > this.price.abs) {
       if (this.stopabsexpset > this.price.exp) {
           this.logic.stopabs = true;
           this.logic.lock = true;
           this.logic.waitcount++;
           log.debug('-  ' + this.timearr + ' yyyyyyyyyy ' + '  wait ' + this.logic.stopabs + '  pc ' + this.price.close.toFixed(2) + '  exp ' + this.price.exp.toFixed(2));
       }
   }
}
trenda.goShort = function () {
   this.logic.longpos = false;
   this.advice('short');
   log.debug('>>> ' + this.timearr + ' Short price.close = ' + this.price.close);
}
trenda.goLong = function () {
   this.logic.longpos = true;
   this.advice('long');
   this.price.long = this.price.close;
   log.debug(' <<<' + this.timearr + ' Long price.close = ' + this.price.close);
}
trenda.priceUpdate = function () {
   this.price.close = this.candle.close;
   this.price.low = this.candle.low;
   this.price.high = this.candle.high;
   this.price.volume = this.candle.volume;
   this.price.vwp = this.candle.vwp;
   this.price.trades = this.candle.trades;
}
trenda.calculus = function () {
   this.price.abs = ((this.price.long - this.price.close) / this.price.long) * -100;    //LAST LONG

   this.price.dif = ((this.price.last - this.price.close) / this.price.last) * -100;    //LAST LONG
   this.price.last = 0;
   this.price.last = this.price.close;

   this.price.exp = this.price.trades * this.price.dif;
}

trenda.indInit = function () {
   // define the indicators we need     //move the settings into >>>rsi input length
   this.addTulipIndicator('myrsi', 'rsi', this.customRSIsettings);
}
trenda.allInit = function () {

   //first fetch settings from .toml
   this.customRSIsettings = this.settings.RSI;

   //add candle
   price =
       {
           close: 0,//this.candle
           low: 0,//this.candle
           high: 0,//this.candle
           volume: 0,//this.candle
           vwp: 0,//this.candle
           trades: 0,//this.candle
           long: 0,
           last: 0,
           dif: 0,
           exp: 0
       };
   this.price = price;

   logic =
       {
           longpos: false,
           stopabs: false,
           lock: false,
           globalcount: 0,
           stopcount: 0,
           waitcount: 0
       };
   this.logic = logic;

   this.stopabsset = this.settings.___stop_abs____.stop_abs;
   this.stopabsexpset = this.settings.___stop_abs____.abs_exp;
}
trenda.cpuTime = function () {
   //CPU TIME SET
   this.startTime = new Date();
}
trenda.userMap = function () {

   this.longpos = this.settings.___trendatron___.__longPos;
   month = this.settings._backtest_start_.______month;
   day = this.settings._backtest_start_.__________day;
   hour = this.settings._backtest_start_._____hour;
   minute = this.settings._backtest_start_._minute;

   this.montharr = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
   this.month = month;
   this.day = day;
   this.hour = hour;
   this.minute = minute;
   this.timearr = [];
   this.candlesize = this.settings._backtest_start_.candle_size;
}
trenda.timeCursor = function () {
   if (this.logic.globalcount == 0) {
       this.mcount = this.minute;
       this.hcount = this.hour;
       this.dcount = this.day;
       this.moncount = this.month;
   }

   y = this.candlesize;
   for (i = 0; i < y; i++) {
       this.logic.globalcount++;//COUNT BACKTEST CANDLES

       z = this.moncount - 1;
       this.monthframe = this.montharr[z];
       candleminute = this.logic.globalcount % 60;//MINUTE MODULUS////
       this.candleminute = candleminute;
       //HOUR COUNT
       if (this.mcount == 59) {
           this.hcount++;//HOUR COUNT
           this.mcount = 0;
       }
       else if (this.mcount < 59) {
           this.mcount++;
       }
       //DAY COUNT
       if (this.hcount == 24) {
           this.dcount++;//DAY COUNT
           this.hcount = 0;
       }
       //MONTHDAY
       if (this.dcount > (this.monthframe)) {
           this.moncount++;
           this.dcount = 1
       }
       //MONTH
       else if (this.moncount > 12) {
           this.moncount = 1;
       }
       this.candlehour = this.hcount;//HOUR
       this.candleday = this.dcount;//DAY
       this.candlemonth = this.moncount;//MONTH
       this.timearr = [this.candlemonth, this.candleday, this.candlehour, this.candleminute];
   }
}
trenda.setupLog = function () {
   log.info
       (


       '\n' + '\t' + '\t' + '\t' + '\t' +
       '  ...last longpos = ' + this.logic.longpos + '\n' + '\t' + '\t' + '\t' +
       '+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+' + '\n' + '\t' + '\t' + '\t' +
       '  .....start backtest ' + this.name + ' varactor' + '\n' + '\t' + '\t' + '\t' +
       '+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+' + '\n' + '\t' + '\t' + '\t' +
       '\n' + '\t' + '\t' + '\t' +
       '                     <<>>' + '\n' + '\t' + '\t' + '\t' +
       '                 ><<><>><<>>' + '\n' + '\t' + '\t' + '\t' +
       '             >><<>>       <<>><<' + '\n' + '\t' + '\t' + '\t' +
       '        <>><<>    system v3   >><<>>' + '\n' + '\t' + '\t' + '\t' +
       '    <<>><<>  start date ' + this.month + ':' + this.day + ':' + this.hour + ':' + this.minute + ' >><<>>' + '\n' + '\t' + '\t' + '\t' +
       ' ><<>><    ......beginn trading       <>><<>' + '\n' + '\t' + '\t' + '\t' +
       '><<>><            ' + this.name + '         ><>><<' + '\n' + '\t' + '\t' + '\t' +
       '  >><<>>       susitronix d-sign      <<>><<' + '\n' + '\t' + '\t' + '\t' +
       '     >><<<<<>>><<            <<>>><<>><<' + '\n' + '\t' + '\t' + '\t' +
       '              ><<<<>>><<<>>><<>>' + '\n' + '\t' + '\t' + '\t' +
       '                    >>><<<' + '\n' + '\t' + '\t' + '\t' +
       '                      <>' + '\n'
       );
}
trenda.end = function () {
   this.logic.globalcount;
   this.monthdif = (((this.logic.globalcount / 60) / 24) / 30) % 12;
   this.daysdif = ((this.logic.globalcount / 60) / 24) % 30;
   this.hoursdif = (this.logic.globalcount / 60) % 24;
   this.minutesdif = this.logic.globalcount % 60;

   this.globalcountdif = this.logic.globalcount - this.globalcountbegin;

   let seconds = ((new Date() - this.startTime) / 1000),
       minutes = seconds / 60,
       str;
   //CPU TIME CALCULUS IN MILLISECONDS
   this.totaltime = ((minutes / 60) + seconds);
   this.cputime = ((this.totaltime / this.logic.globalcount) * 1000);

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

   log.info
       (
       '\n' + '\t' + '\t' +
       '.....backtest started with longpos = ' + this.longpos + '\n' + '\t' +
       '.....stop count = ' + this.logic.stopcount + '\n' + '\t' +
       '.....wait count = ' + this.logic.waitcount + '\n' + '\t' +
       '                                                       ' + '\n' + '\t' +
       '                             <<>>                      ' + '\n' + '\t' +
       '                       <<>><<>><<>><<>>                ' + '\n' + '\t' +
       '                 >><<>><<>><<>><<>><<>><<>><<          ' + '\n' + '\t' +
       '            <<>><<>>     ' + this.name + '     <<>><<>>' + '\n' + '\t' +
       '        <<>><<>>    start date ' + this.month + ':' + this.day + ':' + this.hour + ':' + this.minute + '     <<>><<>>' + '\n' + '\t' +
       '   <<>><<>>         end time ' + this.candlemonth + ':' + this.candleday + ':' + this.candlehour + ':' + this.candleminute + ' finish     <<>><<>>' + '\n' + '\t' +
       ' <<>><<>>      ' + str + ' / candles = ' + this.logic.globalcount + '       <<>><<>>' + '\n' + '\t' +
       '   <<>><<>>    candle cpu time = ' + this.cputime.toFixed(4) + ' mSec       <<>><<>>' + '\n' + '\t' +
       '      >><< <<>><<>><<>>                <<>><<>><<>> <<>> ' + '\n' + '\t' +
       '    <<>><>         <<>><<>><<>><<>><<>><<>>         <<>><< ' + '\n' + '\t' +
       '<<>><<>>><<                <<>><<>>                ><<>><<>>>< ' + '\n' + '\t'
       );
}

module.exports = trenda;

And here the settings .toml

Code:
Code:
[___trendatron___]
#<<<>>><<<>>>#
__longPos = false

#>>><<<>>><<#
[_backtest_start_]
__________day = 1
______month = 4
_____hour = 18
_minute = 38
candle_size = 1
#<<<>>><<<>>>#

[RSI]
optInTimePeriod = 30

[trsRSI]
high = 68
low = 30

[___stop_abs____]
stop_abs = -1.7
abs_exp = -250


The actual code for the strat would be fearly small, the rest are just debug tools.


Bug [TUT] STRATEGIE #5 dynamique stoploss [SHARE]
Posted by: susitronix - 05-03-2018, 07:02 PM - Forum: Guides - Replies (5)

In this Tutorial we will add a dynamic stoploss.

Stoploss seems to be pretty hard to get right,
because the most approaches would decrease the profit, rather than do good to it.

First one would think, a price.long-absolut-stoploss would work well, but the reallity shows different:
>>>a smaller stop value does increase the errors and loose more than the stop would benefit..!

it simply hurts the strategy as TommieHansen stated.

On the otherside if we set the threshold more loose, then it again does not work too much.


The indicators based stoploss are also interesting but theese have problems with the indication speed,
because:
>>>>>the newest candle.data must first fight against the old averages, before it could seriously indicate a fast change.
>>>thats not always true since they would use multiplication to indicate a fast change.
>>>>>>>THUS also create a lot of false triggers due to multiplication (RSI-based)

so what we do!

i found a easy way is to create our own stop indicator.
Its very simple design:

Code:
this.price.exp = this.price.trades * this.price.dif;
the candle.trades value is intresting.
It seem to indicate the changes pretty faster than enybody else.
But it is a positive number (offcourse!).
For our indicator we wanna have a bipolar output signal, otherwise it would trigger in both trends.
therefore we multiply with the procentage difference between the candles.

The price.dif is a simple procent calculation for the absolut price:
Code:
this.price.dif = ((this.price.last - this.price.close) / this.price.last) * -100;    //LAST LONG
this.price.last = 0;
this.price.last = this.price.close; //BACKUP FOR THE NEXT CANDLE


When goLong we store the candle.close:

Code:
this.price.long = this.price.close;


The stop(trend) logic dos inhibit the RSI trader while in the stop trend.
then a unlock logic will delay the stop trend for not buy to early.

I also adjusted the RSI trader to get better positive results.
4 month
1 month

Binance
BTC/Usdt
candlesize 1min
warmup 10min

For the 4 month period with such a difficult trend, its not bad.
>>>>>>>>its only a rsi and a stoploss...<<<<<<<<<
the one month as expected, is a bit less then the bulltrend

here is the finished code:

Code:
/*
Tutorial:     trendatron #5
           rsi trader
philipp wyler
2018-04-25
*/

var _ = require('lodash');
var log = require('../core/log.js');
var config = require('../core/util.js').getConfig();

var trenda = {};
//<<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><
//>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>
//<<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><

trenda.init = function () {

   this.name = 'trendatron_2';

   this.allInit();

   this.userMap();

   this.cpuTime();

   this.indInit();

   this.setupLog();
}

trenda.update = function (candle) {

   this.timeCursor();

   this.priceUpdate();

   this.calculus();

   this.resultRSI = this.tulipIndicators.myrsi.result.result;
}

trenda.log = function () {

}
trenda.check = function (candle) {

   this.stop();
   //lets trade...
   if (this.logic.stopabs !== true && this.resultRSI > this.settings.trsRSI.high && this.logic.longpos !== false) {
       this.goShort();
   }
   else if (this.logic.stopabs !== true && this.resultRSI < this.settings.trsRSI.low && this.logic.longpos !== true) {
       this.goLong();
   }
}
//<<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><
//>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>
//<<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><
trenda.stop = function () {
   if (this.logic.stopabs !== false) {
       if (this.logic.lock !== false && this.resultRSI > this.settings.trsRSI.high) {
           this.logic.lock = false;
       }
       if (this.logic.lock !== true && this.resultRSI < this.settings.trsRSI.low) {
           this.logic.stopabs = false;
           log.debug('-  ' + this.timearr + ' zz---unlock ' + '  stop ' + this.logic.stopabs + '  pc ' + this.price.close.toFixed(2) + '  exp ' + this.price.exp.toFixed(2));
       }
   }
   //SIDECHAIN STOP
   if (this.logic.stopabs !== true && this.logic.longpos !== false && this.stopabsset > this.price.abs) {
       if (this.stopabsexpset > this.price.exp) {
           this.logic.stopabs = true;
           this.logic.lock = true;
           this.goShort();
           this.logic.stopcount++;
           log.debug('-  ' + this.timearr + ' xxxxxxxxxxx ' + '  stop ' + this.logic.stopabs + '  pc ' + this.price.close.toFixed(2) + '  exp ' + this.price.exp.toFixed(2));
       }
   }
   if (this.logic.stopabs !== true && this.logic.longpos !== true && this.stopabsset > this.price.abs) {
       if (this.stopabsexpset > this.price.exp) {
           this.logic.stopabs = true;
           this.logic.lock = true;
           this.logic.waitcount++;
           log.debug('-  ' + this.timearr + ' yyyyyyyyyy ' + '  wait ' + this.logic.stopabs + '  pc ' + this.price.close.toFixed(2) + '  exp ' + this.price.exp.toFixed(2));
       }
   }
}
trenda.goShort = function () {
   this.logic.longpos = false;
   this.advice('short');
   log.debug('>>> ' + this.timearr + ' Short price.close = ' + this.price.close);
}
trenda.goLong = function () {
   this.logic.longpos = true;
   this.advice('long');
   this.price.long = this.price.close;
   log.debug(' <<<' + this.timearr + ' Long price.close = ' + this.price.close);
}
trenda.priceUpdate = function () {
   this.price.close = this.candle.close;
   this.price.low = this.candle.low;
   this.price.high = this.candle.high;
   this.price.volume = this.candle.volume;
   this.price.vwp = this.candle.vwp;
   this.price.trades = this.candle.trades;
}
trenda.calculus = function () {
   this.price.abs = ((this.price.long - this.price.close) / this.price.long) * -100;    //LAST LONG

   this.price.dif = ((this.price.last - this.price.close) / this.price.last) * -100;    //LAST LONG
   this.price.last = 0;
   this.price.last = this.price.close;

   this.price.exp = this.price.trades * this.price.dif;
}

trenda.indInit = function () {
   // define the indicators we need     //move the settings into >>>rsi input length
   this.addTulipIndicator('myrsi', 'rsi', this.customRSIsettings);
}
trenda.allInit = function () {

   //first fetch settings from .toml
   this.customRSIsettings = this.settings.RSI;

   //add candle
   price =
       {
           close: 0,//this.candle
           low: 0,//this.candle
           high: 0,//this.candle
           volume: 0,//this.candle
           vwp: 0,//this.candle
           trades: 0,//this.candle
           long: 0,
           last: 0,
           dif: 0,
           exp: 0
       };
   this.price = price;

   logic =
       {
           longpos: false,
           stopabs: false,
           lock: false,
           globalcount: 0,
           stopcount: 0,
           waitcount: 0
       };
   this.logic = logic;

   this.stopabsset = this.settings.___stop_abs____.stop_abs;
   this.stopabsexpset = this.settings.___stop_abs____.abs_exp;
}
trenda.cpuTime = function () {
   //CPU TIME SET
   this.startTime = new Date();
}
trenda.userMap = function () {

   this.longpos = this.settings.___trendatron___.__longPos;
   month = this.settings._backtest_start_.______month;
   day = this.settings._backtest_start_.__________day;
   hour = this.settings._backtest_start_._____hour;
   minute = this.settings._backtest_start_._minute;

   this.montharr = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
   this.month = month;
   this.day = day;
   this.hour = hour;
   this.minute = minute;
   this.timearr = [];
   this.candlesize = this.settings._backtest_start_.candle_size;
}
trenda.timeCursor = function () {
   if (this.logic.globalcount == 0) {
       this.mcount = this.minute;
       this.hcount = this.hour;
       this.dcount = this.day;
       this.moncount = this.month;
   }

   y = this.candlesize;
   for (i = 0; i < y; i++) {
       this.logic.globalcount++;//COUNT BACKTEST CANDLES

       z = this.moncount - 1;
       this.monthframe = this.montharr[z];
       candleminute = this.logic.globalcount % 60;//MINUTE MODULUS////
       this.candleminute = candleminute;
       //HOUR COUNT
       if (this.mcount == 59) {
           this.hcount++;//HOUR COUNT
           this.mcount = 0;
       }
       else if (this.mcount < 59) {
           this.mcount++;
       }
       //DAY COUNT
       if (this.hcount == 24) {
           this.dcount++;//DAY COUNT
           this.hcount = 0;
       }
       //MONTHDAY
       if (this.dcount > (this.monthframe)) {
           this.moncount++;
           this.dcount = 1
       }
       //MONTH
       else if (this.moncount > 12) {
           this.moncount = 1;
       }
       this.candlehour = this.hcount;//HOUR
       this.candleday = this.dcount;//DAY
       this.candlemonth = this.moncount;//MONTH
       this.timearr = [this.candlemonth, this.candleday, this.candlehour, this.candleminute];
   }
}
trenda.setupLog = function () {
   log.info
       (


       '\n' + '\t' + '\t' + '\t' + '\t' +
       '  ...last longpos = ' + this.logic.longpos + '\n' + '\t' + '\t' + '\t' +
       '+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+' + '\n' + '\t' + '\t' + '\t' +
       '  .....start backtest ' + this.name + ' varactor' + '\n' + '\t' + '\t' + '\t' +
       '+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+' + '\n' + '\t' + '\t' + '\t' +
       '\n' + '\t' + '\t' + '\t' +
       '                     <<>>' + '\n' + '\t' + '\t' + '\t' +
       '                 ><<><>><<>>' + '\n' + '\t' + '\t' + '\t' +
       '             >><<>>       <<>><<' + '\n' + '\t' + '\t' + '\t' +
       '        <>><<>    system v3   >><<>>' + '\n' + '\t' + '\t' + '\t' +
       '    <<>><<>  start date ' + this.month + ':' + this.day + ':' + this.hour + ':' + this.minute + ' >><<>>' + '\n' + '\t' + '\t' + '\t' +
       ' ><<>><    ......beginn trading       <>><<>' + '\n' + '\t' + '\t' + '\t' +
       '><<>><            ' + this.name + '         ><>><<' + '\n' + '\t' + '\t' + '\t' +
       '  >><<>>       susitronix d-sign      <<>><<' + '\n' + '\t' + '\t' + '\t' +
       '     >><<<<<>>><<            <<>>><<>><<' + '\n' + '\t' + '\t' + '\t' +
       '              ><<<<>>><<<>>><<>>' + '\n' + '\t' + '\t' + '\t' +
       '                    >>><<<' + '\n' + '\t' + '\t' + '\t' +
       '                      <>' + '\n'
       );
}
trenda.end = function () {
   this.logic.globalcount;
   this.monthdif = (((this.logic.globalcount / 60) / 24) / 30) % 12;
   this.daysdif = ((this.logic.globalcount / 60) / 24) % 30;
   this.hoursdif = (this.logic.globalcount / 60) % 24;
   this.minutesdif = this.logic.globalcount % 60;

   this.globalcountdif = this.logic.globalcount - this.globalcountbegin;

   let seconds = ((new Date() - this.startTime) / 1000),
       minutes = seconds / 60,
       str;
   //CPU TIME CALCULUS IN MILLISECONDS
   this.totaltime = ((minutes / 60) + seconds);
   this.cputime = ((this.totaltime / this.logic.globalcount) * 1000);

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

   log.info
       (
       '\n' + '\t' + '\t' +
       '.....backtest started with longpos = ' + this.longpos + '\n' + '\t' +
       '.....stop count = ' + this.logic.stopcount + '\n' + '\t' +
       '.....wait count = ' + this.logic.waitcount + '\n' + '\t' +
       '                                                       ' + '\n' + '\t' +
       '                             <<>>                      ' + '\n' + '\t' +
       '                       <<>><<>><<>><<>>                ' + '\n' + '\t' +
       '                 >><<>><<>><<>><<>><<>><<>><<          ' + '\n' + '\t' +
       '            <<>><<>>     ' + this.name + '     <<>><<>>' + '\n' + '\t' +
       '        <<>><<>>    start date ' + this.month + ':' + this.day + ':' + this.hour + ':' + this.minute + '     <<>><<>>' + '\n' + '\t' +
       '   <<>><<>>         end time ' + this.candlemonth + ':' + this.candleday + ':' + this.candlehour + ':' + this.candleminute + ' finish     <<>><<>>' + '\n' + '\t' +
       ' <<>><<>>      ' + str + ' / candles = ' + this.logic.globalcount + '       <<>><<>>' + '\n' + '\t' +
       '   <<>><<>>    candle cpu time = ' + this.cputime.toFixed(4) + ' mSec       <<>><<>>' + '\n' + '\t' +
       '      >><< <<>><<>><<>>                <<>><<>><<>> <<>> ' + '\n' + '\t' +
       '    <<>><>         <<>><<>><<>><<>><<>><<>>         <<>><< ' + '\n' + '\t' +
       '<<>><<>>><<                <<>><<>>                ><<>><<>>>< ' + '\n' + '\t'
       );
}

module.exports = trenda;

And here the settings .toml

Code:
[___trendatron___]
#<<<>>><<<>>>#
__longPos = false

#>>><<<>>><<#
[_backtest_start_]
__________day = 1
______month = 4
_____hour = 18
_minute = 38
candle_size = 1
#<<<>>><<<>>>#

[RSI]
optInTimePeriod = 30

[trsRSI]
high = 68
low = 30

[___stop_abs____]
stop_abs = -1.7
abs_exp = -250


The actual code for the strat would be fearly small, the rest are just debug tools.
>>>In the following tutorial we will build the hypetrend that can be seen as a complement to the stoploss, function wise.
Also we try to build a macrotrend for the longer trends in the future.

If you have questions to it, feel free to ask here in this topic because i will read them. hope this helps
or if you need some help with your strategie, no worries fire it up


  Migration to postgreSQL or mongoDB
Posted by: xFFFFF - 05-03-2018, 06:06 PM - Forum: Guides - Replies (9)

In my opinion, this is not normal, probably everyone who did it for the first time was just as surprised as me "why the f* does not work?"

Changes should be made in the following files:

gekko/config/adapters/postgresql.toml:1:postgres://
gekko/config/adapters/mongodb.toml:1:mongodb://
gekko/config/general.toml:4:'sqlite'
gekko/web/vue/UIconfig.js:19:'sqlite'
gekko/web/routes/baseConfig.js:53:postgres://
gekko/web/routes/baseConfig.js:66:mongodb://
gekko/test/test-config.json:112:postgres://

God bless the grep!


  New here sorry if this is a repeat Question
Posted by: whoodat - 05-03-2018, 04:31 PM - Forum: General Discussion - Replies (9)

I was looking to backtest on GDAX and do not see it as an option or even for live trading. Was GDAX removed will it be back?  Thanks.


  no sell orders???
Posted by: Presunto - 05-02-2018, 07:44 PM - Forum: Technical Support - No Replies

can anyone confirm this:

(03-12-2018, 09:28 PM)zappra Wrote: Shorting is supported on some exchanges (eg. Kraken) but it's not supported in Gekko (AFAIK)


i want to trade bitfinex marging trade, so i need to open shorts too.

there is any workaround?


  xFFFFF´s github repo! STRATEGIE´s >>>n MORE
Posted by: susitronix - 05-02-2018, 11:49 AM - Forum: Strategy Development - Replies (10)

@ xFFFFF
hi there i found your Repo-collection. Very nice thanks alot!
Super intresting stuff, also the results table. would be of intrest wich pair...

I try to develop my trendline indicator but its a bit hard without a visual feedback.
So i will try the exel method.
When implementing the special debug line into my gekko strat,
it could not find the destination folder/file..offourse hehe, did not tryed hard enough.

Thanks i appreciate ;-)