Price WMA 20 Crossover (Trend)

Buys when price crosses above its 20-bar weighted moving average and sells when it crosses back below.

How It Works

  1. Compute the 20-bar weighted moving average of the close.
  2. Buy when the close crosses above the WMA — price is running ahead of its own recent weighted trend.
  3. Sell when the close crosses back below the WMA.

Worked example. The 20-bar WMA sits at 101 and yesterday's close was 100.5, below it. Today price closes at 101.8 — above the WMA — so buy. Later a 104.1 close falls back under the risen WMA at 104.4 and the trade exits.

The Math Behind The Indicators

Everything runs on closing prices of the traded timeframe: P is a close, Pt today's close, and N counts bars — one bar is one candle of that timeframe, so 20 bars on a 1h chart is 20 hours.

Weighted Moving Average (WMA)
A moving average where newer prices count more: the latest close gets weight N, the one before N − 1, down to weight 1 for the oldest. That makes it react to a turn in price sooner than a plain average.
2026-07-23T00:16:27.847552 image/svg+xml Matplotlib v3.11.1, https://matplotlib.org/
Example: With N = 3 and closes 100, 102, 104 (oldest to newest): (1·100 + 2·102 + 3·104) / (1 + 2 + 3) = 616 / 6 ≈ 102.67 — pulled closer to the latest price than the plain average of 102.

Example Chart

Real Data — Score 32 / 100

Metrics Per Trade

Final Metrics

Scores

Resampled Data — Score 36 / 100

Metrics Per Trade

Final Metrics

Scores