MQL4 - automated forex trading   /  

Forum

Doubt with 5 digit broker

Back to topics list To post a new topic, please log in or register

avatar
251
Alberto_jazz 2011.12.21 11:08 

Hi everybody, I'm using a 5 digit broker. When I use the function

Print(Low[0])

I see 4 digit, for instance 1.3147.

If I write

string value=DoubleToStr(Low[0],5);

Print(value) ;

Low[0] is 1.31467.

My doubt is: when I write Low[0] in an expert, the returned value is 1.3147 or 1.31467?

Thank you!

Easy Way to Publish a Video at MQL4.Community

Easy Way to Publish a Video at MQL4.Community

It is usually easier to show, than to explain. We offer a simple and free way to create a video clip using CamStudio for publishing it in MQL.community forums.


avatar
1675
qjol 2011.12.21 11:50 

of course 1.31467

try something like this & u will have the answer

double PriceTest = 1.31467;

if (Low[0] > PriceTest)
   {
   Alert ("X");
   }
else
   {
   Alert ("Y");
   }

avatar
251
Alberto_jazz 2011.12.21 12:04 

Thank you!

Yes Low[0] is 5 digit :-)


avatar
810
dabbler 2011.12.21 13:29 
Alberto_jazz:

Hi everybody, I'm using a 5 digit broker. When I use the function

I see 4 digit, for instance 1.3147.


From the manual ... (the last line shown is what you need)

void Print( ...)
Prints a message to the experts log. Parameters can be of any type. Amount of passed parameters cannot exceed 64.

Arrays cannot be passed to the Print() function. Arrays should be printed elementwise.

Data of double type are printed with 4 decimal digits after point. To output more precisely, use the DoubleToStr() function.

avatar
4328
WHRoeder 2011.12.21 14:07 
//++++ 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 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
:
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);          }

Back to topics list  

To add comments, please log in or register