OPEN-SOURCE SCRIPT

Comprehensive Trading Indicator

//version=6
indicator("Comprehensive Trading Indicator", overlay=true)

// === Inputs ===
showSupportResistance = input.bool(true, "Show Support/Resistance Levels")
showCandlestickPatterns = input.bool(true, "Show Candlestick Patterns")
showMovingAverages = input.bool(true, "Show Moving Averages")
maLength1 = input.int(50, "MA 1 Length")
maLength2 = input.int(200, "MA 2 Length")
showVolumeAnalysis = input.bool(true, "Show Volume Analysis")
volumeThreshold = input.float(1.5, "Volume Spike Multiplier")

// === Moving Averages ===
ma1 = ta.sma(close, maLength1)
ma2 = ta.sma(close, maLength2)

// Plot Moving Averages (handled dynamically)
plot(showMovingAverages ? ma1 : na, color=color.blue, linewidth=2, title="MA 1")
plot(showMovingAverages ? ma2 : na, color=color.red, linewidth=2, title="MA 2")

// === Support and Resistance ===
support = ta.lowest(close, 20)
resistance = ta.highest(close, 20)

// Draw Support and Resistance Levels
if showSupportResistance
line.new(bar_index - 1, support, bar_index, support, color=color.green, width=1, style=line.style_dotted)
line.new(bar_index - 1, resistance, bar_index, resistance, color=color.red, width=1, style=line.style_dotted)

// === Candlestick Patterns ===
bullishEngulfing = ta.crossover(close, open[1]) and close > open
bearishEngulfing = ta.crossunder(close, open[1]) and close < open

// Label Candlestick Patterns
if showCandlestickPatterns
if bullishEngulfing
label.new(bar_index, high, "Bullish Engulfing", color=color.new(color.green, 0), style=label.style_label_down)
if bearishEngulfing
label.new(bar_index, low, "Bearish Engulfing", color=color.new(color.red, 0), style=label.style_label_up)

// === Volume Analysis ===
avgVolume = ta.sma(volume, 50)
volumeSpike = volume > avgVolume * volumeThreshold

// Highlight Volume Spikes (handled dynamically)
bgcolor(showVolumeAnalysis and volumeSpike ? color.new(color.blue, 90) : na, title="Volume Spike")

// === Alerts ===
alertcondition(volumeSpike, title="Volume Spike Alert", message="High volume spike detected!")
alertcondition(bullishEngulfing, title="Bullish Pattern Alert", message="Bullish Engulfing pattern detected!")
alertcondition(bearishEngulfing, title="Bearish Pattern Alert", message="Bearish Engulfing pattern detected!")

// === Chart Annotations ===
var string titleText = "Comprehensive Trading Indicator\n- Moving Averages (50, 200)\n- Support/Resistance Levels\n- Candlestick Patterns\n- Volume Analysis"
Chart patterns

開源腳本

在真正的TradingView精神中,這個腳本的作者以開源的方式發佈,這樣交易員可以理解和驗證它。請向作者致敬!您可以免費使用它,但在出版物中再次使用這段程式碼將受到網站規則的約束。 您可以收藏它以在圖表上使用。

想在圖表上使用此腳本?

免責聲明