🪙
 Get student discount & enjoy best sellers ~$7/week

Wilder's Smoothing Average

Wilder's Smoothing Average (WSA) is a cornerstone indicator in technical analysis, designed to filter out market noise and reveal the underlying trend with clarity. Developed by J. Welles Wilder Jr., the WSA is widely used by traders across asset classes—stocks, forex, commodities, and crypto. This comprehensive guide will demystify the WSA, show you how to calculate and interpret it, and provide real-world code examples in Pine Script, Python, Node.js, C++, and MetaTrader 5. By the end, you'll understand how to harness WSA for smarter, more confident trading decisions.

1. Hook & Introduction

Imagine you're a trader watching the market's every move. Price swings up and down, and it's hard to tell if a trend is real or just noise. Enter Wilder's Smoothing Average (WSA). This indicator, trusted by professionals, helps you cut through the chaos and spot genuine trends. In this article, you'll learn what WSA is, how it works, and how to use it in your trading. We'll cover the math, show you how to code it, and explain how to avoid common mistakes. By the end, you'll be ready to use WSA like a pro.

2. What is Wilder's Smoothing Average?

Wilder's Smoothing Average is a type of moving average that smooths price data to help traders identify trends. Unlike simple or exponential moving averages, WSA uses a unique formula that gives more weight to recent prices while still considering older data. This makes it less sensitive to sudden price spikes and more reliable for trend analysis. WSA was introduced by J. Welles Wilder Jr. in his 1978 book, "New Concepts in Technical Trading Systems." It's the backbone of several popular indicators, including the Relative Strength Index (RSI) and Average True Range (ATR).

  • Type: Trend-following, lagging indicator
  • Inputs: Price (usually close), smoothing period (e.g., 10, 14, 20)
  • Purpose: Filter out noise, confirm trends, set stop-loss and take-profit levels

3. Mathematical Formula & Calculation

The WSA formula is simple yet powerful. It calculates today's smoothed value by combining yesterday's WSA with today's price, then dividing by the chosen period. This creates a moving average that reacts slower than a simple moving average but is less jumpy than an exponential one.

WSA_today = (Previous_WSA * (N - 1) + Price_today) / N

Step-by-step example (N = 5):

  • Day 1: Price = 100, WSA = 100 (first value is just the price)
  • Day 2: Price = 105, WSA = (100 * 4 + 105) / 5 = 101
  • Day 3: Price = 110, WSA = (101 * 4 + 110) / 5 = 102.8

Each term:

  • Previous_WSA: Yesterday’s smoothed value
  • N: Smoothing period (e.g., 10)
  • Price_today: Today’s closing price

4. How Does WSA Work?

WSA is designed to smooth out price data, making it easier to spot real trends. It does this by applying a smoothing algorithm that gives more weight to recent prices but still considers older data. This makes WSA less sensitive to sudden spikes and more reliable for trend analysis. The indicator is especially useful in trending markets, where it helps traders stay in profitable trades longer and avoid getting shaken out by short-term volatility.

  • Lag: WSA lags behind price, which helps filter out noise but can delay signals.
  • Sensitivity: Adjusting the smoothing period changes how quickly WSA reacts to price changes.
  • Best Use: Trending markets, not sideways or choppy conditions.

5. Why is WSA Important?

WSA is important because it helps traders:

  • Spot real trends and avoid false signals
  • Reduce noise from random price moves
  • Set more reliable stop-loss and take-profit levels
  • Confirm major trends before entering or exiting trades

Limitations: Like all moving averages, WSA lags price and can give late signals in fast markets. It’s less effective in choppy, sideways conditions.

6. Interpretation & Trading Signals

Interpreting WSA is straightforward. Here are the main signals:

  • Bullish: Price above WSA, WSA sloping up
  • Bearish: Price below WSA, WSA sloping down
  • Neutral: Price crossing WSA frequently (sideways market)

Common mistakes include using WSA alone for entries, ignoring market context, or using too short a period (which makes it noisy).

7. Real-World Code Examples

Let's see how to implement WSA in different programming languages. These examples will help you integrate WSA into your trading systems, backtesting engines, or charting tools.

