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

Re: [amibroker] Built-in DEMA questions



PureBytes Links

Trading Reference Links







I can’t say as I see any particular need for EMA to have any more lead time associated with it then a DEMA or AMA but that is how it appears to calculate and plot.

The code below is essentially an EMA although it does allow the period or length (vEMALen) to be time variant i.e. it is the same as AMA.

 

If one uses a fixed time period of 10 bars and runs AMA against the imbedded EMA it’s not until about 43 bars that the EMA catches up to the AMA or vice versa depending on your point of view.

 

for (i = 0; i < BarCount; i++)

{

    vEMAFactor[i] = 2 / (vEMALen[i] + 1);

    if (i < 1)

        vEMA[i] = vEMAArray[i];

    else

        vEMA[i] = vEMAFactor[i] * vEMAArray[i] + (1 - vEMAFactor[i]) * vEMA[i - 1];

}

If however one plots and compares the bundled DEMA with ones own DEMAy using AMA instead of EMA where

Factor = 2 / (Length + 1);

DEMAy = 2 * AMA( C, Factor ) - AMA( AMA( C, Factor ), Factor );

Then these will plot the same from bar one on regardless of whether Length is a constant or it&#8217;s time period variant so I suppose one could think of DEMA to be a double adaptive moving average (DAMA).








Yahoo! Groups Sponsor












Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html



Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.