DYO: Predictive Average


This Predictive Average is a clever method for removing some of the lag inherent with moving averages.  The principle involved is to use the spread between two moving averages as an offset from the original moving average.    In this example, the original moving average is the Blue line.   The spread distance between the Blue line and a 2nd moving average (Red line)  is added to the Blue line to create the Predictive Average which is drawn in Pink.

Formula:

ave1=xaverage(price,period);
ave2=xaverage(ave1,period);
spread=(ave1-ave2);
zlag=(ave1+spread);

DYO Implementation:

Line A will be your price selection.  Example uses the bar closes, but could be changed to be a bar's High or Low.  Line B is the Exponential average of the data on Line A.   Line C is the average of the data on Line B.  This is the calculation for ave1 and ave2.   The 1st average is stored in GV[1].  The 2nd average is stored in GV[2].  GV is our notation for a global variable of which there are 255 variables.   Line D calculates the spread between the two averages by subtracting GV[2] from GV[1].   

Line D reads GV[1] for Value and subtracts the Number field which is the contents of GV[2].  This result is written in GV[3] and is the spread value.  Line E reads the average from GV[1], adds the contents of GV[3] which was written by Line D, and plots the sum as a Pink line.  This is the zlag expression.

This example can be downloaded from the Ensign web site using the Internet Services form.  The template for the example is named:    1391-PredictiveAve     Also, the Predictive Average is a built is study available as a selection on the drop down list of Ensign Windows studies.

Template:  1391-PredictiveAve


Last modified 10/21/08 1:06 PM