OPEN-SOURCE SCRIPT
Displacement Forge [JOAT]

Displacement Forge [JOAT]
Introduction
Displacement Forge is an open-source order block detection engine built on Z-Score impulse analysis. It identifies statistically significant price displacements — moves that exceed a configurable standard deviation threshold relative to recent price change history — and marks the candle immediately preceding each displacement as an Order Block Zone. Order blocks represent the price ranges from which institutional order flow originates. Price regularly returns to these zones to fill remaining orders, and Displacement Forge identifies and tracks each one, monitors for zone reactions, and records cumulative rejection statistics.
The problem order block analysis solves is entry precision. A trend bias tells you direction. An order block tells you at what price the institutions that created that trend loaded their positions. Returning to those prices to enter alongside institutional flow — rather than chasing moves already in progress — is the conceptual foundation Displacement Forge is built on. The Z-Score gate ensures only statistically significant displacements qualify, filtering out small impulses caused by normal market noise.

Core Concepts
1. Z-Score Displacement Detection
Rather than using fixed ATR multiples to define a "significant" move, Displacement Forge computes the Z-Score of each bar's price change relative to the rolling distribution of recent price changes. The Z-Score measures how many standard deviations the current move is from the recent mean:
Pine Script®
A positive Z-Score above the threshold with a bullish candle close and a higher close than recent highs — filtered by an EMA and VWAP trend context — constitutes a bullish displacement impulse. A negative Z-Score below the negative threshold with a bearish close and lower-than-recent lows in the opposing trend context constitutes a bearish displacement impulse.
2. Order Block Zone Identification
When a displacement impulse is detected, the indicator looks backward through the impulse lookback window for the last candle in the opposite direction — the candle just before the institutional move began. That candle's high and low define the order block zone. This captures the price range where institutional orders were being placed before the displacement candle consumed available liquidity:
Pine Script®
Each zone is drawn as a box on the chart using the pre-impulse candle's range. Bull order blocks are drawn with a bullish tint (price expected to react bullishly when revisited). Bear order blocks with a bearish tint.
3. EMA and VWAP Trend Filter
Two independent trend filters gate displacement qualification. The EMA filter (200-period by default, configurable) requires bull displacements to occur above the EMA and bear displacements below it. The VWAP filter adds an intraday fair-value gate — bull displacements require price to be above the current VWAP, bear displacements require price to be below. Both filters can be independently enabled or disabled:
Pine Script®
4. Zone Reaction Detection and Rejection Counting
Active order block zones are continuously monitored for price reactions. A bullish reaction occurs when the candle low touches or enters the bull zone range with a bullish close. A bearish reaction occurs when the high touches or enters the bear zone range with a bearish close. Each confirmed reaction increments the independent bull and bear rejection counters displayed in the dashboard:
Pine Script®
5. Zone Lifespan and Active Zone Management
Each zone carries an age counter that increments bar by bar. Zones exceeding the maximum age (configurable) are automatically removed as inactive. The active zone count and total tested zone count are tracked and displayed in the dashboard, giving a running picture of how many zones are currently relevant versus how many have been tested and absorbed.

