Negative Offset Displaced Moving Average

Why, when using a negative offset DMA, do my results not match the charts?

To answer this, it is important to understand how a negative offset DMA works. As an example, look at the DMA(28,-14). This measure will take current value of the MA(28) and shift it back on the chart by 14 days. Without data from the future, it is very clear that this creates a problem for the most recent 13 days of the measure.

The DMA(N,-P) is computed by taking the MA(N) and effectively "moving it back in time" by P days. Since we don't carry data from the future, it is not possible to compute a N-day average for the remaining P-1 days. For each of these dates, X[i], we compute shorter N-(P-i) day averages; where i=0 ... P-1 (i.e. X[0] is the most recent date and X[P-1] is the point P-1 days ago on the chart.)

To illustrate the above. Notice that the DMA(28,-14) is the same as the MA(14) on the final date of the chart. Additionally, the DMA(28,-14) 8 days ago is the same as a MA(22).

show stocks where close is between 5 and 10
and draw DMA(28,-14)
and draw MA(28)
and draw MA(22)
and draw MA(14)
and add column MA(14)
and add column DMA(28,-14)
and add column MA(22)
and add column DMA(28,-14) 8 days ago
and draw price line at DMA(28,-14) 8 days ago

Additional confusion may arise when using a backtesting feature on StockFetcher (either the date offset phrase or back-testing feature.) When back-testing on StockFetcher your filters are run as-if it were that day. This means the issue mentioned above is taken into account (using future data in back-testing would not provide realistic results.) However, since StockFetcher charts are continuous there will be a discrepancy between the filter value and the chart; however, the filter value will be correct -- for the ending date of the filter.

Still need help? 

*** Disclaimer *** does not endorse or suggest any of the securities which are returned in any of the searches or filters. They are provided purely for informational and research purposes. does not recommend particular securities., Vestyl Software, L.L.C. and involved content providers shall not be liable for any errors or delays in the content, or for any actions taken based on the content.

Copyright 2016 - Vestyl Software L.L.C.Terms of Service | License | Questions or comments? Contact Us
EOD Data sources: DDFPlus & CSI Data Quotes delayed during active market hours. Delay times are at least 15 mins for NASDAQ, 20 mins for NYSE and Amex. Delayed intraday data provided by DDFPlus