Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

One candle difference between Strategy and Indicator

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

    One candle difference between Strategy and Indicator

    I have discovered an inconsistency between the strategy analyzer and my indicator. If I make the measurements directly over the indicator, then I have the right entry point (IsFalling(buy short) or IsRising(buy long)). If I do the whole thing within a strategy, then the trade is always delayed for one candle (see the attached Screenshot)...

    Where does this difference come from and how can i set the trade in the strategy to the same candle as the indicator is drawing an arrow down/up?

    PS: I have already excluded Calculate.OnBarClose.
    Attached Files

    #2
    Hello Sweet&Sour,

    When using Strategy Analyzer, backtesting the strategy will run exactly the same as if CalculateOnBarClose is set to true. This is true whenever the strategy runs on historical type data. The reason for this is because the only info known historically is the Bar open, High, Low and close and not all of the ticks that make up the bar.

    You can also get extremely misleading results if you are using a bar that changes shape such as renko bar type as the finished bar does not show the true range of price movement.

    You may want to try testing on live data or Market replay data to get a better sense of your strategy performance.

    Please let us know if we can be of further assistance.
    Alan P.NinjaTrader Customer Service

    Comment


      #3
      Hi Alan,

      Thanks for the explanation. I'm using a 1500 Tick chart. Using real time data or playback data, trades "would be" placed as expected. The indicator itself also uses the Calculate.OnBarClose property.

      In my case it seems that the NT strategy back testing could be extremely misleading. In a simple case like an MA which is falling/rising, i would expect that as soon as a candle has been completed and the MA direction has changed, a trade should be placed at the opening right on the next bar, not one bar after.

      Fortunately, I have programmed my own back testing calculations (by trade, daily and historical) directly into my indicator set, so i'm able to see visually in the chart, how the strategy would exactly perform. During a six months NT back testing (in comparison to an indicator back testing), i just noticed that I've lost a huge amount of profit (in a middle four-digit range), just because of a single bar of delay per trade :-(
      Last edited by Sweet&Sour; 09-06-2017, 10:24 AM.

      Comment


        #4
        Hello Sweet&Sour,

        To resolve this you could add a secondary series of type tick. Please see the following link,



        Please let us know if you need further assistance.
        Alan P.NinjaTrader Customer Service

        Comment


          #5
          Looks like setting the barsInProgressIndex qualifier in the EnterLong method could solve this "inconvenience"

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          88 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          48 views
          0 likes
          Last Post NabilKhattabi  
          Started by Deep42, 03-06-2026, 12:28 AM
          0 responses
          30 views
          0 likes
          Last Post Deep42
          by Deep42
           
          Started by TheRealMorford, 03-05-2026, 06:15 PM
          0 responses
          34 views
          0 likes
          Last Post TheRealMorford  
          Started by Mindset, 02-28-2026, 06:16 AM
          0 responses
          68 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Working...
          X