range text?

 

This seems to print a value of 0 for the first part of the text (High -Low) - any ideas on how to fix it?


               ObjectSetText("signal"+x+"3",DoubleToStr(MathRound(MathAbs(iHigh(Symbol(),PERIOD_D1,0)-iLow(Symbol(),PERIOD_D1,0))),0)+" out of "+
                                            DoubleToStr(MathRound(iATR(Symbol(),PERIOD_D1,14,0)*10000),0)+" pips",
                                            8,"Tahoma",Black);
 
SanMiguel:

This seems to print a value of 0 for the first part of the text (High -Low) - any ideas on how to fix it?

Simplifying slightly, you seem to be taking the difference between today's high and low, rounding it to the nearest integer, and then displaying it as text (with 0 digits after the decimal point, because you've rounded it).


If the high is something like 1.50944 and the low is something like 1.49546, then the difference of iHigh() - iLow() is 0.01398. Rounded to the nearest integer, this is zero. Did you mean to convert the difference to pips before rounding it?

 
jjc:

Simplifying slightly, you seem to be taking the difference between today's high and low, rounding it to the nearest integer, and then displaying it as text (with 0 digits after the decimal point, because you've rounded it).


If the high is something like 1.50944 and the low is something like 1.49546, then the difference of iHigh() - iLow() is 0.01398. Rounded to the nearest integer, this is zero. Did you mean to convert the difference to pips before rounding it?



oops :)