Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Order sequence

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

    Order sequence

    Hello,

    I've coded the following to place discrete orders:
    Code:
    public Order[] MyEnterLongLimit(double LimitPrice, double ProfitTargetTicks, double StopLossTicks)
    
    {
    
    Order[] Orders = {null,null,null};
    
    Orders[0] = ExitLongStopMarket(Close[0] - (StopLossTicks*TickSize),"SL");
    
    Orders[1] = EnterLongLimit(Close[0]);
    
    Orders[2] = ExitLongLimit(Close[0] + (ProfitTargetTicks*TickSize),"PT");
    
    return Orders;
    
    }
    ​
    I expect Orders[1] to be filled first (long entry order), then Orders[2] (profit target), in worst case then Orders[0] (stop loss)

    When profit target is filled, how do I cancel the stop loss? (or vice versa)

    Many Thanks, Caesar.

    #2
    Hello Skechers,

    Thank you for your note.

    Unfortunately, what you have there wouldn't work as you would expect. Exit orders will be ignored until there is a position to be exited, which means you need to first submit your entry order, wait for it to fill, and then submit the exit orders for the position.

    Exit orders will be automatically cancelled when the position they were meant to exit is closed.

    I would take a look at this example from our help guide which goes over submitting exit orders for stops and targets immediately on the entry order filling:



    Please let us know if we may be of further assistance to you.

    Comment


      #3
      Many Thanks Kate!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by NullPointStrategies, Today, 05:17 AM
      0 responses
      44 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      124 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      65 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      42 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      46 views
      0 likes
      Last Post TheRealMorford  
      Working...
      X