I'm pretty much a beginner at coding but am trying to create an indicator with multiple confirmations and alerts but have come across a few issues.
My strategy is to use adx crossunders ,higher volume at the cross , engulfing candles and pivot points with all needing to happen at the same time.
I have started to code the first parameter which is the -DI cross under the plusDI and also the crossunder of plusDm and -DI to show on my chart. As further confirmation I am also trying to add engulfing candles at the point of a cross and two other confirmations which are increase in volume (last 2 bars) and price being at swing high or swing low maybe using fractal before any alerts are triggered. I am using this on lower timeframes eg 1min - 5min charts. If anyone could help with this or point me in the direction of how I combine them all into one alert it be would be massively appreciated.
Thank you!
//@version=5
indicator("My script")
//DMI + ADX
lensig = input.int(14, title="ADX Smoothing", minval=1, maxval=50)
len = input.int(14, minval=1, title="DI Length")
up = ta.change(high)
down = -ta.change(low)
plusDM = na(up) ? na : (up > down and up > 0 ? up : 0)
minusDM = na(down) ? na : (down > up and down > 0 ? down : 0)
trur = ta.rma(ta.tr, len)
plus = fixnan(100 * ta.rma(plusDM, len) / trur)
minus = fixnan(100 * ta.rma(minusDM, len) / trur)
sum = plus + minus
adx = 100 * ta.rma(math.abs(plus - minus) / (sum == 0 ? 1 : sum), lensig)
adxmax = input.int(50, title="ADX Max Buying Area", minval=1, maxval=100)
adxmin = input.int(0, title="ADX Min Buying Area", minval=0, maxval=99)
//identify engulfing candles
bullishEC = close > open[1] and close[1] < open[1]
bearishEC = close < open[1] and close [1] > close [1]
//plotshape( series=bearishEC, style = shape.cross , color=color.black, location=location.abovebar)
//plotshape( series=bullishEC, style = shape.circle , color=color.black, location=location.abovebar)
//DI cross alert
DIPcross = ta.crossover(plus, minus) ? plus : na
plotshape(DIPcross, style = shape.circle , color=color.teal, location=location.absolute)
DINcross = ta.crossover(minus, plus) ? minus : na
plotshape(DINcross, style = shape.circle , color=color.red, location=location.absolute)
plot(adx, color=color.orange, title="ADX", linewidth=2)
p1 = plot(plus, color=color.teal, title="+DI", linewidth=1)
p2 = plot(minus, color=color.yellow, title="-DI", linewidth=1)
adxmaxl = hline(adxmax, title="ADX MaxLine", color=color.silver, linestyle=hline.style_solid)
adxminl = hline(adxmin, title="ADX MinLine", color=color.silver, linestyle=hline.style_solid)