Delete pending orders if an order is open

How to create strategies and indicators
Message
Author
pthomas82
Posts: 60
Joined: Tue Aug 10, 2010 8:39 pm

Delete pending orders if an order is open

#1 Postby pthomas82 » Mon Oct 31, 2011 1:53 am

Hi Guys,

im having problems getting pending orders (i.e buystop / sellstop) to delete when another order (buy / sell) is opened.

Code: Select all

// Delete any pending orders if order is opened
   if (OrdersTotal > 0) then
   begin
   for i:=0  to OrdersTotal do
   begin
   OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
   if (OrderType = tp_SellStop) then DeleteOrder(i);
   if (OrderType = tp_BuyStop) then DeleteOrder(i);
   end;
   end;



in the journal it keeps posting can not find order - so therefore I assume im not selecting the order correctly. Anyone got any hints?

FT Support
Posts: 905
Joined: Sat Jul 11, 2009 10:54 am

#2 Postby FT Support » Mon Oct 31, 2011 10:10 am

Hello,

Please change

Code: Select all

DeleteOrder(i)
with

Code: Select all

DeleteOrder(OrderTicket)


it should help.
Check our other product here:
http://www.forexcopier.com

pthomas82
Posts: 60
Joined: Tue Aug 10, 2010 8:39 pm

#3 Postby pthomas82 » Mon Oct 31, 2011 6:11 pm

Thanks again support!


Return to “FT API”

Who is online

Users browsing this forum: Google [Bot] and 30 guests