OPEN-SOURCE SCRIPT
MC² Daily Candidates (v1.0 SAFE)

// This Pine Script® code is subject to the terms of the Mozilla Public License 2.0 at mozilla.org/MPL/2.0/
// © mason_fibkins
//version=5
indicator("MC² Daily Candidates (v1.0 SAFE)", overlay=true)
// ──────────────────────────────────────────
// INTERNAL DAILY DATA (NO TIMEFRAME ARGUMENT)
// ──────────────────────────────────────────
getDaily(_src) =>
request.security(syminfo.tickerid, "D", _src)
// Daily values
d_close = getDaily(close)
d_open = getDaily(open)
d_high = getDaily(high)
d_low = getDaily(low)
d_vol = getDaily(volume)
// ──────────────────────────────────────────
// Parameters
// ──────────────────────────────────────────
lookbackVol = input.int(10, "Vol Lookback (days)")
atrLength = input.int(14, "ATR Length")
emaLen = input.int(20, "EMA Length")
smaLen = input.int(50, "SMA Length")
// ──────────────────────────────────────────
// Core Calculations (DAILY)
// ──────────────────────────────────────────
// Relative Volume
relVol = d_vol / request.security(syminfo.tickerid, "D", ta.sma(volume, lookbackVol))
// Momentum — last 2 daily bullish candles
twoGreen = (d_close > d_open) and (request.security(syminfo.tickerid, "D", close[1]) > request.security(syminfo.tickerid, "D", open[1]))
// Trend filters
emaTrend = d_close > request.security(syminfo.tickerid, "D", ta.ema(close, emaLen))
smaTrend = d_close > request.security(syminfo.tickerid, "D", ta.sma(close, smaLen))
// ATR Expansion
d_atr = request.security(syminfo.tickerid, "D", ta.atr(atrLength))
atrExpand = d_atr > request.security(syminfo.tickerid, "D", ta.atr(atrLength))[1]
// Strong Close
dayRange = d_high - d_low
closePos = dayRange > 0 ? (d_close - d_low) / dayRange : 0.5
strongClose = closePos > 0.70
// MASTER CONDITION
candidate = relVol > 2.0 and twoGreen and emaTrend and smaTrend and atrExpand and strongClose
// ──────────────────────────────────────────
// PLOT — GREEN CIRCLE BELOW DAILY BARS
// ──────────────────────────────────────────
plotshape(candidate, title="Daily Candidate", style=shape.circle, size=size.large, color=color.new(color.green, 0), location=location.belowbar, text="MC²")
// ──────────────────────────────────────────
// END
// ──────────────────────────────────────────
plot(candidate ? 1 : 0, title="MC2_Signal", display=display.none)
// © mason_fibkins
//version=5
indicator("MC² Daily Candidates (v1.0 SAFE)", overlay=true)
// ──────────────────────────────────────────
// INTERNAL DAILY DATA (NO TIMEFRAME ARGUMENT)
// ──────────────────────────────────────────
getDaily(_src) =>
request.security(syminfo.tickerid, "D", _src)
// Daily values
d_close = getDaily(close)
d_open = getDaily(open)
d_high = getDaily(high)
d_low = getDaily(low)
d_vol = getDaily(volume)
// ──────────────────────────────────────────
// Parameters
// ──────────────────────────────────────────
lookbackVol = input.int(10, "Vol Lookback (days)")
atrLength = input.int(14, "ATR Length")
emaLen = input.int(20, "EMA Length")
smaLen = input.int(50, "SMA Length")
// ──────────────────────────────────────────
// Core Calculations (DAILY)
// ──────────────────────────────────────────
// Relative Volume
relVol = d_vol / request.security(syminfo.tickerid, "D", ta.sma(volume, lookbackVol))
// Momentum — last 2 daily bullish candles
twoGreen = (d_close > d_open) and (request.security(syminfo.tickerid, "D", close[1]) > request.security(syminfo.tickerid, "D", open[1]))
// Trend filters
emaTrend = d_close > request.security(syminfo.tickerid, "D", ta.ema(close, emaLen))
smaTrend = d_close > request.security(syminfo.tickerid, "D", ta.sma(close, smaLen))
// ATR Expansion
d_atr = request.security(syminfo.tickerid, "D", ta.atr(atrLength))
atrExpand = d_atr > request.security(syminfo.tickerid, "D", ta.atr(atrLength))[1]
// Strong Close
dayRange = d_high - d_low
closePos = dayRange > 0 ? (d_close - d_low) / dayRange : 0.5
strongClose = closePos > 0.70
// MASTER CONDITION
candidate = relVol > 2.0 and twoGreen and emaTrend and smaTrend and atrExpand and strongClose
// ──────────────────────────────────────────
// PLOT — GREEN CIRCLE BELOW DAILY BARS
// ──────────────────────────────────────────
plotshape(candidate, title="Daily Candidate", style=shape.circle, size=size.large, color=color.new(color.green, 0), location=location.belowbar, text="MC²")
// ──────────────────────────────────────────
// END
// ──────────────────────────────────────────
plot(candidate ? 1 : 0, title="MC2_Signal", display=display.none)
開源腳本
秉持TradingView一貫精神,這個腳本的創作者將其設為開源,以便交易者檢視並驗證其功能。向作者致敬!您可以免費使用此腳本,但請注意,重新發佈代碼需遵守我們的社群規範。
免責聲明
這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。
開源腳本
秉持TradingView一貫精神,這個腳本的創作者將其設為開源,以便交易者檢視並驗證其功能。向作者致敬!您可以免費使用此腳本,但請注意,重新發佈代碼需遵守我們的社群規範。
免責聲明
這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。