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 aberto

Dentro do verdadeiro espírito TradingView, o autor deste script publicou ele como um script de código aberto, para que os traders possam compreender e checar ele. Um viva ao autor! Você pode usá-lo gratuitamente, mas a reutilização deste código em uma publicação é regida pelas Regras da Casa. Você pode favoritá-lo para usá-lo em um gráfico.

Aviso legal

As informações e publicações não devem ser e não constituem conselhos ou recomendações financeiras, de investimento, de negociação ou de qualquer outro tipo, fornecidas ou endossadas pela TradingView. Leia mais em Termos de uso.

Quer usar esse script no 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)