Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy not executing as I expect

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

    Strategy not executing as I expect



    Hello,
    I'm trying to understand the basics of how the Strategy Builder works and I have a simple strategy that is not executing as I would expect.
    Here is some snapshots of the settings and chart...


    I just wanted to see the strategy take a short position if the low of the current candle is lower than the lows of all 3 previous candles.

    However, you can see from the chart that it initiates a short position when the current price was still higher than the lows of previous candles.
    Any guidance would be appreciated.




    Click image for larger version

Name:	chart.png
Views:	133
Size:	112.3 KB
ID:	1147057 Hello,

    #2
    Hello George21,

    Thanks for your post.

    Regarding the trades on the chart, can you clarify if you observed these trades being made live, or are you looking at trades made on historical bars?

    The reason for asking is that a strategy will perform as if Calculate.OnBarClose was set (and I see you are trying to use Calculate.OnPriceChange)

    Comment


      #3
      Yes, this on historical bars.

      Comment


        #4
        Hello George21,

        Thanks for your reply.

        That would explain the entries then because the 3 bar condition is met on the bar before the entry. This would be expected behavior when looking at historical trades because the strategy is only executed once per bar, at the end of a bar. If a trade is submitted because of the entry conditions being met then the actual entry could only be on the next bar.

        Please try your strategy on live data or with the playback connection using Market reply data. Either of these will show you how your strategy performs with Calculate.OnPriceChange.

        Comment


          #5
          Ok,

          Thanks for the info. So, I guess that the strategy optimizer will not work for any strategy that is designed to execute on price action as it occurs. It can only operate off the data created at the conclusion of each bar.

          Am I understanding correctly?

          Thanks.

          Comment


            #6
            Hello George21,

            Thanks for your reply.

            Correct the default behavior of a strategy (or indicator) on historical data is to execute once per bar.

            It is possible to modify your strategy to provide intrabar actions on historical data.

            To accomplish this goal, you would need to add a 1 tick series to the strategy to improve order fills and you would need to enable "Tick Replay" in the platform and then in the strategy analyzer as well as any chart where you apply the strategy (if you need to see historical fills in the same manner). By adding a 1 tick series you would no longer be able to select High order fills in the analyzer.

            Please note that for the entire period of the backtest, you would need to ensure that you have historical tick data. Using Tick replay and a 1 tick series will add quite a burden o the strategy analyzer so you should expect longer operating times.

            Here is information on enabling Tick Replay: https://ninjatrader.com/support/help...ick_replay.htm

            As an educational reference, please see this post by my colleague Chelsea where he clarifies comparing real-time, historical, and replay performance: https://ninjatrader.com/support/foru...mance?t=102504

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by CarlTrading, 03-31-2026, 09:41 PM
            1 response
            43 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by CarlTrading, 04-01-2026, 02:41 AM
            0 responses
            21 views
            0 likes
            Last Post CarlTrading  
            Started by CaptainJack, 03-31-2026, 11:44 PM
            0 responses
            30 views
            1 like
            Last Post CaptainJack  
            Started by CarlTrading, 03-30-2026, 11:51 AM
            0 responses
            50 views
            0 likes
            Last Post CarlTrading  
            Started by CarlTrading, 03-30-2026, 11:48 AM
            0 responses
            41 views
            0 likes
            Last Post CarlTrading  
            Working...
            X