本页源码来自 TradingView 公开发布的开源脚本,版权归原作者所有, 请遵循其原始许可(Pine 脚本常见 CC BY-NC-SA / MPL-2.0 / MIT)。 本项目仅用于研究检索与许可范围内的移植。
//@version=6
indicator(title = 'EMA Combo + UT Bot', shorttitle = 'EMA_UT', overlay = true)
// =====================================================
// === EMA Trend (Bulut) ===
Curly_Fries = input.int(8, title = 'Trend Fast EMA')
Popeyes = input.int(21, title = 'Trend Medium EMA')
Chicken_Sandwich = input.int(21, title = 'Trend Slow EMA')
emaTrendFast = ta.ema(close, Curly_Fries)
emaTrendMed = ta.ema(close, Popeyes)
emaTrendSlow = ta.ema(close, Chicken_Sandwich)
// Bulut için gizli plot
a = plot(emaTrendFast, title = 'Trend EMA Fast', display = display.none)
b = plot(emaTrendMed, title = 'Trend EMA Medium', display = display.none)
c = plot(emaTrendSlow, title = 'Trend EMA Slow', display = display.none)
// Renkli bulut
upTrend = emaTrendFast > emaTrendSlow
downTrend = emaTrendFast < emaTrendSlow
trendColor = upTrend ? color.new(color.green, 70) : downTrend ? color.new(color.red, 70) : na
fill(a, c, color = trendColor)
// =====================================================
// === EMA 50-100-150-200 (Çizgi) ===
ema50 = ta.ema(close, 50)
ema100 = ta.ema(close, 100)
ema150 = ta.ema(close, 150)
ema200 = ta.ema(close, 200)
plot(ema50, title = 'EMA 50', color = color.aqua, linewidth = 1)
plot(ema100, title = 'EMA 100', color = color.yellow, linewidth = 1)
plot(ema150, title = 'EMA 150', color = color.red, linewidth = 1)
plot(ema200, title = 'EMA 200', color = color.black, linewidth = 1)
// =====================================================
// === UT Bot Alerts ===
UT_keyValue = input.float(1.0, title = 'Key Value (Sensitivity)')
UT_ATRPeriod = input.int(10, title = 'ATR Period')
UT_useHeikinAshi = input.bool(false, title = 'Use Heikin Ashi candles?')
xATR = ta.atr(UT_ATRPeriod)
UT_nLoss = UT_keyValue * xATR
// Heikin Ashi veya normal mum
ha_ticker = ticker.heikinashi(syminfo.tickerid)
UT_src = UT_useHeikinAshi ? request.security(ha_ticker, timeframe.period, close) : close
var float UT_xATRTrailingStop = na
UT_xATRTrailingStop := UT_src > nz(UT_xATRTrailingStop[1], 0) and UT_src[1] > nz(UT_xATRTrailingStop[1], 0) ? math.max(nz(UT_xATRTrailingStop[1]), UT_src - UT_nLoss) : UT_src < nz(UT_xATRTrailingStop[1], 0) and UT_src[1] < nz(UT_xATRTrailingStop[1], 0) ? math.min(nz(UT_xATRTrailingStop[1]), UT_src + UT_nLoss) : UT_src > nz(UT_xATRTrailingStop[1], 0) ? UT_src - UT_nLoss : UT_src + UT_nLoss
var int UT_pos = 0
UT_pos := UT_src[1] < nz(UT_xATRTrailingStop[1], 0) and UT_src > nz(UT_xATRTrailingStop[1], 0) ? 1 : UT_src[1] > nz(UT_xATRTrailingStop[1], 0) and UT_src < nz(UT_xATRTrailingStop[1], 0) ? -1 : nz(UT_pos[1], 0)
UT_buy = UT_src > UT_xATRTrailingStop and ta.crossover(ta.ema(UT_src, 1), UT_xATRTrailingStop)
UT_sell = UT_src < UT_xATRTrailingStop and ta.crossover(UT_xATRTrailingStop, ta.ema(UT_src, 1))
UT_buyColor = color.green
UT_sellColor = color.red
// Marker size seçimi
UT_markerSizeInput = input.string('tiny', 'UT Marker Size', options = ['tiny', 'small', 'normal', 'large'])
// Buy plotshapes
plotshape(UT_buy and UT_markerSizeInput == 'tiny', title = 'UT Buy Tiny', text = 'Buy', style = shape.labelup, location = location.belowbar, color = UT_buyColor, textcolor = color.white, size = size.tiny)
plotshape(UT_buy and UT_markerSizeInput == 'small', title = 'UT Buy Small', text = 'Buy', style = shape.labelup, location = location.belowbar, color = UT_buyColor, textcolor = color.white, size = size.small)
plotshape(UT_buy and UT_markerSizeInput == 'normal', title = 'UT Buy Normal', text = 'Buy', style = shape.labelup, location = location.belowbar, color = UT_buyColor, textcolor = color.white, size = size.normal)
plotshape(UT_buy and UT_markerSizeInput == 'large', title = 'UT Buy Large', text = 'Buy', style = shape.labelup, location = location.belowbar, color = UT_buyColor, textcolor = color.white, size = size.large)
// Sell plotshapes
plotshape(UT_sell and UT_markerSizeInput == 'tiny', title = 'UT Sell Tiny', text = 'Sell', style = shape.labeldown, location = location.abovebar, color = UT_sellColor, textcolor = color.white, size = size.tiny)
plotshape(UT_sell and UT_markerSizeInput == 'small', title = 'UT Sell Small', text = 'Sell', style = shape.labeldown, location = location.abovebar, color = UT_sellColor, textcolor = color.white, size = size.small)
plotshape(UT_sell and UT_markerSizeInput == 'normal', title = 'UT Sell Normal', text = 'Sell', style = shape.labeldown, location = location.abovebar, color = UT_sellColor, textcolor = color.white, size = size.normal)
plotshape(UT_sell and UT_markerSizeInput == 'large', title = 'UT Sell Large', text = 'Sell', style = shape.labeldown, location = location.abovebar, color = UT_sellColor, textcolor = color.white, size = size.large)
// Alerts
alertcondition(UT_buy, title = 'UT Long', message = 'UT Long Signal')
alertcondition(UT_sell, title = 'UT Short', message = 'UT Short Signal')