Indicator values drift in live trading, but are okay in backtesting
We're facing an issue in live trading where the indicator values slowly separate from reality over time.
For example, RSI will start at the correct value, but will slowly start deviating from what it's supposed to be. Several days on, it will be far off from the actual RSI. This happens for all indicators, not just RSI.
This does not happen in backtesting. We can run a backtest, check values for RSI (and others) historically, and find it tracks perfectly.
A few details:
- Data is pulled from Binance.com
- We use two timeframes
- We calculate numerous indicators, some built-in, some custom
I can provide more technical detail as needed, but want to start off with this to see if any obvious misses on our part may jump out.
One other note is we're using CCXT to get exchange values.
@fivo I just read through this massive thread here: https://community.backtrader.com/topic/623/anyone-use-backtrader-to-do-live-trading-on-bitcoin-exchange
And I see you posted a similar issue at the bottom of page 10. I didn't see a solution in the remaining 7 pages, but perhaps I overlooked it.
Does your issue sound similar to what I'm posted and were you able to resolve things?
@jagesso I have also noticed this issue. From what I understand it is partly due to the data retrieved from binance is not the real closed bars. It seems like the bars loaded are only partial.
I'm running indicators on the 4h timeframe, so my solution is to start the script using cron every fourth hour. I still get partially loaded bars, but only the last one so it is quite close to what I'm backtesting.
However, it would be good to be able to backtest partially loaded bars, as this gives the opportunity to make decisions more often than the the timeframe dictates.
I don't understand how to do that though.