close the orders when a new come

 
Hi can some body tell me how to close the orders when a new comes means when a buy comes it close all orders related to sell and when sell comes closes all the order related to buy?
 
ankitkalindi:
Hi can some body tell me how to close the orders when a new comes means when a buy comes it close all orders related to sell and when sell comes closes all the order related to buy?
You use OrderClose()
 

sir thanks for your reply but sir i already using orderclose function .sir i have written this code but the problem it is closing only one order correspond to the new order but i have close all sell orders when ever new order comes of buy.

 

You will shortly be supplied with some links re counting down when using OrderTotal()

I don't have the links, so am unable to save someone else the bother

for(int i=OrdersTotal()-1;i>=0;i--)
 
ankitkalindi:

sir thanks for your reply but sir i already using orderclose function .sir i have written this code but the problem it is closing only one order correspond to the new order but i have close all sell orders when ever new order comes of buy.

Please edit your post . . . please use the SRC button to post code: How to use the SRC button.
 
GumRai:

You will shortly be supplied with some links re counting down when using OrderTotal()

I don't have the links, so am unable to save someone else the bother


Loops and Closing or Deleting Orders
 
Thanks its working now.
Reason: