The Gap Scanner is your primary tool for "Gapping" strategies. It filters your watchlist to show which stocks have moved the most overnight relative to their previous close. This allows you to identify morning breakouts or "Gap and Crap" reversals before the market even opens.
//@version=5
indicator("DTL Lab - Gap Scanner Table", overlay=true)
// --- POSITION SETTINGS ---
table_pos = input.string("top_right", "Table Position", options=["top_right", "bottom_right", "top_left", "bottom_left"])
pos_val = table_pos == "top_right" ? position.top_right :
table_pos == "bottom_right" ? position.bottom_right :
table_pos == "top_left" ? position.top_left : position.bottom_left
// --- Ticker Inputs ---
t1 = input.symbol("AAPL", "Ticker 1"), t2 = input.symbol("TSLA", "Ticker 2")
t3 = input.symbol("NVDA", "Ticker 3"), t4 = input.symbol("AMD", "Ticker 4")
t5 = input.symbol("META", "Ticker 5"), t6 = input.symbol("MSFT", "Ticker 6")
// --- Gap Logic Function ---
calculateGap(sym) =>
prevClose = request.security(sym, "D", close[1], lookahead=barmerge.lookahead_on)
currOpen = request.security(sym, "D", open, lookahead=barmerge.lookahead_on)
gapPct = ((currOpen - prevClose) / prevClose) * 100
gapPct
// --- Execution ---
g1 = calculateGap(t1), g2 = calculateGap(t2)
g3 = calculateGap(t3), g4 = calculateGap(t4)
g5 = calculateGap(t5), g6 = calculateGap(t6)
// --- UI Table ---
var tbl = table.new(pos_val, 2, 7, frame_color=color.gray, frame_width=1)
if barstate.islast
table.cell(tbl, 0, 0, "Symbol", bgcolor=color.new(#6f42c1, 80), text_color=color.white)
table.cell(tbl, 1, 0, "Gap %", bgcolor=color.new(#6f42c1, 80), text_color=color.white)
// Rows
table.cell(tbl, 0, 1, t1, text_color=color.white)
table.cell(tbl, 1, 1, str.tostring(g1, "#.##") + "%", bgcolor = g1 >= 0 ? color.new(color.green, 40) : color.new(color.red, 40), text_color=color.white)
table.cell(tbl, 0, 2, t2, text_color=color.white)
table.cell(tbl, 1, 2, str.tostring(g2, "#.##") + "%", bgcolor = g2 >= 0 ? color.new(color.green, 40) : color.new(color.red, 40), text_color=color.white)
table.cell(tbl, 0, 3, t3, text_color=color.white)
table.cell(tbl, 1, 3, str.tostring(g3, "#.##") + "%", bgcolor = g3 >= 0 ? color.new(color.green, 40) : color.new(color.red, 40), text_color=color.white)
table.cell(tbl, 0, 4, t4, text_color=color.white)
table.cell(tbl, 1, 4, str.tostring(g4, "#.##") + "%", bgcolor = g4 >= 0 ? color.new(color.green, 40) : color.new(color.red, 40), text_color=color.white)
table.cell(tbl, 0, 5, t5, text_color=color.white)
table.cell(tbl, 1, 5, str.tostring(g5, "#.##") + "%", bgcolor = g5 >= 0 ? color.new(color.green, 40) : color.new(color.red, 40), text_color=color.white)
table.cell(tbl, 0, 6, t6, text_color=color.white)
table.cell(tbl, 1, 6, str.tostring(g6, "#.##") + "%", bgcolor = g6 >= 0 ? color.new(color.green, 40) : color.new(color.red, 40), text_color=color.white)
To provide the best experiences, we use technologies like cookies to store and/or access device information. Consenting to these technologies will allow us to process data such as browsing behaviour or unique IDs on this site. Not consenting or withdrawing consent, may adversely affect certain features and functions.
DayTradeLab DOES NOT provide investment advice. The information contained within this websites, is provided for informational and educational purposes only. The information should not be construed as investment or trading advice, and is not meant to be a solicitation or recommendation to buy, sell, or hold any positions in any indices or financial markets mentioned.