SABIO TITAN ELITE 4.0

bravsky50 · study · 244 行 · 点赞 10 · TradingView 原页

本页源码来自 TradingView 公开发布的开源脚本,版权归原作者所有, 请遵循其原始许可(Pine 脚本常见 CC BY-NC-SA / MPL-2.0 / MIT)。 本项目仅用于研究检索与许可范围内的移植。

Pine Script

// This Pine Script® code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © bravsky50
 
//@version=6
//@version=6
indicator("SABIO TITAN ELITE 4.0", shorttitle="TITAN ELITE", overlay=true)
 
//==================================================
// 1. INPUTS
//==================================================
 
groupTrend = "TREND ENGINE"
emaFast = input.int(20, "EMA Fast", minval=1, group=groupTrend)
emaMedium = input.int(50, "EMA Medium", minval=1, group=groupTrend)
emaSlow = input.int(200, "EMA Slow", minval=1, group=groupTrend)
 
groupIchi = "ICHIMOKU ENGINE"
tenkanLen = input.int(9, "Tenkan", minval=1, group=groupIchi)
kijunLen = input.int(26, "Kijun", minval=1, group=groupIchi)
senkouLen = input.int(52, "Senkou B", minval=1, group=groupIchi)
 
groupRSI = "RSI ENGINE"
rsiLen = input.int(14, "RSI Period", minval=1, group=groupRSI)
rsiBuy = input.int(52, "RSI BUY", minval=1, maxval=99, group=groupRSI)
rsiSell = input.int(48, "RSI SELL", minval=1, maxval=99, group=groupRSI)
 
groupMACD = "MACD ENGINE"
macdFast = input.int(12, "MACD Fast", minval=1, group=groupMACD)
macdSlow = input.int(26, "MACD Slow", minval=1, group=groupMACD)
macdSignal = input.int(9, "MACD Signal", minval=1, group=groupMACD)
 
groupADX = "ADX ENGINE"
diLen = input.int(14, "DI Period", minval=1, group=groupADX)
adxLen = input.int(14, "ADX Smoothing", minval=1, group=groupADX)
adxThreshold = input.float(20, "ADX Threshold", minval=1, group=groupADX)
 
groupStoch = "STOCHASTIC ENGINE"
stochLen = input.int(14, "Stochastic Period", minval=1, group=groupStoch)
stochSmooth = input.int(3, "Stochastic Smoothing", minval=1, group=groupStoch)
 
groupStructure = "MARKET STRUCTURE"
swingLen = input.int(10, "Swing Period", minval=2, group=groupStructure)
 
groupRisk = "RISK ENGINE"
atrLen = input.int(14, "ATR Period", minval=1, group=groupRisk)
atrMultiplier = input.float(2.0, "ATR Multiplier", minval=0.1, step=0.1, group=groupRisk)
 
groupSignal = "SIGNAL ENGINE"
minimumScore = input.int(6, "Minimum Score", minval=1, maxval=8, group=groupSignal)
 
//==================================================
// 2. EMA TREND ENGINE
//==================================================
 
ema20 = ta.ema(close, emaFast)
ema50 = ta.ema(close, emaMedium)
ema200 = ta.ema(close, emaSlow)
 
bullishEMA = close > ema20 and ema20 > ema50 and ema50 > ema200
bearishEMA = close < ema20 and ema20 < ema50 and ema50 < ema200
 
//==================================================
// 3. ICHIMOKU ENGINE
//==================================================
 
tenkan = (ta.highest(high, tenkanLen) + ta.lowest(low, tenkanLen)) / 2
kijun = (ta.highest(high, kijunLen) + ta.lowest(low, kijunLen)) / 2
 
senkouA = (tenkan + kijun) / 2
senkouB = (ta.highest(high, senkouLen) + ta.lowest(low, senkouLen)) / 2
 
cloudA = senkouA[kijunLen]
cloudB = senkouB[kijunLen]
 
cloudTop = math.max(cloudA, cloudB)
cloudBottom = math.min(cloudA, cloudB)
 
bullishIchi = close > cloudTop and tenkan > kijun
bearishIchi = close < cloudBottom and tenkan < kijun
 
//==================================================
// 4. RSI ENGINE
//==================================================
 
rsiValue = ta.rsi(close, rsiLen)
 
bullishRSI = rsiValue > rsiBuy
bearishRSI = rsiValue < rsiSell
 
//==================================================
// 5. MACD ENGINE
//==================================================
 
[macdLine, macdSignalLine, macdHistogram] = ta.macd(close, macdFast, macdSlow, macdSignal)
 
bullishMACD = macdLine > macdSignalLine and macdHistogram > 0
bearishMACD = macdLine < macdSignalLine and macdHistogram < 0
 
//==================================================
// 6. ADX / DMI ENGINE
//==================================================
 
[plusDI, minusDI, adxValue] = ta.dmi(diLen, adxLen)
 
bullishADX = adxValue > adxThreshold and plusDI > minusDI
bearishADX = adxValue > adxThreshold and minusDI > plusDI
 
//==================================================
// 7. STOCHASTIC ENGINE
//==================================================
 
stochRaw = ta.stoch(close, high, low, stochLen)
stochK = ta.sma(stochRaw, stochSmooth)
stochD = ta.sma(stochK, 3)
 
bullishStoch = stochK > stochD and stochK > 50
bearishStoch = stochK < stochD and stochK < 50
 
