Crossover
A crossover occurs on the bar where one series moves from below another to above it. The reverse — moving from above to below — is a "crossunder". Crossovers are the building blocks of trend-following strategies.
In Pine Script
if ta.crossover(fast, slow)
strategy.entry("Long", strategy.long)
if ta.crossunder(fast, slow)
strategy.close("Long")ta.crossover(a, b) returns true only on the single bar where the cross happens — not while a > b continues to hold.
Signal quality
Crossovers fire late by design. A crossover happens after the relationship has already changed — that latency is the cost you pay for filtering whipsaws. Tighter MAs (e.g. 3/8) react faster but generate more false signals.
Strategies that use Crossover
Related Terms
EMA (Exponential Moving Average)
The exponential moving average weights recent price data more heavily than older bars, making it faster to react than a simple moving average.
SMA (Simple Moving Average)
The simple moving average is the unweighted mean of the last N bars — slower to react than an EMA but with smoother output.
Stop Reading. Start Trading.
PineForge backtests every concept on this site against real market data.
Try It Free