You need this thread https://www.mql5.com/en/forum/174329 : there is some links like 'one order per chart' for example.
This is what I use.
int buy_orders = 0, sell_orders = 0;
int i;
int cnt = OrdersTotal();
for (i=0;i<cnt;i++)
{
OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
if (OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber)
if (OrderType() == OP_BUY) buy_orders++;
else if (OrderType() == OP_SELL) sell_orders++;
}
I always put this at the start of every ea and then check that there are no existing orders in the logic section.(I borrowed it from someone else!)
if(sell_orders<1 && etc....
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
Hello guys,
I'm newbie in programming MQL4 and I'm facing a major problem while I was creating my first EA... My EA always places multiple orders in one time with the same price. I was wondering if anybody in the forum who are more senior
can guide me how to edit my EA so it can only place an order (buy/sell) at every price condition.
Thanks.
Best Regard