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

Skrip sumber terbuka

Dalam semangat sebenar TradingView, penulis telah menerbitkan kod Pine ini sebagai sumber terbuka supaya pedagang dapat memahami dan mengesahkannya. Sorakan kepada penulis! Anda boleh menggunakan perpustakaan ini secara percuma, tetapi penggunaan semula kod dalam penerbitan ini adalah dikawal oleh Peraturan dalaman. Anda boleh menyukainya untuk menggunakannya pada carta.

Ingin menggunakan skrip ini pada carta?

Penafian