OPEN-SOURCE SCRIPT

Commodity Channel Index

51
// BUY CONDITION
buySignal = direction < 0 and ta.crossover(cci, -100)

// ENTRY PRICE
entryPrice = close

// STOP LOSS AT SUPERTREND
stopLoss = supertrend

// RISK CALCULATION
risk = entryPrice - stopLoss

// TARGET 1:2
target = entryPrice + (risk * 2)

// ALERT
alertcondition(buySignal, title="BUY", message="Supertrend Green + CCI Cross Above -100 | RR 1:2")

// OPTIONAL PLOTS
plotshape(buySignal, title="BUY Signal", location=location.belowbar, color=color.green, style=shape.labelup, text="BUY")
plot(stopLoss, title="Stop Loss", color=color.red)
plot(target, title="Target 1:2", color=color.green)

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.