Trend Flip Risk MapTrend Flip Risk Map - TradingView Publishing Description
Short description:
Trend Flip Risk Map is a Pine v6 regime-transition study that turns selected compression-release flips into structured risk maps. It combines EMA-spread compression, directional pressure, release scoring, structure-based invalidation, retest tracking, and staged R-multiple targets.
Full description:
Trend Flip Risk Map is built for studying one specific market behaviour: a compressed trend regime beginning to release into a new directional phase. It is not intended to mark every moving-average crossover. The crossover is only the initial trigger. A signal is accepted only when the surrounding compression, candle participation, spread slope, and directional pressure conditions support the idea that the market may be leaving a low-separation regime.
The script’s purpose is to turn a possible trend flip into a complete review map. Instead of showing only a BUY or SELL label, it draws the active transition zone, the signal reference, a structure-aware stop, an early flip-failure line, three R-multiple target references, and a short retest window. This helps users review the full shape of the setup: where the regime changed, where the idea begins to weaken, where it is invalidated, and whether the first pullback into the transition zone holds.
Core idea:
A plain EMA crossover can occur in strong expansion, during compression, or inside meaningless chop. Trend Flip Risk Map tries to separate those situations by measuring the relationship between EMA separation and volatility. The script normalises the distance between the fast EMA and slow EMA by ATR. When that normalised spread remains below the selected threshold, the market is treated as compressed. A later flip is more meaningful when it appears after that compression and begins to expand with directional pressure.
How the regime engine works:
1. The fast EMA and slow EMA define the baseline regime.
2. The absolute distance between those EMAs is divided by ATR to create a volatility-normalised spread reading.
3. If the spread is below the compression threshold, the script treats the market as being in a compressed phase.
4. The script counts how many bars the market has spent in that compressed phase.
5. A flip can qualify only when the fast EMA crosses the slow EMA and the selected compression-release conditions are satisfied.
Directional pressure filter:
The script uses a pressure stack to avoid accepting weak flips by default. For bullish releases, price should be above the fast EMA, the fast EMA should be above the slow EMA, the EMA spread slope should be positive, and the signal candle should close in the upper part of its range. For bearish releases, the same checks are inverted. This makes the marker more selective than a basic crossover label.
Candle participation filter:
The signal candle body is measured relative to ATR. This prevents very small candles from being treated the same as larger transition candles. Users can raise or lower the minimum body-to-ATR input depending on whether they want fewer, stronger releases or more exploratory signals.
Release score:
Each accepted flip receives a release score. The score is a relative context score, not a prediction. It combines:
- How long the market spent in compression
- How much the EMA spread is expanding relative to its baseline
- How large the signal candle body is compared with ATR
- How strongly the EMA spread is sloping in the new direction
The score is useful for comparing different releases on the same symbol and timeframe under the same settings. It should not be read as a win probability or performance forecast.
Structure-aware risk map:
When a qualifying BUY or SELL release appears, the script creates a risk map from the signal candle. The Entry reference is the signal candle close. The stop can be based on recent swing structure with an ATR buffer. For bullish releases, the structure stop references recent lows. For bearish releases, it references recent highs. If that structure stop would not make sense relative to the entry, the script falls back to an ATR-based stop.
The Entry-to-Stop distance defines one unit of risk. TP1, TP2, and TP3 are then projected as configurable R-multiples from that distance. This keeps the ladder tied to the actual invalidation distance rather than drawing arbitrary target lines.
Flip-failure line:
The script also draws a separate FLIP FAIL line around the EMA midline with an ATR band. This is not the same as the full stop. It is an earlier regime-quality warning level. The idea is that a new trend regime can start to lose quality before the full structure stop is reached. This line gives users a visual reference for where the transition thesis begins to weaken.
Retest zone:
After a qualifying release, the script creates a temporary retest zone around the EMA midline. If price returns to that zone and holds in the direction of the active flip within the selected watch window, a RETEST HELD label is printed. This helps users study whether a release continues immediately, fails quickly, or first retests the transition area before continuation.
Dashboard:
The dashboard summarises the current state of the model. It shows whether there is an active bull or bear flip, whether the market is currently in compression or expansion, the current EMA spread relative to ATR, the current candle body relative to ATR, and the latest release score. The dashboard is designed to make the script easier to understand without needing to inspect every input or calculation manually.
Visual elements:
- Fast EMA: short-term regime reference
- Slow EMA: longer regime reference
- EMA midline: centre of the transition zone
- Compression box: recent low-separation area before release
- BUY / SELL release label: accepted directional transition after filters
- Release score: relative strength of the accepted transition
- Entry line: signal candle close
- STRUCT SL line: structure-aware invalidation reference
- FLIP FAIL line: earlier regime-quality warning level
- TP1 / TP2 / TP3 lines: R-multiple target references
- Retest zone: temporary zone used to study the first pullback after release
- RETEST HELD label: retest zone held during the watch window
- Dashboard: live regime and filter context
How to use it:
1. Add the indicator to a clean chart.
2. Use a liquid market and a timeframe where trend transitions are readable.
3. Look for releases that occur after visible compression, not random sideways crossover noise.
4. Review the release score in relation to other signals on the same chart.
5. Check whether the Entry, FLIP FAIL, STRUCT SL, and TP levels make sense against nearby structure.
6. Watch whether price retests the transition zone and holds during the retest window.
7. Adjust the compression threshold, required compression bars, EMA lengths, structure lookback, stop buffer, and R-multiple targets for the market being studied.
8. Forward-test settings before using them in any decision process.
Suggested chart setup:
15-minute and 30-minute charts usually provide cleaner examples because they show compression, release, retest, and continuation without excessive low-timeframe noise. One-hour charts can work well for broader swing review. Very small timeframes may produce more signals but can make the chart harder to interpret.
Important limitations:
Trend Flip Risk Map does not forecast price movement. It does not know whether a release will continue or fail. It can still produce poor signals during rotational, illiquid, or news-driven conditions. The release score is only a relative study metric under the selected settings. It is not a probability model, performance estimate, or recommendation.
Educational-use notice:
This script is for educational, research, and chart-planning purposes only. BUY and SELL labels, release scores, Entry levels, Stop Loss levels, flip-failure levels, retest markers, and target levels are visual study references. They are not financial advice, trade recommendations, or guarantees of future performance. Each user is responsible for testing settings on their own symbol, timeframe, and risk model.
Pine Script® 인디케이터






















