OPEN-SOURCE SCRIPT

MC² Pullback Screener v1.01

51
//version=5
indicator("MC² Pullback Screener v1.01", overlay=false)

//----------------------------------------------------
// 🔹 PARAMETERS
//----------------------------------------------------

lenTrend = input.int(20, "SMA Trend Length")
relVolLookback = input.int(10, "Relative Volume Lookback")
minRelVol = input.float(0.7, "Min Relative Volume on Pullback")
maxSpikeVol = input.float(3.5, "Max Spike Vol (Reject News Bars)")
pullbackBars = input.int(3, "Pullback Lookback Bars")

//----------------------------------------------------
// 🔹 DATA
//----------------------------------------------------

// Moving averages for trend direction
sma20 = ta.sma(close, lenTrend)
sma50 = ta.sma(close, 50)

// Relative Volume
volAvg = ta.sma(volume, relVolLookback)
relVol = volume / volAvg

// Trend condition
uptrend = close > sma20 and sma20 > sma50

//----------------------------------------------------
// 🔹 BREAKOUT + PULLBACK LOGIC
//----------------------------------------------------

// Recent breakout reference
recentHigh = ta.highest(close, 10)
isBreakout = close > recentHigh[1]

// Pullback logic
nearSupport = close > recentHigh[1] * 0.98 and close < recentHigh[1] * 1.02
lowVolPullback = relVol < minRelVol

// Reject single-bar news spike
rejectSpike = relVol > maxSpikeVol

//----------------------------------------------------
// 🔹 ENTRY SIGNAL
//----------------------------------------------------

pullbackSignal = uptrend and lowVolPullback and nearSupport and not rejectSpike

//----------------------------------------------------
// 🔹 SCREENER OUTPUT
//----------------------------------------------------

// Pine Screener expects a plot output
plot(pullbackSignal ? 1 : 0, title="MC² Pullback Signal", style=plot.style_columns, color=pullbackSignal ? color.green : color.black)

免责声明

这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。