Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Discrepancies between live indicator and back test indicator

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

    Discrepancies between live indicator and back test indicator

    Hello, I'm running live simulations on my strategies, using the Bollinger indicator as basis for my strategy, and i have notices that the bollinger band values are not the same in live compared to a back test environment, i have downloaded historical data using the Historical data Download tool provided by ninjatrader.


    This is the live image:
    Click image for larger version

Name:	live_image_bollinger.png.jpg
Views:	193
Size:	227.1 KB
ID:	1243225

    this is the back test image:

    Click image for larger version

Name:	backtest_image_bollinger.jpg
Views:	181
Size:	143.4 KB
ID:	1243226

    as you can see the back test is not presenting the correct values, is there something I'm doing wrong in this case? what should i be looking for to fix this issue.

    Best regards.
    Aviram Y

    #2
    Hello Aviram,

    Thanks for your note.

    Please review the help guide document on the differences on real-time vs backtest (historical).
    http://ninjatrader.com/support/helpG...ime_vs_bac.htm

    It is expected that a strategy running real-time (live brokerage account, live market simulation, Playback connection etc...) will produce different results than the performance results generated during a backtest.

    When in historical data, only the Open, High, Low, and Close will be available and there will be no intra-bar data. No intrabar information is known for the script to process when backtesting. All prices and actions come from and occur when the bar closes as this is all the information that is known.​

    You may consider using the Playback connection with Market Replay data to test your script to have the script mimic as if it were running realtime.

    Playback: https://ninjatrader.com/support/help...8/playback.htm

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

    Comment


      #3
      I will check everything out, thanks.
      but just to give you an example of how different the data is, the difference between the upper Bollinger value of the live and back test Bollinger indicators is very large,
      live - 12595.51
      back test - 12906.50

      both Bollinger indicators are Bollinger(2, 30)

      the bar data is very accurate in my case on both live and back test environments.

      Comment


        #4
        Hello Aviram,

        Thanks for your note.

        I have created a simple test strategy in the Strategy Builder that uses the Bollinger(2, 30) indicator and plots it on the chart.

        When backtesting the script in the Strategy Analyzer on an NQ 06-23 5-Minute instrument with a Start Date of 03/27/2023 and End Date of 03/27/2023 I am seeing the Bollinger(2, 30) indicator values in the Chart Display of the Strategy Analyzer match the Bollinger(2, 30) indicator added to a 5-Minute NQ 06-23 Chart window when connected to a live data feed connection.

        See this demonstration video showing that the Bollinger(2, 30) indicator values match between the Bollinger indicator on a live chart and the Bollinger indicator on the Strategy Analyzer Chart Display: https://brandonh-ninjatrader.tinytak...Nl8yMTIxMTc3NQ

        If you test the attached strategy that I used to test this using the exact same settings seen in the demo video, do you see a different behavior occur than seen in the demo video?

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

        Comment


          #5
          Thanks for the reply,
          I have tested the strategy you have provided and got matching results like yours.

          The problem rose when i tried loading a chart with trading hours limitations, causing the Bollinger to present different results (US Equities RTH).

          Is there a way to keep the trading hours limitation, but have the Bollinger indicator use bar data that is not limited by the trading hours?

          Thanks again for the help! much appreciated.

          Aviram Y



          Comment


            #6
            Hello Aviram,

            Thanks for your note.

            The Bollinger indicator will use the Trading Hours that the Data Series is set to use. This means the Bollinger indicator on the live chart window will use the Trading Hours template that is set in the chart's Data Series window.

            When backtesting in the Strategy Analyzer, the Bollinger indicator will use the Trading Hours template set in the Strategy Analyzer backtest settings.

            For the live chart window and Strategy Analyzer Chart Display to match up, the same Trading Hours template should be used for the live chart Data Series and for the Strategy Analyzer settings.

            There are no options available for having the indicator use a different Trading Hours template than the one the data series is set to use.

            Data Series Properties: https://ninjatrader.com/support/help...riesParameters
            Backtest Properties: https://ninjatrader.com/support/help...testProperties

            Please let me know if you have further questions.
            Brandon H.NinjaTrader Customer Service

            Comment


              #7
              Thanks for the reply,

              I see, in that case, would it be possible to create a feature request?

              I know that it's possible to avoid trading hours using code, but haven't tried it yet, the question is how hard is it to implement, can i just use the trading hours templates in my code on the OnBarUpdate method and return when i want to avoid hours outside of the template?

              Or is it more tedious than that? by how much? i would love an example if there is one!

              The feature request will also be helpful for beginner programmers or people who trade manually, and just seems to me like something useful either way.
              If the chart doesn't represent the actual Bollinger value for the last 30 bars in the case i presented, wont it yield different results for traders using a strategy, or even just trading manually?

              Thank you for the continued support
              Aviram Y.
              Last edited by Aviram Y; 03-29-2023, 09:58 AM.

              Comment


                #8
                Hello Aviram,

                Thanks for your notes.

                I have submitted your feature request to the Development team and added your vote to it. This request is being tracked under the number SFT-5834.

                As with all feature requests, interest is tracked before implementation is considered, so we cannot offer an ETA or promise of fulfillment. If implemented, it will be noted in the Release Notes page of the Help Guide.

                Release Notes — https://ninjatrader.com/support/help...ease_notes.htm

                There are no documented or supported methods or functions available to avoid using a Trading Hours template. Trading Hours templates are required to use for a data series.

                You may consider trying to create a custom Trading Hours template and set the Trading Hours property in the Data Series window or Strategy Analyzer window to use your custom Trading Hours template.

                Using the Trading Hours window: https://ninjatrader.com/support/help...indow.htm#HowT oCreateAndEditATradingHourTemplate

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

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by arvidvanstaey, Today, 02:19 PM
                4 responses
                11 views
                0 likes
                Last Post arvidvanstaey  
                Started by samish18, 04-17-2024, 08:57 AM
                16 responses
                60 views
                0 likes
                Last Post samish18  
                Started by jordanq2, Today, 03:10 PM
                2 responses
                9 views
                0 likes
                Last Post jordanq2  
                Started by traderqz, Today, 12:06 AM
                10 responses
                18 views
                0 likes
                Last Post traderqz  
                Started by algospoke, 04-17-2024, 06:40 PM
                5 responses
                47 views
                0 likes
                Last Post NinjaTrader_Jesse  
                Working...
                X