Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy Position Highlighted 1 bar later than expected

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

    Strategy Position Highlighted 1 bar later than expected

    Hi,

    In the attached picture I have highlighted that 2 strategies applied to my chart should be displayed on the previous bar ( The Open price is of the previous bar) - this seems to only happen on the open positions

    I dont understand how this is happening - does Ninja Team have an idead what could cause this?

    The strategy is updating IntraBar
    Attached Files

    #2
    Hello meftrader,

    Historically and when CalculateOnBarClose = true: Conditions are evaluated at the close of the bar. If true, they are submitted to the next bar. Market orders are filled at the open of the next bar following the condition.

    It may help to add drawing objects to your code. The drawing objects will indicate the bar the condition occurred on, and you will then see an entry on the next bar following. This sample can help with drawing objects:


    Only in real time with CalculateOnBarClose = false, conditions are evaluated with every incoming tick, and orders are submitted immediately when conditions evaluate true.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      RyanM,

      The 1st trade the condition became true on the 8th(the indicator on the lower panel highlights this when it goes to 1 andthen 2 when it is in a trade) and the entry at open should have been on the 9th (at market) - not the 10th...

      If you look at where the arrow is the open value refers to the previous bar(the 9th) and not the 10th (where the strategy indicates it got in)??

      Comment


        #4
        Use drawing objects for additional visual confirmation.

        Print() all values used for entry conditions so you can verify they're what you expect.

        Use TraceOrders output to track output related to strategy order submission.

        Please see this link for help using these debugging tools:
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          RyanM, the close postions are correct the open positions are wrong ( 1 candle out) any ideas?

          Comment


            #6
            There are some ideas in my previous replies. If you are looking for professional level debug help, please consider a NinjaScript consultant. These are NinjaTrader partners who can be hired to write and debug your NinjaScript code:


            If you have a scenario you want me to check into, please provide a simple code snippet and steps needed to see. You can post directly here to the forums or send to support 'at' ninjatrader 'dot' com. I cannot debug your code, unfortunately, but if there is a simple script I can run that shows an issue, I'm happy to look into it.
            Ryan M.NinjaTrader Customer Service

            Comment


              #7
              There is nothing wrong with the code - since the close positions are correct!
              The open position is highlighting the wrong bar (the bar of the 9th instead of the 8th) - Look at the open price of the bar highlighted on the 9th this is the open value for the 8th not the 9th

              Is this a Ninja bug?

              Comment


                #8
                I have noticed that I was using the "Default 24/7 template" and when I switched it to "CME US Index Futures RTH" the open position now moves to the correct bar - why would that correct things ?

                See attached
                Attached Files

                Comment


                  #9
                  Unfortunately there's no way to know what is happening other than using the debugging tools previously indicated. We can't offer guesses without seeing the script you're working with.
                  Ryan M.NinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                  0 responses
                  633 views
                  0 likes
                  Last Post Geovanny Suaza  
                  Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                  0 responses
                  364 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by Mindset, 02-09-2026, 11:44 AM
                  0 responses
                  105 views
                  0 likes
                  Last Post Mindset
                  by Mindset
                   
                  Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                  0 responses
                  567 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by RFrosty, 01-28-2026, 06:49 PM
                  0 responses
                  568 views
                  1 like
                  Last Post RFrosty
                  by RFrosty
                   
                  Working...
                  X