Use DoubleToStr( double, Digits) to convert your double to a string and use that with Comment
RaptorUK:
Use DoubleToStr( double, Digits) to convert your double to a string and use that with Comment
Use DoubleToStr( double, Digits) to convert your double to a string and use that with Comment
Thank you Now it is working with 5 digits ouput when I used DoubleToStr
sunil
string PriceToStr(double p){ return( DoubleToStr(p, Digits); } string DeltaToPoints(double p){ return( DoubleToStr(p/Point(), Digits); }Or variations from my code:
//++++ 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(){ OptParameters(); 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()); */ : } string PriceToStr(double p){ string pFrc = DoubleToStr(p, Digits); if(Digits.pips==0) return(pFrc); string pPip = DoubleToStr(p, Digits-1); if (pPip+"0" == pFrc) return(pPip); return(pFrc); } string DeltaToPips(double d){ if (d > 0) string sign = "+"; else sign = ""; double pips = d / pips2dbl; string dPip = sign + DoubleToStr(pips, 0); if(Digits.pips==0) return(dPip); string dFrc = sign + DoubleToStr(pips, Digits.pips); if (dPip+".0" == dFrc) return(dPip); return(dFrc); }

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
friends,
When I use Comment(text) where text is defined as string, I get 8 digits decimal output for H3,L3 and pips value as 1.69451000 on mt4 screen in place of 5 digits decimal 1.69451 I want to exclude the zeros.
Any solution to get output with 5 digits
sunil