Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Send stop order within same bar as entry

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

    Send stop order within same bar as entry

    I have a strategy that works on CalculateOnBarClose=true. When it enters an order (mkt) at the next bar open, the strategy waits until the next bar to enter a stop order using ExitLong(Short)Stop(). Is there a simple way of sending a stop order when the entry order is filled? I don't use SetStopLoss() because the value is based on ATR and thus not fixed for the whole strategy.

    -thanks

    #2
    laparker, I think you could still use SetStopLoss with the ATR value in the OnBarUpdate() then for this. Another solution is to move this to the OnExecution() to send the stop once the entry order is filled -

    The OnOrderUpdate() and OnExecution() methods are reserved for experienced programmers. Instead of using Set() methods to submit stop-loss and profit target orders, you can submit and update them manually through the use of IOrder and IExecution objects in the OnOrderUpdate() and OnExecution() methods. The OnOrderUpdate()

    Comment


      #3
      thanks Bertrand - I will experiment with using SetStopLoss(). One question I have, how do I reset this order for the next entry so it doesn't trigger before I have placed the new stop loss?

      -thanks

      Comment


        #4
        Just reset to a default value once flat like shown in the sample I referenced earlier in this thread.

        Comment


          #5
          Bertrand - your example relates to using OnExecution() which would be a big code change and learning curve for me. Using SetStopLoss() looks like I can keep within OnBarUpdate() but I don't see how to cancel the previous SetStopLoss(). Do I include a new SetStopLoss() order when flat and before the new entry order and if so, what do I use as the value?

          -thanks

          Comment


            #6
            You cannot cancel a previous Set() order. All you can do is change the value you will be submitting the stop at prior to your next entry.
            Josh P.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

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