PROTECTED SOURCE SCRIPT

InstColorRare

13
//version=5
indicator("InstColorRare-OnlyBarColor", shorttitle="InstRareOBC", overlay=true)

// ── 1) Inputs ────────────────────────────────────────────────
nVol = input.int(50, "MA Volume Period", minval=1)
thU = input.float(2.5,"Ultra Threshold", minval=0.1, step=0.1)
thVH = input.float(2.0,"Very Threshold", minval=0.1, step=0.1)
thH = input.float(1.5,"High Threshold", minval=0.1, step=0.1)
thL = input.float(0.6,"Low Threshold", minval=0.0, step=0.1)
cdU = input.int(3, "Cooldown Ultra", minval=0)
cdV = input.int(2, "Cooldown Very", minval=0)

// ── 2) Cálculos ──────────────────────────────────────────────
volMA = ta.sma(volume, nVol)
volRel = volume / volMA

// ── 3) Classificação Sato pura (sem spread) ─────────────────
rawU = volRel >= thU
rawV = volRel >= thVH
rawH = volRel >= thH
rawL = volRel <= thL

// aplica cooldownes
isU = rawU and ta.barssince(rawU[1]) > cdU
isV = rawV and not isU and ta.barssince(rawV[1]) > cdV
isH = rawH and not isU and not isV
isL = rawL

// ── 4) Só barcolor, nada mais ───────────────────────────────
col = isU ? color.rgb(190,39,39) : // Ultra
isV ? color.rgb(202,125,8) : // Very
isH ? color.rgb(224,208,59) : // High
isL ? color.rgb(178,218,252) : // Low
color.white // Normal

barcolor(col)

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

Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.