Fair Value Gap Signals [Kodexius]Fair Value Gap Signals is an advanced market structure tool that automatically detects and tracks Fair Value Gaps (FVGs), evaluates the quality of each gap, and highlights high value reaction zones with visual metrics and signal markers.
The script is designed for traders who focus on liquidity concepts, order flow and mean reversion. It goes beyond basic FVG plotting by continuously monitoring how price interacts with each gap and by quantifying three key aspects of each zone:
-Entry velocity inside the gap
-Volume absorption during tests
-Structural integrity and depth of penetration
The result is a dynamic, information rich visualization of which gaps are being respected, which are being absorbed, and where potential reversals or continuations are most likely to occur.
All visual elements are configurable, including the maximum number of visible gaps per direction, mitigation method (close or wick) and an ATR based filter to ignore insignificant gaps in low volatility environments.
🔹 Features
🔸 Automated Fair Value Gap Detection
The script detects both bullish and bearish FVGs based on classic three candle logic:
Bullish FVG: current low is strictly above the high from two bars ago
Bearish FVG: current high is strictly below the low from two bars ago
🔸 ATR Based Gap Filter
To avoid clutter and low quality signals, the script can ignore very small gaps using an ATR based filter.
🔸Per Gap State Machine and Lifecycle
Each gap is tracked with an internal status:
Fresh: gap has just formed and has not been tested
Testing: price is currently trading inside the gap
Tested: gap was tested and left, waiting for a potential new test
Rejected: price entered the gap and then rejected away from it
Filled: gap is considered fully mitigated and no longer active
This state machine allows the script to distinguish between simple touches, multiple tests and meaningful reversals, and to trigger different alerts accordingly.
🔸 Visual Ranking of Gaps by Metrics
For each active gap, three additional horizontal rank bars are drawn on top of the gap area:
Rank 1 (Vel): maximum entry velocity inside the gap
Rank 2 (Vol): relative test volume compared to average volume
Rank 3 (Dpt): remaining safety of the gap based on maximum penetration depth
These rank bars extend horizontally from the creation bar, and their length is a visual score between 0 and 1, scaled to the age of the gap. Longer bars represent stronger or more favorable conditions.
🔸Signals and Rejection Markers
When a gap shows signs of rejection (price enters the gap and then closes away from it with sufficient activity), the script can print a signal label at the reaction point. These markers summarize the internal metrics of the gap using a tooltip:
-Velocity percentage
-Volume percentage
-Safety score
-Number of tests
🔸 Flexible Mitigation Logic (Close or Wick)
You can choose how mitigation is defined via the Mitigation Method input:
Close: the gap is considered filled only when the closing price crosses the gap boundary
Wick: a full fill is detected as soon as any wick crosses the gap boundary
🔸 Alert Conditions
-New FVG formed
-Price entering a gap (testing)
-Gap fully filled and invalidated
-Rejection signal generated
🔹Calculations
This section summarizes the main calculations used under the hood. Only the core logic is covered.
1. ATR Filter and Gap Size
The script uses a configurable ATR length to filter out small gaps. First the ATR is computed:
float atrVal = ta.atr(atrLength)
Gap size for both directions is then measured:
float gapSizeBull = low - high
float gapSizeBear = low - high
If useAtrFilter is enabled, gaps smaller than atrVal are ignored. This ties the minimum gap size to the current volatility regime.
2. Fair Value Gap Detection
The basic FVG conditions use a three bar structure:
bool fvgBull = low > high
bool fvgBear = high < low
For bullish gaps the script stores:
-top as low of the current bar
-bottom as high
For bearish gaps:
-top as high of the current bar
-bottom as low
This defines the price range that is considered the imbalance area.
3. Depth and Safety Score
Depth measures how far price has penetrated into the gap since its creation. For each bar, the script computes a currentDepth and updates the maximum depth:
float currentDepth = 0.0
if g.isBullish
if l < g.top
currentDepth := g.top - l
else
if h > g.bottom
currentDepth := h - g.bottom
if currentDepth > g.maxDepth
g.maxDepth := currentDepth
The safety score expresses how much of the gap remains intact:
float depthRatio = g.maxDepth / gapSize
float safetyScore = math.max(0.0, 1.0 - depthRatio)
safetyScore near 1: gap is mostly untouched
safetyScore near 0: gap is mostly or fully filled
4. Velocity Metric
Velocity captures how aggressively price moves inside the gap. It is based on the body to range ratio of each bar that trades within the gap and rewards bars that move in the same direction as the gap:
float barRange = h - l
float bodyRatio = math.abs(close - open) / barRange
float directionBonus = 0.0
if g.isBullish and close > open
directionBonus := 0.2
else if not g.isBullish and close < open
directionBonus := 0.2
float currentVelocity = math.min(bodyRatio + directionBonus, 1.0)
The gap keeps track of the strongest observed value:
if currentVelocity > g.maxVelocity
g.maxVelocity := currentVelocity
This maximum is later used as velScore when building the velocity rank bar.
5. Volume Accumulation and Volume Score
While price is trading inside a gap, the script accumulates the traded volume:
if isInside
g.testVolume += volume
It also keeps track of the number of tests and the volume at the start of the first test:
if g.status == "Fresh"
g.status := "Testing"
g.testCount := 1
g.testStartVolume := volume
An average volume is computed using a 20 period SMA:
float volAvg = ta.sma(volume, 20)
The expected volume is approximated as:
float expectedVol = volAvg * math.max(1, (bar_index - g.index) / 2)
The volume score is then:
float volScore = math.min(g.testVolume / expectedVol, 1.0)
This produces a normalized 0 to 1 metric that shows whether the gap has attracted more or less volume than expected over its lifetime.
6. Rank Bar Scaling
All three scores are projected visually along the time axis as horizontal bars. The script uses the age of the gap in bars as the maximum width:
float maxWidth = math.max(bar_index - g.index, 1)
Then each metric is mapped to a bar length:
int len1 = int(math.max(1, maxWidth * velScore))
g.rankBox1.set_right(g.index + len1)
int len2 = int(math.max(1, maxWidth * volScore))
g.rankBox2.set_right(g.index + len2)
int len3 = int(math.max(1, maxWidth * safetyScore))
g.rankBox3.set_right(g.index + len3)
This creates an intuitive visual representation where stronger metrics produce longer rank bars, making it easy to quickly compare the relative quality of multiple FVGs on the chart.
Depth
Momentum ScopeOverview
Momentum Scope is a Pine Script™ v6 study that renders a –1 to +1 momentum heatmap across up to 32 lookback periods in its own pane. Using an Augmented Relative Momentum Index (ARMI) and color shading, it highlights where momentum strengthens, weakens, or stays flat over time—across any asset and timeframe.
Key Features
Full-Spectrum Momentum Map : Computes ARMI for 1–32 lookbacks, indexed from –1 (strong bearish) to +1 (strong bullish).
Flexible Scale Gradation : Choose Linear or Exponential spacing, with adjustable expansion ratio and maximum depth.
Trending Bias Control : Apply a contrast-style curve transform to emphasize trending vs. mean-reverting behavior.
Duotone & Tritone Palettes : Select between two vivid color styles, with user-definable hues for bearish, bullish, and neutral momentum.
Compact, Overlay-Free Display : Renders solely in its own pane—keeping your price chart clean.
Inputs & Customization
Scale Gradation : Linear or Exponential spacing of intervals
Scale Expansion : Ratio governing step-size between successive lookbacks
Scale Maximum : Maximum lookback period (and highest interval)
Trending Bias : Curve-transform bias to tilt the –1 … +1 grid
Color Style : Duotone or Tritone rendering modes
Reducing / Increasing / Neutral Colors : Pick your own hues for bearish, bullish, and flat zones
How to Use
Add to Chart : Apply “Momentum Scope” as a separate indicator.
Adjust Scale : For exponential spacing, switch your indicator Y-axis to Logarithmic .
Set Bias & Colors : Tweak Trending Bias and choose a palette that stands out on your layout.
Interpret the Heatmap :
Red tones = weakening/bearish momentum
Green tones = strengthening/bullish momentum
Neutral hues = indecision or flat momentum
Copyright © 2025 MVPMC. Licensed under MIT. For full license see opensource.org
Depth Trend Indicator - RSIDepth Trend Indicator - RSI
This indicator is designed to identify trends and gauge pullback strength by combining the power of RSI and moving averages with a depth-weighted calculation. The script was created by me, Nathan Farmer and is based on a multi-step process to determine trend strength and direction, adjusted by a "depth" factor for more accurate signal analysis.
How It Works
Trend Definition Using RSI: The RSI Moving Average ( rsiMa ) is calculated to assess the current trend, using customizable parameters for the RSI Period and MA Period .
Trends are defined as follows:
Uptrend : RSI MA > Critical RSI Value
Downtrend : RSI MA < Critical RSI Value
Pullback Depth Calculation: To measure pullback strength relative to the current trend, the indicator calculates a Depth Percentage . This is defined as the portion of the gap between the moving average and the price covered by a pullback.
Depth-Weighted RSI Calculation: The Depth Percentage is then applied as a weighting factor on the RSI Moving Average , giving us a Weighted RSI line that adjusts to the depth of pullbacks. This line is rather noisy, and as such we take a moving average to smooth out some of the noise.
Key Parameters
RSI Period : The period for RSI calculation.
MA Period : The moving average period applied to RSI.
Price MA Period : Determines the SMA period for price, used to calculate pullback depth.
Smoothing Length : Length of smoothing applied to the weighted RSI, creating a more stable signal.
RSI Critical Value : The critical value (level) used in determining whether we're in an uptrend or a downtrend.
Depth Critical Value : The critical value (level) used in determining whether or not the depth weighted value confirms the state of a trend.
Notes:
As always, backtest this indicator and modify the parameters as needed for your specific asset, over your specific timeframe. I chose these defaults as they worked well on the assets I look at, but it is likely you tend to look at a different group of assets over a different timeframe than what I do.
Large pullbacks can create large downward spikes in the weighted line. This isn't graphically pleasing, but I have tested it with various methods of normalization and smoothing and found the simple smoothing used in the indicator to be best despite this.
Liquidity Price Depth Chart [LuxAlgo]The Liquidity Price Depth Chart is a unique indicator inspired by the visual representation of order book depth charts, highlighting sorted prices from bullish and bearish candles located on the chart's visible range, as well as their degree of liquidity.
Note that changing the chart's visible range will recalculate the indicator.
🔶 USAGE
The indicator can be used to visualize sorted bullish/bearish prices (in descending order), with bullish prices being highlighted on the left side of the chart, and bearish prices on the right. Prices are highlighted by dots, and connected by a line.
The displacement of a line relative to the x-axis is an indicator of liquidity, with a higher displacement highlighting prices with more volume.
These can also be easily identified by only keeping the dots, visible voids can be indicative of a price associated with significant volume or of a large price movement if the displacement is more visible for the price axis. These areas could play a key role in future trends.
Additionally, the location of the bullish/bearish prices with the highest volume is highlighted with dotted lines, with the returned horizontal lines being useful as potential support/resistances.
🔹 Liquidity Clusters
Clusters of liquidity can be spotted when the Liquidity Price Depth Chart exhibits more rectangular shapes rather than "V" shapes.
The steepest segments of the shape represent periods of non-stationarity/high volatility, while zones with clustered prices highlight zones of potential liquidity clusters, that is zones where traders accumulate positions.
🔹 Liquidity Sentiment
At the bottom of each area, a percentage can be visible. This percentage aims to indicate if the traded volume is more often associated with bullish or bearish price variations.
In the chart above we can see that bullish price variations make 63.89% of the total volume in the range visible range.
🔶 SETTINGS
🔹 Bullish Elements
Bullish Price Highest Volume Location: Shows the location of the bullish price variation with the highest associated volume using one horizontal and one vertical line.
Bullish Volume %: Displays the bullish volume percentage at the bottom of the depth chart.
🔹 Bearish Elements
Bearish Price Highest Volume Location: Shows the location of the bearish price variation with the highest associated volume using one horizontal and one vertical line.
Bearish Volume %: Displays the bearish volume percentage at the bottom of the depth chart.
🔹 Misc
Volume % Box Padding: Width of the volume % boxes at the bottom of the Liquidity Price Depth Chart as a percentage of the chart visible range
Depth Multiple Time FrameThe price always returns to the average !!!
An important separation of the price with respect to an average, indicates a depth and generally generates a reversion or correction in the trend. Depth detection is a simple and very powerful technique, it is widely used for scalping and pyramid operations, this indicator detects depth in 7 time frames, everything is configurable independently, simultaneous detection of depth in several time frames increases The chances of success in the operation. I personally like pyramidization and it is one of the tools I use to detect depth to average the price of my operations.
thumbs up!!
Correction Percent and Days SinceS
Use this script to see the depths of corrections and also to see how long it has been since a correction.
I published this script because the last time the SNP has gone this long without a 5% correction was 1996 excluding bear markets of course.
NOTE: This script is a 2 in 1. In order to see correction depth only use the first 3 plot settings as visible.
In order to see the days since a correction use the last two plot settings.





