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