Help! Need ATR with 8 digits after decimal point

 

I am using the standard ATR function.

I notice that the result is rounded to 4 digits after the decimal point. I need however 8 digits after the decimal point.

I have tried using NormaLizeDouble but I do not seem to manage to get to 8 digits.

Can you help please,
Many thanks,

Sylvano

 

You're probably using Print(NormalizeDouble(doubleVar,8));

Try Print(DoubletoStr(doubleVar, 8));

 

Thanks,

My main problem is the different values I obtain from MQL4 and from MetaStock, using in both the standard ATR function coming with the programs. Look at the images of both with an ATR(10) on both charts with the EUR/USD 1M, there are big differences. They should be the same! First the MT4 chart and below the MetaStock chart. Any idea what is going on here?

 
Are you sure your ATR at metaStock has a 10 bar period? At first glance it seems lower and the screenshot doesn't state what period it's using. Also this.
 
forexCoder:
Are you sure your ATR at metaStock has a 10 bar period? At first glance it seems lower and the screenshot doesn't state what period it's using. Also this.


Found the difference!

MetaStock uses the Wilder averaging method while MT4 uses a normal simple moving average. In the sample ATR coding I replaced this line:

AtrBuffer[i]=iMAOnArray(TempBuffer,Bars,AtrPeriod,0,MODE_SMA,i);

With this line.

AtrBuffer[i]=iMAOnArray(TempBuffer,Bars,AtrPeriod*2-1,0,MODE_EMA,i);

Now I have the same result in both applications.

I was first confused with the display of only 4 digits after the decimal point in MT4, so I tought that was the problem...

Thanks

Reason: