Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Managing Stops via IOrder

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

    Managing Stops via IOrder

    Hi All,

    I wanted to add a broker-side catastrophic stop-loss to my automated ninja strategy. Generally, I manage the stops synthetically from my script, but i wanted to get a stop loss order on the broker as well in case i lost connections or something else terrible happened.

    I use MBTrading -- the fact that MB does not support OCO orders has made this very difficult. In order to achieve this, I have used advanced order management within my strategy to place an EnterLongStop() with the broker when the initial order is filled. Up to this part, it works great....


    Here is where it gets tricky -- When my strategy is performing a normal trade exit, it uses "ExitLong()". Unfortunately, if there is a live stopOrder MB Trading will reject the exitLong order. So, I decided to call CancelOrder on the stop order and then immediately call ExitLong(). Unfortunately, when running live it seems that the cancel does not process quickly enough, and the ExitLong() is not accepted by MBTrading (complains I am "trying to go short").

    So, I am wondering -- what would happen if, rather than canceling and using an ExitLong, I just updated the stop value to the current bar Close[0] price? In effect, using the live stopOrder to force an exit? Seems logical, but what would happen if the Close[0] price is already above the current stock price? Will the broker accept a stop price update that triggers an automatic exit, or would they reject that update?

    If that strategy won't work, might you have any ideas how i could get either the original strategy above to work, or any alternative approaches I might be able to use?

    Thanks for your help,
    Brandon

    #2
    Hi bridenour, do you wait for confirmation that your stop orderstate has been changed to OrderState.Cancelled in the IOrder object? Try sending the ExitLong() after this has been confirmed...
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Should I wait for that confirmation and execute ExitLong in the OnExecution method? right now i am canceling and the calling ExitLong in the OnBarUpdate method...

      thanks

      Comment


        #4
        I would suggest moving it to the OnOrderUpdate(), as this is the first one to receive order state changes - please see also this reference sample - http://www.ninjatrader-support2.com/...ead.php?t=7499
        BertrandNinjaTrader Customer Service

        Comment


          #5
          Thanks, i will give that approach a go...

          br

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Vietanhnguyen2hotmailcom, Yesterday, 10:29 AM
          4 responses
          23 views
          0 likes
          Last Post Vietanhnguyen2hotmailcom  
          Started by PhillT, 04-19-2024, 02:16 PM
          4 responses
          36 views
          0 likes
          Last Post PhillT
          by PhillT
           
          Started by ageeholdings, 05-01-2024, 05:22 AM
          5 responses
          37 views
          0 likes
          Last Post ageeholdings  
          Started by reynoldsn, Today, 02:34 PM
          0 responses
          14 views
          0 likes
          Last Post reynoldsn  
          Started by nightstalker, Today, 02:05 PM
          0 responses
          24 views
          0 likes
          Last Post nightstalker  
          Working...
          X