Chirag Elite: UT Bot + Volume

syalshaeb · study · 64 行 · 点赞 21 · TradingView 原页

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

Pine Script

// @version=6
indicator("Chirag Elite: UT Bot + Volume", overlay=true)
 
// --- 1. INPUTS ---
// UT Bot Inputs
a = input.float(1.0, "UT Sensitivity (Key Value)")
c = input.int(10, "UT ATR Period")
// Volume & Trend Inputs
ema_len = input.int(200, "Trend Filter (200 EMA)")
va_len  = input.int(70, "Value Area Lookback")
 
// --- 2. UT BOT LOGIC ---
xATR = ta.atr(c)
nLoss = a * xATR
 
var float xATRTrailingStop = 0.0
xPrev = nz(xATRTrailingStop[1], 0)
 
xATRTrailingStop := close > xPrev and close[1] > xPrev ? math.max(xPrev, close - nLoss) :
   close < xPrev and close[1] < xPrev ? math.min(xPrev, close + nLoss) :
   close > xPrev ? close - nLoss : close + nLoss
 
var int pos = 0
pos := close[1] < xPrev and close > xPrev ? 1 :
   close[1] > xPrev and close < xPrev ? -1 : nz(pos[1], 0)
 
// --- 3. VOLUME PROFILE & TREND LOGIC ---
ema200 = ta.ema(close, ema_len)
vah = ta.highest(high, va_len)
val = ta.lowest(low, va_len)
poc = (vah + val) / 2
 
// --- 4. CONFLUENCE SIGNALS (The "Elite" Entry) ---
// BUY CALL: UT Bot flips Green + Above 200 EMA + Price above VAH
buy_signal  = ta.crossover(close, xATRTrailingStop) and close > ema200 and close > vah
 
// BUY PUT: UT Bot flips Red + Below 200 EMA + Price below VAL
sell_signal = ta.crossunder(close, xATRTrailingStop) and close < ema200 and close < val
 
// --- 5. VISUALS ---
plot(ema200, "200 EMA", color=color.white, linewidth=2)
plot(vah, "VA High", color=color.new(color.green, 60), style=plot.style_stepline)
plot(val, "VA Low", color=color.new(color.red, 60), style=plot.style_stepline)
plot(poc, "POC", color=color.new(color.yellow, 60), style=plot.style_cross)
 
// UT Bot Stop Line
plot(xATRTrailingStop, "UT Stop", color=pos == 1 ? color.green : color.red, linewidth=1)
 
// Labels
plotshape(buy_signal, title="BUY CALL", text="BUY CALL", style=shape.labelup, location=location.belowbar, color=color.green, textcolor=color.white, size=size.small)
plotshape(sell_signal, title="BUY PUT", text="BUY PUT", style=shape.labeldown, location=location.abovebar, color=color.red, textcolor=color.white, size=size.small)
 
// --- 6. TARGET DASHBOARD ---
var table tbl = table.new(position.top_right, 2, 3, color.new(color.black, 40), color.gray, 1, color.gray, 1)
if barstate.islast
    table.cell(tbl, 0, 0, "TREND", text_color=color.white)
    table.cell(tbl, 1, 0, close > ema200 ? "BULLISH" : "BEARISH", text_color=close > ema200 ? color.green : color.red)
    
    table.cell(tbl, 0, 1, "SIGNAL", text_color=color.white)
    sig_text = buy_signal ? "BUY CALL" : sell_signal ? "BUY PUT" : "WAIT"
    table.cell(tbl, 1, 1, sig_text, text_color=buy_signal ? color.green : sell_signal ? color.red : color.yellow)
    
    table.cell(tbl, 0, 2, "UT STATE", text_color=color.white)
    table.cell(tbl, 1, 2, pos == 1 ? "LONG" : "SHORT", text_color=pos == 1 ? color.green : color.red)

← 返回列表