int OrderExist() { for(int openOrder = 0; openOrder < OrdersTotal(); openOrder++) { if(OrderSelect(openOrder, SELECT_BY_POS, MODE_TRADES)) { if(OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber) { if(OrderType() > OP_BUY) { return(1); } else if(OrderType() > OP_SELL) { return(1); } } } } GetLastError(); return(0); }
if(OrderType() > OP_BUY)
if(OrderType() > OP_SELL)
Why are you using > ?
Why are you calling GetLastError()?
Why is your function an int when it is being called as a bool?
if(!OrderExist())
int sellOrder(ENUM_ORDER_TYPE orderType,double stopLoss, double takeProfit)
if(orderType == ORDER_TYPE_SELL)
Why are you using MQL5 enums in MQL4?
return(ticket > 0);
Why are you returning a bool from an integer function?
Why are you using MQL5 enums in MQL4?
Why are you returning a bool from an integer function?
Why are you using > ?
Why are you calling GetLastError()?
Why is your function an int when it is being called as a bool?
It was the last way I tried to make it work. I have tried it as a bool with no luck. I am checking to see if there is a current open order of that type, being greater than 0. I used GetLastError() as a filler basically. Without, it kept saying something was needing to be checked.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
This is the orders to place the sell or buy orders:
This is the code I am trying to use to limit the number orders by type:
Please HELP!! I have been unable to determine the problem.