Difference in ATR calculation - page 2

 
1005phillip:
Implemented, see attached.

(they produce identical results, verified, but figured I'd do both for sake of completion since this was easy changes)

Yup. For the record, a lot of venerable indicator calculations use SMMA or EMA because they're simpler and faster than SMA. The SMMA and EMA can be calculated just from the current data value and previous average, whereas SMA also requires the n+1th value (or, for simplicity, the entire set of all n values).

Unless anyone knows differently, I'd suspect that the original ATR calculation uses SMMA not for "smoothing", but because Welles Wilder and/or his readers only had pocket calculators rather than computers, and calculating an SMA was comparatively time-consuming in 1978.
 
1005phillip:


Implemented, see attached.


Implemented, see attached.

(they produce identical results, verified, but figured I'd do both for sake of completion since this was easy changes)


Muchos gracias to all contributors. Problem solved...

oz

 

Excellent, thanks for posting.

One q: Is there a reason why the indicator was not processing the latest value? Suggest to change to for(i=0; i<limit; i++) AtrBuffer[i]=iMAOnArray(TempBuffer,Bars,AtrPeriod,0,MODE_SMMA,i); // this is the smoothed average proposed by jjc

Reason: