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.
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.