Conversione indicatore ATRTrailingStop da TradingView a PRT

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

    Ciao a tutti, vorrei chiedervi un aiuto a convertire questo indicatori di Tradingview, con codice in pine editor. il mio più grosso problema è nella parte centrale.. quella in grassetto.

    Grazie mille per l’aiuto!

    // 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)andsrc[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)andsrc<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>xATRTrailingStopandabove
    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)
    #213291 quote
    NicolasNicolas
    Keymaster
    Legend

    È un "trailingstop ATR" di base, puoi sostituirlo con l'uso dell'istruzione SuperTrend, come ad esempio:

    xATRTrailingStop=SuperTrend[a,c]
    luca_mass thanked this post
    #213303 quote
    luca_massluca_mass
    Participant
    New

    Grazie mille Nicolas!!

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

Conversione indicatore ATRTrailingStop da TradingView a PRT


ProBuilder: Indicatori & Strumenti Personalizzati

New Reply
Author
author-avatar
luca_mass @luca_mass Participant
Summary

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

Topic Details
Forum: ProBuilder: Indicatori & Strumenti Personalizzati
Language: Italian
Started: 04/14/2023
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...