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 Mindset, 04-21-2026, 06:46 AM
      0 responses
      44 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      54 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by M4ndoo, 04-19-2026, 05:54 PM
      0 responses
      33 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by cmoran13, 04-16-2026, 01:02 PM
      0 responses
      94 views
      0 likes
      Last Post cmoran13  
      Started by PaulMohn, 04-10-2026, 11:11 AM
      0 responses
      56 views
      0 likes
      Last Post PaulMohn  
      Working...
      X