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.
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.