OTicketEU1 = OpenBuyStopOrder("EURUSD", LotSizeEU, PendingPriceEU, SLEU1 ,TPEU1, Slippage, MagicNumber, 0, "Buy Stop Order"); if(OTicketEU1 > 0)OCOsetEU1 = true;
Always test return codes.
OTicketEU1 = OpenBuyStopOrder("EURUSD", LotSizeEU, PendingPriceEU, SLEU1 ,TPEU1, Slippage, MagicNumber, 0, "Buy Stop Order"); if (OTicketEU1 < 0){ Alert("OrderSend failed: ", GetLastError()); return; } OCOsetEU1 = true;
- EA's must adjust for 4/5 digit brokers, tp, sl, AND slippage
int pips2points; // slippage 3 pips 3=points 30=points double pips2dbl; // Stoploss 15 pips 0.015 0.0150 int Digits.pips; // DoubleToStr(dbl/pips2dbl, Digits.pips) int init(){ if (Digits % 2 == 1){ // DE30=1/JPY=3/EURUSD=5 https://www.mql5.com/en/forum/135345 pips2dbl = Point*10; pips2points = 10; Digits.pips = 1; } else { pips2dbl = Point; pips2points = 1; Digits.pips = 0; } // OrderSend(... Slippage.Pips * pips2points, Bid - StopLossPips * pips2dbl
if(OTicketEU2 > 0)OCOsetEU2 = true;
Where do you ever set OCOsetEU2 to false?OCOsetEU2 = OTicketEU2 > 0;
WHRoeder:
Always test return codes.
- EA's must adjust for 4/5 digit brokers, tp, sl, AND slippage
- Where do you ever set OCOsetEU2 to false?
The OCOsetEU2 is initialized to false before the init() function at the top

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
I have a problem with straddle orders. The Buy stop places orders but the sell stop does sometimes. I have a condition on the straddle orders that it will try to place the orders until both buystop
and sell stop are placed.