OPEN-SOURCE SCRIPT
My script

//version=5
indicator("IMK RSI-50 10x Reversal (Buy/Sell + Divergence + MTF + MAs + Alerts)", overlay=true, max_labels_count=500)
//========================================================
// 🔧 Inputs
//========================================================
rsiLen = input.int(14, "RSI Length")
stochLen = input.int(14, "Stoch RSI Length")
kLen = input.int(3, "Stoch K")
dLen = input.int(3, "Stoch D")
volShortLen = input.int(5, "Volume Short EMA")
volLongLen = input.int(20, "Volume Long EMA")
shortMA_len = input.int(20, "Short MA Length")
longMA_len = input.int(800, "Long MA Length")
lbL = input.int(2, "Pivot Left (Div)")
lbR = input.int(2, "Pivot Right (Div)")
requireDiv = input.bool(true, "Require Bullish Divergence?")
useMTF = input.bool(true, "Use Higher-Timeframe RSI?")
htf = input.timeframe("240", "Higher TF (4H)")
//========================================================
// 📈 Moving Averages
//========================================================
shortMA = ta.sma(close, shortMA_len)
longMA = ta.sma(close, longMA_len)
plot(shortMA, "Short MA", color=color.orange, linewidth=2)
plot(longMA, "800 MA", color=color.blue, linewidth=2)
//========================================================
// 📈 RSI + Crosses
//========================================================
rsi = ta.rsi(close, rsiLen)
rsi50 = 50
rsiCrossUp = ta.crossover(rsi, rsi50)
rsiCrossDown = ta.crossunder(rsi, rsi50)
//========================================================
// ⏫ MTF Confirmation
//========================================================
rsiHTF = request.security(syminfo.tickerid, htf, ta.rsi(close, rsiLen))
htfOk = useMTF ? rsiHTF > 50 : true
//========================================================
// 🌀 Stoch RSI
//========================================================
rsiSrc = rsi
rsiLowest = ta.lowest(rsiSrc, stochLen)
rsiHighest = ta.highest(rsiSrc, stochLen)
stochRaw = (rsiSrc - rsiLowest) / math.max(rsiHighest - rsiLowest, 1e-10) * 100
k = ta.sma(stochRaw, kLen)
d = ta.sma(k, dLen)
stochCrossUp = ta.crossover(k, d)
stochCrossDown = ta.crossunder(k, d)
//========================================================
// 📦 Volume Oscillator
//========================================================
volShort = ta.ema(volume, volShortLen)
volLong = ta.ema(volume, volLongLen)
volOsc = volShort - volLong
volPositive = volOsc > 0
//========================================================
// 🔍 Bullish Divergence (Simple)
//========================================================
plPrice = ta.pivotlow(low, lbL, lbR)
plRSI = ta.pivotlow(rsi, lbL, lbR)
priceLow1 = ta.valuewhen(not na(plPrice), low[lbR], 0)
priceLow2 = ta.valuewhen(not na(plPrice), low[lbR], 1)
rsiLow1 = ta.valuewhen(not na(plRSI), rsi[lbR], 0)
rsiLow2 = ta.valuewhen(not na(plRSI), rsi[lbR], 1)
bullDivSimple =
not na(priceLow1) and not na(priceLow2) and
not na(rsiLow1) and not na(rsiLow2) and
priceLow1 < priceLow2 and rsiLow1 > rsiLow2
//========================================================
// 🎯 IMK A+ Long Setup
//========================================================
coreOK = rsiCrossUp and stochCrossUp and volPositive
divOK = requireDiv ? bullDivSimple : true
aPlusLong = coreOK and divOK and htfOk
//========================================================
// 🟢 BUY / 🔴 SELL Signals
//========================================================
buySignal = aPlusLong
sellSignal = rsiCrossDown // Clean exit rule
plotshape(buySignal, title="BUY", style=shape.triangleup, location=location.belowbar, color=color.green, size=size.small, text="BUY")
plotshape(sellSignal, title="SELL", style=shape.triangledown, location=location.abovebar, color=color.red, size=size.small, text="SELL")
//========================================================
// 🔔 ALERT CONDITIONS (OPTIMIZED FOR PHONE & EMAIL)
//========================================================
alertcondition(rsiCrossUp, title="RSI 50 CROSS UP",
message="IMK ALERT: RSI crossed ABOVE 50 — potential entry.")
alertcondition(rsiCrossDown, title="RSI 50 CROSS DOWN",
message="IMK ALERT: RSI fell BELOW 50 — exit signal.")
alertcondition(aPlusLong, title="IMK A+ LONG SETUP",
message="IMK BUY SETUP: RSI>50, Stoch up, Volume positive, MTF OK, Divergence OK.")
alertcondition(buySignal, title="IMK BUY SIGNAL",
message="IMK BUY: Full BUY signal confirmed.")
alertcondition(sellSignal, title="IMK SELL SIGNAL",
message="IMK SELL: RSI lost 50 — exit now.")
indicator("IMK RSI-50 10x Reversal (Buy/Sell + Divergence + MTF + MAs + Alerts)", overlay=true, max_labels_count=500)
//========================================================
// 🔧 Inputs
//========================================================
rsiLen = input.int(14, "RSI Length")
stochLen = input.int(14, "Stoch RSI Length")
kLen = input.int(3, "Stoch K")
dLen = input.int(3, "Stoch D")
volShortLen = input.int(5, "Volume Short EMA")
volLongLen = input.int(20, "Volume Long EMA")
shortMA_len = input.int(20, "Short MA Length")
longMA_len = input.int(800, "Long MA Length")
lbL = input.int(2, "Pivot Left (Div)")
lbR = input.int(2, "Pivot Right (Div)")
requireDiv = input.bool(true, "Require Bullish Divergence?")
useMTF = input.bool(true, "Use Higher-Timeframe RSI?")
htf = input.timeframe("240", "Higher TF (4H)")
//========================================================
// 📈 Moving Averages
//========================================================
shortMA = ta.sma(close, shortMA_len)
longMA = ta.sma(close, longMA_len)
plot(shortMA, "Short MA", color=color.orange, linewidth=2)
plot(longMA, "800 MA", color=color.blue, linewidth=2)
//========================================================
// 📈 RSI + Crosses
//========================================================
rsi = ta.rsi(close, rsiLen)
rsi50 = 50
rsiCrossUp = ta.crossover(rsi, rsi50)
rsiCrossDown = ta.crossunder(rsi, rsi50)
//========================================================
// ⏫ MTF Confirmation
//========================================================
rsiHTF = request.security(syminfo.tickerid, htf, ta.rsi(close, rsiLen))
htfOk = useMTF ? rsiHTF > 50 : true
//========================================================
// 🌀 Stoch RSI
//========================================================
rsiSrc = rsi
rsiLowest = ta.lowest(rsiSrc, stochLen)
rsiHighest = ta.highest(rsiSrc, stochLen)
stochRaw = (rsiSrc - rsiLowest) / math.max(rsiHighest - rsiLowest, 1e-10) * 100
k = ta.sma(stochRaw, kLen)
d = ta.sma(k, dLen)
stochCrossUp = ta.crossover(k, d)
stochCrossDown = ta.crossunder(k, d)
//========================================================
// 📦 Volume Oscillator
//========================================================
volShort = ta.ema(volume, volShortLen)
volLong = ta.ema(volume, volLongLen)
volOsc = volShort - volLong
volPositive = volOsc > 0
//========================================================
// 🔍 Bullish Divergence (Simple)
//========================================================
plPrice = ta.pivotlow(low, lbL, lbR)
plRSI = ta.pivotlow(rsi, lbL, lbR)
priceLow1 = ta.valuewhen(not na(plPrice), low[lbR], 0)
priceLow2 = ta.valuewhen(not na(plPrice), low[lbR], 1)
rsiLow1 = ta.valuewhen(not na(plRSI), rsi[lbR], 0)
rsiLow2 = ta.valuewhen(not na(plRSI), rsi[lbR], 1)
bullDivSimple =
not na(priceLow1) and not na(priceLow2) and
not na(rsiLow1) and not na(rsiLow2) and
priceLow1 < priceLow2 and rsiLow1 > rsiLow2
//========================================================
// 🎯 IMK A+ Long Setup
//========================================================
coreOK = rsiCrossUp and stochCrossUp and volPositive
divOK = requireDiv ? bullDivSimple : true
aPlusLong = coreOK and divOK and htfOk
//========================================================
// 🟢 BUY / 🔴 SELL Signals
//========================================================
buySignal = aPlusLong
sellSignal = rsiCrossDown // Clean exit rule
plotshape(buySignal, title="BUY", style=shape.triangleup, location=location.belowbar, color=color.green, size=size.small, text="BUY")
plotshape(sellSignal, title="SELL", style=shape.triangledown, location=location.abovebar, color=color.red, size=size.small, text="SELL")
//========================================================
// 🔔 ALERT CONDITIONS (OPTIMIZED FOR PHONE & EMAIL)
//========================================================
alertcondition(rsiCrossUp, title="RSI 50 CROSS UP",
message="IMK ALERT: RSI crossed ABOVE 50 — potential entry.")
alertcondition(rsiCrossDown, title="RSI 50 CROSS DOWN",
message="IMK ALERT: RSI fell BELOW 50 — exit signal.")
alertcondition(aPlusLong, title="IMK A+ LONG SETUP",
message="IMK BUY SETUP: RSI>50, Stoch up, Volume positive, MTF OK, Divergence OK.")
alertcondition(buySignal, title="IMK BUY SIGNAL",
message="IMK BUY: Full BUY signal confirmed.")
alertcondition(sellSignal, title="IMK SELL SIGNAL",
message="IMK SELL: RSI lost 50 — exit now.")
开源脚本
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
免责声明
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.
开源脚本
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
免责声明
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.