Gekko Forum
Default included CCI strat values wrong? Or i did not understand something... - Printable Version

+- Gekko Forum (https://forum.gekko.wizb.it)
+-- Forum: Gekko (https://forum.gekko.wizb.it/forum-13.html)
+--- Forum: General Discussion (https://forum.gekko.wizb.it/forum-14.html)
+--- Thread: Default included CCI strat values wrong? Or i did not understand something... (/thread-1463.html)



Default included CCI strat values wrong? Or i did not understand something... - piactif - 02-10-2018

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 ?


RE: Default included CCI strat values wrong? Or i did not understand something... - askmike - 02-11-2018

First things first: Gekko calculates candles differently (if you have hourly candles they won't start on the dot). What kind of candle did you configure? And do you have logs?


RE: Default included CCI strat values wrong? Or i did not understand something... - piactif - 02-11-2018

(02-11-2018, 03:54 AM)askmike Wrote: First things first: Gekko calculates candles differently (if you have hourly candles they won't start on the dot). What kind of candle did you configure? And do you have logs?
Thank ou for your answer Mike !

As stated in point #2 i chose 4 hours candles, history 20 (so 20*4 hours candles right? both 20 value in trader and in strategy).
The default CCI strat is used, not modified except the csv log of values.

Yes there is a small difference between the candle start : 46 minutes, so in Tradingview i have a candle every 4 hours at 1h, 5h, 9h etc... and in Gekko the same but 1h46, 5h46, 9h46 etc... it seems the difference depends on the date/hour of data import start.

But the difference between CCI values in Tradingview and Gekko are huge and the 46mn difference can not explain so much difference.

The logs are clean and just show the CCI values for each candle calc as defined in the default CCI strat.

Here are the csv file logged values, you'll see for example, that on feb 9 1:46PM Gekko logged a -88 CCI value and price at 0.13323, price is OK but CCI value not :

[Image: Capture_du_2018_02_11_12_30_11.png]


Code:
date    price    cci
Wed Jan 24 2018 01:46:00 GMT+0100 (CET)    0    35.95
Wed Jan 24 2018 05:46:00 GMT+0100 (CET)    0    57.28
Wed Jan 24 2018 09:46:00 GMT+0100 (CET)    0    201.66
Wed Jan 24 2018 09:46:00 GMT+0100 (CET)    0.13289    201.65882501107333
Wed Jan 24 2018 13:46:00 GMT+0100 (CET)    0    246.32
Wed Jan 24 2018 17:46:00 GMT+0100 (CET)    0    107.72
Wed Jan 24 2018 21:46:00 GMT+0100 (CET)    0    29.02
Thu Jan 25 2018 01:46:00 GMT+0100 (CET)    0    23.20
Thu Jan 25 2018 05:46:00 GMT+0100 (CET)    0    0.85
Thu Jan 25 2018 09:46:00 GMT+0100 (CET)    0    3.64
Thu Jan 25 2018 13:46:00 GMT+0100 (CET)    0    -6.39
Thu Jan 25 2018 17:46:00 GMT+0100 (CET)    0    -15.28
Thu Jan 25 2018 21:46:00 GMT+0100 (CET)    0    -26.08
Fri Jan 26 2018 01:46:00 GMT+0100 (CET)    0    -35.00
Fri Jan 26 2018 05:46:00 GMT+0100 (CET)    0    -74.19
Fri Jan 26 2018 09:46:00 GMT+0100 (CET)    0    -69.22
Fri Jan 26 2018 13:46:00 GMT+0100 (CET)    0    -47.62
Fri Jan 26 2018 17:46:00 GMT+0100 (CET)    0    -21.04
Fri Jan 26 2018 21:46:00 GMT+0100 (CET)    0    -17.23
Sat Jan 27 2018 01:46:00 GMT+0100 (CET)    0    -39.09
Sat Jan 27 2018 05:46:00 GMT+0100 (CET)    0    -46.37
Sat Jan 27 2018 09:46:00 GMT+0100 (CET)    0    -49.27
Sat Jan 27 2018 13:46:00 GMT+0100 (CET)    0    -13.68
Sat Jan 27 2018 17:46:00 GMT+0100 (CET)    0    -27.99
Sat Jan 27 2018 21:46:00 GMT+0100 (CET)    0    -22.29
Sun Jan 28 2018 01:46:00 GMT+0100 (CET)    0    -60.69
Sun Jan 28 2018 05:46:00 GMT+0100 (CET)    0    -59.83
Sun Jan 28 2018 09:46:00 GMT+0100 (CET)    0    -65.64
Sun Jan 28 2018 13:46:00 GMT+0100 (CET)    0    -27.11
Sun Jan 28 2018 17:46:00 GMT+0100 (CET)    0    -7.31
Sun Jan 28 2018 21:46:00 GMT+0100 (CET)    0    11.44
Mon Jan 29 2018 01:46:00 GMT+0100 (CET)    0    109.32
Mon Jan 29 2018 05:46:00 GMT+0100 (CET)    0    109.04
Mon Jan 29 2018 09:46:00 GMT+0100 (CET)    0    133.28
Mon Jan 29 2018 09:46:00 GMT+0100 (CET)    0.1319    133.28407281876434
Mon Jan 29 2018 13:46:00 GMT+0100 (CET)    0    122.72
Mon Jan 29 2018 17:46:00 GMT+0100 (CET)    0    152.03
Mon Jan 29 2018 21:46:00 GMT+0100 (CET)    0    153.50
Tue Jan 30 2018 01:46:00 GMT+0100 (CET)    0    82.65
Tue Jan 30 2018 05:46:00 GMT+0100 (CET)    0    -15.94
Tue Jan 30 2018 09:46:00 GMT+0100 (CET)    0    -20.28
Tue Jan 30 2018 13:46:00 GMT+0100 (CET)    0    -29.38
Tue Jan 30 2018 17:46:00 GMT+0100 (CET)    0    -32.41
Tue Jan 30 2018 21:46:00 GMT+0100 (CET)    0    -38.53
Wed Jan 31 2018 01:46:00 GMT+0100 (CET)    0    -54.76
Wed Jan 31 2018 05:46:00 GMT+0100 (CET)    0    -61.91
Wed Jan 31 2018 09:46:00 GMT+0100 (CET)    0    -58.40
Wed Jan 31 2018 13:46:00 GMT+0100 (CET)    0    -82.15
Wed Jan 31 2018 17:46:00 GMT+0100 (CET)    0    -84.15
Wed Jan 31 2018 17:46:00 GMT+0100 (CET)    0.128575    -84.14823343792457
Wed Jan 31 2018 21:46:00 GMT+0100 (CET)    0    -52.92
Thu Feb 01 2018 01:46:00 GMT+0100 (CET)    0    -75.92
Thu Feb 01 2018 05:46:00 GMT+0100 (CET)    0    -57.15
Thu Feb 01 2018 09:46:00 GMT+0100 (CET)    0    -68.23
Thu Feb 01 2018 13:46:00 GMT+0100 (CET)    0    -33.57
Thu Feb 01 2018 17:46:00 GMT+0100 (CET)    0    -2.77
Thu Feb 01 2018 21:46:00 GMT+0100 (CET)    0    19.43
Fri Feb 02 2018 01:46:00 GMT+0100 (CET)    0    8.84
Fri Feb 02 2018 05:46:00 GMT+0100 (CET)    0    9.04
Fri Feb 02 2018 09:46:00 GMT+0100 (CET)    0    19.27
Fri Feb 02 2018 13:46:00 GMT+0100 (CET)    0    89.96
Fri Feb 02 2018 17:46:00 GMT+0100 (CET)    0    113.40
Fri Feb 02 2018 17:46:00 GMT+0100 (CET)    0.132442    113.39518712107399
Fri Feb 02 2018 21:46:00 GMT+0100 (CET)    0    103.66
Sat Feb 03 2018 01:46:00 GMT+0100 (CET)    0    72.65
Sat Feb 03 2018 05:46:00 GMT+0100 (CET)    0    62.42
Sat Feb 03 2018 09:46:00 GMT+0100 (CET)    0    45.43
Sat Feb 03 2018 13:46:00 GMT+0100 (CET)    0    32.19
Sat Feb 03 2018 17:46:00 GMT+0100 (CET)    0    6.00
Sat Feb 03 2018 21:46:00 GMT+0100 (CET)    0    -14.10
Sun Feb 04 2018 01:46:00 GMT+0100 (CET)    0    -26.93
Sun Feb 04 2018 05:46:00 GMT+0100 (CET)    0    -30.53
Sun Feb 04 2018 09:46:00 GMT+0100 (CET)    0    -38.30
Sun Feb 04 2018 13:46:00 GMT+0100 (CET)    0    -49.61
Sun Feb 04 2018 17:46:00 GMT+0100 (CET)    0    -63.40
Sun Feb 04 2018 21:46:00 GMT+0100 (CET)    0    -26.87
Mon Feb 05 2018 01:46:00 GMT+0100 (CET)    0    -47.07
Mon Feb 05 2018 05:46:00 GMT+0100 (CET)    0    -87.10
Mon Feb 05 2018 05:46:00 GMT+0100 (CET)    0.126011    -87.0950410996449
Mon Feb 05 2018 09:46:00 GMT+0100 (CET)    0    -97.76
Mon Feb 05 2018 13:46:00 GMT+0100 (CET)    0    -101.50
Mon Feb 05 2018 17:46:00 GMT+0100 (CET)    0    -43.48
Mon Feb 05 2018 21:46:00 GMT+0100 (CET)    0    -27.91
Tue Feb 06 2018 01:46:00 GMT+0100 (CET)    0    -59.34
Tue Feb 06 2018 05:46:00 GMT+0100 (CET)    0    -38.77
Tue Feb 06 2018 09:46:00 GMT+0100 (CET)    0    15.56
Tue Feb 06 2018 13:46:00 GMT+0100 (CET)    0    57.62
Tue Feb 06 2018 17:46:00 GMT+0100 (CET)    0    116.90
Tue Feb 06 2018 17:46:00 GMT+0100 (CET)    0.133106    116.9029406142114
Tue Feb 06 2018 21:46:00 GMT+0100 (CET)    0    146.78
Wed Feb 07 2018 01:46:00 GMT+0100 (CET)    0    138.69
Wed Feb 07 2018 05:46:00 GMT+0100 (CET)    0    149.36
Wed Feb 07 2018 09:46:00 GMT+0100 (CET)    0    123.79
Wed Feb 07 2018 13:46:00 GMT+0100 (CET)    0    52.14
Wed Feb 07 2018 17:46:00 GMT+0100 (CET)    0    36.62
Wed Feb 07 2018 21:46:00 GMT+0100 (CET)    0    13.85
Thu Feb 08 2018 01:46:00 GMT+0100 (CET)    0    15.10
Thu Feb 08 2018 05:46:00 GMT+0100 (CET)    0    0.30
Thu Feb 08 2018 09:46:00 GMT+0100 (CET)    0    -10.08
Thu Feb 08 2018 13:46:00 GMT+0100 (CET)    0    -17.30
Thu Feb 08 2018 17:46:00 GMT+0100 (CET)    0    -22.75
Thu Feb 08 2018 21:46:00 GMT+0100 (CET)    0    -26.54
Fri Feb 09 2018 01:46:00 GMT+0100 (CET)    0    -29.66
Fri Feb 09 2018 05:46:00 GMT+0100 (CET)    0    -32.25
Fri Feb 09 2018 09:46:00 GMT+0100 (CET)    0    -56.23
Fri Feb 09 2018 13:46:00 GMT+0100 (CET)    0    -88.46
Fri Feb 09 2018 13:46:00 GMT+0100 (CET)    0.13323    -88.46102258392924
Fri Feb 09 2018 17:46:00 GMT+0100 (CET)    0    -151.53
Fri Feb 09 2018 21:46:00 GMT+0100 (CET)    0    -150.63
Sat Feb 10 2018 01:46:00 GMT+0100 (CET)    0    -92.85
Sat Feb 10 2018 05:46:00 GMT+0100 (CET)    0    -63.29
Sat Feb 10 2018 09:46:00 GMT+0100 (CET)    0    -39.17
Sat Feb 10 2018 13:46:00 GMT+0100 (CET)    0    -35.38



RE: Default included CCI strat values wrong? Or i did not understand something... - piactif - 02-11-2018

OK i wrote a minimalist CCI strat with talib library: this.addTulipIndicator('mycci', 'cci', customCCISettings);

cci returned values are by far more accurate.

Perhaps a TP price calculation problem in default CCI.js indicator...?


RE: Default included CCI strat values wrong? Or i did not understand something... - ntanhdt - 07-02-2018

(02-11-2018, 02:12 PM)piactif Wrote: OK i wrote a minimalist CCI strat with talib library: this.addTulipIndicator('mycci', 'cci', customCCISettings);

cci returned values are by far more accurate.

Perhaps a TP price calculation problem in default CCI.js indicator...?

I have the same problem with CCI, both default CCI.js indicator and Talib. CCI talib returned values more accurate but different a lot from tradingview.