本页源码来自 TradingView 公开发布的开源脚本,版权归原作者所有, 请遵循其原始许可(Pine 脚本常见 CC BY-NC-SA / MPL-2.0 / MIT)。 本项目仅用于研究检索与许可范围内的移植。
// GEX Levels Dashboard - NQ/NDX/QQQ Gamma Exposure Levels
// Data exported in NQ Futures terms - Select your ticker in settings
// Alert system contribution by @_prodigy_dev
// v6.9: BUILT-IN 5DTE WEEKLY LEVELS - Works out of the box! Custom data in text input takes priority
// v7.0: WEEKLY VAR DATA - Update WEEKLY_DATA string in code, publish via TV Update each week
//@version=6
indicator("GEX Levels Dashboard - NQ/NDX/QQQ Gamma Exposure", overlay=true, max_lines_count=500, max_labels_count=500, max_boxes_count=500)
// ============== INPUTS ==============
groupTicker = "Ticker Settings"
groupGen = "General Settings"
groupLevels = "Level Visibility"
groupLines = "Price Levels Style"
groupCol = "Colors"
groupAlerts = "Alerts"
// TICKER SELECTION
tickerChoice = input.string("NQ", "Display Ticker", options=["NQ", "NDX", "QQQ"], group=groupTicker, tooltip="Select the instrument to display levels in. Data is exported in NQ terms and converted based on this selection.")
// NQ-NDX Spread captured at export time
var float nqNdxSpread = 40
// v7.0: WEEKLY DATA — to update: change WEEKLY_DATA string below, then publish via TV Update
// ⚠️ ONLY this line changes each week — everything else stays the same
// Last update: 2026-03-08 | Expiry: 5DTE | Next update: ~2026-03-14
string WEEKLY_DATA = "L:24886,ZG,ZERO GAMMA,Zero Gamma~Key pivot where dealer gamma flips~Price magnet,0;24928,MP,MAX PAIN,Max Pain~Strike with maximum option pain~Expiry target,0;24835,EH,EM HIGH,Expected Move HIGH~1-sigma upper boundary~Statistical resistance,0;24506,EL,EM LOW,Expected Move LOW~1-sigma lower boundary~Statistical support,0;24968,VH,VOL HIGH,Vol Band HIGH~Volatility-based resistance~ZG + 25% EM,0;24803,VL,VOL LOW,Vol Band LOW~Volatility-based support~ZG - 25% EM,0;25228,CW,Call Wall,Strike: 25228~From Spot: +2.26%~Tot GEX: 108.47M~C/P Ratio: 36.6~Hold: 63% | Break: 37%,108.5;25128,CW,Call Wall,Strike: 25128~From Spot: +1.86%~Tot GEX: 36.66M~C/P Ratio: 4.5~Hold: 58% | Break: 42%,36.7;24728,PW,Put Wall,Strike: 24728~From Spot: +0.23%~Tot GEX: -39.62M~C/P Ratio: 0.1~Hold: 79% | Break: 21%,39.6;25028,CW,Call Wall,Strike: 25028~From Spot: +1.45%~Tot GEX: 19.37M~C/P Ratio: 3.3~Hold: 68% | Break: 32%,19.4;24978,PW,Put Wall,Strike: 24978~From Spot: +1.25%~Tot GEX: -10.69M~C/P Ratio: 0.5~Hold: 70% | Break: 30%,10.7;24828,PW,Put Wall,Strike: 24828~From Spot: +0.64%~Tot GEX: -8.13M~C/P Ratio: 0.5~Hold: 80% | Break: 20%,8.1;24878,PW,Put Wall,Strike: 24878~From Spot: +0.84%~Tot GEX: -4.98M~C/P Ratio: 0.7~Hold: 83% | Break: 17%,5.0;24778,PW,Put Wall,Strike: 24778~From Spot: +0.44%~Tot GEX: -9.00M~C/P Ratio: 0.4~Hold: 80% | Break: 20%,9.0;25378,CW,Call Wall,Strike: 25378~From Spot: +2.87%~Tot GEX: 18.31M~C/P Ratio: 9.4~Hold: 64% | Break: 36%,18.3;25928,CW,Call Wall,Strike: 25928~From Spot: +5.10%~Tot GEX: 20.46M~Hold: 59% | Break: 41%,20.5;25328,CW,Call Wall,Strike: 25328~From Spot: +2.67%~Tot GEX: 13.46M~C/P Ratio: 5.3~Hold: 64% | Break: 36%,13.5;26028,CW,Call Wall,Strike: 26028~From Spot: +5.50%~Tot GEX: 18.88M~Hold: 59% | Break: 41%,18.9;25078,CW,Call Wall,Strike: 25078~From Spot: +1.65%~Tot GEX: 1.64M~C/P Ratio: 1.2~Hold: 76% | Break: 24%,1.6;25278,CW,Call Wall,Strike: 25278~From Spot: +2.46%~Tot GEX: 12.51M~C/P Ratio: 7.7~Hold: 65% | Break: 35%,12.5;24958,PW,Put Wall,Strike: 24958~From Spot: +1.17%~Tot GEX: -15.16M~Hold: 70% | Break: 30%,15.2;24028,PW,Put Wall,Strike: 24028~From Spot: -2.60%~Tot GEX: -107.80M~C/P Ratio: 0.0~Hold: 59% | Break: 41%,107.8;24428,PW,Put Wall,Strike: 24428~From Spot: -0.98%~Tot GEX: -78.92M~C/P Ratio: 0.1~Hold: 60% | Break: 40%,78.9;24628,CW,Call Wall,Strike: 24628~From Spot: -0.17%~Tot GEX: 31.97M~C/P Ratio: 2.2~Hold: 71% | Break: 29%,32.0;24128,PW,Put Wall,Strike: 24128~From Spot: -2.20%~Tot GEX: -60.66M~C/P Ratio: 0.0~Hold: 55% | Break: 45%,60.7;24528,PW,Put Wall,Strike: 24528~From Spot: -0.58%~Tot GEX: -36.46M~C/P Ratio: 0.1~Hold: 63% | Break: 37%,36.5;24078,PW,Put Wall,Strike: 24078~From Spot: -2.40%~Tot GEX: -31.07M~Hold: 55% | Break: 45%,31.1;23928,PW,Put Wall,Strike: 23928~From Spot: -3.01%~Tot GEX: -25.86M~Hold: 64% | Break: 36%,25.9;24478,PW,Put Wall,Strike: 24478~From Spot: -0.78%~Tot GEX: -20.86M~C/P Ratio: 0.1~Hold: 62% | Break: 38%,20.9;24228,PW,Put Wall,Strike: 24228~From Spot: -1.79%~Tot GEX: -21.26M~C/P Ratio: 0.0~Hold: 56% | Break: 44%,21.3;24328,PW,Put Wall,Strike: 24328~From Spot: -1.39%~Tot GEX: -17.72M~C/P Ratio: 0.0~Hold: 58% | Break: 42%,17.7;24278,PW,Put Wall,Strike: 24278~From Spot: -1.59%~Tot GEX: -17.72M~Hold: 57% | Break: 43%,17.7;23828,PW,Put Wall,Strike: 23828~From Spot: -3.41%~Tot GEX: -1.23M~C/P Ratio: 0.8~Hold: 79% | Break: 21%,1.2;23428,PW,Put Wall,Strike: 23428~From Spot: -5.04%~Tot GEX: -14.28M~Hold: 59% | Break: 41%,14.3;23228,PW,Put Wall,Strike: 23228~From Spot: -5.85%~Tot GEX: -14.03M~Hold: 59% | Break: 41%,14.0;24578,PW,Put Wall,Strike: 24578~From Spot: -0.37%~Tot GEX: -9.17M~C/P Ratio: 0.2~Hold: 65% | Break: 35%,9.2;25250,PDH,PDH,Prior Day High~Previous session high~Key resistance,0;24773,PDL,PDL,Prior Day Low~Previous session low~Key support,0;25495,PWH,PWH,Prior Week High~Previous week high~Major resistance,0;24668,PWL,PWL,Prior Week Low~Previous week low~Major support,0|P:21728,-0.1,-1;22028,-0.2,-1;22328,-0.1,-1;22528,-0.2,-1;22528,-0.1,-1;22528,-0.4,-1;22628,-0.1,-1;22628,-0.1,-1;22728,-0.6,-1;22828,-0.6,-1;22928,-0.7,-1;23028,-1.0,-1;23128,-0.1,-1;23128,-0.2,-1;23228,-0.3,-1;23228,-0.5,-1;23228,-0.5,-1;23328,-0.2,-1;23328,-0.1,-1;23428,-0.4,-1;23428,-0.6,-1;23428,-0.2,-1;23528,-0.1,-1;23528,-0.1,-1;23528,-0.1,-1;23578,-0.1,-1;23578,-0.3,-1;23628,-0.3,-1;23628,-0.2,-1;23678,-0.1,-1;23678,-0.1,-1;23728,-0.2,-1;23728,-0.2,-1;23728,-0.3,-1;23728,-0.3,-1;23778,-0.1,-1;23778,-0.2,-1;23778,-0.1,-1;23828,-0.3,-1;23828,-0.2,-1;23828,-0.2,-1;23828,0.5,1;23878,-0.4,-1;23928,-0.5,-1;23928,-0.4,-1;23928,-1.2,-1;23928,-0.4,-1;23978,-0.2,-1;23978,-0.2,-1;23978,-0.2,-1;24028,-4.2,-1;24028,-0.4,-1;24028,-1.0,-1;24028,-0.2,-1;24028,-4.9,-1;24078,-2.5,-1;24078,-0.2,-1;24078,-0.1,-1;24078,-0.2,-1;24128,-0.4,-1;24128,-0.2,-1;24128,-0.2,-1;24128,-5.1,-1;24178,-0.2,-1;24178,-0.1,-1;24178,-0.1,-1;24228,-0.9,-1;24228,-0.4,-1;24228,-0.2,-1;24228,-0.2,-1;24228,-0.4,-1;24278,-0.6,-1;24278,-0.4,-1;24278,-0.3,-1;24278,-0.2,-1;24278,-0.2,-1;24298,-0.4,-1;24308,-0.3,-1;24318,0.1,1;24328,-0.4,-1;24328,-0.8,-1;24328,-0.2,-1;24328,-0.3,-1;24378,-0.4,-1;24378,-0.3,-1;24378,-0.1,-1;24388,-0.1,-1;24398,-0.1,-1;24418,-0.2,-1;24428,-5.2,-1;24428,-0.5,-1;24428,-0.2,-1;24428,-0.2,-1;24428,-1.6,-1;24438,-0.2,-1;24478,-0.3,-1;24478,-0.2,-1;24478,-1.5,-1;24498,-0.1,-1;24518,-0.1,-1;24528,-0.7,-1;24528,-0.5,-1;24528,-0.1,-1;24528,-0.1,-1;24528,-2.2,-1;24578,-0.5,-1;24578,-0.2,-1;24578,-0.2,-1;24628,-0.7,-1;24628,-0.4,-1;24628,4.8,1;24628,-0.2,-1;24628,-0.3,-1;24638,-0.1,-1;24658,-0.1,-1;24678,-0.3,-1;24678,-0.2,-1;24678,-0.2,-1;24728,-3.0,-1;24728,-0.4,-1;24728,-0.2,-1;24728,-0.2,-1;24738,0.1,1;24758,0.3,1;24768,0.2,1;24778,-0.7,-1;24778,0.1,1;24808,0.2,1;24818,-0.3,-1;24828,-0.3,-1;24828,-0.3,-1;24828,-0.1,-1;24868,-0.2,-1;24878,0.1,1;24878,-0.3,-1;24878,-0.1,-1;24878,-0.2,-1;24918,-1.2,-1;24928,1.7,1;24928,4.2,1;24928,-0.6,-1;24938,0.1,1;24958,-1.5,-1;24968,0.1,1;24978,-0.5,-1;24978,-0.3,-1;24978,0.2,1;24978,-0.5,-1;24988,-0.2,-1;24998,0.1,1;25028,0.4,1;25028,0.6,1;25028,0.2,1;25028,0.7,1;25078,0.1,1;25078,-0.1,-1;25128,0.5,1;25128,0.2,1;25128,2.8,1;25178,0.1,1;25178,0.6,1;25228,0.1,1;25228,0.1,1;25228,0.4,1;25228,10.0,1;25278,0.1,1;25278,0.2,1;25278,0.8,1;25328,0.2,1;25328,0.2,1;25328,0.1,1;25328,0.8,1;25378,0.3,1;25378,0.2,1;25378,1.3,1;25428,0.3,1;25428,0.1,1;25428,0.2,1;25428,0.3,1;25478,0.2,1;25478,0.2,1;25478,0.2,1;25528,0.1,1;25528,0.3,1;25528,0.2,1;25578,0.1,1;25578,0.4,1;25628,0.2,1;25678,0.1,1;25678,0.1,1;25678,0.1,1;25728,0.2,1;25728,0.2,1;25778,0.1,1;25828,0.2,1;25828,0.2,1;25878,0.2,1;25928,1.9,1;25978,0.1,1;26028,0.1,1;26028,0.2,1;26028,1.5,1;26228,0.1,1"
// Leave empty to use WEEKLY_DATA above. Paste custom string here to override for personal use.
gexDataInput = input.text_area("", title="GEX Data (optional override)", group=groupGen, tooltip="Leave empty to use the built-in weekly levels. Paste custom data to override.")
// Active data: custom input takes priority, falls back to weekly built-in
string gexDataActive = gexDataInput != "" ? gexDataInput : WEEKLY_DATA
// Level Toggles
showGexLevels = input.bool(true, "Show GEX Levels (Call/Put Walls)", group=groupLevels)
showSystemLevels = input.bool(true, "Show System Levels (ZG, MaxPain, EM, VolBands)", group=groupLevels)
showStructureLevels = input.bool(true, "Show Structure Levels (PDH/PDL/PWH/PWL)", group=groupLevels)
maxLevelsChoice = input.string("10", "Max GEX Levels", options=["5", "10", "15", "20", "25", "30", "All"], group=groupLevels, tooltip="Maximum Call/Put Walls to display. System and Structure levels are always shown.")
int maxVisibleLevels = maxLevelsChoice == "All" ? 999 : int(str.tonumber(maxLevelsChoice))
showOnlyNear = input.bool(false, "Show only levels near price", group=groupLevels, tooltip="Hide levels that are far from current price to reduce chart clutter")
nearPct = input.float(3.0, " ↳ Radius (%)", step=0.5, minval=0.5, maxval=10.0, group=groupLevels, tooltip="Only show levels within this % of current price")
enableThreshold = input.bool(false, "Enable GEX Threshold Filter", group=groupLevels, tooltip="Hide weak GEX levels below a minimum magnitude.")
gexThreshold = input.float(50.0, " ↳ Min GEX Magnitude (M)", step=10.0, minval=0.0, maxval=500.0, group=groupLevels, tooltip="Minimum absolute GEX value in millions.")
profileWidth = input.int(50, "GEX Chart Width", group=groupGen, inline="gex1")
barThickness = input.int(8, "GEX Bar Height", group=groupGen, inline="gex1")
profileOffset = input.int(15, "Chart Offset", group=groupGen, inline="gex2")
colorScheme = input.string("Wall Street Classic", "Color Theme", options=["Wall Street Classic", "Boreal", "Lady Trader"], group=groupCol, tooltip="Colors for GEX levels and profile bars")
barColorStyle = input.string("Theme Colors", "Bar Color Style", options=["Theme Colors", "Greyscale", "Custom"], group=groupCol, tooltip="Theme = follows skin (inverted: Call=Bear, Put=Bull). Greyscale = neutral. Custom = you choose")
customBarCall = input.color(#ef4444, "Custom Call Bar", group=groupCol, inline="custbar")
customBarPut = input.color(#22c55e, "Custom Put Bar", group=groupCol, inline="custbar")
colorZeroGamma = input.color(#9ca3af, "Zero Gamma", group=groupCol, inline="sys1")
colorMaxPain = input.color(#ef4444, "Max Pain", group=groupCol, inline="sys1")
colorEM = input.color(#3b82f6, "Expected Move", group=groupCol, inline="sys2")
colorVolBand = input.color(#9ca3af, "Vol Bands", group=groupCol, inline="sys2")
colorStructure = input.color(#9ca3af, "Structure Levels", group=groupCol)
lineLeftExt = input.int(50, "Line Left Extension", minval=1, group=groupLines)
lineStyleInput = input.string("Dotted", "Line Style", options=["Solid", "Dashed", "Dotted"], group=groupLines)
lineWidth = input.int(1, "Line Width", minval=1, maxval=4, group=groupLines)
enableAlerts = input.bool(true, "Enable Level Cross Alerts", group=groupAlerts, tooltip="Get notified when price crosses key GEX levels")
var string lineStyleChoice = line.style_dotted
if lineStyleInput == "Solid"
lineStyleChoice := line.style_solid
else if lineStyleInput == "Dashed"
lineStyleChoice := line.style_dashed
// ============== TICKER CONVERSION FUNCTIONS ==============
f_convertPrice(float nqPrice) =>
float result = nqPrice
if tickerChoice == "NDX"
result := nqPrice - nqNdxSpread
else if tickerChoice == "QQQ"
result := (nqPrice - nqNdxSpread) / 40
result
f_formatPrice(float nqPrice) =>
float converted = f_convertPrice(nqPrice)
string result = ""
if tickerChoice == "QQQ"
result := str.tostring(converted, "#.##")
else
result := str.tostring(converted, "#")
result
// ============== STATE VARIABLES ==============
var forceBoxes = array.new_box()
var line[] strategicLines = array.new_line()
var label[] strategicLabels = array.new_label()
var string prevGexData = ""
var int prevProfileWidth = 0
var int prevBarThickness = 0
var int prevProfileOffset = 0
var string prevColorScheme = ""
var string prevBarColorStyle = ""
var string prevLineStyle = ""
var int prevLineWidth = 0
var int prevLineLeftExt = 0
var string prevTickerChoice = ""
var label timestampLabel = na
var int lastDrawnBarIndex = -1
bool newBar = bar_index != lastDrawnBarIndex
bool settingsChanged = gexDataActive != prevGexData or profileWidth != prevProfileWidth or barThickness != prevBarThickness or profileOffset != prevProfileOffset or colorScheme != prevColorScheme or barColorStyle != prevBarColorStyle or lineStyleInput != prevLineStyle or lineWidth != prevLineWidth or lineLeftExt != prevLineLeftExt or tickerChoice != prevTickerChoice
// ============== HELPER COLORS ==============
f_charToNum(string char) =>
char == "0" ? 0. : char == "1" ? 1. : char == "2" ? 2. : char == "3" ? 3. : char == "4" ? 4. : char == "5" ? 5. : char == "6" ? 6. : char == "7" ? 7. : char == "8" ? 8. : char == "9" ? 9. : char == "a" or char == "A" ? 10. : char == "b" or char == "B" ? 11. : char == "c" or char == "C" ? 12. : char == "d" or char == "D" ? 13. : char == "e" or char == "E" ? 14. : 15.
f_hexToColor(string hex, int transp = 0) =>
r = f_charToNum(str.substring(hex, 1, 2)) * 16 + f_charToNum(str.substring(hex, 2, 3))
g = f_charToNum(str.substring(hex, 3, 4)) * 16 + f_charToNum(str.substring(hex, 4, 5))
b = f_charToNum(str.substring(hex, 5, 6)) * 16 + f_charToNum(str.substring(hex, 6, 7))
color.rgb(int(r), int(g), int(b), transp)
f_clear_force() =>
for b in forceBoxes
box.delete(b)
array.clear(forceBoxes)
for l in strategicLines
line.delete(l)
array.clear(strategicLines)
for lbl in strategicLabels
label.delete(lbl)
array.clear(strategicLabels)
if not na(timestampLabel)
label.delete(timestampLabel)
// ============== DYNAMIC GEX COLORS ==============
color colorPos = na
color colorNeg = na
if colorScheme == "Boreal"
colorPos := #22d3ee
colorNeg := #f472b6
else if colorScheme == "Wall Street Classic"
colorPos := #22c55e
colorNeg := #ef4444
else if colorScheme == "Lady Trader"
colorPos := #2dd4bf
colorNeg := #c084fc
// ============== DRAW EVERYTHING ==============
if barstate.islast and (settingsChanged or newBar)
f_clear_force()
lastDrawnBarIndex := bar_index
string tickerLabel = tickerChoice
timestampLabel := label.new(bar_index + profileOffset, high + (syminfo.mintick * 50), "GEX " + tickerLabel + " (NQ)", color=color.new(color.gray, 100), style=label.style_label_center, textcolor=color.new(color.gray, 40), size=size.tiny)
// ============== PARSE DATA FORMAT L:|P: ==============
string levelsData = ""
string profileData = ""
if str.contains(gexDataActive, "|P:")
int pipePos = str.pos(gexDataActive, "|P:")
string beforePipe = str.substring(gexDataActive, 0, pipePos)
profileData := str.substring(gexDataActive, pipePos + 3)
if str.startswith(beforePipe, "L:")
levelsData := str.substring(beforePipe, 2)
else
profileData := gexDataActive
// ============== PARSE AND DRAW DYNAMIC LEVELS ==============
if levelsData != ""
string[] levelPairs = str.split(levelsData, ";")
int gexAboveDrawn = 0
int gexBelowDrawn = 0
int halfMax = math.ceil(maxVisibleLevels / 2)
float closestAbove = na
float closestAboveDist = 999999.0
float closestBelow = na
float closestBelowDist = 999999.0
for lvlPair in levelPairs
string[] lvlParts = str.split(lvlPair, ",")
if array.size(lvlParts) >= 3
float lvlStrike = str.tonumber(array.get(lvlParts, 0))
string lvlType = array.get(lvlParts, 1)
if not na(lvlStrike)
bool isGex = lvlType == "CW" or lvlType == "PW" or lvlType == "GL"
if isGex
float convertedLvl = f_convertPrice(lvlStrike)
float dist = math.abs(convertedLvl - close)
if convertedLvl > close and dist < closestAboveDist
closestAboveDist := dist
closestAbove := convertedLvl
else if convertedLvl <= close and dist < closestBelowDist
closestBelowDist := dist
closestBelow := convertedLvl
for lvlPair in levelPairs
string[] lvlParts = str.split(lvlPair, ",")
if array.size(lvlParts) >= 3
float lvlStrike = str.tonumber(array.get(lvlParts, 0))
string lvlType = array.get(lvlParts, 1)
string lvlLabel = array.get(lvlParts, 2)
string lvlTooltip = array.size(lvlParts) >= 4 ? str.replace_all(array.get(lvlParts, 3), "~", "\n") : ""
float lvlMagnitude = array.size(lvlParts) >= 5 ? str.tonumber(array.get(lvlParts, 4)) : 0.0
if not na(lvlStrike)
float convertedLvl = f_convertPrice(lvlStrike)
bool inRange = not showOnlyNear or (math.abs(close - convertedLvl) / close * 100.0 <= nearPct)
bool isGex = lvlType == "CW" or lvlType == "PW" or lvlType == "GL"
bool isSystem = lvlType == "ZG" or lvlType == "MP" or lvlType == "EH" or lvlType == "EL" or lvlType == "VH" or lvlType == "VL"
bool isStructure = lvlType == "PDH" or lvlType == "PDL" or lvlType == "PWH" or lvlType == "PWL"
bool passesThreshold = not enableThreshold or not isGex or lvlMagnitude >= gexThreshold or lvlMagnitude == 0.0
bool isAbovePrice = convertedLvl > close
bool isBelowPrice = convertedLvl <= close
bool isProtected = (not na(closestAbove) and convertedLvl == closestAbove) or (not na(closestBelow) and convertedLvl == closestBelow)
bool shouldShow = false
if isGex and showGexLevels and passesThreshold
if isProtected
shouldShow := true
else if isAbovePrice and gexAboveDrawn < halfMax
shouldShow := true
else if isBelowPrice and gexBelowDrawn < halfMax
shouldShow := true
else if isSystem and showSystemLevels
shouldShow := true
else if isStructure and showStructureLevels
shouldShow := true
if shouldShow and inRange
color lvlColor = color.gray
int styleCode = 0
string finalTooltip = lvlTooltip
if lvlType == "CW"
bool flipped = convertedLvl < close
lvlColor := flipped ? colorPos : colorNeg
styleCode := flipped ? 1 : 0
if not isProtected
if isAbovePrice
gexAboveDrawn += 1
else
gexBelowDrawn += 1
finalTooltip := lvlTooltip + "\n" + (flipped ? "FLIPPED (Res→Sup)" : "Resistance")
else if lvlType == "PW"
bool flipped = convertedLvl > close
lvlColor := flipped ? colorNeg : colorPos
styleCode := flipped ? 1 : 0
if not isProtected
if isAbovePrice
gexAboveDrawn += 1
else
gexBelowDrawn += 1
finalTooltip := lvlTooltip + "\n" + (flipped ? "FLIPPED (Sup→Res)" : "Support")
else if lvlType == "ZG"
lvlColor := colorZeroGamma
styleCode := 0
else if lvlType == "MP"
lvlColor := colorMaxPain
styleCode := 2
else if lvlType == "EH" or lvlType == "EL"
lvlColor := colorEM
styleCode := 1
else if lvlType == "VH" or lvlType == "VL"
lvlColor := colorVolBand
styleCode := 2
else if isStructure
lvlColor := colorStructure
styleCode := 2
array.push(strategicLines, line.new(bar_index - lineLeftExt, convertedLvl, bar_index + profileOffset, convertedLvl, color=lvlColor, style=styleCode == 2 ? line.style_dotted : styleCode == 1 ? line.style_dashed : line.style_solid, width=lineWidth))
string displayLabel = f_formatPrice(lvlStrike) + " | " + lvlType + " | " + lvlLabel
array.push(strategicLabels, label.new(bar_index - lineLeftExt, convertedLvl, displayLabel, color=lvlColor, style=label.style_label_left, textcolor=color.white, size=size.small, tooltip=finalTooltip))
// ============== DRAW PROFILE BARS ==============
if profileData != ""
string forzaData = str.replace_all(profileData, "\n", "")
string[] forzaPairs = str.split(forzaData, ";")
float[] forzaStrikes = array.new_float()
float[] forzaValues = array.new_float()
float[] forzaSigns = array.new_float()
for pair in forzaPairs
string[] parts = str.split(pair, ",")
if array.size(parts) == 3
array.push(forzaStrikes, str.tonumber(array.get(parts, 0)))
array.push(forzaValues, str.tonumber(array.get(parts, 1)))
array.push(forzaSigns, str.tonumber(array.get(parts, 2)))
if array.size(forzaValues) > 0
float maxAbsForza = 10.0
float boxHeight = barThickness * syminfo.mintick
int x_zero = bar_index + profileOffset
for i = 0 to array.size(forzaValues) - 1
float nqStrike = array.get(forzaStrikes, i)
float convertedStrike = f_convertPrice(nqStrike)
float forza = array.get(forzaValues, i)
float sign = array.get(forzaSigns, i)
int barLength = int((forza / maxAbsForza) * profileWidth)
float intensity = math.abs(forza) / maxAbsForza
int fillTransp = int(80 - (intensity * 50))
color barCall = barColorStyle == "Greyscale" ? #a0a0a0 : barColorStyle == "Custom" ? customBarCall : colorNeg
color barPut = barColorStyle == "Greyscale" ? #505050 : barColorStyle == "Custom" ? customBarPut : colorPos
color baseColor = sign >= 0 ? barCall : barPut
color fillColor = color.new(baseColor, fillTransp)
color borderColor = color.new(baseColor, 0)
box forzaBox = box.new(left=x_zero, top=convertedStrike + (boxHeight / 2), right=x_zero + barLength, bottom=convertedStrike - (boxHeight / 2), border_color=borderColor, border_width=1, bgcolor=fillColor)
array.push(forceBoxes, forzaBox)
prevGexData := gexDataActive
prevProfileWidth := profileWidth
prevBarThickness := barThickness
prevProfileOffset := profileOffset
prevColorScheme := colorScheme
prevBarColorStyle := barColorStyle
prevLineStyle := lineStyleInput
prevLineWidth := lineWidth
prevLineLeftExt := lineLeftExt
prevTickerChoice := tickerChoice
// ============== ALERT SYSTEM (by @_prodigy_dev) ==============
var float[] alertPrices = array.new_float(0)
if barstate.isfirst
array.push(alertPrices, f_convertPrice(25441)) // CW - Call Wall
array.push(alertPrices, f_convertPrice(25241)) // CW - Biggest Call Wall
array.push(alertPrices, f_convertPrice(25171)) // EM High
array.push(alertPrices, f_convertPrice(25141)) // MP - Max Pain
array.push(alertPrices, f_convertPrice(25011)) // PDH
array.push(alertPrices, f_convertPrice(24969)) // ZG - Zero Gamma
array.push(alertPrices, f_convertPrice(24941)) // PW
array.push(alertPrices, f_convertPrice(24831)) // EM Low
array.push(alertPrices, f_convertPrice(24791)) // PW
array.push(alertPrices, f_convertPrice(24741)) // PW
array.push(alertPrices, f_convertPrice(24668)) // PWL
array.push(alertPrices, f_convertPrice(24541)) // PW - Big Put Wall
array.push(alertPrices, f_convertPrice(24352)) // PDL
array.push(alertPrices, f_convertPrice(24341)) // PW
array.push(alertPrices, f_convertPrice(24241)) // PW
if enableAlerts and array.size(alertPrices) > 0
for i = 0 to array.size(alertPrices) - 1
float price = array.get(alertPrices, i)
bool inRange = not showOnlyNear or (math.abs(close - price) / close * 100.0 <= nearPct)
if inRange
bool touched = (high >= price and low <= price)
bool crossUp = touched and (close >= price) and (open < price or low < price)
bool crossDown = touched and (close <= price) and (open > price or high > price)
if crossUp or crossDown
string dir = crossUp ? "⬆️ Cross UP " : "⬇️ Cross DOWN "
string crossTxt = dir + str.tostring(price, format.mintick) + " | " + str.tostring(time, "HH:mm")
alert(crossTxt, alert.freq_once_per_bar)