OPEN-SOURCE SCRIPT

🔍 Candle Scanner (75m/D/W/M) + Volume + EMA + Trend

71
//version=5
indicator("🔍 Candle Scanner (75m/D/W/M) + Volume + EMA + Trend", overlay=true)

is75min = timeframe.period == "75"

// Time Slot Logic for 75-min only
startTime = timestamp("Asia/Kolkata", year, month, dayofmonth, 9, 15)
candle75 = math.floor((time - startTime) / (75 * 60 * 1000)) + 1
candleNo = is75min and candle75 >= 1 and candle75 <= 5 ? candle75 : na

getTimeSlot(n) =>
slot = ""
if n == 1
slot := "09:15–10:30"
else if n == 2
slot := "10:30–11:45"
else if n == 3
slot := "11:45–13:00"
else if n == 4
slot := "13:00–14:15"
else if n == 5
slot := "14:15–15:30"
slot

// EMA Filters
ema20 = ta.ema(close, 20)
ema50 = ta.ema(close, 50)
aboveEMA20 = close > ema20
aboveEMA50 = close > ema50

// Volume Strength
avgVol = ta.sma(volume, 20)
volStrength = volume > avgVol ? "High Volume" : "Low Volume"

// Candle Body Strength
bodySize = math.abs(close - open)
fullSize = high - low
bodyStrength = fullSize > 0 ? (bodySize / fullSize > 0.6 ? "Strong Body" : "Small Body") : "Small Body"

// Prior Trend
priorTrend = close[1] < close[2] and close[2] < close[3] ? "Downtrend" :
close[1] > close[2] and close[2] > close[3] ? "Uptrend" : "Sideways"

// Patterns
bullishEngulfing = close > open and close[1] < open[1] and close > open[1] and open < close[1]
bearishEngulfing = close < open and close[1] > open[1] and close < open[1] and open > close[1]
hammer = (high - low) > 3 * bodySize and (close - low) / (0.001 + high - low) > 0.6 and (open - low) / (0.001 + high - low) > 0.6
shootingStar = (high - low) > 3 * bodySize and (high - close) / (0.001 + high - low) > 0.6 and (high - open) / (0.001 + high - low) > 0.6
doji = bodySize <= fullSize * 0.1
morningStar = close[2] < open[2] and bodySize[1] < (high[1] - low[1]) * 0.3 and close > (open[2] + close[2]) / 2
eveningStar = close[2] > open[2] and bodySize[1] < (high[1] - low[1]) * 0.3 and close < (open[2] + close[2]) / 2

// Pattern Selection
pattern = ""
sentiment = ""
colorBox = color.gray
yOffset = 15

if bullishEngulfing
pattern := "Bull Engulfing"
sentiment := "Bullish"
colorBox := color.green
yOffset := -15
else if bearishEngulfing
pattern := "Bear Engulfing"
sentiment := "Bearish"
colorBox := color.red
yOffset := 15
else if hammer
pattern := "Hammer"
sentiment := "Bullish"
colorBox := color.green
yOffset := -15
else if shootingStar
pattern := "Shooting Star"
sentiment := "Bearish"
colorBox := color.red
yOffset := 15
else if doji
pattern := "Doji"
sentiment := "Neutral"
colorBox := color.gray
yOffset := 15
else if morningStar
pattern := "Morning Star"
sentiment := "Bullish"
colorBox := color.green
yOffset := -15
else if eveningStar
pattern := "Evening Star"
sentiment := "Bearish"
colorBox := color.red
yOffset := 15

timeSlot = is75min and not na(candleNo) ? getTimeSlot(candleNo) : ""
info = pattern != "" ? "🕒 " + (is75min ? timeSlot + " | " : "") + pattern + " (" + sentiment + ") | " + volStrength + " | " + bodyStrength + " | Trend: " + priorTrend + " | EMA20: " + (aboveEMA20 ? "Above" : "Below") + " | EMA50: " + (aboveEMA50 ? "Above" : "Below") : ""

// Label Draw
var label lb = na
if info != ""
lb := label.new(bar_index, high + yOffset, text=info, style=label.style_label_down, textcolor=color.white, size=size.small, color=colorBox)
label.delete(lb[1])

// Smart Alert
validAlert = pattern != "" and (volStrength == "High Volume") and bodyStrength == "Strong Body" and (aboveEMA20 or aboveEMA50)
alertcondition(validAlert, title="📢 Smart Candle Alert", message="Smart Alert: Candle with Volume + EMA + Trend + Pattern Filtered")

免責聲明

這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。