//==================================================
// 8. ATR ENGINE
//==================================================
 
atrValue = ta.atr(atrLen)
 
atrStopBuy = close - atrValue * atrMultiplier
atrStopSell = close + atrValue * atrMultiplier
 
//==================================================
// 9. MARKET STRUCTURE
//==================================================
 
previousHigh = ta.highest(high, swingLen)[1]
previousLow = ta.lowest(low, swingLen)[1]
 
bullishBOS = close > previousHigh
bearishBOS = close < previousLow
 
//==================================================
// 10. LIQUIDITY SWEEPS
//==================================================
 
bullishSweep = low < previousLow and close > previousLow
bearishSweep = high > previousHigh and close < previousHigh
 
//==================================================
// 11. CANDLE CONFIRMATION
//==================================================
 
bullishCandle = close > open and close > close[1]
bearishCandle = close < open and close < close[1]
 
//==================================================
// 12. CONFLUENCE SCORING
//==================================================
 
buyScore =
     (bullishEMA ? 1 : 0) +
     (bullishIchi ? 1 : 0) +
     (bullishRSI ? 1 : 0) +
     (bullishMACD ? 1 : 0) +
     (bullishADX ? 1 : 0) +
     (bullishStoch ? 1 : 0) +
     ((bullishBOS or bullishSweep) ? 1 : 0) +
     (bullishCandle ? 1 : 0)
 
sellScore =
     (bearishEMA ? 1 : 0) +
     (bearishIchi ? 1 : 0) +
     (bearishRSI ? 1 : 0) +
     (bearishMACD ? 1 : 0) +
     (bearishADX ? 1 : 0) +
     (bearishStoch ? 1 : 0) +
     ((bearishBOS or bearishSweep) ? 1 : 0) +
     (bearishCandle ? 1 : 0)
 
//==================================================
// 13. FINAL SIGNALS
//==================================================
 
buyCondition = buyScore >= minimumScore and bullishEMA and bullishIchi
sellCondition = sellScore >= minimumScore and bearishEMA and bearishIchi
 
buySignal = buyCondition and barstate.isconfirmed
sellSignal = sellCondition and barstate.isconfirmed
 
strongBuy = buySignal and buyScore >= 7
strongSell = sellSignal and sellScore >= 7
 
eliteBuy = buySignal and buyScore == 8
eliteSell = sellSignal and sellScore == 8
 
//==================================================
// 14. PLOTS
//==================================================
 
plot(ema20, "EMA 20", color=color.aqua, linewidth=1)
plot(ema50, "EMA 50", color=color.orange, linewidth=2)
plot(ema200, "EMA 200", color=color.white, linewidth=3)
 
plot(tenkan, "Tenkan", color=color.blue)
plot(kijun, "Kijun", color=color.red)
 
plot(senkouA, "Senkou A", color=color.green, offset=kijunLen)
plot(senkouB, "Senkou B", color=color.maroon, offset=kijunLen)
 
cloudPlotA = plot(senkouA, "Cloud A", color=color.new(color.green, 100), offset=kijunLen)
cloudPlotB = plot(senkouB, "Cloud B", color=color.new(color.red, 100), offset=kijunLen)
 
fill(cloudPlotA, cloudPlotB, color=senkouA >= senkouB ? color.new(color.green, 85) : color.new(color.red, 85))
 
//==================================================
// 15. BUY / SELL SIGNALS
//==================================================
 
plotshape(buySignal, title="TITAN BUY", style=shape.arrowup, location=location.belowbar, color=color.lime, size=size.large, text="BUY", textcolor=color.white)
 
plotshape(sellSignal, title="TITAN SELL", style=shape.arrowdown, location=location.abovebar, color=color.red, size=size.large, text="SELL", textcolor=color.white)
 
plotshape(strongBuy, title="STRONG BUY", style=shape.labelup, location=location.belowbar, color=color.green, size=size.normal, text="STRONG BUY", textcolor=color.white)
 
plotshape(strongSell, title="STRONG SELL", style=shape.labeldown, location=location.abovebar, color=color.maroon, size=size.normal, text="STRONG SELL", textcolor=color.white)
 
plotshape(eliteBuy, title="ELITE BUY", style=shape.diamond, location=location.belowbar, color=color.aqua, size=size.large, text="ELITE", textcolor=color.white)
 
plotshape(eliteSell, title="ELITE SELL", style=shape.diamond, location=location.abovebar, color=color.fuchsia, size=size.large, text="ELITE", textcolor=color.white)
 
//==================================================
// 16. ATR RISK REFERENCES
//==================================================
 
plot(bullishEMA ? atrStopBuy : bearishEMA ? atrStopSell : na, "ATR STOP", color=color.red, linewidth=2)
 
//==================================================
// 17. ALERTS
//==================================================
 
alertcondition(buySignal, "TITAN BUY", "SABIO TITAN: BUY signal")
alertcondition(sellSignal, "TITAN SELL", "SABIO TITAN: SELL signal")
 
alertcondition(strongBuy, "STRONG BUY", "SABIO TITAN: STRONG BUY signal")
alertcondition(strongSell, "STRONG SELL", "SABIO TITAN: STRONG SELL signal")
 
alertcondition(eliteBuy, "ELITE BUY", "SABIO TITAN: ELITE BUY signal")
alertcondition(eliteSell, "ELITE SELL", "SABIO TITAN: ELITE SELL signal")

← 返回列表