OPEN-SOURCE SCRIPT
☸Gap Detector [NHP]

🔶This is a Pine Script code for a “Gap Detector” study in TradingView. The script scans for gaps in the price chart and labels them as either ‘🟢Bull gap’ or ‘🔴Bear gap’. Here’s a brief explanation of the code:
🔶Length and Width are user inputs that define the number of bars to look back and the width of the lines drawn, respectively.
➡️Gap_start and gap_end are variables that store the start and end of a gap.
➡️Gap_bull and gap_bear are boolean variables that indicate whether a bull or bear gap has been detected.
🔶Inf_gap and sup_gap are variables that store the lower and upper bounds of a gap.
The script then iterates over the specified length of bars. If a gap is detected (a high price that is lower than the previous bar’s low price for a bull gap, or a low price that is higher than the previous bar’s high price for a bear gap), it calculates the size of the gap and draws lines and labels on the chart if the gap is larger than 5 pips. ( pips meaning percentage in point)
🔶All content provided is for informational & educational purposes only. Past performance does not guarantee future results.
🔶Length and Width are user inputs that define the number of bars to look back and the width of the lines drawn, respectively.
➡️Gap_start and gap_end are variables that store the start and end of a gap.
➡️Gap_bull and gap_bear are boolean variables that indicate whether a bull or bear gap has been detected.
🔶Inf_gap and sup_gap are variables that store the lower and upper bounds of a gap.
The script then iterates over the specified length of bars. If a gap is detected (a high price that is lower than the previous bar’s low price for a bull gap, or a low price that is higher than the previous bar’s high price for a bear gap), it calculates the size of the gap and draws lines and labels on the chart if the gap is larger than 5 pips. ( pips meaning percentage in point)
🔶All content provided is for informational & educational purposes only. Past performance does not guarantee future results.
Script open-source
Dans l'esprit de TradingView, le créateur de ce script l'a rendu open-source, afin que les traders puissent examiner et vérifier sa fonctionnalité. Bravo à l'auteur! Vous pouvez l'utiliser gratuitement, mais n'oubliez pas que la republication du code est soumise à nos Règles.
Clause de non-responsabilité
Les informations et les publications ne sont pas destinées à être, et ne constituent pas, des conseils ou des recommandations en matière de finance, d'investissement, de trading ou d'autres types de conseils fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.
Script open-source
Dans l'esprit de TradingView, le créateur de ce script l'a rendu open-source, afin que les traders puissent examiner et vérifier sa fonctionnalité. Bravo à l'auteur! Vous pouvez l'utiliser gratuitement, mais n'oubliez pas que la republication du code est soumise à nos Règles.
Clause de non-responsabilité
Les informations et les publications ne sont pas destinées à être, et ne constituent pas, des conseils ou des recommandations en matière de finance, d'investissement, de trading ou d'autres types de conseils fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.