Robson Fernandes: How do i get him to execute only one order?
- You don't want only one order — you want one order per symbol.
- Count your open orders with an OrderSelect loop and don't open a second one.
Symbol Doesn't equal Ordersymbol when another currency is added to another seperate chart . - MQL4 programming forum
MagicNumber: "Magic" Identifier of the Order - MQL4 Articles
Robson Fernandes:
If you mean only one open position in the same time then this is how to do it.How do i get him to execute only one order?
Thank you
&& LastHistoryDirection() >= 0 //Last Historical Trade Direction >= fixed value ) { RefreshRates(); price = Bid; SL = 40.0 * myPoint; //Stop Loss = value in points (relative to price) int total_positions=PositionsTotal();//get total open positions number if(IsTradeAllowed()&&total_positions==0)//check if there is no open positions { ticket = myOrderSend(OP_SELLLIMIT, price + 50.0 * myPoint, TradeSize, ""); if(ticket <= 0) return; } else //not autotrading => only send alert myAlert("order", ""); myOrderModifyRel(ticket, SL, 0); } }
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
Problem solved
There is no error in the code.
Thank you