OPEN-SOURCE SCRIPT
Updated TA (Miles) Adaptive Trend

TA (Miles) Adaptive Trend
TA (Miles) Adaptive Trend is a volatility-gated trend follower. At its core is a 21/55 EMA pair, but unlike a plain EMA cross, a flip only counts when the market proves it.
What makes it different
A raw EMA cross is only the starting point. Before it becomes a trend flip it must clear a stack of gates, and that gating is the whole point of the tool:
1. Volume must run above its 20-bar average (default 1.2x).
2. Volatility must be alive (ATR above a minimum percent of price).
3. The EMAs must be spread far enough apart to mean something (default 0.12 percent).
4. Price must hold the new side for a confirmation period (default 2 bars).
5. A cooldown since the last flip must have passed (default 8 bars).
Optional extras: an ADX floor, and a higher-timeframe filter that only allows flips agreeing with the daily 200 MA. The result is a trend follower that sits out the chop that bleeds plain MA-cross systems dry in sideways markets.
What you see
The 21 and 55 EMAs with a fill colored by the confirmed trend state (blue bull, orange bear, gray neutral). Flip triangles mark confirmed changes. Gray X markers show blocked crosses, the raw EMA crosses the anti-chop engine rejected, which is half the value: you see exactly the whipsaws you were spared. A compact info table reports the current trend, EMA spread, chop status, and ATR percent.
Strategy integration
Exports trend state and flip events as data-window plots you can wire into companion strategy scripts.
Best timeframes
Tuned for daily charts; works well on 4H and weekly. On lower timeframes, raise the confirmation bars and cooldown.
Alerts
Two conditions: Bull trend flip and Bear trend flip, confirmed flips only, never raw crosses.
TA (Miles) Adaptive Trend is a volatility-gated trend follower. At its core is a 21/55 EMA pair, but unlike a plain EMA cross, a flip only counts when the market proves it.
What makes it different
A raw EMA cross is only the starting point. Before it becomes a trend flip it must clear a stack of gates, and that gating is the whole point of the tool:
1. Volume must run above its 20-bar average (default 1.2x).
2. Volatility must be alive (ATR above a minimum percent of price).
3. The EMAs must be spread far enough apart to mean something (default 0.12 percent).
4. Price must hold the new side for a confirmation period (default 2 bars).
5. A cooldown since the last flip must have passed (default 8 bars).
Optional extras: an ADX floor, and a higher-timeframe filter that only allows flips agreeing with the daily 200 MA. The result is a trend follower that sits out the chop that bleeds plain MA-cross systems dry in sideways markets.
What you see
The 21 and 55 EMAs with a fill colored by the confirmed trend state (blue bull, orange bear, gray neutral). Flip triangles mark confirmed changes. Gray X markers show blocked crosses, the raw EMA crosses the anti-chop engine rejected, which is half the value: you see exactly the whipsaws you were spared. A compact info table reports the current trend, EMA spread, chop status, and ATR percent.
Strategy integration
Exports trend state and flip events as data-window plots you can wire into companion strategy scripts.
Best timeframes
Tuned for daily charts; works well on 4H and weekly. On lower timeframes, raise the confirmation bars and cooldown.
Alerts
Two conditions: Bull trend flip and Bear trend flip, confirmed flips only, never raw crosses.
Release Notes
Adaptive Trend - V2A major upgrade to the trend engine, focused on cutting whipsaws in choppy
markets and making the settings much simpler.
New in this version:
- Volatility-gated trend detection. The zone now factors in volatility
contraction and sideways structure, and holds back early flips when price is
chopping. Clean EMA crosses always flip the zone.
- Confluence-accelerated flips. A volume climax or a reversal candle can pull a
flip slightly ahead of the EMA cross, so strong moves register a bit sooner.
- One Sensitivity setting. Light, Balanced, or Strict now drives all the filter
thresholds at once, so there are no more individual numbers to tune. Balanced
is the recommended default.
- New Signal Quality controls for blocking flips in chop and requiring a
bearish candle before a short flip.
- Cleaner visuals. Thinner EMA lines, a mint green uptrend zone, flip triangles
without text labels, and blocked markers off by default.
Since the engine changed, the settings panel is streamlined, so take a moment to
review your settings after updating.
Release Notes
Streamlined public features.Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Invite-only indicators for Trading Apologist Patreon members.
Join at patreon.com/TradingApologist, then submit your TradingView username via the form on Patreon or the portal at tradingapologist.com. Access within 1-2h.
Join at patreon.com/TradingApologist, then submit your TradingView username via the form on Patreon or the portal at tradingapologist.com. Access within 1-2h.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Invite-only indicators for Trading Apologist Patreon members.
Join at patreon.com/TradingApologist, then submit your TradingView username via the form on Patreon or the portal at tradingapologist.com. Access within 1-2h.
Join at patreon.com/TradingApologist, then submit your TradingView username via the form on Patreon or the portal at tradingapologist.com. Access within 1-2h.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.