Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Suspending a strategy after order open

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

    Suspending a strategy after order open

    Hi guys. I have a strategy that has a 12 tick stop and a 3 tick profit target. Is there a method available in the NT API to ensure that the strategy won't open any more any more orders?

    For example supposed on a bar update, all the conditions are met and an order is open. Then on the next bar update which could be before the first order closed, the same conditions are met. Since an order is opened we don't want to have another one opened until the first one is closed.

    I was thinking of setting a variable outside of OnBarUpdate that tracks whether an order is open, but I'm not sure how to determine if it closed.

    Thanks!

    #2
    Jay, are you looking to check if an order is open or if the strategy is currently managing an open trade so has a market position?

    Comment


      #3
      The goal is to check if the a SPECIFIC strategy has an order open. We don't care if a manual order is open or a different strategy has opened an order.

      The end game is... when the script opens an order from OnBarUpdate() using EnterLong() or EnterShort(), with a SetStopLoss() and a SetProfitTarget() enabled, subsequent calls to OnBarUpdate won't place an order until either the profit target or stop loss are triggered. In other words, place one order at a time.

      For example if the strategy is to trade an SMA(5) crossover with SMA(20), and the OnBarUpdate opens the trade, the next OnBarUpdate call should know that the last call opened a trade and should refrain from placing an order even if the condition is met.

      Comment


        #4
        JayJoshi, if you set Entries Per Direction to 1 when you run your strategy, you won't need any extra code to make sure only one position is open. NinjaTrader will take care of it automatically so there is only one position open at any one time.
        AustinNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        648 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        369 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        108 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        572 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        574 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X