PROTECTED SOURCE SCRIPT

TheDu Engulfing + vol20

11

// Volume filter settings
volumeLength = input.int(20, title="Volume MA Length", minval=1)
volumeThreshold = input.float(1.2, title="Volume Threshold (1.2 = 120%)", minval=1.0, step=0.1)

// Calculate volume moving average
volumeMA = ta.sma(volume, volumeLength)

// Volume condition: current volume > volume MA * threshold
volumeCondition = volume > volumeMA * volumeThreshold

// bullish engulfing with volume filter
bullishEngulfing = open[1] > close[1] ? close > open ? close >= open[1] ? close[1] >= open ? close - open > open[1] - close[1] ? volumeCondition ? color.blue : na : na : na : na : na : na
barcolor(bullishEngulfing)

// bearish engulfing with volume filter
bearishEngulfing = close[1] > open[1] ? open > close ? open >= close[1] ? open[1] >= close ? open - close > close[1] - open[1] ? volumeCondition ? color.purple : na : na : na : na : na : na
barcolor(bearishEngulfing)

alertcondition(bullishEngulfing != na, title='Bullish Engulfing', message='[CurrencyPair] [TimeFrame], Bullish candle engulfing previous candle with high volume')
alertcondition(bearishEngulfing != na, title='Bearish Engulfing', message='[CurrencyPair] [TimeFrame], Bearish candle engulfing previous candle with high volume')

// Optional: Plot volume MA for reference
plot(volumeMA, title="Volume MA", color=color.gray, display=display.none)

Declinazione di responsabilità

Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.