OPEN-SOURCE SCRIPT

ROC Spike Alert by Jaani

41
//version=5
indicator("ROC Spike Alert by Jaani", overlay=true)

// === Inputs ===
rocLength = input.int(9, title="ROC Length")
spikeThreshold = input.float(2.0, title="Spike Threshold (%)")

// === ROC Calculation ===
roc = 100 * (close - close[rocLength]) / close[rocLength]

// === Spike Conditions ===
bullishSpike = roc > spikeThreshold
bearishSpike = roc < -spikeThreshold

// === Plot ROC on Separate Scale
plot(roc, title="ROC", color=color.blue, linewidth=1, display=display.none)

// === Signal Plotting on Chart ===
plotshape(bullishSpike, title="Bullish Spike", location=location.belowbar,
color=color.green, style=shape.triangleup, size=size.small, text="BUY")

plotshape(bearishSpike, title="Bearish Spike", location=location.abovebar,
color=color.red, style=shape.triangledown, size=size.small, text="SELL")

// === Alerts ===
alertcondition(bullishSpike, title="ROC Bullish Spike", message="ROC UP Spike Detected - BUY Signal")
alertcondition(bearishSpike, title="ROC Bearish Spike", message="ROC DOWN Spike Detected - SELL Signal")

Penafian

Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.