tôi tự code thôi, cho bác source code bác tự mở pine editor lên save vào nhé, xong set up như này
//
View attachment 302275
rồi nó sẽ ra như sau
View attachment 302276
cứ cao trên cái vạch chấm chấm là trên 1 là quất thôi
//@version=5
//Ratio of candle price range with ATR
indicator(title="Candle Filter", overlay=false)
length = input.int(title="Length", defval=14, minval=1)
smoothing = input.string(title="Smoothing", defval="RMA", options=["RMA", "SMA", "EMA", "WMA"])
ma_function(source, length) =>
switch smoothing
"RMA" => ta.rma(source, length)
"SMA" => ta.sma(source, length)
"EMA" => ta.ema(source, length)
=> ta.wma(source, length)
candleRange = math.abs(close - open)
candleFullRange = math.abs(high - low)
candleRatio = candleFullRange/ma_function(ta.tr(true), length)
h0 = hline(1, "Base Line", color=#787B86)
plot(candleRatio, title = "Candle Ratio", color = color.green)