TAtrader

Highs & Lows by TaTrader

Hello,

This is my script for H&Ls. I am still working on it.

EDIT: be careful when using it!
It does NOT compare previous H&L levels with those in the making. It can only be used if you hold your positions a long time.
Script de código abierto

Siguiendo el verdadero espíritu de TradingView, el autor de este script lo ha publicado en código abierto, para que los traders puedan entenderlo y verificarlo. ¡Un hurra por el autor! Puede utilizarlo de forma gratuita, aunque si vuelve a utilizar este código en una publicación, debe cumplir con lo establecido en las Normas internas. Puede añadir este script a sus favoritos y usarlo en un gráfico.

Exención de responsabilidad

La información y las publicaciones que ofrecemos, no implican ni constituyen un asesoramiento financiero, ni de inversión, trading o cualquier otro tipo de consejo o recomendación emitida o respaldada por TradingView. Puede obtener información adicional en las Condiciones de uso.

¿Quiere utilizar este script en un gráfico?
study("Highs & Lows by TaTrader", overlay = true)
time = input(title = "Timeframe (minutes)", defval = 240)

// Calculate Highs & Lows
low_m = lowest(low, 30*240/time)
high_m = highest(high, 30*240/time)
low_w = lowest(low, 15*240/time)
high_w = highest(high, 15*240/time)

// Set up Highs & Lows
bottom_m = valuewhen(low <= low_m[1], low, 0)
top_m = valuewhen(high >= high_m[1], high, 0)
bottom_w = valuewhen(low <= low_w[1], low, 0)
top_w = valuewhen(high >= high_w[1], high, 0)

// Draw Highs & Lows
// Important S&R Levels --> extend lines (hline)
plot(bottom_m, color=bottom_m != bottom_m[1] ? na : black, style = cross, linewidth = 2, join = true)
plot(top_m, color=top_m != top_m[1] ? na : black, style = cross, linewidth = 2, join = true)
plot(bottom_w, color=bottom_w != bottom_w[1] ? na : black, style = line, linewidth = 2, join = true)
plot(top_w, color=top_w != top_w[1] ? na : black, style = line, linewidth = 2, join = true)

// Breakthrough signals
plot(bottom_m, color=(close < bottom_m[1]) ? red : na, style = line, linewidth = 2)
plot(top_m, color=(close > top_m[1]) ? green : na, style = line, linewidth = 2)
plot(bottom_w, color=(close < bottom_w[1]) ? red : na, style = line, linewidth = 2)
plot(top_w, color=(close > top_w[1]) ? green : na, style = line, linewidth = 2)

plot(top_m, color=(close > top_m[1]) ? green : na, style = line, linewidth = 2)
plot(bottom_m, color=(close < bottom_m[1]) ? red : na, style = line, linewidth = 2)
plot(top_w, color=(close > top_w[1]) ? green : na, style = line, linewidth = 2)
plot(bottom_w, color=(close < bottom_w[1]) ? red  : na, style = line, linewidth = 2)

// PVT!!!
//plot((high_w - low_w) / (high_m[1] - low_m[1]) * rsi(hlc3, 14), color = black, join = true)