DYO: Adaptive Average


This example implements an Adaptive Average which self adjusts to the momentum of the market.  The example implements this formula:

  • Sum = Summation( Abs( Net ), period )
  • Factor = ( Abs( Momentum( Last, period ) ) / Sum * 0.6022 ) + 0.0645
  • AdaptiveAve = ExponentialAverage( Last, Power( Factor, 2 ))

Line A returns the Absolute of the Net.   Line B calculates the Summation of those Nets and stores the result in [2].

Line C returns the Bar Close values.  Line D calculates the 5 period Momentum of the close, and stores in [1].

Line E, F and G implement the formula:  ( Abs( Momentum( Last, period ) ) / Sum * 0.6022 ) + 0.0645

Line H stores the number 2 in Global Variable [2].  This value is the 2nd parameter of the Power function on Line I.

Line I calculates the formula:   Power( Factor, 2 )    The Factor was stored in [1] by Line G.

Line J plots the Exponential Average of the Close using the adaptive parameter stored by Line I in [1].

The AdaptiveAverage template for this example can be downloaded from the Ensign web site using Internet Services.


Last modified 10/27/08 11:51 AM