Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Entry at Incorrect Time

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

    Entry at Incorrect Time

    Hi,

    I have been backtesting a recently develoiped strategy when I ran across an unusuall occurence. I had an order entry and yet the Position.MarketPosition was flat. The entry and exit occured on the same bar with the same entry and exit time. I have attached pics. Can anyone please explain to me what happened and how to avoid this in the future? Any help would be greatly appreciated. Thank you very much.
    Attached Files

    #2
    Hi Zeos6,

    There's nothing unexpected here. If the stop loss can be filled on the entry bar, then it will be filled. The only time known for the bar is the bar time stamp so you see entry and exit time the same.

    In order to work around this, you would have to move away from set statements, work with a multiseries script, and submit ExitLongStop, ExitShortStop to a smaller series than the primary. This gives you increased granularity on the sequence from entry > exit.

    You can also run your strategy against market replay data to simulate live trading conditions.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Thank you for the reply Ryan. I understand re the entry and exit on the same bar at the same timestamp. However, why did the Position.MarketPosition remain as flat?

      Comment


        #4
        It is only processed once per bar and at the end of the bar you were flat.
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          Got it. Thank you Ryan.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by charlesugo_1, 05-26-2026, 05:03 PM
          0 responses
          59 views
          0 likes
          Last Post charlesugo_1  
          Started by DannyP96, 05-18-2026, 02:38 PM
          1 response
          143 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by CarlTrading, 05-11-2026, 05:56 AM
          0 responses
          161 views
          0 likes
          Last Post CarlTrading  
          Started by CarlTrading, 05-10-2026, 08:12 PM
          0 responses
          97 views
          0 likes
          Last Post CarlTrading  
          Started by Hwop38, 05-04-2026, 07:02 PM
          0 responses
          276 views
          0 likes
          Last Post Hwop38
          by Hwop38
           
          Working...
          X