OPEN-SOURCE SCRIPT

ATR Histogram vs High-Low

170
//version=5
indicator("RSI+Price Confluence", overlay=false)

rsiSrc = input(close)
rsiLen = input.int(14)
emaRSI = input.int(9)
wmaRSI = input.int(45)
tf = input.timeframe("60")

emaF = input.int(21)
emaS = input.int(52)

// Lấy EMA và WMA của RSI HTF chỉ trong 1 lần request
ema_rsi = request.security(syminfo.tickerid, tf, ta.ema(ta.rsi(rsiSrc, rsiLen), emaRSI))
wma_rsi = request.security(syminfo.tickerid, tf, ta.wma(ta.rsi(rsiSrc, rsiLen), wmaRSI))

// Xác định lực RSI
luc_up = ema_rsi > wma_rsi
luc_down = ema_rsi < wma_rsi

// Lực giá (EMA nhanh & chậm)
gia_up = ta.ema(close, emaF) > ta.ema(close, emaS)
gia_down = ta.ema(close, emaF) < ta.ema(close, emaS)

// Tín hiệu cuối cùng
isUP = luc_up and gia_up
isDOWN = luc_down and gia_down
isNEU = not isUP and not isDOWN

// Vẽ cột tín hiệu, color= đầy đủ
plot(isUP ? 1 : na, title="UP", style=plot.style_columns, color=color.green, linewidth=6)
plot(isDOWN ? -1 : na, title="DOWN", style=plot.style_columns, color=color.red, linewidth=6)
plot(isNEU ? 0 : na, title="NEU", style=plot.style_columns, color=color.yellow, linewidth=6)

// Đường zero
hline(0, "", color=color.gray, linestyle=hline.style_dotted)

Disclaimer

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.