OPEN-SOURCE SCRIPT
My script

//version=5
indicator("MA + OI + Volume Breakout", overlay=true)
// === MA Parameters ===
ma_type = input.string("EMA", title="MA Type", options=["SMA", "EMA", "WMA"])
ma(src, len, type) =>
type == "SMA" ? ta.sma(src, len) :
type == "EMA" ? ta.ema(src, len) :
ta.wma(src, len)
ma5 = ma(close, 5, ma_type)
ma21 = ma(close, 21, ma_type)
ma50 = ma(close, 50, ma_type)
ma100 = ma(close, 100, ma_type)
plot(ma5, "5-day MA", color=color.yellow, linewidth=2)
plot(ma21, "21-day MA", color=color.orange, linewidth=2)
plot(ma50, "50-day MA", color=color.fuchsia, linewidth=2)
plot(ma100, "100-day MA", color=color.blue, linewidth=2)
// === Trend Signal ===
bullish_trend = ma5 > ma21 and ma21 > ma50 and ma50 > ma100
bearish_trend = ma5 < ma21 and ma21 < ma50 and ma50 < ma100
bgcolor(bullish_trend ? color.new(color.green, 85) : bearish_trend ? color.new(color.red, 85) : na)
// === Volume Breakout ===
vol_avg = ta.sma(volume, 20)
vol_breakout = volume > 1.5 * vol_avg
plotshape(vol_breakout, title="Volume Breakout", location=location.belowbar, style=shape.circle, color=color.aqua, size=size.tiny)
// === Open Interest Overlay (assumes OI data via external input or future integration) ===
// Placeholder: simulate OI input (replace with `request.security(syminfo.tickerid, ..., ...)` if available)
oi = input.float(na, title="Open Interest (external feed)")
oi_avg = ta.sma(oi, 20)
oi_breakout = oi > 1.2 * oi_avg
plotshape(not na(oi) and oi_breakout, title="OI Spike", location=location.belowbar, style=shape.diamond, color=color.purple, size=size.tiny)
plot(oi, title="Open Interest", color=color.gray, display=display.none) // Optional: hidden line for alerts
// === Composite Signal ===
strong_long = bullish_trend and vol_breakout and oi_breakout
plotshape(strong_long, title="Strong Long Signal", location=location.belowbar, style=shape.labelup, text="LONG", size=size.small, color=color.lime)
// === Screener Logic ===
// Use `strong_long` as your filter condition in a screener or dashboard output
indicator("MA + OI + Volume Breakout", overlay=true)
// === MA Parameters ===
ma_type = input.string("EMA", title="MA Type", options=["SMA", "EMA", "WMA"])
ma(src, len, type) =>
type == "SMA" ? ta.sma(src, len) :
type == "EMA" ? ta.ema(src, len) :
ta.wma(src, len)
ma5 = ma(close, 5, ma_type)
ma21 = ma(close, 21, ma_type)
ma50 = ma(close, 50, ma_type)
ma100 = ma(close, 100, ma_type)
plot(ma5, "5-day MA", color=color.yellow, linewidth=2)
plot(ma21, "21-day MA", color=color.orange, linewidth=2)
plot(ma50, "50-day MA", color=color.fuchsia, linewidth=2)
plot(ma100, "100-day MA", color=color.blue, linewidth=2)
// === Trend Signal ===
bullish_trend = ma5 > ma21 and ma21 > ma50 and ma50 > ma100
bearish_trend = ma5 < ma21 and ma21 < ma50 and ma50 < ma100
bgcolor(bullish_trend ? color.new(color.green, 85) : bearish_trend ? color.new(color.red, 85) : na)
// === Volume Breakout ===
vol_avg = ta.sma(volume, 20)
vol_breakout = volume > 1.5 * vol_avg
plotshape(vol_breakout, title="Volume Breakout", location=location.belowbar, style=shape.circle, color=color.aqua, size=size.tiny)
// === Open Interest Overlay (assumes OI data via external input or future integration) ===
// Placeholder: simulate OI input (replace with `request.security(syminfo.tickerid, ..., ...)` if available)
oi = input.float(na, title="Open Interest (external feed)")
oi_avg = ta.sma(oi, 20)
oi_breakout = oi > 1.2 * oi_avg
plotshape(not na(oi) and oi_breakout, title="OI Spike", location=location.belowbar, style=shape.diamond, color=color.purple, size=size.tiny)
plot(oi, title="Open Interest", color=color.gray, display=display.none) // Optional: hidden line for alerts
// === Composite Signal ===
strong_long = bullish_trend and vol_breakout and oi_breakout
plotshape(strong_long, title="Strong Long Signal", location=location.belowbar, style=shape.labelup, text="LONG", size=size.small, color=color.lime)
// === Screener Logic ===
// Use `strong_long` as your filter condition in a screener or dashboard output
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
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.
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
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.