FamWue:
You must count down in your for loop NOT up: Loops and Closing or Deleting Orders
Hi guys,
i have to trades open with the same Symbol, Comment, Trading direction and i'm trying to close both but it only works once. The second trade is still open.
Is there anything wrong?
FamWue: i have to trades open with the same Symbol, Comment, Trading direction and i'm trying to close both but it only works once.
- Count down.
- Brokers can change comments, including complete replacement.
- No need for your TD
Your TD int closeTrade(string TD){ : if(OrderType()==OP_BUY && TD=="B") {OrderClose(OrderTicket(),OrderLots(),Bid,3,Red).. if(OrderType()==OP_SELL && TD=="S"){OrderClose(OrderTicket(),OrderLots(),Ask,3,Red)..
Simplify #define OP_ALL -1 int closeTrade(int op=OP_ALL){ : if(op==OP_ALL || OrderType()==op) { OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),3,Red)..
- No need for Bid/Ask on close, use OrderClosePrice. (see above)
- EAs must adjust for 4/5 digit brokers, TP, SL, AND slippage
//++++ These are adjusted for 5 digit brokers. int pips2points; // slippage 3 pips 3=points 30=points double pips2dbl; // Stoploss 15 pips 0.0015 0.00150 int Digits.pips; // DoubleToStr(dbl/pips2dbl, Digits.pips) int init(){ OptInitialization(); if(Digits % 2 == 1){ // DE30=1/JPY=3/EURUSD=5 forum.mql4.com/43064#515262 pips2dbl = Point*10; pips2points = 10; Digits.pips = 1; } else { pips2dbl = Point; pips2points = 1; Digits.pips = 0; } // OrderSend(... Slippage.Pips * pips2points, Bid - StopLossPips * pips2dbl //---- These are adjusted for 5 digit brokers. //{On ECN brokers you must open first and THEN set stops // int ticket = OrderSend(..., 0,0,...) // if(ticket < 0) // Alert("OrderSend failed: ", GetLastError()); // else if(!OrderSelect(ticket, SELECT_BY_TICKET)) // Alert("OrderSelect failed: ", GetLastError()); // else if(!OrderModify(OrderTicket(), OrderOpenPrice(), SL, TP, 0)) // Alert("OrderModify failed: ", GetLastError()); //}
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 guys,
i have to trades open with the same Symbol, Comment, Trading direction and i'm trying to close both but it only works once. The second trade is still open.
Is there anything wrong?