OPEN-SOURCE SCRIPT
ICT Key Levels: PDH / PDL / Daily Open

//version=5
indicator("ICT Key Levels: PDH / PDL / Daily Open", shorttitle="ICT Levels", overlay=true)
// --- Inputs
showPD = input.bool(true, "Mostrar PDH/PDL")
showOpen = input.bool(true, "Mostrar Daily Open")
pdhColor = input.color(color.new(color.green, 0), "Color PDH")
pdlColor = input.color(color.new(color.red, 0), "Color PDL")
openColor = input.color(color.new(color.orange, 0), "Color Daily Open")
lineWidth = input.int(1, "Ancho líneas", minval=1, maxval=4)
// --- Previous day high / low (using daily security)
pdh = request.security(syminfo.tickerid, "D", high[1])
pdl = request.security(syminfo.tickerid, "D", low[1])
// --- Daily open (current day's open on Daily timeframe)
dailyOpen = request.security(syminfo.tickerid, "D", open)
// --- Plots
plot(showPD and not na(pdh) ? pdh : na, title="PDH", color=pdhColor, linewidth=lineWidth, style=plot.style_line)
plot(showPD and not na(pdl) ? pdl : na, title="PDL", color=pdlColor, linewidth=lineWidth, style=plot.style_line)
plot(showOpen and not na(dailyOpen) ? dailyOpen : na, title="Daily Open", color=openColor, linewidth=lineWidth, style=plot.style_line)
// --- Optional: etiquetas en inicio de día (solo en la primera barra diaria)
isNewDay = ta.change(time("D"))
labelNewDayOpen = input.bool(true, "Mostrar etiqueta en apertura diaria")
if labelNewDayOpen and isNewDay
label.new(bar_index, dailyOpen, text="Open", style=label.style_label_down, color=color.new(openColor,50), textcolor=color.black, yloc=yloc.price)
indicator("ICT Key Levels: PDH / PDL / Daily Open", shorttitle="ICT Levels", overlay=true)
// --- Inputs
showPD = input.bool(true, "Mostrar PDH/PDL")
showOpen = input.bool(true, "Mostrar Daily Open")
pdhColor = input.color(color.new(color.green, 0), "Color PDH")
pdlColor = input.color(color.new(color.red, 0), "Color PDL")
openColor = input.color(color.new(color.orange, 0), "Color Daily Open")
lineWidth = input.int(1, "Ancho líneas", minval=1, maxval=4)
// --- Previous day high / low (using daily security)
pdh = request.security(syminfo.tickerid, "D", high[1])
pdl = request.security(syminfo.tickerid, "D", low[1])
// --- Daily open (current day's open on Daily timeframe)
dailyOpen = request.security(syminfo.tickerid, "D", open)
// --- Plots
plot(showPD and not na(pdh) ? pdh : na, title="PDH", color=pdhColor, linewidth=lineWidth, style=plot.style_line)
plot(showPD and not na(pdl) ? pdl : na, title="PDL", color=pdlColor, linewidth=lineWidth, style=plot.style_line)
plot(showOpen and not na(dailyOpen) ? dailyOpen : na, title="Daily Open", color=openColor, linewidth=lineWidth, style=plot.style_line)
// --- Optional: etiquetas en inicio de día (solo en la primera barra diaria)
isNewDay = ta.change(time("D"))
labelNewDayOpen = input.bool(true, "Mostrar etiqueta en apertura diaria")
if labelNewDayOpen and isNewDay
label.new(bar_index, dailyOpen, text="Open", style=label.style_label_down, color=color.new(openColor,50), textcolor=color.black, yloc=yloc.price)
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.