Closed xerix32 closed 5 years ago
To be sure, I have repeated the tests with poloniex and nothing has changed, there are the same inconsistencies.
Hi,
I see no interest / response in this (in my opinion) really important matter.
Is this something I did not understand or just do not care about anyone?
If is my misunderstand, can I ask to explain me the problem? Please...
Thanks in advice, Xr.
Hi xerix32, I just noticed the same. Something is clearly going wrong here. Also the Simulated Profit from Backtest result doesn't match the numbers from Roundtrips table when added up.
I also noticed, maybe unrelated, that the backtest doesn't finish always, i.e. the timespan doesn't match the duration from the dataset, leading to different amounts of trades, and no error being output on console if that happens.
I think we have to dive in and debug...
@bbjay if you can reproduce in CLI mode with debug logs that would be awesome!
@askmike I can reproduce this in CLI. Some observations:
I used the following papertrader config:
config.paperTrader = {
enabled: true,
reportInCurrency: true,
simulationBalance: {
asset: 1,
currency: 0,
},
feeMaker: 0,
feeTaker: 0,
feeUsing: 'maker',
slippage: 0.0,
}
2017-09-26 01:27:53 (INFO): Setting up Gekko in backtest mode
2017-09-26 01:27:53 (INFO):
2017-09-26 01:27:53 (INFO): Setting up:
2017-09-26 01:27:53 (INFO): Trading Advisor
2017-09-26 01:27:53 (INFO): Calculate trading advice
2017-09-26 01:27:53 (INFO): Using the strategy: DEMA
2017-09-26 01:27:53 (INFO):
2017-09-26 01:27:53 (INFO): Setting up:
2017-09-26 01:27:53 (INFO): Paper Trader
2017-09-26 01:27:53 (INFO): Paper trader that simulates fake trades.
2017-09-26 01:27:53 (INFO):
2017-09-26 01:27:53 (INFO): Setting up:
2017-09-26 01:27:53 (INFO): Performance Analyzer
2017-09-26 01:27:53 (INFO): Analyzes performances of trades
2017-09-26 01:27:53 (INFO):
2017-09-26 01:27:53 (INFO): Scanning local history for backtestable dateranges.
2017-09-26 01:27:53 (DEBUG): Available 4300
2017-09-26 01:27:53 (DEBUG): Optimal 4299
2017-09-26 01:27:53 (INFO): Gekko is able to fully use the local history.
2017-09-26 01:27:53 (INFO): Gekko was able to find a single daterange in the locally stored history:
2017-09-26 01:27:53 (INFO): from: 2017-09-05 18:02:00
2017-09-26 01:27:53 (INFO): to: 2017-09-08 17:41:00
2017-09-26 01:27:53 (INFO): WARNING: BACKTESTING FEATURE NEEDS PROPER TESTING
2017-09-26 01:27:53 (INFO): WARNING: ACT ON THESE NUMBERS AT YOUR OWN RISK!
2017-09-26 01:27:53 (INFO): 2017-09-05 20:47:00: Paper trader simulated a BUY 0.00000000 USDT => 1.00000000 BTC
2017-09-26 01:27:53 (INFO): 2017-09-05 22:37:00: Paper trader simulated a SELL 4368.00001798 USDT <= 0.00000000 BTC
2017-09-26 01:27:53 (INFO): 2017-09-05 23:02:00: Paper trader simulated a BUY 0.00000000 USDT => 0.98778833 BTC
2017-09-26 01:27:53 (INFO): 2017-09-05 23:27:00: Paper trader simulated a SELL 4330.46403875 USDT <= 0.00000000 BTC
2017-09-26 01:27:53 (INFO): 2017-09-06 00:27:00: Paper trader simulated a BUY 0.00000000 USDT => 0.98061614 BTC
2017-09-26 01:27:53 (INFO): 2017-09-06 01:57:00: Paper trader simulated a SELL 4287.25376457 USDT <= 0.00000000 BTC
2017-09-26 01:27:53 (INFO): 2017-09-06 02:52:00: Paper trader simulated a BUY 0.00000000 USDT => 0.96658203 BTC
2017-09-26 01:27:53 (INFO): 2017-09-06 05:57:00: Paper trader simulated a SELL 4300.71008429 USDT <= 0.00000000 BTC
2017-09-26 01:27:53 (INFO): 2017-09-06 09:17:00: Paper trader simulated a BUY 0.00000000 USDT => 0.96862839 BTC
2017-09-26 01:27:53 (INFO): 2017-09-06 12:22:00: Paper trader simulated a SELL 4340.64083678 USDT <= 0.00000000 BTC
2017-09-26 01:27:53 (INFO): 2017-09-06 12:37:00: Paper trader simulated a BUY 0.00000000 USDT => 0.95949749 BTC
2017-09-26 01:27:53 (INFO): 2017-09-06 14:42:00: Paper trader simulated a SELL 4325.47108663 USDT <= 0.00000000 BTC
2017-09-26 01:27:53 (INFO): 2017-09-06 16:22:00: Paper trader simulated a BUY 0.00000000 USDT => 0.95632789 BTC
2017-09-26 01:27:53 (INFO): 2017-09-06 21:12:00: Paper trader simulated a SELL 4367.25657159 USDT <= 0.00000000 BTC
2017-09-26 01:27:53 (INFO): 2017-09-06 23:52:00: Paper trader simulated a BUY 0.00000000 USDT => 0.95412728 BTC
2017-09-26 01:27:53 (INFO): 2017-09-07 02:47:00: Paper trader simulated a SELL 4349.91465412 USDT <= 0.00000000 BTC
2017-09-26 01:27:53 (INFO): 2017-09-07 05:07:00: Paper trader simulated a BUY 0.00000000 USDT => 0.96023419 BTC
2017-09-26 01:27:53 (INFO): 2017-09-07 05:42:00: Paper trader simulated a SELL 4314.09215712 USDT <= 0.00000000 BTC
2017-09-26 01:27:53 (INFO): 2017-09-07 06:42:00: Paper trader simulated a BUY 0.00000000 USDT => 0.95287997 BTC
2017-09-26 01:27:53 (INFO): 2017-09-07 08:17:00: Paper trader simulated a SELL 4298.02645482 USDT <= 0.00000000 BTC
2017-09-26 01:27:53 (INFO): 2017-09-07 10:37:00: Paper trader simulated a BUY 0.00000000 USDT => 0.95185457 BTC
2017-09-26 01:27:53 (INFO): 2017-09-07 17:07:00: Paper trader simulated a SELL 4410.89407756 USDT <= 0.00000000 BTC
2017-09-26 01:27:53 (INFO): 2017-09-07 17:52:00: Paper trader simulated a BUY 0.00000000 USDT => 0.94638803 BTC
2017-09-26 01:27:53 (INFO): 2017-09-07 18:52:00: Paper trader simulated a SELL 4383.19616094 USDT <= 0.00000000 BTC
2017-09-26 01:27:53 (INFO): 2017-09-07 23:57:00: Paper trader simulated a BUY 0.00000000 USDT => 0.94845056 BTC
2017-09-26 01:27:53 (INFO): 2017-09-08 02:07:00: Paper trader simulated a SELL 4360.10599519 USDT <= 0.00000000 BTC
2017-09-26 01:27:53 (INFO): 2017-09-08 04:37:00: Paper trader simulated a BUY 0.00000000 USDT => 0.94789652 BTC
2017-09-26 01:27:53 (INFO): 2017-09-08 06:52:00: Paper trader simulated a SELL 4336.62657900 USDT <= 0.00000000 BTC
2017-09-26 01:27:53 (INFO): 2017-09-08 08:42:00: Paper trader simulated a BUY 0.00000000 USDT => 0.93968073 BTC
2017-09-26 01:27:53 (INFO): 2017-09-08 12:32:00: Paper trader simulated a SELL 4357.29954501 USDT <= 0.00000000 BTC
2017-09-26 01:27:53 (INFO): 2017-09-08 14:42:00: Paper trader simulated a BUY 0.00000000 USDT => 0.93803577 BTC
2017-09-26 01:27:53 (INFO): 2017-09-08 15:22:00: Paper trader simulated a SELL 4258.48165615 USDT <= 0.00000000 BTC
2017-09-26 01:27:53 (INFO): 2017-09-08 18:02:00: Paper trader simulated a BUY 0.00000000 USDT => 0.97676481 BTC
2017-09-26 01:27:53 (INFO):
2017-09-26 01:27:53 (INFO): (ROUNDTRIP) REPORT:
2017-09-26 01:27:53 (INFO): (ROUNDTRIP) entry date exit date exposed duration P&L profit
2017-09-26 01:27:53 (INFO): (ROUNDTRIP) 2017-09-05 20:47 2017-09-05 22:37 2 hours -74.37 -1.67
2017-09-26 01:27:53 (INFO): (ROUNDTRIP) 2017-09-05 23:02 2017-09-05 23:27 25 minutes -7.69 -0.18
2017-09-26 01:27:53 (INFO): (ROUNDTRIP) 2017-09-06 00:27 2017-09-06 01:57 2 hours -7.84 -0.18
2017-09-26 01:27:53 (INFO): (ROUNDTRIP) 2017-09-06 02:52 2017-09-06 05:57 3 hours -14.24 -0.33
2017-09-26 01:27:53 (INFO): (ROUNDTRIP) 2017-09-06 09:17 2017-09-06 12:22 3 hours 39.93 0.93
2017-09-26 01:27:53 (INFO): (ROUNDTRIP) 2017-09-06 12:37 2017-09-06 14:42 2 hours -6.66 -0.15
2017-09-26 01:27:53 (INFO): (ROUNDTRIP) 2017-09-06 16:22 2017-09-06 21:12 5 hours 2.58 0.06
2017-09-26 01:27:53 (INFO): (ROUNDTRIP) 2017-09-06 23:52 2017-09-07 02:47 3 hours -42.21 -0.96
2017-09-26 01:27:53 (INFO): (ROUNDTRIP) 2017-09-07 05:07 2017-09-07 05:42 35 minutes -11.20 -0.26
2017-09-26 01:27:53 (INFO): (ROUNDTRIP) 2017-09-07 06:42 2017-09-07 08:17 2 hours -29.00 -0.67
2017-09-26 01:27:53 (INFO): (ROUNDTRIP) 2017-09-07 10:37 2017-09-07 17:07 7 hours 44.04 1.01
2017-09-26 01:27:53 (INFO): (ROUNDTRIP) 2017-09-07 17:52 2017-09-07 18:52 an hour -19.31 -0.44
2017-09-26 01:27:53 (INFO): (ROUNDTRIP) 2017-09-07 23:57 2017-09-08 02:07 2 hours -37.92 -0.86
2017-09-26 01:27:53 (INFO): (ROUNDTRIP) 2017-09-08 04:37 2017-09-08 06:52 2 hours -25.84 -0.59
2017-09-26 01:27:53 (INFO): (ROUNDTRIP) 2017-09-08 08:42 2017-09-08 12:32 4 hours 6.58 0.15
2017-09-26 01:27:53 (INFO): (ROUNDTRIP) 2017-09-08 14:42 2017-09-08 15:22 40 minutes 345.93 8.84
2017-09-26 01:27:53 (INFO):
2017-09-26 01:27:53 (INFO): (PROFIT REPORT) start time: 2017-09-05 18:02:00
2017-09-26 01:27:53 (INFO): (PROFIT REPORT) end time: 2017-09-08 17:41:00
2017-09-26 01:27:53 (INFO): (PROFIT REPORT) timespan: 3 days
2017-09-26 01:27:53 (INFO): (PROFIT REPORT) sharpe ratio: -1.8835803765024357
2017-09-26 01:27:53 (INFO):
2017-09-26 01:27:53 (INFO): (PROFIT REPORT) start price: 4343.00000002 USDT
2017-09-26 01:27:53 (INFO): (PROFIT REPORT) end price: 4275.00000005 USDT
2017-09-26 01:27:53 (INFO): (PROFIT REPORT) Market: -1.56573797%
2017-09-26 01:27:53 (INFO):
2017-09-26 01:27:53 (INFO): (PROFIT REPORT) amount of trades: 33
2017-09-26 01:27:53 (INFO): (PROFIT REPORT) original simulated balance: 4343.00000002 USDT
2017-09-26 01:27:53 (INFO): (PROFIT REPORT) current simulated balance: 4175.66956280 USDT
2017-09-26 01:27:53 (INFO): (PROFIT REPORT) simulated profit: -167.33043722 USDT (-3.85287675%)
2017-09-26 01:27:53 (INFO): (PROFIT REPORT) simulated yearly profit: -20457.98506710 USDT (-471.05652929%)
2017-09-26 01:27:53 (INFO): 2017-09-08 19:12:00: Paper trader simulated a SELL 4181.44562077 USDT <= 0.00000000 BTC
2017-09-26 01:28:50 (INFO): Setting up Gekko in backtest mode
2017-09-26 01:28:50 (INFO):
2017-09-26 01:28:50 (INFO): Setting up:
2017-09-26 01:28:50 (INFO): Trading Advisor
2017-09-26 01:28:50 (INFO): Calculate trading advice
2017-09-26 01:28:50 (INFO): Using the strategy: DEMA
2017-09-26 01:28:50 (INFO):
2017-09-26 01:28:50 (INFO): Setting up:
2017-09-26 01:28:50 (INFO): Paper Trader
2017-09-26 01:28:50 (INFO): Paper trader that simulates fake trades.
2017-09-26 01:28:50 (INFO):
2017-09-26 01:28:50 (INFO): Setting up:
2017-09-26 01:28:50 (INFO): Performance Analyzer
2017-09-26 01:28:50 (INFO): Analyzes performances of trades
2017-09-26 01:28:50 (INFO):
2017-09-26 01:28:50 (INFO): Scanning local history for backtestable dateranges.
2017-09-26 01:28:50 (DEBUG): Available 4300
2017-09-26 01:28:50 (DEBUG): Optimal 4299
2017-09-26 01:28:50 (INFO): Gekko is able to fully use the local history.
2017-09-26 01:28:50 (INFO): Gekko was able to find a single daterange in the locally stored history:
2017-09-26 01:28:50 (INFO): from: 2017-09-05 18:02:00
2017-09-26 01:28:50 (INFO): to: 2017-09-08 17:41:00
2017-09-26 01:28:50 (INFO): WARNING: BACKTESTING FEATURE NEEDS PROPER TESTING
2017-09-26 01:28:50 (INFO): WARNING: ACT ON THESE NUMBERS AT YOUR OWN RISK!
2017-09-26 01:28:50 (INFO): 2017-09-05 20:47:00: Paper trader simulated a BUY 0.00000000 USDT => 1.00000000 BTC
2017-09-26 01:28:50 (INFO): 2017-09-05 22:37:00: Paper trader simulated a SELL 4368.00001798 USDT <= 0.00000000 BTC
2017-09-26 01:28:50 (INFO): 2017-09-05 23:02:00: Paper trader simulated a BUY 0.00000000 USDT => 0.98778833 BTC
2017-09-26 01:28:50 (INFO): 2017-09-05 23:27:00: Paper trader simulated a SELL 4330.46403875 USDT <= 0.00000000 BTC
2017-09-26 01:28:50 (INFO): 2017-09-06 00:27:00: Paper trader simulated a BUY 0.00000000 USDT => 0.98061614 BTC
2017-09-26 01:28:50 (INFO): 2017-09-06 01:57:00: Paper trader simulated a SELL 4287.25376457 USDT <= 0.00000000 BTC
2017-09-26 01:28:50 (INFO): 2017-09-06 02:52:00: Paper trader simulated a BUY 0.00000000 USDT => 0.96658203 BTC
2017-09-26 01:28:50 (INFO): 2017-09-06 05:57:00: Paper trader simulated a SELL 4300.71008429 USDT <= 0.00000000 BTC
2017-09-26 01:28:50 (INFO): 2017-09-06 09:17:00: Paper trader simulated a BUY 0.00000000 USDT => 0.96862839 BTC
2017-09-26 01:28:50 (INFO): 2017-09-06 12:22:00: Paper trader simulated a SELL 4340.64083678 USDT <= 0.00000000 BTC
2017-09-26 01:28:50 (INFO): 2017-09-06 12:37:00: Paper trader simulated a BUY 0.00000000 USDT => 0.95949749 BTC
2017-09-26 01:28:50 (INFO): 2017-09-06 14:42:00: Paper trader simulated a SELL 4325.47108663 USDT <= 0.00000000 BTC
2017-09-26 01:28:50 (INFO): 2017-09-06 16:22:00: Paper trader simulated a BUY 0.00000000 USDT => 0.95632789 BTC
2017-09-26 01:28:50 (INFO): 2017-09-06 21:12:00: Paper trader simulated a SELL 4367.25657159 USDT <= 0.00000000 BTC
2017-09-26 01:28:50 (INFO): 2017-09-06 23:52:00: Paper trader simulated a BUY 0.00000000 USDT => 0.95412728 BTC
2017-09-26 01:28:50 (INFO): 2017-09-07 02:47:00: Paper trader simulated a SELL 4349.91465412 USDT <= 0.00000000 BTC
2017-09-26 01:28:50 (INFO): 2017-09-07 05:07:00: Paper trader simulated a BUY 0.00000000 USDT => 0.96023419 BTC
2017-09-26 01:28:50 (INFO): 2017-09-07 05:42:00: Paper trader simulated a SELL 4314.09215712 USDT <= 0.00000000 BTC
2017-09-26 01:28:50 (INFO): 2017-09-07 06:42:00: Paper trader simulated a BUY 0.00000000 USDT => 0.95287997 BTC
2017-09-26 01:28:50 (INFO): 2017-09-07 08:17:00: Paper trader simulated a SELL 4298.02645482 USDT <= 0.00000000 BTC
2017-09-26 01:28:50 (INFO): 2017-09-07 10:37:00: Paper trader simulated a BUY 0.00000000 USDT => 0.95185457 BTC
2017-09-26 01:28:50 (INFO): 2017-09-07 17:07:00: Paper trader simulated a SELL 4410.89407756 USDT <= 0.00000000 BTC
2017-09-26 01:28:50 (INFO): 2017-09-07 17:52:00: Paper trader simulated a BUY 0.00000000 USDT => 0.94638803 BTC
2017-09-26 01:28:50 (INFO): 2017-09-07 18:52:00: Paper trader simulated a SELL 4383.19616094 USDT <= 0.00000000 BTC
2017-09-26 01:28:50 (INFO): 2017-09-07 23:57:00: Paper trader simulated a BUY 0.00000000 USDT => 0.94845056 BTC
2017-09-26 01:28:50 (INFO): 2017-09-08 02:07:00: Paper trader simulated a SELL 4360.10599519 USDT <= 0.00000000 BTC
2017-09-26 01:28:50 (INFO): 2017-09-08 04:37:00: Paper trader simulated a BUY 0.00000000 USDT => 0.94789652 BTC
2017-09-26 01:28:50 (INFO): 2017-09-08 06:52:00: Paper trader simulated a SELL 4336.62657900 USDT <= 0.00000000 BTC
2017-09-26 01:28:50 (INFO): 2017-09-08 08:42:00: Paper trader simulated a BUY 0.00000000 USDT => 0.93968073 BTC
2017-09-26 01:28:50 (INFO): 2017-09-08 12:32:00: Paper trader simulated a SELL 4357.29954501 USDT <= 0.00000000 BTC
2017-09-26 01:28:50 (INFO): 2017-09-08 14:42:00: Paper trader simulated a BUY 0.00000000 USDT => 0.93803577 BTC
2017-09-26 01:28:50 (INFO): 2017-09-08 15:22:00: Paper trader simulated a SELL 4258.48165615 USDT <= 0.00000000 BTC
2017-09-26 01:28:50 (INFO): 2017-09-08 18:02:00: Paper trader simulated a BUY 0.00000000 USDT => 0.97676481 BTC
2017-09-26 01:28:50 (INFO): 2017-09-08 19:12:00: Paper trader simulated a SELL 4181.44562077 USDT <= 0.00000000 BTC
2017-09-26 01:28:50 (INFO):
2017-09-26 01:28:50 (INFO): (ROUNDTRIP) REPORT:
2017-09-26 01:28:50 (INFO): (ROUNDTRIP) entry date exit date exposed duration P&L profit
2017-09-26 01:28:50 (INFO): (ROUNDTRIP) 2017-09-05 20:47 2017-09-05 22:37 2 hours -32.00 -0.73
2017-09-26 01:28:50 (INFO): (ROUNDTRIP) 2017-09-05 23:02 2017-09-05 23:27 25 minutes -7.69 -0.18
2017-09-26 01:28:50 (INFO): (ROUNDTRIP) 2017-09-06 00:27 2017-09-06 01:57 2 hours -71.58 -1.64
2017-09-26 01:28:50 (INFO): (ROUNDTRIP) 2017-09-06 02:52 2017-09-06 05:57 3 hours -0.53 -0.01
2017-09-26 01:28:50 (INFO): (ROUNDTRIP) 2017-09-06 09:17 2017-09-06 12:22 3 hours -0.01 -0.00
2017-09-26 01:28:50 (INFO): (ROUNDTRIP) 2017-09-06 12:37 2017-09-06 14:42 2 hours -6.66 -0.15
2017-09-26 01:28:50 (INFO): (ROUNDTRIP) 2017-09-06 16:22 2017-09-06 21:12 5 hours 63.78 1.48
2017-09-26 01:28:50 (INFO): (ROUNDTRIP) 2017-09-06 23:52 2017-09-07 02:47 3 hours 5.55 0.13
2017-09-26 01:28:50 (INFO): (ROUNDTRIP) 2017-09-07 05:07 2017-09-07 05:42 35 minutes -11.20 -0.26
2017-09-26 01:28:50 (INFO): (ROUNDTRIP) 2017-09-07 06:42 2017-09-07 08:17 2 hours -26.14 -0.60
2017-09-26 01:28:50 (INFO): (ROUNDTRIP) 2017-09-07 10:37 2017-09-07 17:07 7 hours 44.04 1.01
2017-09-26 01:28:50 (INFO): (ROUNDTRIP) 2017-09-07 17:52 2017-09-07 18:52 an hour -19.31 -0.44
2017-09-26 01:28:50 (INFO): (ROUNDTRIP) 2017-09-07 23:57 2017-09-08 02:07 2 hours -37.92 -0.86
2017-09-26 01:28:50 (INFO): (ROUNDTRIP) 2017-09-08 04:37 2017-09-08 06:52 2 hours -25.84 -0.59
2017-09-26 01:28:50 (INFO): (ROUNDTRIP) 2017-09-08 08:42 2017-09-08 12:32 4 hours 19.73 0.45
2017-09-26 01:28:50 (INFO): (ROUNDTRIP) 2017-09-08 14:42 2017-09-08 15:22 40 minutes 345.93 8.84
2017-09-26 01:28:50 (INFO): (ROUNDTRIP) 2017-09-08 18:02 2017-09-08 19:12 an hour -38.90 -0.92
2017-09-26 01:28:50 (INFO):
2017-09-26 01:28:50 (INFO): (PROFIT REPORT) start time: 2017-09-05 18:02:00
2017-09-26 01:28:50 (INFO): (PROFIT REPORT) end time: 2017-09-08 17:41:00
2017-09-26 01:28:50 (INFO): (PROFIT REPORT) timespan: 3 days
2017-09-26 01:28:50 (INFO): (PROFIT REPORT) sharpe ratio: -1.9024370777755863
2017-09-26 01:28:50 (INFO):
2017-09-26 01:28:50 (INFO): (PROFIT REPORT) start price: 4343.00000002 USDT
2017-09-26 01:28:50 (INFO): (PROFIT REPORT) end price: 4275.00000005 USDT
2017-09-26 01:28:50 (INFO): (PROFIT REPORT) Market: -1.56573797%
2017-09-26 01:28:50 (INFO):
2017-09-26 01:28:50 (INFO): (PROFIT REPORT) amount of trades: 34
2017-09-26 01:28:50 (INFO): (PROFIT REPORT) original simulated balance: 4343.00000002 USDT
2017-09-26 01:28:50 (INFO): (PROFIT REPORT) current simulated balance: 4181.44562077 USDT
2017-09-26 01:28:50 (INFO): (PROFIT REPORT) simulated profit: -161.55437925 USDT (-3.71987979%)
2017-09-26 01:28:50 (INFO): (PROFIT REPORT) simulated yearly profit: -19751.79849588 USDT (-454.79618917%)
Can you email me a zipped history folder + config file? Thanks! gekko@mvr.me
Its only 200KB and gmail doesn't let me send zipped scripts: bt-debug.zip
Thanks for looking into this!
Hi guys !
I'm here with news in debugging...
PerformanceAnalyzer.js, during "logRoundtripPart" assign
date: trade.date,
price: this.price,
Date is correct of trade, price is not correct (and so the "total" percent) and is of different candle !
I set
date: trade.date,
price: trade.price,
and all seems good, but before changing all the chain (other variables depending on this) I want to ask if this is the correct way and why "processCandle" and "processTrade" methods of performanceAnalyzer plugin seems to be "asynch" to each other ?!
For me understanding backtraces is really really important phase (as the CSV export I see in other issue) to developing a good strategy.
As you can see in the current screen, paperTrader request BUY on 7:19 but performanceAnalyzer seems to go on 6:18 candle with different price (the one wrongly reported on RoundTrip).
Overall report (Backtest result) seems not to be affected because calculations doesn't have relationship with "trade" advisor events.
I can't say if this is the correct way, but it looks very consistent now!
One thing that still seems odd is that simulated profit doesn't equal the numbers from P&L column added up. Or should they not?
Hi @bbjay ,
I'waiting @askmike or other confirmation before changing P&L, because "total" is affected from this problem:
this.roundTrip.entry = {
date: trade.date,
//price: this.price,
price: trade.price,
total: this.current.asset * this.price,
"this.price" must be changed in "trade.price" if my doubt is correct.
Hi @xerix32 I've figured out now why my simulated profit didn't add up equal. My settings for papertrader were
[simulationBalance]
asset = 1
currency = 0
in which case the "start balance"(original simulated balance in CLI) and the "entry balance" of the first trade in roundtrips are not equal ("start balance" equals "start price" in this case). If I set
asset = 0
currency = 4000
everything adds up correctly and is consistent now with your modifications.
In hindsight, It makes no sense to start with asset > 0 to test a strategy unless you specifically programmed it to first sell and only then start trading. But even if you did, the current logic does not take the first sell amount as start balance and consequently reports wrong numbers for profit. So I wonder why the option for setting an asset balance even exists. @askmike Is there a use case where setting asset balance is needed? Or wouldn't it be better to remove that option?
@askmike what do you think of @xerix32's modifications?
Will look into it detailed ASAP!
news?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. If you feel this is very a important issue please reach out the maintainer of this project directly via e-mail: gekko at mvr dot me.
I'm submitting a ... [X] probably bug report
Action taken (what you did) Simply one backtest, in Gekko UI current version (Gekko v0.5.7 and Gekko UI v0.2.0.), from kraken data (I don't think source is important) with any strategy (I used CCI in the example).
Expected result (what you hoped would happen)
Consistent results with the chart and trade/advisor values.
Data not consistent... seems wrong price in candles?
I added entryPrice and exitPrice (seems to be current candle price during roundtrip) to roundtripTable.vue to investigating and some log in priceAdvisor and CCI strategy
and values are different with graph values and logs of priceAdvisor/strategy.
Seems that price values differ with real trading one, emitted from advisor and correctly showed in the graph. I used: feeMaker = 0.0 feeTaker = 0.0 feeUsing = 'maker' slippage = 0.00 [simulationBalance] asset = 0 currency = 100
so (with my understanding of the logic) must be no difference with traded "wanted" values.
An image talk more than 1000 words, look at values all not coherent... the more evident is 6th roundtrip that in graph is a loss and in the table is a "green" positive value !??! Even the first value of "Entry balance" not convincing me, why differ from 100 (is the first trade and EUR not change is value, is my "real" currency). But this point probably is my misunderstanding of somethings, the other inconsistency can be a bug.