PureBytes Links
Trading Reference Links
|
--- In amibroker@xxxx, Tom McDaniel <tmtempe@xxxx> wrote:
> Hi all-
>
> I have attempted to code John Ehlers' Mesa Adaptive Moving Averages
> (MAMA) from the TradeStation code presented in the September 2001
issue
> of Technical Analysis of Stocks and Commodities. The code is
presented
> below. The results appear to be off by perhaps a scaling factor (or
> something(?!).
>
> I also do not claim to be proficient with AFL so there could be some
> glaring errors there.
>
> Any help or suggestions would be appreciated.
>
> Regards,
> -Tom McDaniel
>
> /* MESA Adaptive Moving Averages (MAMA) */
> /* and Following Adaptive Moving Average (FAMA) */
> /* From John Ehlers' article in Sept. 2001 issue of */
> /* Technical Analysis of Stocks and Commodities */
> /* AFL code by T. L. McDaniel, August, 2001 */
>
> FastLimit = 0.5;
> SlowLimit = 0.05;
> Value = ((H+L)/2);
> Period = 0;
> SmoothPeriod = 0;
> Phase = 0;
> MAMA = 0;
> FAMA = 0;
>
> /* Plot OHLC */
> Graph0Style = 128;
> Graph0 = Close;
>
> /* CurrentBar ? */
> Smooth = (4*Value+3*(Ref(Value,-1))+2*(Ref(Value,-2))+Ref(Value,-
3))/10;
>
> Detrender = (0.0962*Smooth + 0.5769*Ref(Smooth,-2) -
> 0.5769*Ref(Smooth,-4) - 0.0962*Ref(Smooth,-6))*(0.075*Ref(Period,-
1) +
> 0.54);
>
Tom,
Until this line the code reads for period the
Period = 0;
(Somewhere the function of period must be defined.
Do not confuse initial values of other languages.)
Since
period=0;
and ref(period,-1) for your code will be =0.
This affects Detrender etc.
Dimitris Tsokakis
|