OPEN-SOURCE SCRIPT

Gaps Trend [ChartPrime]

The Gaps Trend - ChartPrime indicator is designed to detect Fair Value Gaps (FVGs) in the market and apply a trailing stop mechanism based on those gaps. It identifies both bullish and bearish gaps and provides traders with a way to manage trades dynamically as gaps appear. The indicator visually highlights gaps and uses the detected momentum to assess trend direction, helping traders identify price imbalances caused by strong buy or sell pressure.


⯁ KEY FEATURES & HOW TO USE

⯌ Fair Value Gap (FVG) Detection:
The indicator automatically detects both bullish and bearish FVGs, identifying gaps between candle highs and lows. Bullish gaps are shown in green, and bearish gaps in purple. These gaps indicate price imbalances driven by strong momentum, such as when there is significant buying or selling pressure.
Use: Traders can use FVG detection to identify periods of high price momentum, offering insight into potential continuation or exhaustion of trends.
snapshot

⯌ Trailing Stop Feature Based on FVGs:
A core feature of this indicator is the trailing stop mechanism, which adjusts dynamically based on the identified FVGs. When a bullish gap is detected, the trailing stop is placed below the price to capture upward momentum, while bearish gaps result in a trailing stop placed above the price. This feature helps traders stay in trends while protecting profits as the price moves.
Use: The trailing stop follows the momentum of the price, ensuring that traders can stay in profitable trades during strong trends and exit when the momentum shifts.

bullish set up
snapshot
snapshot

bearish set up
snapshot
snapshot

⯌ Trend Direction Indication:
The indicator colors the chart according to the current trend direction based on the position of the price relative to the trailing stop. Green indicates an uptrend (bullish gap), while purple shows a downtrend (bearish gap). This provides traders with a quick visual assessment of trend direction based on the presence of gaps.
Use: Traders can monitor the chart's color to stay aligned with the market’s trend, staying long during green phases and short during purple ones.
snapshot

⯌ Gap Size Filtering:
Each detected gap is assigned a numerical ranking based on its size, with larger gaps having higher rankings. The gap size filter allows traders to only display gaps that meet a minimum size threshold, focusing on the most impactful gaps in terms of price movement.
Use: Traders can use the filter to focus on gaps of a certain size, filtering out smaller, less significant gaps. The numerical ranking helps identify the largest and most influential gaps for decision-making.
snapshot

⯌ FVG Level Visualization:
The indicator can display dashed lines marking the levels of previously filled FVGs. These levels represent areas where price once experienced a gap and later filled it. Monitoring these levels can provide traders with key reference points for potential reactions in price.
Use: Traders can use these gap levels to track where price has filled gaps and potentially use these levels as zones for entry, exit, or assessing market behavior.
snapshot

⯁ USER INPUTS
  • Filter Gaps: Adjust the size threshold to filter gaps by their size ranking.
  • Show Gap Levels: Toggle the display of dashed lines at filled FVG levels.
  • Enable Trailing Stop: Activate or deactivate the trailing stop feature based on FVGs.
  • Trailing Stop Length: Set the number of bars used to calculate the trailing stop.
  • Bullish/Bearish Colors: Customize the colors representing bullish and bearish gaps.


⯁ CONCLUSION
The Gaps Trend [ChartPrime] indicator combines Fair Value Gap detection with a dynamic trailing stop feature to help traders manage trades during periods of high price momentum. By detecting gaps caused by strong buy or sell pressure and applying adaptive stops, the indicator provides a powerful tool for riding trends and managing risk. The additional ability to filter gaps by size and visualize previously filled gaps enhances its utility for both trend-following and risk management strategies.
fairvaluegapfvgstoplossTrend AnalysistrendsVolatility

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publication is governed by House rules. You can favorite it to use it on a chart.

Want to use this script on a chart?


Also on:

Disclaimer