Log in to see Cloud of Tags

Wealth-Lab Wiki

Shifted Moving Average

RSS

ShiftedMA: Indicator Documentation

Syntax

DataSeries ShiftedMA( DataSeries ds, int period, int delay, ChoiceOfMA option );

Parameter Description

ds Data series used to produce the moving average calculation
period Period to average the data series
delay Period to offset the moving average to the right
option Select between the moving average types: SMA, EMA, WMA or SMMA (smoothed MA)

Description

The Shifted Moving Average (ShiftedMA) is not a cool new moving average. It is nothing but a typical moving average (that can be SMA, EMA or WMA) delayed by the user specified offset. The purpose of this indicator is to facilitate the use of delays in rule-based Strategies. In code-based Strategies, this is simply a matter of using the DataSeries offset (>> or <<, see DataSeries in the QuickRef).

Example

This example illustrates how to use the ShiftedMA indicator, comparing an EMA with its delayed version:

using System; using System.Collections.Generic; using System.Text; using System.Drawing; using WealthLab; using WealthLab.Indicators; using Community.Indicators;

namespace WealthLab.Strategies { public class shiftedMA_demo : WealthScript { protected override void Execute() { ShiftedMA delayedEMA = ShiftedMA.Series( Close, 20, 2, ChoiceOfMA.EMA ); DataSeries ema = EMAModern.Series( Close, 20 ); PlotSeries( PricePane, ema, Color.Red, LineStyle.Solid, 2 ); PlotSeries( PricePane, delayedEMA, Color.Blue, LineStyle.Solid, 1 ); } } }

Important Disclaimer: The information provided by Wealth-Lab is strictly for informational purposes and is not to be construed as advice or solicitation to buy or sell any security.  The owner of Wealth-Lab.com assumes no liability resulting from the use of the material contained herein for investment purposes. By using this web site, you agree to the terms of this disclaimer and our Terms of Use.


ScrewTurn Wiki. Some of the icons created by FamFamFam.