Phase Exhaustion Reversal [BullByte]Phase Exhaustion Reversal (PXR) is an intraday reversal engine that measures one specific market phenomenon: the moment a short-horizon directional burst exhausts itself against a broader structural gradient. It is built on a single mathematical primitive - directional efficiency - applied at two horizons, and turns the gap between them into an exhaustion-detection framework.
This is not a mashup of existing indicators. The entire engine is derived from one calculation family: how cleanly price travels over a window. The regime classifier, the signal trigger, the risk engine, and the dashboard are all layers of that single concept rather than separate components.
---
Why This Indicator Exists
Most reversal tools fire on oscillator extremes or candlestick patterns. They answer the question "is price stretched?" but not "has the energy actually run out? " A market can stay stretched for a long time before reverting. PXR was built to answer a more precise question: when has a short-horizon momentum burst exhausted its energy against the prevailing structural direction? That moment - the exhaustion-and-recede - is what PXR isolates.
The phenomenon being studied can be observed on historical price data.
When price moves with high short-horizon efficiency in a direction that contradicts the medium-horizon efficiency gradient, that move is consuming energy faster than structure supports. Such bursts can appear to exhaust and then realign with the broader gradient on historical data. PXR visualizes that potential realignment as an observation worth studying.
---
Why a Trader Might Use It
Intraday traders on 5-minute and 15-minute charts frequently face counter-trend bursts that look like reversals but are actually just temporary dislocations. PXR offers a structured way to read those bursts: it waits for the burst to peak, confirms the peak has begun receding, and only then marks the realignment as armed. The next-bar open execution model means the entry price on the chart matches what a real-time observer could actually have achieved.
PXR is designed for traders who want a single coherent reading of market state - regime, bias, setup progression, and signal - rather than juggling multiple unrelated indicators.
---
The Concept
Imagine price as a hiker walking through terrain. Two things can be measured about that hiker over any window of time:
One - how far they ended up from where they started. This is transport.
Two - how much total ground they covered while getting there. This is agitation.
The ratio of transport to agitation is efficiency. If a hiker walked 100 meters in a straight line, transport equals agitation, and efficiency is 1.0 - perfectly directional. If a hiker zigzagged 500 meters total but ended up only 100 meters away, efficiency is 0.2 - most of the energy was wasted on the zigzag.
PXR computes this efficiency at two horizons simultaneously. The short horizon (around 35 minutes of bars, regardless of timeframe, by default) captures reactive bursts. The medium horizon (around 2 hours of bars by default) captures the structural gradient - the broader direction price is actually flowing in.
When the short-horizon efficiency spikes far from the medium-horizon efficiency, the two have dislocated. PXR normalizes this dislocation into a value called the Phase Gap. When the Phase Gap stretches to an extreme and then begins to recede, the short-horizon burst is exhausting. If the medium-horizon gradient points the opposite direction at that moment, PXR marks a realignment signal - the observed behavior is a possible realignment with the structural gradient.
---
What Makes This Different From a Standard Momentum Tool
Three architectural choices separate PXR from typical oscillator-based reversal tools.
First, the use of two-horizon efficiency phase-gap normalization. The raw difference between two efficiency readings is rescaled by its own rolling maximum so the threshold stays meaningful across all volatility regimes. A 0.6 reading means the same thing on a quiet day as on a volatile one.
Second, regime-conditional adaptive thresholds. The signal threshold is not a fixed constant. It adapts based on whether the market is currently classified as Extended (clean trend), Compressed (range), Transitioning (regime shifting), or Neutral. Each regime gets a different sensitivity, and each timeframe gets its own scaling on top of that.
Third, an exhaustion-and-recede state machine gated by structural gradient sign. The signal does not fire when the Phase Gap simply crosses a level. It fires only when the gap has first reached a qualified peak and then receded by a meaningful fraction of that peak - confirming exhaustion has begun - and only when that exhaustion direction opposes the sign of the medium-horizon efficiency. This is a directional fade of short-horizon energy against the prevailing structural gradient.
---
Mathematical Foundation
The script is built from three primitive calculations. All other logic flows from these.
Transport over n bars equals close minus close n bars ago. This measures net displacement.
Agitation over n bars equals the sum of absolute bar-to-bar price changes across that window. This measures total path length.
Efficiency over n bars equals transport divided by agitation. This produces a signed value bounded between -1 and +1. Positive values indicate net upward directional purity, negative values indicate net downward directional purity, and values near zero indicate chop.
The Phase Gap is the short-horizon efficiency minus the medium-horizon efficiency, divided by the rolling maximum of the absolute raw gap. This normalization keeps the Phase Gap roughly within plus or minus one regardless of market conditions.
A realignment signal fires when the Phase Gap has peaked beyond a regime-adjusted threshold and then receded by a meaningful fraction of that peak, AND the sign of the medium-horizon efficiency points in the direction opposite to the burst that just exhausted.
This calculation family is conceptually related to efficiency-ratio style measurements. PXR's originality lies in the multi-horizon phase-gap construction, the regime-adaptive thresholding, and the exhaustion-and-recede state machine.
---
Recommended Timeframes and Markets
PXR is built for intraday operation. The timeframe-adaptive logic is tuned for 1-minute through 15-minute charts. The default Auto-Scale setting recalibrates the horizons so the same physical time window of analysis is used regardless of timeframe.
The phenomenon PXR studies appears most cleanly on liquid intraday instruments. Crypto majors such as BTCUSDT and ETHUSDT on 5-minute and 15-minute charts work well because crypto exhibits meaningful path tortuosity - the agitation-to-transport ratio carries real information. Index futures such as NQ and ES on 5-minute and 15-minute charts also work, though session boundaries can affect the normalization window on overnight sessions.
PXR is built for intraday use. Higher timeframes such as 1H, 4H, or daily may behave differently because the regime thresholds and recede fractions are tuned for intraday energy cycles rather than multi-day structural shifts.
---
Chart Examples
The two examples below are illustrative historical signals chosen to show the engine's mechanics and visual elements. They are not representative of typical or expected outcomes. Many signals fail and reach the INVALIDATION level instead. These examples are educational only.
1. Example - Bull Realignment on BTCUSDT 15m
The annotated chart shows a complete PXR realignment cycle.
Price experienced a sharp short-horizon bearish burst from roughly 77,650 down to 76,150. During this drop, the medium-horizon efficiency gradient remained bullish - the slower 24-bar window still carried the structural upward bias from earlier hours. The yellow diagonal line traces this bullish medium-horizon gradient that the bearish burst was working against.
At the bottom of the move, the Phase Gap reached its negative peak . The bearish burst's energy was fully spent. The yellow rectangle marks the exhaustion zone where two indecision candles stalled the fall.
Beginning shortly after, the Phase Gap began receding from its negative peak. Once it had receded by the configured fraction, the exhaustion-and-recede condition was satisfied. The medium-horizon efficiency was still positive, so the structural gradient gate qualified the direction. The state machine flipped upward and the signal armed on the close of the trigger bar.
On the next bar, the entry executed at the open at 76,410. The four rails drew automatically - INVALIDATION at 75,982, TARGET 1 at 76,923, TARGET 2 at 77,351.
In this illustrative example, the price moved upward after the signal and later reached TARGET 1 and TARGET 2. This is one historical instance only. Outcomes vary, and many signals reach the INVALIDATION level instead.
2. Example - Bear Realignment and Engine
This chart illustrates three aspects of PXR that complement the phenomenon view.
First, the engine is bidirectional. The red downward callout marks a BEAR realignment signal. A short-horizon bullish burst pushed price upward over several hours. When that burst exhausted near 77,400, the Phase Gap reached its positive peak . As the gap began receding and the medium-horizon gradient pointed bearish, the exhaustion-and-recede condition triggered a BEAR signal . The four rails drew at INVALIDATION 77,465, ENTRY 76,765, TARGET 1 75,925, and TARGET 2 75,226.
Second, the regime ribbon is visible across the background. Subtle orange tints mark COMPRESSED periods where both efficiencies are low and the market is consolidating. Subtle cyan tints mark TRANSITIONING periods where the Phase Gap has stretched far and a regime shift is underway. These background colors give an at-a-glance read of market state without requiring a glance at the dashboard.
Third, the live dashboard in the top-right shows engine state in real time. State, Setup, Bias, Phase Gap, and Last all update on every bar. The five-line legend overlay explains what each field represents. At the moment of this screenshot, the BEAR signal was Triggered, the regime was COMPRESSED , and the Phase Gap reading was -0.07 - a sign the dislocation had largely normalized after the signal fired.
Together with the dashboard and regime ribbon, the engine provides a continuous reading of market state - not just point-in-time signals, but a live framework that contextualizes each signal as it forms.
---
How to Read the Chart
PXR draws several elements. Each one represents something specific.
The PHASE EXHAUSTION label, marked with an upward or downward arrow, appears at the bar where the signal arms. An upward arrow with the text " Realign Up " means a short-horizon bearish burst has exhausted against a bullish gradient , and the studied behavior is upward realignment. A downward arrow means the opposite. The label is anchored outside the bar's price extreme so it does not clash with other chart elements.
The ENTRY rail is a dashed line drawn at the open of the bar immediately after the signal armed. This is the reference entry level. The script does not place orders - it visualizes the reference level a real-time user could have acted on.
The INVALIDATION rail is a solid red line. If price reaches this level, the realignment thesis is rejected. This level is calculated as the worse of two values: a structural swing high or low with an ATR buffer, or a minimum ATR-floored distance from entry. Whichever is further from entry is used. This guarantees the invalidation level is never crammed inside short-term noise.
The TARGET 1 and TARGET 2 rails are teal solid lines placed at user-configurable R-multiples of the invalidation distance. These represent profit objectives. The defaults are 1.2R and 2.2R, which can be modified in the Risk Settings group.
All four rails extend forward bar by bar while the trade is conceptually active, and their labels trail slightly ahead of the live bar so they remain visible at the right edge of the chart.
The regime ribbon is a subtle background tint. Red indicates an Extended regime, orange indicates Compressed, cyan indicates Transitioning, and faint grey indicates Neutral. The ribbon helps users see at a glance which regime the engine currently classifies the market in.
The active tint colors bars green during an active long observation and red during an active short observation. This is purely visual and can be toggled off.
---
How to Read the Dashboard
The dashboard sits in the top-right of the chart and shows six live readings.
State shows the current regime classification. Extended means the medium-horizon efficiency is high - the market has a clean directional gradient. Compressed means both efficiencies are low - the market is ranging. Transitioning means the Phase Gap has stretched far - a regime change is in progress. Neutral means none of the above.
Setup shows the realignment setup progress. No Setup means nothing is forming. Forming means the Phase Gap has reached 60 percent of the threshold. Watching means the Phase Gap has reached 85 percent of the threshold - a setup is building but no signal has fired yet. Armed means a confirmed signal has fired and is awaiting next-bar execution. Triggered means a trade observation is currently active.
Bias shows the direction of the medium-horizon efficiency gradient. BULL means the structural gradient points up. BEAR means it points down. A dash means it is neutral.
Phase Gap shows the live normalized Phase Gap value, roughly bounded within plus or minus one. The color brightens when the absolute value exceeds the threshold.
Last shows the direction of the most recently triggered realignment.
---
Settings Explained
Core Settings.
Auto-Scale Horizons: when on, the Short and Medium horizons are automatically recomputed per timeframe so the analysis covers similar physical time on every chart. When off, the manually entered horizon lengths are used. Recommended on for users who switch between timeframes.
Short Horizon: bars used to measure short-horizon efficiency. Lower values are more reactive but noisier. Default 7. Ignored when Auto-Scale is on.
Medium Horizon: bars used to measure the structural efficiency gradient. Should span one meaningful intraday cycle. Default 24. Ignored when Auto-Scale is on.
Phase Gap Threshold: the normalized Phase Gap level required for a peak to qualify as exhaustion-grade. Higher values yield fewer but stronger signals. Default 0.58.
Cooldown Bars: minimum bars between two consecutive signals. Prevents clustering during noisy regimes. Default 3.
Risk Settings.
ATR Length: the ATR window used for the volatility-based stop floor. Default 14.
ATR Floor Multiplier: minimum stop distance expressed as a multiple of ATR. Ensures the stop is never inside short-term noise. Default 1.0.
TP1 R-Multiple: first profit target expressed as a multiple of the invalidation distance. Default 1.2.
TP2 R-Multiple: final profit target expressed as a multiple of the invalidation distance. Default 2.2.
Visuals.
Show Regime Ribbon: toggles the background regime tint.
Show Active Tint: toggles the green or red bar coloring during an active observation.
Show Dashboard: toggles the top-right state dashboard.
---
Execution Model - Why This Is Honest
PXR uses a strict two-bar workflow. The signal arms only on the close of a confirmed bar - this is enforced by a barstate-confirmed gate inside the engine. The entry then executes at the open of the next bar. This means the entry price shown on the chart matches what a real-time user could have achieved by placing a market order the moment the signal arms.
This workflow prevents the most common form of repaint illusion. The script does not use lookahead data. It does not use future bars. It does not modify past signal positions. Historical signals on the chart represent the same logic that fires in real time.
---
What the Indicator Does Not Do
PXR does not predict future price. It identifies a measurable energy state and labels the observation. It does not place trades. It does not guarantee outcomes. It does not work on all markets in all conditions. It is not a substitute for risk management, position sizing, or contextual judgment.
The realignment behavior is an observed tendency on historical data, not a certainty or guarantee.
The invalidation rail exists precisely because failure is expected and must be bounded.
---
Limitations You Should Know
Session boundaries on instruments such as NQ and ES can compress the rolling normalization window during overnight low-liquidity periods. This can make the Phase Gap appear weaker than it would on a continuous session.
The engine is intentionally reversal-focused. It does not generate continuation signals. In strong trending markets, reversal signals may underperform compared to a continuation tool because the structural gradient is not exhausting - it is reinforcing itself.
Auto-Scale produces horizon values that may differ substantially from the manual input defaults. If a user toggles Auto-Scale off after operating with it on, the manual values will be used immediately and behavior will shift.
On very long historical lookbacks at 1-minute resolution, the efficiency calculation may require additional processing time due to the bar-by-bar path-length computation. If performance is a concern, reducing the Medium Horizon input or enabling Auto-Scale on faster timeframes will reduce the load.
---
Disclaimer
This script is provided for educational and analytical use only. It does not provide financial, investment, or trading advice. It does not guarantee any specific outcome. Past behavior of the indicator on historical data does not imply future results. Markets carry risk. Use independent judgment, sound risk control, and full market context before acting on any signal or observation produced by this tool. The author is not responsible for any decisions made on the basis of this script.
Chỉ báo Pine Script®






















