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

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:	106
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)
    Paul H.NinjaTrader Customer Service

    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.

        Paul H.NinjaTrader Customer Service

        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

            Paul H.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by cmtjoancolmenero, Yesterday, 03:58 PM
            11 responses
            39 views
            0 likes
            Last Post cmtjoancolmenero  
            Started by FrazMann, Today, 11:21 AM
            0 responses
            5 views
            0 likes
            Last Post FrazMann  
            Started by geddyisodin, Yesterday, 05:20 AM
            8 responses
            52 views
            0 likes
            Last Post NinjaTrader_Gaby  
            Started by DayTradingDEMON, Today, 09:28 AM
            4 responses
            26 views
            0 likes
            Last Post DayTradingDEMON  
            Started by George21, Today, 10:07 AM
            1 response
            22 views
            0 likes
            Last Post NinjaTrader_ChristopherJ  
            Working...
            X