// Wilder's Smoothing Average in C++
#include <vector>
std::vector<double> wildersSmoothing(const std::vector<double>& prices, int period) {
    std::vector<double> wsa;
    if (prices.empty()) return wsa;
    wsa.push_back(prices[0]);
    for (size_t i = 1; i < prices.size(); ++i) {
        double prev = wsa.back();
        wsa.push_back((prev * (period - 1) + prices[i]) / period);
    }
    return wsa;
}
# Wilder's Smoothing Average in Python
def wilders_smoothing(prices, period):
    wsa = [prices[0]]
    for price in prices[1:]:
        prev = wsa[-1]
        wsa.append((prev * (period - 1) + price) / period)
    return wsa
# Example usage:
prices = [100, 105, 110, 108, 112]
print(wilders_smoothing(prices, 5))
// Wilder's Smoothing Average in Node.js
function wildersSmoothing(prices, period) {
  if (!prices.length) return [];
  let wsa = [prices[0]];
  for (let i = 1; i < prices.length; i++) {
    let prev = wsa[wsa.length - 1];
    wsa.push((prev * (period - 1) + prices[i]) / period);
  }
  return wsa;
}
// Example usage:
console.log(wildersSmoothing([100, 105, 110, 108, 112], 5));
// Wilder's Smoothing Average in Pine Script v6
//@version=6
indicator("Wilder's Smoothing Average", overlay=true)
length = input(10, title="Length")
wsa = ta.wilders(close, length)
plot(wsa, color=color.blue, title="WSA")
// Wilder's Smoothing Average in MetaTrader 5 (MQL5)
double WildersSmoothing(const double &prices[], int period, double &wsa[]) {
    int size = ArraySize(prices);
    if (size == 0) return 0;
    wsa[0] = prices[0];
    for (int i = 1; i < size; i++) {
        wsa[i] = (wsa[i-1] * (period - 1) + prices[i]) / period;
    }
    return wsa[size-1];
}

8. Customization & Parameter Tuning

WSA can be customized to fit your trading style. The most important parameter is the smoothing period (N). A shorter period makes WSA more sensitive to price changes, while a longer period smooths out more noise but lags further behind price. Experiment with different periods to find what works best for your market and timeframe.

  • Short period (5-10): More responsive, but more false signals
  • Medium period (14-20): Balanced, good for most markets
  • Long period (30+): Very smooth, best for long-term trends

Other customizations include changing the input price (e.g., high, low, typical price) and combining WSA with other indicators for confirmation.

9. Combining WSA With Other Indicators

WSA is powerful on its own, but even better when combined with other indicators. Here are some popular combinations:

  • WSA + RSI: Use WSA to confirm the trend, and RSI to spot overbought/oversold conditions.
  • WSA + MACD: Use WSA for trend direction, and MACD for momentum confirmation.
  • WSA + ATR: Use WSA for trend, and ATR for setting volatility-based stops.

Example strategy: Only take long trades when price is above WSA and RSI is above 50. Only take short trades when price is below WSA and RSI is below 50.

10. Real-World Trading Scenarios

Let's look at how WSA performs in different market conditions:

  • Trending market: WSA helps you stay in the trade as long as the trend lasts. For example, in a strong uptrend, price remains above WSA, and you avoid getting shaken out by minor pullbacks.
  • Sideways market: WSA generates frequent crossovers, which can lead to false signals. It's best to use WSA with a filter, such as a higher timeframe trend or another indicator.
  • Volatile market: WSA smooths out wild price swings, making it easier to spot the underlying trend.

11. Backtesting & Performance

Backtesting is essential to understand how WSA performs in real markets. Here's how you can set up a simple backtest in Python:

// Backtesting logic in C++ would require a full trading engine, omitted for brevity.
# Simple backtest: Buy when price crosses above WSA, sell when below
def backtest(prices, period):
    wsa = wilders_smoothing(prices, period)
    position = 0
    pnl = 0
    for i in range(1, len(prices)):
        if prices[i-1] < wsa[i-1] and prices[i] > wsa[i]:
            position = prices[i]
        elif prices[i-1] > wsa[i-1] and prices[i] < wsa[i] and position:
            pnl += prices[i] - position
            position = 0
    return pnl
