UT Bot - EMA40 Altı BUY (Alarm Ready)

alibinay · study · 48 行 · 点赞 149 · TradingView 原页

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

Pine Script

//@version=5
indicator("UT Bot - EMA40 Altı BUY (Alarm Ready)", overlay=true)
 
// === INPUT ===
keyValue  = input.float(1.0, "Key Value")
atrPeriod = input.int(10, "ATR Period")
emaPeriod = input.int(40, "EMA Periyodu")
 
// === EMA ===
ema40 = ta.ema(close, emaPeriod)
 
// === ATR ===
atr = ta.atr(atrPeriod)
nLoss = keyValue * atr
 
// === UT TRAILING STOP ===
var float trailingStop = na
 
if na(trailingStop)
    trailingStop := close - nLoss
 
if close > trailingStop and close[1] > trailingStop
    trailingStop := math.max(trailingStop, close - nLoss)
else if close < trailingStop and close[1] < trailingStop
    trailingStop := math.min(trailingStop, close + nLoss)
else
    trailingStop := close > trailingStop ? close - nLoss : close + nLoss
 
// === SİNYALLER ===
buySignal  = ta.crossover(close, trailingStop)
sellSignal = ta.crossunder(close, trailingStop)
 
// === FİLTRE ===
filteredBuy = buySignal and close < ema40
 
// === PLOT ===
plot(ema40, color=color.orange, linewidth=2)
plot(trailingStop, color=color.red)
 
plotshape(filteredBuy, location=location.belowbar,
     color=color.green, style=shape.labelup, text="BUY")
 
plotshape(sellSignal, location=location.abovebar,
     color=color.red, style=shape.labeldown, text="SELL")
 
// === ALARM ŞARTLARI ===
alertcondition(filteredBuy, title="BUY ALERT", message="BUY Sinyali Geldi")
alertcondition(sellSignal, title="SELL ALERT", message="SELL Sinyali Geldi")

← 返回列表