askmike / gekko

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

Command Line Backtest Issue #1020

Closed Gab0 closed 7 years ago

Gab0 commented 7 years ago

[ bug report]

2017-08-21 18:13:19 (DEBUG): calculated MACD properties for candle: 2017-08-21 18:13:19 (DEBUG): short: 1022.78699510 2017-08-21 18:13:19 (DEBUG): long: 1020.56962192 2017-08-21 18:13:19 (DEBUG): macd: 2.21737317 2017-08-21 18:13:19 (DEBUG): signal: 2.18463573 2017-08-21 18:13:19 (DEBUG): macdiff: 0.03273744 2017-08-21 18:13:19 (DEBUG): In uptrend since 20 candle(s) 2017-08-21 18:13:19 (INFO): 2017-02-04 14:37:00: Paper trader simulated a SELL 109.99230337 USDT <= 0.00000000 BTC 2017-08-21 18:13:19 (INFO): 2017-02-04 14:50:00: Paper trader simulated a BUY 0.00000000 USDT => 0.10804170 BTC 2017-08-21 18:13:19 (DEBUG): calculated MACD properties for candle: 2017-08-21 18:13:19 (DEBUG): short: 1023.13213731 2017-08-21 18:13:19 (DEBUG): long: 1020.94377241 2017-08-21 18:13:19 (DEBUG): macd: 2.18836490 2017-08-21 18:13:19 (DEBUG): signal: 2.18538157 2017-08-21 18:13:19 (DEBUG): macdiff: 0.00298333

askmike commented 7 years ago

Can you share your:

Gab0 commented 7 years ago

Ran full seven month history for clearer results. Profits: UI -58% CMD -100% gekko-ui-sample-backtest

poloniex-history.zip

config.tradingAdvisor = {
  enabled: true,
  method: 'MACD',
  candleSize: 1,
  historySize: 10,
  adapter: 'sqlite',
  talib: {
    enabled: false,
    version: '1.0.2'
  }
}
.....
config.MACD = {
  // EMA weight (α)
  // the higher the weight, the more smooth (and delayed) the line
  short: 10,
  long: 21,
  signal: 9,
  // the difference between the EMAs (to act as triggers)
  thresholds: {
    down: -0.025,
    up: 0.025,
    // How many candle intervals should a trend persist
    // before we consider it real?
    persistence: 1
  }
};

....
config.paperTrader = {
  enabled: true,
  // report the profit in the currency or the asset?
  reportInCurrency: true,
  // start balance, on what the current balance is compared with
  simulationBalance: {
    // these are in the unit types configured in the watcher.
    asset: 1,
    currency: 100,
  },
  // how much fee in % does each trade cost?
  fee: 0.25,
  // how much slippage/spread should Gekko assume per trade?
  slippage: 0.05,
}
askmike commented 7 years ago

Ah! In your CLI config you set candleSize to 1. candleSize is in minutes. Could you try again with either the UI set to 1 minute or the CLI backtester to 60?

Gab0 commented 7 years ago

And that was the problem :x Would be nice to comment ' candle size in minutes' on the config file just to.. not let this be in vain haah Thanks.

askmike commented 7 years ago

Ah yes, great idea.