- MQL4 order count in closed for stop loss
- Need help to identify closed order
- I need an ea that open an order at a certain price if the candle close above/bellow it.
Show us your code then. Please use SRC when posting the code.
Actually I havent a code for that function or do you mean the whole code ? My only problem is that I need a solution to let the Ea do something if the ea close an order. Why do I need that ? I saw that if i would work with the stoploss and the takeprofit, the Ea will sometimes take the stoploss but not the takeprofit and I will solve that problem and let it close ALL trade( includes pending order) if one OR more orders are closed by the ea
Thank you for your quick answer
count the open orders save it somewhere if there is a change close them all
previousOpenOrders = x; currentOpenOrders =y; if (currentOpenOrdess < PreviousOpenOrders) Close Them All
Actually I havent a code for that function or do you mean the whole code ? My only problem is that I need a solution to let the Ea do something if the ea close an order. Why do I need that ? I saw that if i would work with the stoploss and the takeprofit, the Ea will sometimes take the stoploss but not the takeprofit and I will solve that problem and let it close ALL trade( includes pending order) if one OR more orders are closed by the ea
Thank you for your quick answer
Actually what you want already covered so many times. Google it. What qjol put here is a part of what you want to achieve.
What qjol put here is a part of what you want to achieve.
its not a part just the idea
@qjol : That is how I count the buy and the sell orders but how can I set previousOpenOrders = x; currentOpenOrders =y; ?
int BuyTotalMagicOpen() { int OrderCount = 0; for (int l_pos_4 = OrdersTotal() - 1; l_pos_4 >= 0; l_pos_4--) { OrderSelect(l_pos_4, SELECT_BY_POS, MODE_TRADES); if (OrderSymbol() != Symbol() || OrderMagicNumber() != magic) continue; if (OrderSymbol() == Symbol() && OrderMagicNumber() == magic) if (OrderType() == OP_BUY) OrderCount++; } return (OrderCount); } int SellTotalMagicOpen() { int OrderCount = 0; for (int l_pos_4 = OrdersTotal() - 1; l_pos_4 >= 0; l_pos_4--) { OrderSelect(l_pos_4, SELECT_BY_POS, MODE_TRADES); if (OrderSymbol() != Symbol() || OrderMagicNumber() != magic) continue; if (OrderSymbol() == Symbol() && OrderMagicNumber() == magic) if (OrderType() == OP_SELL) OrderCount++; } return (OrderCount); }
@deysmacro :I had use Google but I didnt found something, can you give me an idea what exactly i have to google ?
Put ...
int BuyTotalMagicOpen() { int OrderCount = 0; for (int l_pos_4 = OrdersTotal() - 1; l_pos_4 >= 0; l_pos_4--) { OrderSelect(l_pos_4, SELECT_BY_POS, MODE_TRADES); if (OrderSymbol() != Symbol() || OrderMagicNumber() != magic) continue; if (OrderSymbol() == Symbol() && OrderMagicNumber() == magic) if (OrderType() == OP_BUY) OrderCount++; } return (OrderCount); } int SellTotalMagicOpen() { int OrderCount = 0; for (int l_pos_4 = OrdersTotal() - 1; l_pos_4 >= 0; l_pos_4--) { OrderSelect(l_pos_4, SELECT_BY_POS, MODE_TRADES); if (OrderSymbol() != Symbol() || OrderMagicNumber() != magic) continue; if (OrderSymbol() == Symbol() && OrderMagicNumber() == magic) if (OrderType() == OP_SELL) OrderCount++; } return (OrderCount); } if (currentOpenOrdess < PreviousOpenOrders) {Close-Them-All-code-here} previousOpenOrders = currentOpenOrders;
Something like that.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use