Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Different entries on back testing and live demo

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

    Different entries on back testing and live demo

    Hello,
    To start, I hired someone to automate this strategy for me. Can someone explain to me why this strategy running on the exact same settings and gave a different entry in back testing vs on live data (demo). It's clear that the issue in this example is with the 2-lines cross indicator beneath the chart. That being said if this error can occur with 1 indicator I think it's possible that it can happen with any indicator which makes me believe that I will experience this problem fairly often.
    Click image for larger version

Name:	NT Entry 1.png
Views:	86
Size:	44.1 KB
ID:	1219967Click image for larger version

Name:	NT Entry2.png
Views:	84
Size:	34.1 KB
ID:	1219968
    Attached Files

    #2
    Hello jfobel123,

    You can expect that a strategy running real-time (live brokerage account, live market simulation, Market Replay etc...) may produce different results than the performance results generated during a backtest depending on how much resolution the script is running with. Further, this difference may be more easily seen on certain Bars types (e.g. Point and Figure, Renko) than others due to their inherent nature in bar formation.

    Below is a link to the Help Guide on 'Discrepancies: Real-Time vs Backtest'.
    http://ninjatrader.com/support/helpG...ime_vs_bac.htm

    Adding intra-bar granularity can help with this.

    Intra-bar granularity adds a second data series such as a 1 tick series so that the strategy has finer granularity in the historical data in between the OHLC of the primary series. This allows for more accurate trades by supplying the correct price at the correct time for the order to fill with.

    In NinjaTrader 8, there have been two new enhancements so that programmers do not have to manually add this secondary series and code the script to for high accuracy fills (Order Fill Resolution) and for intra-bar actions (TickReplay).

    Below is a link to a forum post that discusses what causes differences, how to use prints or writing to file to understand what is specifically causing differences in your script, and how to mitigate these differences.
    https://ninjatrader.com/support/foru...mance?t=102504
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      I believe I have intra-bar granularity enabled. I also don't think this explains the cause of my problem. The strategy is set to enter at the close of the candle where a signal is given. Maybe I'm ignorant but I would think that the closing price and therefore the indicator readings would be the same regardless.

      Comment


        #4
        Hello jfobel123,

        To confirm, you are adding a 1 tick-series with AddDataSeries and you are submitting orders using the barsInProgressIndex of that 1 tick series, is this correct?

        Please provide the output written to file of the conditions and data of both runs so that we may compare.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Please bare with me. I'm completely ignorant when it comes to the programming side. Is this what you're looking for? ​
          Click image for larger version

Name:	NT Forum (2).png
Views:	58
Size:	1.5 KB
ID:	1220152

          Comment


            #6
            Hello jfobel123,

            May I confirm you have reviewed the forum post I have linked you in it's entirety and you have reviewed the SampleIntrabarBacktest_NT8 reference sample linked in the forum post on intra-bar granularity?

            This involves adding a 1 tick series with AddDataSeries, placing orders to the barsInProgressIndex of that 1 tick series, and ensuring the logic is updating with the primary barsInProgress.

            As far as writing information to file, you are doing this with StreamWriter?
            Chelsea B.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by burtoninlondon, Today, 12:38 AM
            0 responses
            10 views
            0 likes
            Last Post burtoninlondon  
            Started by AaronKoRn, Yesterday, 09:49 PM
            0 responses
            14 views
            0 likes
            Last Post AaronKoRn  
            Started by carnitron, Yesterday, 08:42 PM
            0 responses
            11 views
            0 likes
            Last Post carnitron  
            Started by strategist007, Yesterday, 07:51 PM
            0 responses
            13 views
            0 likes
            Last Post strategist007  
            Started by StockTrader88, 03-06-2021, 08:58 AM
            44 responses
            3,983 views
            3 likes
            Last Post jhudas88  
            Working...
            X