UT BOT from Tradingview

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #216652 quote
    AndrewtUK
    Participant
    New

    Hi Please see the code for the UT Bot from Tradingview.

    //@version=4
    strategy(title=”UT Bot Strategy”, overlay = true)
    //CREDITS to HPotter for the orginal code. The guy trying to sell this as his own is a scammer lol.

    // Inputs
    a = input(1, title = “Key Vaule. ‘This changes the sensitivity'”)
    c = input(10, title = “ATR Period”)
    h = input(false, title = “Signals from Heikin Ashi Candles”)

    xATR = atr(c)
    nLoss = a * xATR

    src = h ? security(heikinashi(syminfo.tickerid), timeframe.period, close, lookahead = false) : close

    xATRTrailingStop = 0.0
    xATRTrailingStop := iff(src > nz(xATRTrailingStop[1], 0) and src[1] > nz(xATRTrailingStop[1], 0), max(nz(xATRTrailingStop[1]), src – nLoss),
    iff(src < nz(xATRTrailingStop[1], 0) and src[1] < nz(xATRTrailingStop[1], 0), min(nz(xATRTrailingStop[1]), src + nLoss),
    iff(src > nz(xATRTrailingStop[1], 0), src – nLoss, src + nLoss)))

    pos = 0
    pos := iff(src[1] < nz(xATRTrailingStop[1], 0) and src > nz(xATRTrailingStop[1], 0), 1,
    iff(src[1] > nz(xATRTrailingStop[1], 0) and src < nz(xATRTrailingStop[1], 0), -1, nz(pos[1], 0)))

    xcolor = pos == -1 ? color.red: pos == 1 ? color.green : color.blue

    ema = ema(src,1)
    above = crossover(ema, xATRTrailingStop)
    below = crossover(xATRTrailingStop, ema)

    buy = src > xATRTrailingStop and above
    sell = src < xATRTrailingStop and below

    barbuy = src > xATRTrailingStop
    barsell = src < xATRTrailingStop

    plotshape(buy, title = “Buy”, text = ‘Buy’, style = shape.labelup, location = location.belowbar, color= color.green, textcolor = color.white, transp = 0, size = size.tiny)
    plotshape(sell, title = “Sell”, text = ‘Sell’, style = shape.labeldown, location = location.abovebar, color= color.red, textcolor = color.white, transp = 0, size = size.tiny)

    barcolor(barbuy ? color.green : na)
    barcolor(barsell ? color.red : na)

    strategy.entry(“long”, true, when = buy)
    strategy.entry(“short”, false, when = sell)

    Thank you

    #216661 quote
    Nicolas
    Keymaster
    Legend

    Yes I see it. Please post description and picture, thank you.

    #216662 quote
    Nicolas
    Keymaster
    Legend

    ok, after reading, it’s an EMA cross strategy with TOTALPRICE data (aka Heikin Ashi) with a SuperTrend.

    a = 1 //Key Vaule. ‘This changes the sensitivity
    c = 10 //ATR Period
    
    st = supertrend[a,c]
    ema = average[1,1](totalprice)
    
    if ema crosses over st then 
    drawarrowup(barindex,low) coloured("green")
    drawcandle(open,high,low,close) coloured("green")
    elsif ema crosses under st then 
    drawarrowdown(barindex,high) coloured("red")
    drawcandle(open,high,low,close) coloured("red")
    endif 
    
    return
    Distincttacos thanked this post
Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.
ProRealAI ProRealAI New

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

UT BOT from Tradingview


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
AndrewtUK @andrewtuk Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by Nicolas
3 years, 2 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 06/23/2023
Status: Active
Attachments: No files
Logo Logo
Loading...