//version=5
indicator(“MACD + ADX + RSI Strategy”, overlay=true)

// MACD settings
[macdLine, signalLine, _] = ta.macd(close, 12, 26, 9)
macdHist = macdLine – signalLine

// ADX settings
adxValue = ta.adx(14)

// RSI settings
rsiValue = ta.rsi(close, 14)

// Conditions of purchase and sale
buySignal = (macdLine > signalLine) and (adxValue > 20) and (rsiValue < 30)
sellSignal = (macdLine < signalLine) and (adxValue > 20) and (rsiValue > 70)

// Draw the signals on the graph
plotshape(buySignal, style=shape.labelup, location=location.belowbar, color=color.green, size=size.small, title=”Buy Signal”, text=”BUY”)
plotshape(sellSignal, style=shape.labeldown, location=location.abovebar, color=color.red, size=size.small, title=”Sell Signal”, text=”SELL”)

// Display the values ​​of the indicators in a separate panel
hline(20, “ADX Threshold”, color=color.gray)
plot(adxValue, title=”ADX”, color=color.blue)
hline(30, “RSI Oversold”, color=color.green)
hline(70, “RSI Overbought”, color=color.red)
plot(rsiValue, title=”RSI”, color=color.orange)

Shares:

Leave a Reply

Your email address will not be published. Required fields are marked *