askmike / gekko

A bitcoin trading bot written in node - https://gekko.wizb.it/
MIT License
10.06k stars 3.95k forks source link

Example EMA Gekko Indicator Returns False #2396

Closed VeronicaC12 closed 6 years ago

VeronicaC12 commented 6 years ago

Note: this is the technical bug tracker, please use other platforms for getting support and starting a (non technical) discussion. See the getting help page for details.

I'm submitting a ... [X] bug report [ ] question about the decisions made in the repository

Action taken (what you did) Followed the example code exactly.

Expected result (what you hoped would happen) A valid EMA number.

Actual result (unexpected outcome) A boolean.

Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, etc)

https://gist.github.com/VeronicaC12/a885f6ed6a58515f92adbd08bd911a7d

askmike commented 6 years ago

~I'm not 100% sure about your sample strategy, but this one is working for me: https://gist.github.com/askmike/ce4120ade30c7da02910c882f6312c99~

Scratch that, even yours is working for me:

➜  gekko git:(feature/trailing-stop) ✗ node gekko -c sample-config.js -b

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

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

2018-08-11 15:50:03 (INFO): Setting up Gekko in backtest mode
2018-08-11 15:50:03 (INFO): 
2018-08-11 15:50:03 (WARN): The plugin Candle writer does not support the mode backtest. It has been disabled.
2018-08-11 15:50:03 (INFO): Setting up:
2018-08-11 15:50:03 (INFO):    Trading Advisor
2018-08-11 15:50:03 (INFO):    Calculate trading advice
2018-08-11 15:50:03 (INFO):    Using the strategy: v2
2018-08-11 15:50:03 (INFO): 

2018-08-11 15:50:03 (INFO): Setting up:
2018-08-11 15:50:03 (INFO):    Paper Trader
2018-08-11 15:50:03 (INFO):    Paper trader that simulates fake trades.
2018-08-11 15:50:03 (INFO): 

2018-08-11 15:50:03 (INFO): Setting up:
2018-08-11 15:50:03 (INFO):    Performance Analyzer
2018-08-11 15:50:03 (INFO):    Analyzes performances of trades
2018-08-11 15:50:03 (INFO): 

2018-08-11 15:50:04 (INFO): Scanning local history for backtestable dateranges.
2018-08-11 15:50:04 (DEBUG):  Available 111096
2018-08-11 15:50:04 (DEBUG):  Optimal 386185
2018-08-11 15:50:04 (INFO): The database has 275090 candles missing, Figuring out which ones...
2018-08-11 15:50:04 (INFO): Gekko detected multiple dateranges in the locally stored history. Please pick the daterange you are interested in testing:
2018-08-11 15:50:04 (INFO):      OPTION 1:
2018-08-11 15:50:04 (INFO):    from: 2017-11-14 03:43:00
2018-08-11 15:50:04 (INFO):    to: 2017-12-27 04:43:00
2018-08-11 15:50:04 (INFO):      OPTION 2:
2018-08-11 15:50:04 (INFO):    from: 2018-04-02 14:43:00
2018-08-11 15:50:04 (INFO):    to: 2018-04-05 08:43:00
2018-08-11 15:50:04 (INFO):      OPTION 3:
2018-08-11 15:50:04 (INFO):    from: 2018-07-03 00:43:00
2018-08-11 15:50:04 (INFO):    to: 2018-08-03 04:43:00
prompt: option:  1

2018-08-11 15:50:05 (INFO):   WARNING: BACKTESTING FEATURE NEEDS PROPER TESTING
2018-08-11 15:50:05 (INFO):   WARNING: ACT ON THESE NUMBERS AT YOUR OWN RISK!

2018-08-11 15:50:05 (DEBUG):  calculated random number:
2018-08-11 15:50:05 (DEBUG):     0.239
2018-08-11 15:50:05 (DEBUG):  EMA: 6610.189999999999
2018-08-11 15:50:05 (DEBUG):  calculated random number:
2018-08-11 15:50:05 (DEBUG):     0.241
2018-08-11 15:50:05 (DEBUG):  EMA: 6597.417272727271
2018-08-11 15:50:05 (DEBUG):  calculated random number:
2018-08-11 15:50:05 (DEBUG):     0.401
2018-08-11 15:50:05 (DEBUG):  EMA: 6588.803223140494
2018-08-11 15:50:05 (DEBUG):  calculated random number:
2018-08-11 15:50:05 (DEBUG):     0.445
2018-08-11 15:50:05 (DEBUG):  EMA: 6574.660818933131
2018-08-11 15:50:05 (DEBUG):  calculated random number:
2018-08-11 15:50:05 (DEBUG):     0.461
2018-08-11 15:50:05 (DEBUG):  EMA: 6549.95885185438
2018-08-11 15:50:05 (DEBUG):  calculated random number:
2018-08-11 15:50:05 (DEBUG):     0.406
2018-08-11 15:50:05 (DEBUG):  EMA: 6540.826333335401
2018-08-11 15:50:05 (DEBUG):  calculated random number:
2018-08-11 15:50:05 (DEBUG):     0.057
2018-08-11 15:50:05 (DEBUG):  EMA: 6531.781545456236
2018-08-11 15:50:05 (INFO): 2017-11-14 18:43:00: Paper trader simulated a SELL  6581.34338000 USDT <= 0.00000000 BTC
2018-08-11 15:50:05 (DEBUG):  calculated random number:
2018-08-11 15:50:05 (DEBUG):     0.150
2018-08-11 15:50:05 (DEBUG):  EMA: 6517.819446282374
2018-08-11 15:50:05 (DEBUG):  calculated random number:
2018-08-11 15:50:05 (DEBUG):     0.666
2018-08-11 15:50:05 (DEBUG):  EMA: 6491.126819685578
2018-08-11 15:50:05 (DEBUG):  calculated random number:
2018-08-11 15:50:05 (DEBUG):     0.730
2018-08-11 15:50:05 (DEBUG):  EMA: 6469.10012519729
2018-08-11 15:50:05 (DEBUG):  calculated random number:
2018-08-11 15:50:05 (DEBUG):     0.055

Can you provide more debug information? Feel free to comment here, but I'll be closing this as I doubt it's a bug (if it is we can always reopen).