Wealth-Lab Wiki

API ChartStyles Community Components Community Indicators IndexDefinitions Knowledge Base Misc Optimizers Pending Deletion PosSizers Providers Standard Indicators TASC Traders Tips TASCIndicators Tutorial Videos Visualizers
RSS

Navigation


Quick Search
»
Advanced Search »


Syntax

public static WMA Series(DataSeries ds, int period)
public static double Value(int bar, DataSeries ds, int period)
public WMA(DataSeries ds, int period, string description)

Parameter Description

ds The source DataSeries to smooth
period Indicator calculation period

Description

WMA returns a linearly-Weighted Moving Average of the Price Series over the specified Period.

Whereas a SMA calculates a straight average of the data, WMA applies more weight to the data that is more current. The most weight is placed on the most recent data point. Because of the way it's calculated, WMA will follow prices more closely than a corresponding SMA.

Interpretation

  • Use the same rules that we apply to SMA when interpreting WMA. Keep in mind, though, that WMA is generally more sensitive to price movement. This can be a double-edged sword. On the one hand, it can get you into trends a bit earlier than an WMA would. On the other hand, the WMA will probably experience more whipsaws than a corresponding SMA.
  • Use the WMA to determine trend direction, and trade in that direction. When the WMA rises then buy when prices dip near or a bit below the WMA. When the WMA falls then sell when prices rally towards or a bit above the WMA.
  • Moving averages can also indicate support and resistance areas. A rising WMA tends to support the price action and a falling WMA tends to provide resistance to price action. This reinforces the idea of buying when price is near the rising WMA or selling when price is near the falling WMA.
  • All Moving Averages, including the WMA are not designed to get you into a trade at the exact bottom and out again at the exact top. They tend to ensure that you're trading in the general direction of the trend, but with a delay at the entry and exit. The WMA has a shorter delay then the SMA.

Calculation

WMA is a linearly-weighted moving average that is calculated by multiplying the first data point (oldest in time) by 1, the second by 2, the third by 3, etc. The final result is then divided by the sum of the weights. More recent data is thus more heavily weighted, and contributes more to the final WMA value. WMA excludes price data outside the length of the moving average, Period.

WMA = ( P0 * n + P1 * (n-1) + P2 * (n-2) + ... ) / ( n + (n-1) + (n-2) + ... )

where,

P0 = Current Price
P1 = price one bar ago, etc....
n = number of periods


Example

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

namespace WealthLab.Strategies { public class MyStrategy : WealthScript { protected override void Execute() { // This sample system acts on crossovers of 60 and 80 period WMAs

DataSeries WMASlow = WMA.Series( Close, 80 ); DataSeries WMAFast = WMA.Series( Close, 60 ); PlotSeries( PricePane, WMAFast, Color.Blue, LineStyle.Solid, 1 ); PlotSeries( PricePane, WMASlow, Color.Red, WealthLab.LineStyle.Solid, 1 );

for(int bar = 80; bar < Bars.Count; bar++) { if (IsLastPositionActive) { if( CrossUnder( bar, WMAFast, WMASlow ) ) SellAtMarket( bar+1, LastPosition ); else SellAtLimit( bar+1, LastPosition, LastPosition.EntryPrice*1.2 ); } else { if( CrossOver( bar, WMAFast, WMASlow ) ) BuyAtMarket( bar+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.

Used under license from FMR Corp. Copyright 2008 FMR Corp. All rights reserved.


ScrewTurn Wiki. Some of the icons created by FamFamFam.