Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How does NT8 treat EnterLong and EnterShort issued on same bar close?

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

    How does NT8 treat EnterLong and EnterShort issued on same bar close?

    I have a strategy running on bar close.
    It has multiple entry criteria for long and multiple entry criteria for short.
    I use EnterLong() and EnterShort()

    Suppose on a bar close of the same primary series, conditions for long and for short are valid at the same time, how does ninjatrader decide which order to send to the exchange? or does it do nothing at all?

    PS: using boolean flags, i filtered for a strategy to only trade when both long and short entries are valid on the same bar close. Weirdly I found that it actually does take the trades randomly long or short... sometimes from flat position or it exits and reverses the position.

    Thanks

    #2
    Hello madb123,

    That can cause problems however the second order should be blocked. You should never call multiple order actions in the same event because that will not allow for other items like the position to update. That can also lead to incorrect position depending on the order actions being called at the same time. If your conditions are too similar your logic should prevent this by disabling the other condition if the first condition becomes true.

    Comment


      #3
      ok so confirmed that ninjatrader doesnt handle this situation and it needs to be logic handled.
      How come does it calculate as if there is no conflict in the backtests though.

      Comment


        #4
        Hello madb123,

        It should work similar in realtime as well, that specific scenario the second order should get ignored because the managed approach will not let you submit opposing entry orders. There are other combinations of orders that will result in problems with entering incorrect positions so its best to just avoid doing conflicting logic like that in general. Your logic should always try to be as specific as possible to avoid multiple order submission methods becoming true at once.

        Comment


          #5
          Thanks jesse
          Other situations that the must be handled handled manually by the developer:
          - submitting an order to enter short, when marketposition is long, and at the same time having an ExitLong condition trigger.. it looks fine in backtesting but it incorrectly would exit the Long position two times in live. (and vice versa)
          - in multi instrument strategies, on bar close is not simultaneous for the 2 instruments. so Closes[0][0] and Closes[1][0] in backtesting is actually Closes[0][0] and Closes[1][1] in live. this is huge difference in larger timeframes. can only be fixed by adding tick data series in live trading. This also looks fine in back testing but not in live.

          these 2 plus what we discussed above, are 3 major pitfalls that new users especially those starting out from the strategy builder, can easily fall into and not realise until they start testing live, if at all.

          The help guide page is very thorough and clear, but one would have to deduce the above. There isnt enough or explicit warning anywhere that ninjatrader would not handle these situations in the managed approach.

          My conclusion is to use Booleans always for submitting entry orders and exit orders. just in case there is a possibility of multiple condition sets testing positive on the same bar close.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by NullPointStrategies, Today, 05:17 AM
          0 responses
          21 views
          0 likes
          Last Post NullPointStrategies  
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          120 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          63 views
          0 likes
          Last Post NabilKhattabi  
          Started by Deep42, 03-06-2026, 12:28 AM
          0 responses
          41 views
          0 likes
          Last Post Deep42
          by Deep42
           
          Started by TheRealMorford, 03-05-2026, 06:15 PM
          0 responses
          45 views
          0 likes
          Last Post TheRealMorford  
          Working...
          X