Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Renko Backtesting Error

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Renko Backtesting Error

    I've noticed that frequently enough I'm getting errors in my backtesting of renko charts that it's making it difficult to get accurate and optimized results. With the strategy set to 'On Bar Close', despite the correct close being at the top of the previous green bar, it exits above the next red bar which gives an inaccurate representation of where the actual close would be. Using publicly available wicked renko chart doesn't solve this nor does using UniRenko. is there any solution to this apparent bug? Thank you.

    #2
    Hello KDTrade,

    Thanks for your post.

    Are you referring to seeing the trade markers occur on the next bar and not on the signal bar?

    If your strategy is set to run in the mode of Calculate.OnBarClose which means that the strategy code executes once at the end of each bar and will perform calculations on completed bars. If your strategy determines to enter an order, the order would be placed on the next bar. In this mode, your strategy will operate the same historically as it does when connected to real-time (or replay) data.

    Using the calculate mode of Calculate.OnPriceChange, or Calculate.OnEachTick, will allow the strategy to be executed intrabar with greater frequency which means your code will be executed on each tick or each change in price. Depending on the bar size and market volatility this can be a significant number of times per bar. You would be working with data that could change and your strategy conditions could change from one tick to the next. Entry orders would be executed intrabar instead of waiting until the next bar.

    In regard to using Renko bars when backtesting a strategy with the Strategy Analyzer, please keep in mind the following.

    Standard Renko bars can be challenging for backtesting as the barstypes use functionality to remove the last bar in the data series and replace the bar with a new Open price. This is done with reversals and cannot be simulated historically, because the bars are already built. Testing may be done with the Playback Connection to fully simulate standard Renko bars with accurate reversals and order fills.

    Some custom Renko bars aim to work around this limitation and often substitute a "fake" open price in the bar. This will result in Standard Order Fill Resolution estimating fill prices using OHLC values that are not 100% reflective of actual price action which can create discrepancies with results. High Order Fill Resolution should be used in cases like this, or the strategy should be written to submit orders to a single tick data series.

    See this help guide page for information about discrepancies between realtime vs backtest (historical): https://ninjatrader.com/support/help...ime_vs_bac.htm

    Let me know if I may assist further.
    Brandon H.NinjaTrader Customer Service

    Comment


      #3
      Hi Brandon, thanks for the quick response.

      I can't use on price change or tick change for the renko bars since that would defeat it's purpose of eliminating noise. I'll look into the suggestions and resources you've given but, with my complete lack of technical knowledge of programming, is it not possible to make the analyzer use the actual close of the bar and not the open of the next bar? My apologies if you've already explained this and I'm not understanding.

      Comment


        #4
        Hello KDTrade,

        Thanks for your note.

        That is correct. If you run your strategy with Calculate.OnBarClose and your strategy determines to enter an order, the trade marker for the order would be placed on the next bar.

        Please let me know if I may further assist.
        Brandon H.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by KDTrade View Post
          Hi Brandon, thanks for the quick response.

          I can't use on price change or tick change for the renko bars since that would defeat it's purpose of eliminating noise. I'll look into the suggestions and resources you've given but, with my complete lack of technical knowledge of programming, is it not possible to make the analyzer use the actual close of the bar and not the open of the next bar? My apologies if you've already explained this and I'm not understanding.
          Change the order fill resolution to High in the strategy. The Analyzer reads a 1 tick offset from the close of the previous bar which will be closer to the true open for the next bar. Renko Bars display a fake open by nature. The actual open is hidden. The Analyzer is using the Historical OCHL values, not what the Renko Bars are displaying on the chart. Playback and the Analyzer calculates the data differently.

          Click image for larger version

Name:	6-27.png
Views:	251
Size:	39.5 KB
ID:	1206736

          .

          Comment


            #6
            Thank you MisterTMF66, that helped immensely.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by fx.practic, 10-15-2013, 12:53 AM
            5 responses
            5,404 views
            0 likes
            Last Post Bidder
            by Bidder
             
            Started by Shai Samuel, 07-02-2022, 02:46 PM
            4 responses
            95 views
            0 likes
            Last Post Bidder
            by Bidder
             
            Started by DJ888, Yesterday, 10:57 PM
            0 responses
            7 views
            0 likes
            Last Post DJ888
            by DJ888
             
            Started by MacDad, 02-25-2024, 11:48 PM
            7 responses
            159 views
            0 likes
            Last Post loganjarosz123  
            Started by Belfortbucks, Yesterday, 09:29 PM
            0 responses
            8 views
            0 likes
            Last Post Belfortbucks  
            Working...
            X