OPEN-SOURCE SCRIPT
Custom Buy Signal Indicator

//version=5
indicator("Custom Buy Signal Indicator", overlay=true)
// INPUTS
emaLength = input.int(9, title="EMA Length")
supertrendLength = input.int(10, title="SuperTrend Length")
supertrendFactor = input.float(2.0, title="SuperTrend Factor")
keltnerLength = input.int(20, title="Keltner Channel Length")
keltnerMult = input.float(1.0, title="Keltner Multiplier")
avgVolLength = input.int(20, title="Average Volume Length")
// CALCULATIONS
price = close
ema9 = ta.ema(price, emaLength)
// Condition 1: Price Crosses Above 9 EMA
crossAboveEMA = ta.crossover(price, ema9)
// Condition 2: Price is above central pivot line (previous day)
pivotCentral = (high[1] + low[1] + close[1]) / 3
abovePivot = price > pivotCentral
// Condition 3: SuperTrend
[supertrend, direction] = ta.supertrend(supertrendFactor, supertrendLength)
aboveSupertrend = price > supertrend
// Condition 4: VWAP
vwapLine = ta.vwap
aboveVWAP = price > vwapLine
// Condition 5: Above middle line of Keltner Channel
basisKC = ta.ema(price, keltnerLength)
rangeKC = ta.ema(high - low, keltnerLength)
upperKC = basisKC + keltnerMult * rangeKC
lowerKC = basisKC - keltnerMult * rangeKC
middleKC = basisKC
aboveKCmiddle = price > middleKC
// Condition 6: Above average volume
avgVol = ta.sma(volume, avgVolLength)
aboveAvgVol = volume > avgVol
// Combine all conditions
buySignal = crossAboveEMA and abovePivot and aboveSupertrend and aboveVWAP and aboveKCmiddle and aboveAvgVol
// Plotting
plotshape(buySignal, title="Buy Signal", location=location.belowbar, color=color.green, style=shape.labelup, text="BUY")
// Optional: Display Indicators
plot(ema9, title="EMA 9", color=color.orange)
plot(supertrend, title="SuperTrend", color=color.green)
plot(vwapLine, title="VWAP", color=color.blue)
plot(middleKC, title="KC Middle", color=color.purple)
indicator("Custom Buy Signal Indicator", overlay=true)
// INPUTS
emaLength = input.int(9, title="EMA Length")
supertrendLength = input.int(10, title="SuperTrend Length")
supertrendFactor = input.float(2.0, title="SuperTrend Factor")
keltnerLength = input.int(20, title="Keltner Channel Length")
keltnerMult = input.float(1.0, title="Keltner Multiplier")
avgVolLength = input.int(20, title="Average Volume Length")
// CALCULATIONS
price = close
ema9 = ta.ema(price, emaLength)
// Condition 1: Price Crosses Above 9 EMA
crossAboveEMA = ta.crossover(price, ema9)
// Condition 2: Price is above central pivot line (previous day)
pivotCentral = (high[1] + low[1] + close[1]) / 3
abovePivot = price > pivotCentral
// Condition 3: SuperTrend
[supertrend, direction] = ta.supertrend(supertrendFactor, supertrendLength)
aboveSupertrend = price > supertrend
// Condition 4: VWAP
vwapLine = ta.vwap
aboveVWAP = price > vwapLine
// Condition 5: Above middle line of Keltner Channel
basisKC = ta.ema(price, keltnerLength)
rangeKC = ta.ema(high - low, keltnerLength)
upperKC = basisKC + keltnerMult * rangeKC
lowerKC = basisKC - keltnerMult * rangeKC
middleKC = basisKC
aboveKCmiddle = price > middleKC
// Condition 6: Above average volume
avgVol = ta.sma(volume, avgVolLength)
aboveAvgVol = volume > avgVol
// Combine all conditions
buySignal = crossAboveEMA and abovePivot and aboveSupertrend and aboveVWAP and aboveKCmiddle and aboveAvgVol
// Plotting
plotshape(buySignal, title="Buy Signal", location=location.belowbar, color=color.green, style=shape.labelup, text="BUY")
// Optional: Display Indicators
plot(ema9, title="EMA 9", color=color.orange)
plot(supertrend, title="SuperTrend", color=color.green)
plot(vwapLine, title="VWAP", color=color.blue)
plot(middleKC, title="KC Middle", color=color.purple)
開源腳本
本著TradingView的真正精神,此腳本的創建者將其開源,以便交易者可以查看和驗證其功能。向作者致敬!雖然您可以免費使用它,但請記住,重新發佈程式碼必須遵守我們的網站規則。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。
開源腳本
本著TradingView的真正精神,此腳本的創建者將其開源,以便交易者可以查看和驗證其功能。向作者致敬!雖然您可以免費使用它,但請記住,重新發佈程式碼必須遵守我們的網站規則。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。