Convertir Indicateur RAM Buy and Sell signals

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #245364 quote
    Gigi
    Participant
    Senior

    Bonsoir, ci joint un indicateur de chez tradingview à convertir sur Prorealtime.

     

    indicator(title=’RAM BUY AND SELL SIGNALS’, overlay=true)

     

    // Inputs

    a = input.int(1, title=’Key Value. \”This changes the sensitivity\”‘)

    c = input.int(10, title=’ATR Period’)

    h = input.bool(false, title=’Signals from Heikin Ashi Candles’)

     

    xATR = ta.atr(c)

    nLoss = a * xATR

     

    src = h ? request.security(syminfo.tickerid, timeframe.period, close, lookahead=barmerge.lookahead_off, gaps=barmerge.gaps_off) : close

     

     

     

    xATRTrailingStop = 0.0

    iff_1 = src > nz(xATRTrailingStop[1], 0) ? src – nLoss : src + nLoss

    iff_2 = src < nz(xATRTrailingStop[1], 0) and src[1] < nz(xATRTrailingStop[1], 0) ? math.min(nz(xATRTrailingStop[1]), src + nLoss) : iff_1

    xATRTrailingStop := src > nz(xATRTrailingStop[1], 0) and src[1] > nz(xATRTrailingStop[1], 0) ? math.max(nz(xATRTrailingStop[1]), src – nLoss) : iff_2

     

    pos = 0

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

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

     

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

     

    ema = ta.ema(src, 1)

    above = ta.crossover(ema, xATRTrailingStop)

    below = ta.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.new(color.green, 0), textcolor=color.new(color.white, 0), size=size.tiny)

    plotshape(sell, title=’Sell’, text=’Sell’, style=shape.labeldown, location=location.abovebar, color=color.new(color.red, 0), textcolor=color.new(color.white, 0), size=size.tiny)

     

    barcolor(barbuy ? color.green : na)

    barcolor(barsell ? color.red : na)

     

    alertcondition(buy, ‘BUY’, ‘BUY’)

    alertcondition(sell, ‘SELL’, ‘SELL’)

    #245383 quote
    Iván González
    Moderator
    Master
    //-------------------------------------------//
    //-------------------------------------------//
    // Inputs
    //-------------------------------------------//
    a=1 //Sensivity
    c=10 //atr period
    heikin=0 //Signals from Heikin Ashi candles
    //-------------------------------------------//
    // Calculations
    //-------------------------------------------//
    xatr=averagetruerange[c](close)
    nLoss=a*xatr
    
    if heikin then
    
    else
    src=close
    endif
    
    xatrTrailingstop=0
    
    if src>xatrTrailingstop[1] then
    iff1=src-nLoss
    else
    iff1=src+nLoss
    endif
    
    if src<xatrTrailingstop[1] and src[1]<xatrTrailingstop[1] then
    iff2=min(xatrTrailingstop[1],src+nLoss)
    else
    iff2=iff1
    endif
    
    if src>xatrTrailingstop[1] and src[1]>xatrTrailingstop[1] then
    xatrTrailingstop=max(xatrTrailingstop[1],src-nLoss)
    else
    xatrTrailingstop=iff2
    endif
    
    pos=0
    if src[1]>xatrTrailingstop[1] and src<xatrTrailingstop[1] then
    iff3=-1
    else
    iff3=pos[1]
    endif
    
    if src[1]<xatrTrailingstop[1] and src>xatrTrailingstop[1] then
    pos=1
    else
    pos=iff3
    endif
    
    if pos=-1 then
    r=255
    g=0
    b=0
    elsif pos=1 then
    r=0
    g=255
    b=0
    else
    r=0
    g=0
    b=255
    endif
    
    ema=average[1,1](src)
    above=ema crosses over xatrTrailingstop
    below=ema crosses under xatrTrailingstop
    
    ibuy=src>xatrTrailingstop and above
    isell=src<xatrTrailingstop and below
    
    barbuy=src>xatrTrailingstop
    barsell=src<xatrTrailingstop
    
    if ibuy then
    drawarrowup(barindex,low-xatr)coloured("green")
    elsif isell then
    drawarrowdown(barindex,high+xatr)coloured("red")
    endif
    
    if barbuy then
    drawcandle(open,high,low,close)coloured("green")
    elsif barsell then
    drawcandle(open,high,low,close)coloured("red")
    endif
    
    //-------------------------------------------//
    return
    #245407 quote
    LucasBest
    Participant
    Junior

    Salut Ivan,
    tu as oublié d’ajouter le code pour les bougies Heikin…

    //-------------------------------------------//
    //-------------------------------------------//
    // Inputs
    //-------------------------------------------//
    //a=1 //Sensivity
    //c=10 //atr period
    //heikin=1 //Signals from Heikin Ashi candles
    //-------------------------------------------//
    // Calculations
    //-------------------------------------------//
    xatr=averagetruerange[c](close)
    nLoss=a*xatr
    
    if heikin then
    offset = 1-(BarIndex=0)
    XOpen = (XOpen[offset] + Xclose[offset]) / 2
    XClose = TotalPrice
    XHigh = high
    XLow = Low
    src = XClose
    else
    src = close
    endif
    
    xatrTrailingstop=0
    
    if src>xatrTrailingstop[1] then
    iff1=src-nLoss
    else
    iff1=src+nLoss
    endif
    
    if src<xatrTrailingstop[1] and src[1]<xatrTrailingstop[1] then
    iff2=min(xatrTrailingstop[1],src+nLoss)
    else
    iff2=iff1
    endif
    
    if src>xatrTrailingstop[1] and src[1]>xatrTrailingstop[1] then
    xatrTrailingstop=max(xatrTrailingstop[1],src-nLoss)
    else
    xatrTrailingstop=iff2
    endif
    
    pos=0
    if src[1]>xatrTrailingstop[1] and src<xatrTrailingstop[1] then
    iff3=-1
    else
    iff3=pos[1]
    endif
    
    if src[1]<xatrTrailingstop[1] and src>xatrTrailingstop[1] then
    pos=1
    else
    pos=iff3
    endif
    
    if pos=-1 then
    r=255
    g=0
    b=0
    elsif pos=1 then
    r=0
    g=255
    b=0
    else
    r=0
    g=0
    b=255
    endif
    
    ema=average[1,1](src)
    above=ema crosses over xatrTrailingstop
    below=ema crosses under xatrTrailingstop
    
    ibuy=src>xatrTrailingstop and above
    isell=src<xatrTrailingstop and below
    
    barbuy=src>xatrTrailingstop
    barsell=src<xatrTrailingstop
    
    if ibuy then
    drawarrowup(barindex,low-xatr)coloured("green")
    elsif isell then
    drawarrowdown(barindex,high+xatr)coloured("red")
    endif
    
    if barbuy then
    drawcandle(open,high,low,close)coloured("green")
    elsif barsell then
    drawcandle(open,high,low,close)coloured("red")
    endif
    
    //-------------------------------------------//
    return
    #245438 quote
    Iván González
    Moderator
    Master

    buff, c'est vrai. Merci beaucoup 🙂

    LucasBest thanked this post
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.

Convertir Indicateur RAM Buy and Sell signals


ProBuilder : Indicateurs & Outils Personnalisés

New Reply
Author
author-avatar
Gigi @gigi Participant
Summary

This topic contains 3 replies,
has 3 voices, and was last updated by Iván González
10 months, 1 week ago.

Topic Details
Forum: ProBuilder : Indicateurs & Outils Personnalisés
Language: French
Started: 03/27/2025
Status: Active
Attachments: 1 files
Logo Logo
Loading...