OPEN-SOURCE SCRIPT

Double EMA Crossover with Volume Filter

//version=5
indicator("Double EMA Crossover with Volume Filter", overlay=true)

// Inputs for EMA lengths
fast_ema_length = input.int(3, title="Fast EMA Length", minval=1)
slow_ema_length = input.int(30, title="Slow EMA Length", minval=1)

// Input for Volume settings
volume_length = input.int(20, title="Volume Moving Average Length", minval=1)

// Calculate EMAs
fast_ema = ta.ema(close, fast_ema_length)
slow_ema = ta.ema(close, slow_ema_length)

// Calculate Volume Average
avg_volume = ta.sma(volume, volume_length)

// Volume condition: Current volume is higher than average volume
is_high_volume = volume > avg_volume

// EMA Crossover conditions
bullish_crossover = ta.crossover(fast_ema, slow_ema) // Fast EMA crosses above Slow EMA
bearish_crossover = ta.crossunder(fast_ema, slow_ema) // Fast EMA crosses below Slow EMA

// Combine crossover and volume condition
bullish_signal = bullish_crossover and is_high_volume
bearish_signal = bearish_crossover and is_high_volume

// Plot EMAs
plot(fast_ema, color=color.blue, linewidth=2, title="Fast EMA (3)")
plot(slow_ema, color=color.orange, linewidth=2, title="Slow EMA (30)")

// Plot signals
plotshape(bullish_signal, style=shape.labelup, color=color.green, size=size.small, location=location.belowbar, text="Buy")
plotshape(bearish_signal, style=shape.labeldown, color=color.red, size=size.small, location=location.abovebar, text="Sell")

// Highlight high-volume bars
bgcolor(is_high_volume ? color.new(color.green, 90) : na, title="High Volume Highlight")
Candlestick analysis

開源腳本

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

想在圖表上使用此腳本?

免責聲明