# Example usage:
prices = [100, 102, 104, 103, 105, 107, 106, 108]
print(backtest(prices, 3))
// Backtesting logic in Node.js
function backtest(prices, period) {
  let wsa = wildersSmoothing(prices, period);
  let position = null, pnl = 0;
  for (let i = 1; i < prices.length; i++) {
    if (prices[i-1] < wsa[i-1] && prices[i] > wsa[i]) {
      position = prices[i];
    } else if (prices[i-1] > wsa[i-1] && prices[i] < wsa[i] && position !== null) {
      pnl += prices[i] - position;
      position = null;
    }
  }
  return pnl;
}
console.log(backtest([100, 102, 104, 103, 105, 107, 106, 108], 3));
// Backtesting in Pine Script
//@version=6
strategy("WSA Cross Strategy", overlay=true)
length = input(10)
wsa = ta.wilders(close, length)
longCond = ta.crossover(close, wsa)
shortCond = ta.crossunder(close, wsa)
strategy.entry("Long", strategy.long, when=longCond)
strategy.close("Long", when=shortCond)
// Backtesting in MetaTrader 5 would require a full EA, omitted for brevity.

Sample results:

  • Win rate: 54% (example, varies by market)
  • Risk-reward: 1.5:1
  • Drawdown: 8%
  • Best in: Trending markets
  • Worst in: Sideways, choppy markets

12. Advanced Variations

Advanced traders and institutions often tweak WSA for specific needs:

  • Double smoothing: Apply WSA twice for extra smoothness.
  • Adaptive periods: Change the smoothing period based on volatility (e.g., ATR-based).
  • Volume-weighted WSA: Give more weight to periods with higher volume.
  • Use cases: Scalping (short period), swing trading (medium period), options (combine with Greeks).

Institutions may use WSA as part of larger algorithmic systems, combining it with machine learning or order flow analysis for high-probability trades.

13. Common Pitfalls & Myths

  • Myth: WSA predicts reversals. Fact: It's a lagging indicator, best for confirming trends.
  • Pitfall: Using WSA alone for entries. Solution: Always confirm with other indicators or price action.
  • Pitfall: Confusing WSA with EMA or SMA. Fact: WSA is mathematically different and reacts differently to price changes.
  • Pitfall: Over-optimizing the period. Solution: Test across multiple markets and timeframes.
  • Pitfall: Ignoring market context. Solution: Use WSA in trending markets, avoid in choppy conditions.

14. Conclusion & Summary

Wilder's Smoothing Average is a robust, versatile tool for trend analysis. Its unique formula smooths out price data, helping traders spot real trends and avoid false signals. WSA is easy to implement in any programming language and can be customized for any trading style. Its strengths are best realized in trending markets and when combined with other indicators like RSI, MACD, or ATR. Remember, no indicator is perfect—use WSA as part of a broader trading plan, and always manage your risk. For more on trend indicators, check out our guides on EMA and RSI.

Glossary

  • WSA: Wilder’s Smoothing Average
  • EMA: Exponential Moving Average
  • SMA: Simple Moving Average
  • ATR: Average True Range
  • RSI: Relative Strength Index

Comparison Table: WSA vs. EMA vs. SMA

Indicator Type Lag Sensitivity Best Use
WSA Trend-following Medium Medium Filtering noise, trend confirmation
EMA Trend-following Low High Fast trend changes
SMA Trend-following High Low Long-term trend smoothing

Frequently Asked Questions about Wilder's Smoothing Average

What is Wilder's Smoothing Average?

Wilder's Smoothing Average is a technical indicator that uses two exponential moving averages to smooth out price fluctuations.

How does the WSA indicator work?

The WSA plots the midpoint between two exponential moving averages, providing a smoother and more accurate representation of the trend.

What types of WSA indicators are available?

There are several types of WSA indicators, including the 10-period WSA, 20-period WSA, and 50-period WSA.

How can I use Wilder's Smoothing Average in my trading strategy?

The WSA indicator can be used to identify trends, confirm major trends, set price targets, and stop-loss levels.

Is the WSA indicator reliable?

Like any technical indicator, the WSA has its strengths and weaknesses. It is essential to use it in conjunction with other forms of analysis and risk management techniques.



How to post a request?

Posting a request is easy. Get Matched with experts within 5 minutes

  • 1:1 Live Session: $60/hour
  • MVP Development / Code Reviews: $200 budget
  • Bot Development: $400 per bot
  • Portfolio Optimization: $300 per portfolio
  • Custom Trading Strategy: $99 per strategy
  • Custom AI Agents: Starting at $100 per agent
Professional Services: Trading Debugging $60/hr, MVP Development $200, AI Trading Bot $400, Portfolio Optimization $300, Trading Strategy $99, Custom AI Agent $100. Contact for expert help.
⭐⭐⭐ 500+ Clients Helped | 💯 100% Satisfaction Rate


Was this content helpful?

Help us improve this article