Features
Input Parameters
Displacement Detection:
Trend Filters:
Zone Management:
Display:
How to Use This Indicator
Step 1: Identify the Current Z-Score and Displacement State
The dashboard shows the live Z-Score value and displacement state (BULL IMPULSE, BEAR IMPULSE, or NEUTRAL). Use the Z-Score value as a real-time gauge of how statistically extreme the current price move is relative to recent history.
Step 2: Locate Active Order Block Zones
After any displacement, a colored box marks the pre-impulse candle range. These zones are the areas where institutional orders were accumulated before the move. The dashboard's Active Zones row shows how many live zones are currently on the chart.
Step 3: Wait for Price to Return to a Zone
When price retraces after a displacement and enters an active zone, watch for a reaction candle. A bullish close from within a bull zone or a bearish close from within a bear zone constitutes a zone reaction and increments the dashboard's rejection counter.
Step 4: Apply EMA and VWAP Context
The EMA filter status (ABOVE/BELOW) and VWAP filter status in the dashboard confirm whether the trend context supports the zone direction. An active bull zone with price above both the EMA and VWAP provides a higher-context long reaction than the same zone in a downtrend.
Step 5: Observe Divergence Labels
BULL DIV and BEAR DIV labels appear when the Z-Score diverges from price direction — Z-Score momentum and price momentum disagree. H.BULL and H.BEAR mark hidden divergence. These are secondary signals that may precede displacement reversals.
Indicator Limitations
Originality Statement
Displacement Forge is original in its application of Z-Score analysis to price change distribution as the gate for order block qualification, combined with a dual trend filter and automatic zone reaction monitoring with cumulative statistics. This indicator is published because:
Disclaimer
This indicator is provided for educational and informational purposes only. It is not financial advice or a recommendation to buy or sell any financial instrument. Trading involves substantial risk of loss. Order block zones are identified using statistical and structural criteria but do not guarantee any particular price reaction when revisited. Z-Score thresholds are parameters that require adjustment to match specific instruments and timeframes. Past zone reactions do not guarantee future reactions. Always use proper risk management. The author is not responsible for any trading losses resulting from the use of this indicator.
-Made with passion by jackofalltrades
Introduction
Displacement Forge is an open-source order block detection engine built on Z-Score impulse analysis. It identifies statistically significant price displacements — moves that exceed a configurable standard deviation threshold relative to recent price change history — and marks the candle immediately preceding each displacement as an Order Block Zone. Order blocks represent the price ranges from which institutional order flow originates. Price regularly returns to these zones to fill remaining orders, and Displacement Forge identifies and tracks each one, monitors for zone reactions, and records cumulative rejection statistics.
The problem order block analysis solves is entry precision. A trend bias tells you direction. An order block tells you at what price the institutions that created that trend loaded their positions. Returning to those prices to enter alongside institutional flow — rather than chasing moves already in progress — is the conceptual foundation Displacement Forge is built on. The Z-Score gate ensures only statistically significant displacements qualify, filtering out small impulses caused by normal market noise.
Core Concepts
1. Z-Score Displacement Detection
Rather than using fixed ATR multiples to define a "significant" move, Displacement Forge computes the Z-Score of each bar's price change relative to the rolling distribution of recent price changes. The Z-Score measures how many standard deviations the current move is from the recent mean:
priceChg = close - close[1]
avgChg = ta.sma(priceChg, zscoreLen)
stdChg = ta.stdev(priceChg, zscoreLen)
zscore = stdChg > 0 ? (priceChg - avgChg) / stdChg : 0.0
A positive Z-Score above the threshold with a bullish candle close and a higher close than recent highs — filtered by an EMA and VWAP trend context — constitutes a bullish displacement impulse. A negative Z-Score below the negative threshold with a bearish close and lower-than-recent lows in the opposing trend context constitutes a bearish displacement impulse.
2. Order Block Zone Identification
When a displacement impulse is detected, the indicator looks backward through the impulse lookback window for the last candle in the opposite direction — the candle just before the institutional move began. That candle's high and low define the order block zone. This captures the price range where institutional orders were being placed before the displacement candle consumed available liquidity:
if bullImpulse
for i = 1 to impulseLook
if close < open // Last bearish candle before the impulse
obLow := low
obHigh := high
break
Each zone is drawn as a box on the chart using the pre-impulse candle's range. Bull order blocks are drawn with a bullish tint (price expected to react bullishly when revisited). Bear order blocks with a bearish tint.
3. EMA and VWAP Trend Filter
Two independent trend filters gate displacement qualification. The EMA filter (200-period by default, configurable) requires bull displacements to occur above the EMA and bear displacements below it. The VWAP filter adds an intraday fair-value gate — bull displacements require price to be above the current VWAP, bear displacements require price to be below. Both filters can be independently enabled or disabled:
bullImpulse = zscore > threshold and close > open
and close > ta.highest(close, impulseLook)[1]
and (not useEma or close > ema200)
and (not useVwap or close > ta.vwap)
4. Zone Reaction Detection and Rejection Counting
Active order block zones are continuously monitored for price reactions. A bullish reaction occurs when the candle low touches or enters the bull zone range with a bullish close. A bearish reaction occurs when the high touches or enters the bear zone range with a bearish close. Each confirmed reaction increments the independent bull and bear rejection counters displayed in the dashboard:
if ob.isBull and low <= ob.top and low >= ob.bottom and close > open
bullReactionDetected := true
totalBullRejections += 1
5. Zone Lifespan and Active Zone Management
Each zone carries an age counter that increments bar by bar. Zones exceeding the maximum age (configurable) are automatically removed as inactive. The active zone count and total tested zone count are tracked and displayed in the dashboard, giving a running picture of how many zones are currently relevant versus how many have been tested and absorbed.
Features
- Z-Score impulse gate: Displacement qualification based on standard deviations from the rolling price-change distribution, not arbitrary fixed thresholds
- Order block zone boxes: Pre-impulse candle ranges drawn as colored boxes on the chart for both bull and bear impulses
- EMA trend filter: Configurable EMA length gates displacement direction relative to long-term trend
- VWAP trend filter: Intraday VWAP provides a fair-value gate alongside the EMA for dual confirmation
- Zone reaction monitoring: Active zones continuously checked for price reactions with independent bull and bear rejection counters
- Zone age management: Configurable maximum zone age with automatic removal of expired zones
- Active and tested zone counts: Dashboard tracks how many zones are live versus how many have been tested
- Bull and bear rejection totals: Cumulative counts of all confirmed zone reactions by direction
- Displacement markers: Labeled arrows at each confirmed displacement bar (BULL DISP, BEAR DISP) with size and style differentiation
- Divergence detection: Z-Score divergence against price direction labeled (BULL DIV, BEAR DIV) and hidden divergence (H.BULL, H.BEAR)
- Institutional dashboard (top right): 13-row table with Z-Score, displacement state, OB reactions, active zone count, tested zone count, EMA and VWAP filter status
- Fully configurable: Z-Score length and threshold, impulse lookback, EMA length, VWAP toggle, zone max age, and zone visibility independently adjustable
- Alerts: Separate alertconditions for bullish and bearish displacement impulses
Input Parameters
Displacement Detection:
- Z-Score Length: Rolling window for mean and standard deviation calculation (default: 20)
- Z-Score Threshold: Standard deviation threshold for displacement qualification (default: 1.5)
- Impulse Lookback: Bars back to search for the pre-impulse order block candle (default: 5)
Trend Filters:
- EMA Length: Trend EMA period (default: 200)
- Use EMA Filter toggle (default: enabled)
- Use VWAP Filter toggle (default: enabled)
Zone Management:
- Max Zone Age (Bars): Maximum bar lifespan of active zones before automatic removal (default: 100)
- Show OB Zones toggle
Display:
- Show Dashboard toggle
- Show Divergence Labels toggle
- Bullish and Bearish color inputs
How to Use This Indicator
Step 1: Identify the Current Z-Score and Displacement State
The dashboard shows the live Z-Score value and displacement state (BULL IMPULSE, BEAR IMPULSE, or NEUTRAL). Use the Z-Score value as a real-time gauge of how statistically extreme the current price move is relative to recent history.
Step 2: Locate Active Order Block Zones
After any displacement, a colored box marks the pre-impulse candle range. These zones are the areas where institutional orders were accumulated before the move. The dashboard's Active Zones row shows how many live zones are currently on the chart.
Step 3: Wait for Price to Return to a Zone
When price retraces after a displacement and enters an active zone, watch for a reaction candle. A bullish close from within a bull zone or a bearish close from within a bear zone constitutes a zone reaction and increments the dashboard's rejection counter.
Step 4: Apply EMA and VWAP Context
The EMA filter status (ABOVE/BELOW) and VWAP filter status in the dashboard confirm whether the trend context supports the zone direction. An active bull zone with price above both the EMA and VWAP provides a higher-context long reaction than the same zone in a downtrend.
Step 5: Observe Divergence Labels
BULL DIV and BEAR DIV labels appear when the Z-Score diverges from price direction — Z-Score momentum and price momentum disagree. H.BULL and H.BEAR mark hidden divergence. These are secondary signals that may precede displacement reversals.
Indicator Limitations
- The Z-Score is computed relative to the rolling price-change distribution of the configured lookback period. During regime changes or low-liquidity periods, the distribution can shift and cause the threshold to misfire
- Order block identification looks backward from the displacement bar. The pre-impulse candle selection is algorithmic — it finds the last opposite-direction candle within the lookback. In some impulse structures this may not match the manually identified order block
- Zone reaction detection requires the candle to touch the zone range in the same bar that a directional close occurs. Multi-bar zone entry sequences are not separately tracked
- The VWAP calculation resets at daily boundaries. On instruments that trade across midnight or on continuous futures contracts, the VWAP reset behavior may differ from expectations
- This indicator identifies order block zones and reactions. It does not generate trade entry signals, and zone reactions do not guarantee price continuation from the zone
Originality Statement
Displacement Forge is original in its application of Z-Score analysis to price change distribution as the gate for order block qualification, combined with a dual trend filter and automatic zone reaction monitoring with cumulative statistics. This indicator is published because:
- Using the rolling Z-Score of bar-by-bar price changes — rather than raw ATR multiples — to define what constitutes a statistically significant displacement provides an adaptive, distribution-aware threshold that adjusts to current volatility rather than using fixed values
- The pre-impulse candle lookback logic that identifies the order block as the last opposite-direction candle before the displacement provides a specific, repeatable rule for zone placement that eliminates the ambiguity of manual order block selection
- The dual trend filter combining a configurable EMA with VWAP — both independently togglable — provides layered directional context that single-MA systems do not offer
- Tracking cumulative bull and bear rejection counts alongside active and tested zone counts provides ongoing statistical feedback on how the order block zones are performing across the chart history
Disclaimer
This indicator is provided for educational and informational purposes only. It is not financial advice or a recommendation to buy or sell any financial instrument. Trading involves substantial risk of loss. Order block zones are identified using statistical and structural criteria but do not guarantee any particular price reaction when revisited. Z-Score thresholds are parameters that require adjustment to match specific instruments and timeframes. Past zone reactions do not guarantee future reactions. Always use proper risk management. The author is not responsible for any trading losses resulting from the use of this indicator.
-Made with passion by jackofalltrades
Open-source Skript
Ganz im Sinne von TradingView hat dieser Autor sein/ihr Script als Open-Source veröffentlicht. Auf diese Weise können nun auch andere Trader das Script rezensieren und die Funktionalität überprüfen. Vielen Dank an den Autor! Sie können das Script kostenlos verwenden, aber eine Wiederveröffentlichung des Codes unterliegt unseren Hausregeln.
The AI Trading Ecosystem, Built to win trades 📈
Get Full Access 👇
jackofalltrades.vip 🌐
t.me/jackofalltradesvip 🃏
Get Full Access 👇
jackofalltrades.vip 🌐
t.me/jackofalltradesvip 🃏
Haftungsausschluss
Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.
Open-source Skript
Ganz im Sinne von TradingView hat dieser Autor sein/ihr Script als Open-Source veröffentlicht. Auf diese Weise können nun auch andere Trader das Script rezensieren und die Funktionalität überprüfen. Vielen Dank an den Autor! Sie können das Script kostenlos verwenden, aber eine Wiederveröffentlichung des Codes unterliegt unseren Hausregeln.
The AI Trading Ecosystem, Built to win trades 📈
Get Full Access 👇
jackofalltrades.vip 🌐
t.me/jackofalltradesvip 🃏
Get Full Access 👇
jackofalltrades.vip 🌐
t.me/jackofalltradesvip 🃏
Haftungsausschluss
Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.