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.
Mã nguồn mở

Với tinh thần TradingView, tác giả của tập lệnh này đã xuất bản nó dưới dạng mã nguồn mở, vì vậy các nhà giao dịch có thể hiểu và xác minh nó. Chúc mừng tác giả! Bạn có thể sử dụng mã này miễn phí, nhưng việc sử dụng lại mã này trong một ấn phẩm chịu sự điều chỉnh của Nội quy nội bộ. Bạn có thể yêu thích nó để sử dụng nó trên biểu đồ.

Thông báo miễn trừ trách nhiệm

Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.

Bạn muốn sử dụng tập lệnh này trên biểu đồ?
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)