Dear Sir,
In some of the EA, I found a different approach to broker 5 and not 5 digits, for example the following code segment:
int digits = MarketInfo ("EURUSD", MODE_DIGITS);
if (digits == 5) {int StopMultd = 10;} else {StopMultd = 1;}
int Slippage = Slip * StopMultd;
My question: why should there different approaches. Someone please help explain to me. Thank you.
This method Tonny always using is failing with brokers that have prefix or suffix on currency Symbols
Then there is no "EURUSD" but it is like "EURUSDiam"
That there are different approaches for this is also because there are different ways to do it right for what you want
This method Tonny always using is failing with brokers that have prefix or suffix on currency Symbols
Then there is no "EURUSD" but it is like "EURUSDiam"
That there are different approaches for this is also because there are different ways to do it right for what you want
Thank you very much...........
In some of the EA, I found a different approach to broker 5 and not 5 digits, for example the following code segment:
int digits = MarketInfo ("EURUSD", MODE_DIGITS);
if (digits == 5) {int StopMultd = 10;} else {StopMultd = 1;}
int Slippage = Slip * StopMultd;
My question: why should there different approaches. Someone please help explain to me. Thank you.
- You don't need the market info, Digits works just fine for the chart the EA is on.
- You adjust slippage, but you also have to adjust TP and SL double SL = OrderOpenPrice() - StopLoss.Pips * StopMultd * Point;
- I just use two variables to eliminate the extra multiplication. I also adjust for Yen (2/3 digits) and metals (0/1) and use a more descriptive, generic variable name.
//++++ These are adjusted for 5 digit brokers. 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 //---- 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()); */
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Dear Sir,
In some of the EA, I found a different approach to broker 5 and not 5 digits, for example the following code segment:
int digits = MarketInfo ("EURUSD", MODE_DIGITS);
if (digits == 5) {int StopMultd = 10;} else {StopMultd = 1;}
int Slippage = Slip * StopMultd;
My question: why should there different approaches. Someone please help explain to me. Thank you.