Concept
Sine-weighted MA
Sine-weighted MA is a Trend concept. The Library holds 1 implementation — a working definition you can pull into Quant.
Top Sine-weighted MA indicator
The top custom implementation, built on the original standard Sine-weighted MA formula.
1 total
Want to trade Sine-weighted MA? The implementation below is one prompt away from a backtested strategy in Quant.
What is a Sine-weighted MA?
A sine-weighted MA (SWMA) is a windowed FIR moving average whose weights trace half a sine cycle across the lookback window. Each bar's weight is proportional to the sine of its fractional position in the window, so weights are near zero at both the oldest and newest bars and largest mid-window; the weighted sum is then normalized by the sum of the weights.
That half-sine taper makes it a close cousin of the Triangular MA: symmetric, center-weighted, and very smooth, with less ripple than an equal-weighted SMA because the soft window edges suppress the side lobes a rectangular window lets through. The cost is lag, roughly half the window length, since emphasis sits mid-window rather than on recent bars. It smooths better than it turns, which shapes where it is useful.
The design is borrowed straight from signal processing, where the half-sine is a standard window function. A rectangular window, which is what an SMA is, cuts the data off abruptly at both ends, and those hard edges leak high-frequency content through as ripple: small spurious wiggles in the plotted line that look like information but are artifacts of the window shape. Tapering the weights toward zero at the edges suppresses that leakage markedly, which is the entire engineering content of the SWMA: same length, same general lag class as the SMA, visibly calmer output.
In practice the SWMA, ported to the Library by everget and in layered form by blackcat1402, competes on one dimension only: smoothness per unit of complexity. It is not adaptive, not recency-weighted, and makes no attempt at lag reduction, so its natural jobs are the ones where jitter costs more than delay. A slow, steady line gives cleaner slope reads, steadier crossover legs, and calmer pre-smoothed input for downstream calculations, and the honest counsel is the mirror image: wherever early turn detection is the point, this is the wrong family.
How to identify a sine-weighted MA
The line looks like any smooth average; the signature is the weight shape and the behavior that follows from it.
- 1Check the weight formula: weights proportional to the sine of each bar's fractional position across the window, peaking mid-window and tapering to near zero at both edges.
- 2Confirm normalization: the weighted sum is divided by the sum of the weights, so the line stays on price scale.
- 3Compare against an SMA of the same length: the SWMA should track the same path with visibly less bar-to-bar ripple and essentially the same lag.
- 4Compare against recency-weighted averages: an EMA or WMA of similar smoothness will turn earlier; the SWMA's center weighting trades that speed away deliberately.
- 5Watch the slope: the SWMA's derivative flips direction rarely and cleanly, which is exactly the property slope-based regime reads want.
How it's calculated
A moving average whose weights follow the first half-cycle of a sine wave, putting the most emphasis on the middle of the window.
Introduced by Patrick Lafferty in a 1999 Technical Analysis of Stocks and Commodities article.
Because the weights are symmetric rather than front-loaded, lag is close to an SMA of the same length and the weighting resembles a triangular MA; the benefit is smoother noise suppression, not less lag.
Not the same as the fixed 4-bar swma() built into some platforms, which uses weights 1/6, 2/6, 2/6, 1/6.
How traders use it
- As an extra-smooth trend baseline: the line's slope and price's side of it update with little bar-to-bar jitter, at the cost of confirming turns later than recency-weighted averages.
- As a pre-smoothing stage inside other studies, where the tapered window knocks down high-frequency noise before an oscillator or signal calculation runs on the result.
- As the slow leg in moving-average crossover systems where whipsaw suppression matters more than early entry, paired with a faster average for timing.
- As the input to an MA slope filter: because the sine taper suppresses ripple, slope-sign flips are rarer and more decisive, cutting the false regime changes a jumpier average generates.
- In crossover research as a controlled experiment: swapping an SMA slow leg for an SWMA of the same length isolates the effect of window shape on whipsaw, one of the few one-variable comparisons the moving-average zoo allows.
Sine-weighted MA vs other moving averages
SMA: The SMA is a rectangular window: equal weights, hard edges, and the ripple those edges leak through. The SWMA tapers the same window into a half-sine, buying visibly smoother output at the same length and the same general lag. Shape, not speed, is the difference.
Triangular MA: Both are symmetric center-weighted tapers, and their plots are nearly indistinguishable. The triangular ramps weights linearly, the SWMA rounds them sinusoidally, yielding marginally different ripple suppression. Choosing between them is taste; expecting a performance gap is optimism.
EMA: The EMA concentrates weight on the newest bars to cut lag, accepting jitter as the price. The SWMA concentrates weight mid-window to cut jitter, accepting lag. They sit at opposite ends of the same trade-off, which is why they pair well as fast and slow legs.
Concept family
Trend
100 concepts mapped · 100 in the Library
Sine-weighted MA FAQ
Is a sine-weighted moving average faster than an SMA?
No. Its weights peak at the middle of the window, not at the newest bar, so its lag is comparable to a simple average of the same length, roughly half the window. Its advantage is smoothness: the sine taper suppresses the ripple an equal-weighted window lets through. If lower lag is the goal, recency-weighted or zero-lag designs are the right family.
What is the difference between a sine-weighted MA and a triangular MA?
Both are symmetric, center-weighted averages and they plot almost identically in practice. The triangular MA ramps its weights up and down linearly, while the sine-weighted MA follows a half-sine curve that rounds the shoulders of the window; the two differ only marginally in ripple and smoothness, with no decisive winner. Choosing between them is largely taste; neither meaningfully reduces lag versus the other.
Where does the sine window come from?
From spectral analysis. Window functions were developed to control leakage: cutting a signal off abruptly, as a rectangular window does, splatters energy across frequencies and shows up as side lobes, while tapering the edges suppresses them. The half-sine is one of the standard tapers in that toolbox, and the SWMA is simply that window applied to price bars and normalized.
How does the SWMA compare with Hann or Hamming windows?
They are siblings from the same window-function family. The Hann window is the sine window squared, tapering to zero more aggressively; Hamming lifts the edges slightly to optimize a different side-lobe criterion. Applied to a few dozen price bars, the differences are academic: all three produce smooth, center-weighted averages whose plots nearly coincide. The family choice matters in spectral work far more than on charts.
Is the SWMA a good crossover component?
As the slow leg, yes, when the goal is whipsaw suppression: its calm slope means the fast leg does the timing while the SWMA defines the regime with few false flips. As the fast leg it is miscast, since center weighting makes it late by design. As always, the pairing is an empirical question; the SWMA's contribution is that it changes only the window shape, making tests clean.
Why does my SWMA differ slightly across platforms?
Implementations differ in small ways: the exact fractional positions fed to the sine (endpoint handling), whether the window includes or excludes a zero-weight edge bar, and the input source (close versus typical price). Each choice nudges the weights slightly, so lines from different platforms track together but rarely match tick for tick. Check the weight formula when exactness matters.
Turn Sine-weighted MA into a trading strategy.
Take the implementation from this page into Quant, then build on it, backtest it on real data, and keep refining it with AI.
