OPEN-SOURCE SCRIPT

CM SlingShot System (Customizable)

103
//version=5
indicator("CM SlingShot System (Customizable)", overlay=true, shorttitle="CM_SSS")

// ==== 📌 INPUT SETTINGS ====
group1 = "Entry Settings"
sae = input.bool(true, title="📍 Show Aggressive Entry (pullback)?", group=group1)
sce = input.bool(true, title="📍 Show Conservative Entry (confirmation)?", group=group1)

group2 = "Visual Settings"
st = input.bool(true, title="🔼 Show Trend Arrows (top/bottom)?", group=group2)
sl = input.bool(false, title="🅱🆂 Show 'B' & 'S' Letters Instead of Arrows", group=group2)
pa = input.bool(true, title="🡹🡻 Show Entry Arrows", group=group2)

group3 = "MA Settings"
fastLength = input.int(38, title="Fast EMA Period", group=group3)
slowLength = input.int(62, title="Slow EMA Period", group=group3)
timeframe = input.timeframe("D", title="Timeframe for EMAs", group=group3)

// ==== 📈 EMA CALCULATIONS ====
emaFast = request.security(syminfo.tickerid, timeframe, ta.ema(close, fastLength))
emaSlow = request.security(syminfo.tickerid, timeframe, ta.ema(close, slowLength))
col = emaFast > emaSlow ? color.lime : emaFast < emaSlow ? color.red : color.gray

// ==== ✅ SIGNAL CONDITIONS ====
pullbackUp = emaFast > emaSlow and close < emaFast
pullbackDn = emaFast < emaSlow and close > emaFast

entryUp = emaFast > emaSlow and close[1] < emaFast and close > emaFast
entryDn = emaFast < emaSlow and close[1] > emaFast and close < emaFast

// ==== 🌈 CHART PLOTS ====
plot(emaFast, title="Fast EMA", color=color.new(col, 0), linewidth=2)
plot(emaSlow, title="Slow EMA", color=color.new(col, 0), linewidth=4)
fill(plot(emaSlow, title="", color=color.new(col, 0)), plot(emaFast, title="", color=color.new(col, 0)), color=color.silver, transp=70)

// Highlight bars
barcolor(sae and (pullbackUp or pullbackDn) ? color.yellow : na)
barcolor(sce and (entryUp or entryDn) ? color.aqua : na)

// Trend arrows
upTrend = emaFast >= emaSlow
downTrend = emaFast < emaSlow
plotshape(st and upTrend, title="UpTrend", style=shape.triangleup, location=location.belowbar, color=color.green)
plotshape(st and downTrend, title="DownTrend", style=shape.triangledown, location=location.abovebar, color=color.red)

// Entry indicators
plotarrow(pa and entryUp ? 1 : na, colorup=color.green, offset=-1)
plotarrow(pa and entryDn ? -1 : na, colordown=color.red, offset=-1)

plotchar(sl and entryUp ? low - ta.tr : na, char="B", location=location.absolute, color=color.green)
plotchar(sl and entryDn ? high + ta.tr : na, char="S", location=location.absolute, color=color.red)

免責聲明

這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。