Home Advanced Filtered Supertrend [High Accuracy] Advanced Filtered Supertrend [High Accuracy] pine script Advanced Filtered Supertrend [High Accuracy] pine script Software Technique Web Technique All Computer Language and Computer Language Practice Computer Educa July 20, 2025 0 Comments Share: Facebook Twitter Google+ Pinterest Whatsapp TREDING //@version=5 indicator("Advanced Filtered Supertrend [High Accuracy]", overlay=true) // === INPUTS === atrPeriod = input.int(10, title="ATR Period") factor = input.float(3.0, title="Supertrend Multiplier") minBodySize = input.float(0.4, title="Min Candle Body %") emaShort = input.int(5, title="EMA Short (Trend Confirm)") emaLong = input.int(21, title="EMA Long (Trend Confirm)") volMultiplier = input.float(0.8, title="Min Volume % of Avg") // === TIMEFRAME SETTING (5M Supertrend) === htf = "5" htf_close = request.security(syminfo.tickerid, htf, close) htf_high = request.security(syminfo.tickerid, htf, high) htf_low = request.security(syminfo.tickerid, htf, low) // === ATR and Supertrend Bands === atr = request.security(syminfo.tickerid, htf, ta.atr(atrPeriod)) upperBand = (htf_high + htf_low) / 2 + factor * atr lowerBand = (htf_high + htf_low) / 2 - factor * atr var float finalUpper = na var float finalLower = na var int trend = 1 finalUpper := na(finalUpper[1]) ? upperBand : (htf_close[1] > finalUpper[1] ? math.max(upperBand, finalUpper[1]) : upperBand) finalLower := na(finalLower[1]) ? lowerBand : (htf_close[1] < finalLower[1] ? math.min(lowerBand, finalLower[1]) : lowerBand) trend := htf_close > finalUpper[1] ? 1 : htf_close < finalLower[1] ? -1 : trend[1] // === FILTER 1: Candle Body Strength === candleBody = math.abs(close - open) candleRange = high - low bodyPercent = candleRange > 0 ? (candleBody / candleRange) * 100 : 0 validBody = bodyPercent > minBodySize // === FILTER 2: EMA Trend Confirmation === emaShortVal = ta.ema(close, emaShort) emaLongVal = ta.ema(close, emaLong) emaBullish = emaShortVal > emaLongVal emaBearish = emaShortVal < emaLongVal // === FILTER 3: Volume Confirmation === avgVol = ta.sma(volume, 20) volCondition = volume > avgVol * volMultiplier // === FINAL SIGNALS === buySignal = trend == 1 and trend[1] == -1 and validBody and emaBullish and volCondition sellSignal = trend == -1 and trend[1] == 1 and validBody and emaBearish and volCondition // === PLOT SIGNALS === plotshape(buySignal, title="BUY", location=location.belowbar, style=shape.labelup, color=color.green, text="BUY", textcolor=color.white) plotshape(sellSignal, title="SELL", location=location.abovebar, style=shape.labeldown, color=color.red, text="SELL", textcolor=color.white) plot(trend == 1 ? finalLower : na, title="Trend Support", color=color.green, linewidth=2) plot(trend == -1 ? finalUpper : na, title="Trend Resistance", color=color.red, linewidth=2) bgcolor(trend == 1 ? color.new(color.green, 85) : trend == -1 ? color.new(color.red, 85) : na) Copy Copied Text:
No comments