
Heiken-Ashi candles smoothed twice — colour flip = signal. A noise filter that turns a chart into trend or no-trend.
Smoothed Heiken Ashi (SHA) is a classic noise filter that converts a regular OHLC chart into two trend states — bullish (green) or bearish (red) — and trades the colour flips.
The pipeline runs in three stages:
Stage 1 — Pre-smooth the input candles. Each of the four OHLC series (open / high / low / close) is independently smoothed with a moving average of length smoothLength (default 10). You can pick the MA type: SMA, EMA or WMA. This step kills high-frequency wicks before the Heiken-Ashi recursion sees them.
Stage 2 — Compute Heiken-Ashi. Classic HA formula on the smoothed series: haClose = (o + h + l + c) / 4, haOpen = (prev haOpen + prev haClose) / 2, haHigh = max(h, haOpen, haClose), haLow = min(l, haOpen, haClose). Heiken-Ashi is already a smoothing technique — running it on already-smoothed input compounds the effect.
Stage 3 — Post-smooth the HA series. Apply the same MA again with length afterSmoothLength (default 10) to haOpen and haClose. The final coloured candle is what triggers the signal.
Signals (colour flip):
haClose > haOpen on the current bar AND was not strictly green on the previous bar (red → green transition).haClose < haOpen on the current bar AND was not strictly red on the previous bar (green → red transition).With double-smoothing the strategy becomes lazy by design: false flips in choppy markets are absorbed by the second MA layer, but real trend reversals also arrive a few bars late. That's the trade-off.
| Name | Default | Range | Description |
|---|---|---|---|
| Pre-Smooth Length | 10 | 1–100 | Moving-average length applied to the raw OHLC series before the Heiken-Ashi step. Higher = smoother input, fewer false flips. |
| Post-Smooth Length | 10 | 1–100 | Moving-average length applied to the HA-open / HA-close series. Higher = lazier colour, fewer signals. |
| MA Type | 0 | 0–2 | Type of moving average used for both smoothing stages. SMA (simple), EMA (exponential, default) or WMA (weighted). |
The pre-baked mini-backtest is refreshed daily — check back soon or start a live run in the Arena.
Run in Arena →// Stage 1: smooth raw OHLC
so = MA(open, smooth_length, ma_type)
sh = MA(high, smooth_length, ma_type)
sl = MA(low, smooth_length, ma_type)
sc = MA(close, smooth_length, ma_type)
// Stage 2: Heiken-Ashi on smoothed candles
for i in 0..n:
haClose[i] = (so[i] + sh[i] + sl[i] + sc[i]) / 4
haOpen[i] = i == 0 ? (so[i] + sc[i]) / 2
: (haOpen[i-1] + haClose[i-1]) / 2
// Stage 3: smooth HA again
finalOpen = MA(haOpen, after_smooth_length, ma_type)
finalClose = MA(haClose, after_smooth_length, ma_type)
// Signals: colour flip
for i in 1..n:
prev_green = finalClose[i-1] > finalOpen[i-1]
prev_red = finalClose[i-1] < finalOpen[i-1]
curr_green = finalClose[i] > finalOpen[i]
curr_red = finalClose[i] < finalOpen[i]
if curr_green and not prev_green and position.is_flat:
BUY
if curr_red and not prev_red and position.is_long:
SELLStart with **EMA** (default) — reacts a bit faster than SMA while still smoothing well. **SMA** is the most lagging but cleanest in pure trends. **WMA** sits between the two and emphasises the most recent bars. Test all three on your asset of choice — the difference can be meaningful on shorter timeframes.
Two reasons: (1) the warmup is `smoothLength + afterSmoothLength + ~10 bars` — on weekly candles that's already ~30 weeks of dead time before the first signal can fire. (2) Double-smoothing absorbs many small flips that simpler strategies would trade. If you want more signals, shorten both lengths or switch to a daily timeframe.
Plain Heiken-Ashi already smooths the chart via its `(o+h+l+c)/4` and recursive open formula. Smoothed HA adds a pre-smoothing step (MA over each raw OHLC series) and a post-smoothing step (MA over the HA-open / HA-close). The result is much lazier — and that's the whole point: false signals in choppy markets get absorbed, real trend changes still come through, just slower.
Two EMAs plus an ATR-based neutral zone — like the commercial Larsson Line, but tunable, transparent, and backtested. Choose your bias.
Two weighted moving averages crossing — recent candles weight more, signals fire faster than SMA-based crosses. Validated on BTC weekly.
The classic trend-following signal — when the 50-day SMA crosses above the 200-day SMA, the trend has flipped bullish.
Check out our Strategy Insights Reports — pre-baked deep-dives with historical results, comparisons, and market context.