This EA delete all pendind orders

 
 

Using count up style like for(int i=0;i<OrdersTotal(); i++) used in this EA is bug prone. It may leave the last open trade still open. You should use a count down style.

Also, try adding this line OrderSelect(i,SELECT_BY_POS,MODE_TRADES);

instead of the orderselect used in the code.

Otherwise, the code looks like it should delete the pending orders for the symbol assigned.

 
//+------------------------------------------------------------------+

//| Deleting.mq4 |

//| coded by Rolands Auza |

//| www.rm-forex.lv |

//+------------------------------------------------------------------+

#property copyright "coded by Rolands Auza"

#property link "www.rm-forex.lv"

extern string currencyToDelete="GBPJPY";

int init() {return(0);}

int deinit() {return(0);}

int start() {

int cnt, deleteClose1;

for(cnt=0;cnt<OrdersTotal();cnt++)

{

OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);

if (OrderSymbol()==currencyToDelete)

{

if(OrderType()==OP_BUYLIMIT || OrderType()==OP_SELLLIMIT)

{

deleteClose1=OrderDelete(OrderTicket());

if(deleteClose1==true) Comment("Order Deleted");

}

} //if

} //for

return(0);

}
 

nezinu - thanks for your help.

It works now.

 

Hi all

I know that is is an old thread, but it may do what I need.

Is it possible to modify this ea to only run every 3:50 mins?

I am in need of an ea that will close all pending orders only every 3 hrs 50 mins or 10mins before the end of the 4hr candle, as I have another ea that places pending orders every 4 hrs.

Thanks in advance

 

Do you think that I can use another EA to closing all the EA at specific time, then close all pending order, and close all opened orders?

And start the same EA at another time, and repeat it everyday?

I code a simple ea that I use manually, but want to make it start, stop at specific time using another EA, since im not good at it, so another EA do another job.

Thanks.

 

EA to close pending orders at specific time

EA to close ONLY pending orders at a specific time of day.

Easy to mod if you want it to close all orders.

Files:
Reason: