Trend Following
A crossover you can trust — only takes trades the market is willing to fund.
EMA crossover gated by ADX trend strength and volume direction — only fires when the trend is real.
The idea
A moving-average crossover is the oldest signal in technical analysis. It also fails most of the time, because in sideways markets EMAs cross back and forth every few bars. The standard fix is to only take crossovers when a separate trend-strength filter confirms there is something to follow.
Trend Following uses three gates:
- EMA 9 above / below EMA 21 crossover on the current bar
- ADX > 25 (and the dominant directional indicator aligned with the signal)
- Volume trend bullish for buys, bearish for sells (last 20 bars)
Scoring
| Condition | Points |
|---|---|
| EMA crossover | +2 (base) |
| ADX > 25 and +DI > -DI (for buys) or -DI > +DI (for sells) | +2 |
| Volume trend confirms | +1 |
Threshold: 3 for normal signal, 4+ for a ✓✓ strong signal. Minimum 8 bars between signals.
How to use it
- Enable Trend Following in the Scripts panel.
- A single "Trend Buy" near a fresh ADX expansion is usually the start of a multi-day move. Position sizing matters more than precision entry.
- When the script prints on both a higher timeframe (1d) and the timeframe you trade (4h) within a few bars of each other, that is the cleanest setup you will see from this tool.
- Exit logic is your own problem. Common pairings: trailing stop under swing lows, exit on opposite signal, exit on divergence.
Why it works
Trends persist. Once a market is in an established trend, the path of least resistance is continuation. This script ignores all the "maybe a trend is starting" noise and only speaks when there is real evidence of directional flow.
Limits
- It enters after the crossover, so you are giving up the first leg. That's the price of avoiding fakeouts.
- It produces zero signals in ranging markets. If you see weeks with nothing, that is a feature — the market isn't trending.
- Strong macro reversals can invalidate the trend faster than ADX drops below 25, so use stops.