[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: XMA - Variable length?



PureBytes Links

Trading Reference Links

Since the XMA doesn't reference the entire length of the dataset, just the
last data element, wouldn't the result be colored by the prior input value?

Does a recalculation occur when the inputs are changed?

Eric Svendsen

{*******************************************************************
Description: Exponential Average
Provided By: Omega Research, Inc. (c) Copyright 1999
********************************************************************}

Inputs: Price(NumericSeries), Length(NumericSimple);
Variables: Factor(0);

If Length + 1 <> 0 Then Begin
   If CurrentBar <= 1 Then Begin
      Factor = 2 / (Length + 1);
      XAverage = Price;
 End
 Else
     XAverage = Factor * Price + (1 - Factor) * XAverage[1];
End;