OPEN-SOURCE SCRIPT

Minho Index | SETUP (Safe Filter 90%)

125
//version=5
indicator("Minho Index | SETUP (Safe Filter 90%)", shorttitle="Minho Index | SETUP+", overlay=false)


//--------------------------------------------------------
// ⚙️ INPUTS
//--------------------------------------------------------
bullColor = input.color(color.new(color.lime, 0), "Bull Color (Minho Green)")
bearColor = input.color(color.new(color.red, 0), "Bear Color (Red)")
neutralColor = input.color(color.new(color.white, 0), "Neutral Color (White)")
lineWidth = input.int(2, "Line Width")
period = input.int(14, "RSI Period")
centerLine = input.float(50.0, "Central Line (Fixed at 50)")


//--------------------------------------------------------
// 🧠 BASE RSI + INTERNAL SMOOTHING
//--------------------------------------------------------
rsiBase = ta.rsi(close, period)
rsiSmooth = ta.sma(rsiBase, 3) // light smoothing


//--------------------------------------------------------
// 🔍 TREND DETECTION AND NEUTRAL ZONE
//--------------------------------------------------------
trendUp = (rsiSmooth > rsiSmooth[1]) and (rsiSmooth[1] > rsiSmooth[2])
trendDown = (rsiSmooth < rsiSmooth[1]) and (rsiSmooth[1] < rsiSmooth[2])
slopeUp = (rsiSmooth > rsiSmooth[1])
slopeDown = (rsiSmooth < rsiSmooth[1])

lineColor = neutralColor
if trendUp
lineColor := bullColor
else if trendDown
lineColor := bearColor
else if slopeUp or slopeDown
lineColor := neutralColor


//--------------------------------------------------------
// 📈 MAIN INDEX LINE
//--------------------------------------------------------
plot(rsiSmooth, title="Dynamic RSI Line (Safe Filter)", color=lineColor, linewidth=lineWidth)


//--------------------------------------------------------
// ⚪ FIXED CENTRAL LINE
//--------------------------------------------------------
plot(centerLine, title="Central Line (Highlight)", color=neutralColor, linewidth=1)


//--------------------------------------------------------
// 📊 NORMALIZED MOVING AVERAGES (SMA20 and EMA20)
//--------------------------------------------------------
SMA20 = ta.sma(close, 20)
EMA20 = ta.ema(close, 20)

// Normalization 0–100
minPrice = ta.lowest(low, 100)
maxPrice = ta.highest(high, 100)

rangeCalc = maxPrice - minPrice
rangeCalc := rangeCalc == 0 ? 1 : rangeCalc

normSMA = ((SMA20 - minPrice) / rangeCalc) * 100
normEMA = ((EMA20 - minPrice) / rangeCalc) * 100


//--------------------------------------------------------
// 🩶 MOVING AVERAGES PLOTS (GHOST-GREY STYLE)
//--------------------------------------------------------
ghostColor = color.new(color.rgb(200,200,200), 65)
plot(normSMA, title="SMA 20 (Ghost Grey)", color=ghostColor, linewidth=2)
plot(normEMA, title="EMA 20 (Ghost Grey)", color=ghostColor, linewidth=2)


//--------------------------------------------------------
// 🌈 FILL BETWEEN MOVING AVERAGES
//--------------------------------------------------------
bullCond = normSMA < normEMA
bearCond = normSMA > normEMA

fill(
plot(normSMA, display=display.none),
plot(normEMA, display=display.none),
color = bearCond ? color.new(color.red, 55) :
bullCond ? color.new(color.lime, 55) : na
)


//--------------------------------------------------------
// ✅ END OF INDICATOR
//--------------------------------------------------------

Pernyataan Penyangkalan

Informasi dan publikasi ini tidak dimaksudkan, dan bukan merupakan, saran atau rekomendasi keuangan, investasi, trading, atau jenis lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Ketentuan Penggunaan.