Navigation

    Backtrader Community

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/

    Indicator values drift in live trading, but are okay in backtesting

    Indicators/Strategies/Analyzers
    2
    4
    131
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • J
      jagesso last edited by

      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.

      1 Reply Last reply Reply Quote 1
      • J
        jagesso last edited by

        One other note is we're using CCXT to get exchange values.

        1 Reply Last reply Reply Quote 1
        • J
          jagesso last edited by

          @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?

          Thanks!

          H 1 Reply Last reply Reply Quote 1
          • H
            hoflz5 @jagesso last edited by

            @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.

            1 Reply Last reply Reply Quote 0
            • 1 / 1
            • First post
              Last post
            Copyright © 2016, 2017, 2018, 2019, 2020, 2021 NodeBB Forums | Contributors