Signals Help Center
  • About Signals
  • Getting Started
    • Tutorials
      • Your First Strategy
        • Create a New Strategy
        • Define Variables
        • Define Setup Method
        • Define Register Actions Method
        • Backtest
        • Deploy Strategy & Start Receiving Signals
    • Dashboard
    • Strategies
      • Strategy Tools and Settings
        • Editor
        • Strategy Detail
        • Backtests
          • Backtest Detail
          • Deploying a Backtest
          • Delete a Backtest
        • Deployments
          • Deployment Detail
          • Edit About, Rules & Alternative Markets
          • Undeploy an Active Deployment
          • (Un)Publish a Deployment
          • (Un)Follow a Deployment
          • Delete a Deployment
        • Followings
          • Following Detail
          • Unfollow a Deployment
          • Delete Record of Following
      • Strategies Marketplace
        • Follow a Strategy
        • Publish Strategy
      • Strategy Details
      • Strategy Metrics
        • Initial Capital
        • Initial Capital (USDT)
        • Strategy Balance
        • Strategy Balance (USDT)
        • Total Performance
        • Total Performance (USDT)
      • Strategy Types
        • Single Market Strategy
        • Multi Market Strategy
    • Account
      • Change Plan
      • Change or Reset Password
      • Change Name, Username, or E-mail
  • Framework Documentation
    • Strategy
      • Methods
        • Setup()
          • DataMarketplace
          • IndicatorsMarketplace
        • RegisterActions()
        • Orders Management
          • CancelOrder()
          • CancelAllPendingOrders()
          • EnterLong()
          • EnterLongLimit()
          • EnterShort()
          • EnterLongStop()
          • EnterShortLimit()
          • ExitLong()
          • EnterShortStop()
          • ExitLongLimit()
          • ExitShort()
          • ExitShortLimit()
          • ExitLongStop()
          • ExitShortStop()
        • Risk Management
          • SetProfitTarget()
          • SetStopLoss()
      • Properties
        • Market
        • Markets
        • PendingOrders
        • Position
        • Time
      • Types
        • IOrder
        • PendingOrder
    • Data
    • Logs
  • Knowledge Base
    • Vocabulary
      • Base currency
      • Deployment
      • Following
      • Quote currency
      • Strategy
    • Technical Indicators
      • Oscillators
        • Average Directional Index (ADX)
        • Momentum Indicator (MOM)
        • Moving Average Convergence Divergence (MACD)
        • Relative Strength Index (RSI)
        • Stochastic RSI (STOCH RSI)
      • Volatility
        • Average True Range (ATR)
        • Bollinger Bands (BB)
      • Trend Analysis
        • Exponential Moving Average (EMA)
        • Simple Moving Average (SMA)
        • Volume-weighted Moving Average (VWMA)
        • Weighted Moving Average (WMA)
      • Volume
        • Accumulation/Distribution Line (ADL)
  • Have a question?
    • FAQ
    • Ask on the forums
    • Contact us
Powered by GitBook
On this page
  • Trading application
  • Calculation
  • Parameters
  • Examples
  1. Knowledge Base
  2. Technical Indicators
  3. Trend Analysis

Weighted Moving Average (WMA)

Moving average indicator very similar to SMA but, as with EMA, it adds more weight to recent data points.

PreviousVolume-weighted Moving Average (VWMA)NextVolume

Last updated 5 years ago

Weighted Moving Average (WMA) is a moving average indicator very similar to SMA but, as with EMA, it adds more weight to recent data points. What sets it apart, however, is that WMA doesn’t include data in its formula that comes from periods older than the selected range.

Trading application

WMA is a line which is shown within the price graph, moving close to the price and eventually intersecting with it. WMA moving above the price indicates a downtrend while WMA moving below the price indicates an uptrend. It can also act as a level of Support/Resistance in uptrends and downtrends, respectively. We can interpret buy/sell signals using 2 different SMA lines (one with a shorter period than the other).

If the shorter WMA (e.g. a 20 day WMA) crosses upwards over the longer WMA (e.g. 50 days), it is a buy signal. The opposite, where a shorter WMA crosses downwards below the longer WMA, indicates a sell signal. Another interpretation arises when intersecting with the price. A shorter WMA crossing the price from the bottom up, while it remains above the longer WMA, is considered a buy signal, in the same way that the shorter WMA crossing the price from above downwards, while the longer WMA is located above the shorter WMA, indicates a sell signal.

Calculation

WMA=(P(1)∗5)+(P(2)∗4)+(P(3)∗3)+(P(4)∗2)+(P(5)∗1)/(5+4+3+2+1)WMA = (P(1) * 5) + (P(2) * 4) + (P(3) * 3) + (P(4) * 2) + (P(5)* 1) / (5 + 4+ 3 + 2 + 1)WMA=(P(1)∗5)+(P(2)∗4)+(P(3)∗3)+(P(4)∗2)+(P(5)∗1)/(5+4+3+2+1)

P(n): Closing price from n period

The above calculation was limited to the 5 most recent periods as a matter of simplicity

Parameters

Input Parameters

Name

Type

Range of value

Description

period

int

<1, int.MaxValue>

Number of bars used in the calculation.

Output Parameters

Indicator ouptuts a single value.

Type

Range of value

double

(0, double.MaxValue)

Examples

// Prints the current value of a 20 period WMA using
// the daily bars close price value.
wma = indicators.WMA(20).OnSeries(dailyBars.Close);
Log(wma.Value.ToString());

// Prints the previous value of WMA.
wma = indicators.WMA(20).Keep(2).OnSeries(dailyBars.Close);
Log(wma.Values[1].ToString());

Complete example

using Signals.DataSeries.Bars;
using Signals.Framework;
using Signals.Indicators.WMA;

public class MyStrategy : SingleMarketStrategy
{
    private Bars dailyBars;
    private WMA wma;

    public override void Setup(DataMarketplace data, IndicatorsMarketplace indicators)
    {
        dailyBars = data.Bars(BarPeriodType.Day, 1).WithOffset(25);
        wma = indicators.WMA(20).Keep(2).OnSeries(dailyBars.Close);
    }

    public override void RegisterActions()
    {
        OnUpdateOf(dailyBars).Do(() =>
        {   
            // Prints the current WMA value
            Log("The current WMA value is " + wma.Value.ToString());

            // Prints the previour WMA value
            Log("The previous WMA value is " + wma.Values[1].ToString());
        });
    }
}