TradingView
Asch-
Jan 6, 2020 6:40 PM

GAP DETECTOR 

DAX FuturesEUREX

Description

GAP DETECTOR is an indicator displaying price gaps that have never been completely filled (only gaps >= 5 pips are considered).
Each gap is defined by two lines (the lower and upper bound of the gap), and a label giving information on its price range

#Parameters:
length: the number of candles being considered in the indicator (max is 3000).
width: the width of the gap lines.

Comments
mycotoxin
rajmodi39
Hi,

Can you update with highlight gap as band with filled with colour green and red for more appealing.

Thanks
pareshbhangale
when i copied this to getting error as Add to Chart operation failed, reason: line 212: Could not find function or function reference label.new

any idea why?
donnycf
Asch, love the script!....anyway to have it work so that I can run an intraday chart, like the 5 minute timeframe and see the daily gaps?
Asch-
@donnycf, thanks for the comment. Yes it should work on any timeframe you want. Here is an example of a gap in a 5min timeframe (
) on CHFJPY 04th May. You may have to increase the "length" parameter in order to see older gaps.
randolflewis13
Does the green line disappear once the stock price come down ? @Asch-
pcarriere11
Hi ... there seems to be an issue with a vertical line appearing?
UnknownUnicorn5012578
thanks for this
shelbyfox
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.
tecz0r
Hi there, this is such a great script but unfortunately, your script breaks when I use it on a 10min timeframe. The GAP lines show up but disappear randomly after a while, I don't know why.
More