//+------------------------------------------------------------------+
//| Deleting.mq4 |
//| coded by Rolands Auza |
//| www.rm-forex.lv |
//+------------------------------------------------------------------+
#property copyright "coded by Rolands Auza"
#property link " www.rm-forex.lv "
extern string currencyToClose="GBPJPY";
extern string currencyToDelete="GBPJPY";
int init() {return(0);}
int deinit() {return(0);}
int start() {
int cnt, deleteClose1,Close1,Close2;
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
if (OrderSymbol()==currencyToClose)
{
if(OrderType()==OP_BUY)
{
Close1=OrderClose(OrderTicket(),OrderLots(),Bid,0,Blue);
}
if(OrderType()==OP_SELL)
{
Close2=OrderClose(OrderTicket(),OrderLots(),Ask,0,Red);
}
} //if currency to close
} //for
return(0);
}
thanks for your help
Can you modify to only close GBP/JPY once a set negative float dollar amount is hit? and what is the difference between Close and Delete?
Thanks
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Does anybody have the EA to close all open orders of GBPJPY?
I don't want to close all order, just the pair GBPJPY only.
thanks in advance.