Been discussed allot, try searching with "Once Per Signal".
I use the following function for my clients
bool OrderExisted(int cmd = -1) { for(int k=OrdersHistoryTotal()-1;k>=0;k--) { if((OrderSelect(k,SELECT_BY_POS,MODE_HISTORY))&&(OrderSymbol()==Symbol())&&(OrderMagicNumber()==MagicNumber)) { if((OrderType()==cmd || cmd==-1) && iBarShift(NULL,0,OrderOpenTime(),true)==0 ) return(true); } } return(false); }
so just add the following before you open a trade
if(!OrderExisted(OP_BUY)) OpenBuy...... if(!OrderExisted(OP_SELL)) OpenSell......
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi,
I just learning MQL4. sofar i am implementing by writing code as free of cost to peoples.
i have one problom when i call the custom indicator.
EA place buy/sell as per indicator alert. but when it closes the buy/sell order, its again place buy/sell order when indicator conditions still true.
How to avoid this?
EA should place only one order and should wait for another opposite signal?
Please help me to solve this issues?
Thank You in Advance,
Sheriff