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 lorem, Today, 09:18 AM
          0 responses
          2 views
          0 likes
          Last Post lorem
          by lorem
           
          Started by hazylizard, Today, 08:38 AM
          4 responses
          11 views
          0 likes
          Last Post hazylizard  
          Started by geddyisodin, Today, 05:20 AM
          2 responses
          19 views
          0 likes
          Last Post geddyisodin  
          Started by Max238, Today, 01:28 AM
          5 responses
          47 views
          0 likes
          Last Post Max238
          by Max238
           
          Started by giulyko00, Yesterday, 12:03 PM
          3 responses
          13 views
          0 likes
          Last Post NinjaTrader_BrandonH  
          Working...
          X