TAtrader

HL&SR levels by TaTrader

11
Hello,

I am still working on this. It doesn't work that well for now.
Skrip sumber terbuka

Dalam semangat TradingView yang sebenar, penulis skrip ini telah menerbitkannya dengan menggunakan sumber terbuka supaya pedagang-pedagang dapat memahami dan mengesahkannya. Sorakan kepada penulis! Anda dapat menggunakannya secara percuma tetapi penggunaan semula kod ini dalam penerbitan adalah dikawalselia oleh Peraturan Dalaman. Anda boleh menyukainya untuk menggunakannya pada carta.

Penafian

Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.

Ingin menggunakan skrip ini pada carta?
study(title = "HLSR levels by TaTrader", overlay = true)

////Calculate and set Highs & Lows////
time = input(title = "Timeframe (minutes)", defval = 240)

////Calculate and set Highs & Lows////

// weekly
//s2 = hlc3_w[1]-(high_w[1]-low_w[1])
s1 = hlc3_w[1]+hlc3_w[1]-high_w[1]
pp = sma(hlc3[1], 4*7200/time)
r1 = hlc3_w[1]+hlc3_w[1]-low_w[1]
//r2 = hlc3_w[1]+(high_w[1]-low_w[1])

low_w = lowest(low, 4*7200/time)
high_w = highest(high, 4*7200/time)
hlc3_w = sma(hlc3, 4*7200/time)
low_w_new = valuewhen(low <= low_w[1], low, 0)
high_w_new = valuewhen(high >= high_w[1], high, 0)
bottom_w_min = valuewhen(low_w_new <= lowest(low, 4*7200/time), low_w, 0)
//bottom_w_max = valuewhen(low_w_new <= lowest(high, 4*7200/time)[1], high, 0)
//top_w_min = valuewhen(high_w_new >= highest(low, 4*7200/time)[1], low, 0)
top_w_max = valuewhen(high_w_new >= highest(high, 4*7200/time), high_w, 0)

bottom_w = valuewhen(low[1] <= s1 and low[1] <= pp, low, 0)
top_w = valuewhen(high[1] >= r1 and high[1] >= pp, high, 0)

// plot static levels
W_bottom = plot(lowest(bottom_w_min, 4*7200/time), color = black, style = line, linewidth = 2)
//W_bottom_max = plot(lowest(bottom_w_max, 4*7200/time)[1], color = black, style = line, linewidth = 1)
//W_top_min = plot(highest(top_w_min, 4*7200/time)[1], color = black, style = line, linewidth = 1)
W_top = plot(highest(top_w_max, 4*7200/time), color = black, style = line, linewidth = 2)

// plot dynamic levels
//W_s2 = plot(s2, color = black, style = line, linewidth = 1)
//W_s1 = plot(s1, color = #0059FF, style = cross, linewidth = 2)
W_pp = plot(pp, color = #0059FF, style = line, linewidth = 2)
//W_r1 = plot(r1, color = #0059FF, style = cross, linewidth = 2)
//W_r2 = plot(r2, color = black, style = line, linewidth = 1)

W_bottom2 = plot(bottom_w, color = black, style = line, linewidth = 2)
W_top2 = plot(top_w, color = black, style = line, linewidth = 2)

// Combine lines
//fill(W_s2, W_s1, color = #FFFF00, transp = 70)
fill(W_bottom, W_bottom2, color = #008000, transp = 80)
//fill(W_bottom, W_bottom_max, color = #008000, transp = 80)
//fill(W_top_min, W_top, color = #FF0000, transp = 80)
fill(W_top, W_top2, color = #FF0000, transp = 80)
//fill(W_r2, W_r1, color = #FFFF00, transp = 70)


// Trending market: find a signal!