Traduzione codice TW Rally Base Drop

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #247428 quote
    Msport71Msport71
    Participant
    Senior

    Buongiorno,

     

    chiedo cortese traduzione codice in oggetto (forse noto ai trader ICT) che mi incuriosisce e vorrei provarlo.

     

    Grazie come sempre per l’aiuto.

    https://www.tradingview.com/script/PVsY637u-Rally-Base-Drop-SND-Pivots-LuxAlgo/

    // This work is licensed under a Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0) https://creativecommons.org/licenses/by-nc-sa/4.0/
    // © LuxAlgo

    //@version=6
    indicator(“Rally Base Drop SND Pivots [LuxAlgo]”, “LuxAlgo – RBD SND Pivots”, overlay = true, max_lines_count = 500)

    //———————————————————————————————————————}
    //Inputs
    //———————————————————————————————————————{

    len = input.int(3, title = “Length”)

    rallyCol = input.color(color.new(#089981,50), title = “Rally Color”)
    dropCol = input.color(color.new(#f23645,50),title = “Drop Color”)

    hideLen = input.int(0, title = “Historical Lookback”,minval = 0, tooltip = “Hide Levels farther than this number of bars back.\n\nNote: 0 = Show All”)

    //———————————————————————————————————————}
    //UDTs
    //———————————————————————————————————————{

    type pb
    float price
    int bar

    //———————————————————————————————————————}
    //Basic Variables
    //———————————————————————————————————————{

    gc = close > open
    rc = close < open

    rally = gc and gc[1]
    drop = rc and rc[1]
    base = not rally and not drop

    //———————————————————————————————————————}
    //Functions
    //———————————————————————————————————————{

    check_rb_piv(_len) =>
    var pb piv_hi = pb.new(na,na)
    var pb piv_lo = pb.new(na,na)
    hst = ta.highest(math.max(close,open),_len)
    lst = ta.lowest(math.min(close,open),_len)
    for i = 0 to len – 1
    if not gc[i] or not rc[len+i]
    piv_lo := pb.new(na,na)
    break
    if i == len-1 and close > open[len+i] and close[len] < close[len+i]
    piv_lo := pb.new(low[i],bar_index[i])
    box.new(bar_index[len+i],hst[len],bar_index[len],lst[len], bgcolor = dropCol, border_color = dropCol)
    box.new(bar_index[i],hst,bar_index,lst, bgcolor = rallyCol, border_color = rallyCol)
    for i = 0 to len – 1
    if not rc[i] or not gc[len+i]
    piv_hi := pb.new(na,na)
    break
    if i == len-1 and close < open[len+i] and close[len] > close[len+i]
    piv_hi := pb.new(high[i],bar_index[i])
    box.new(bar_index[len+i],hst[len],bar_index[len],lst[len], bgcolor = rallyCol, border_color = rallyCol)
    box.new(bar_index[i],hst,bar_index,lst, bgcolor = dropCol, border_color = dropCol)

    [piv_hi,piv_lo]

    //———————————————————————————————————————}
    //Processes
    //———————————————————————————————————————{

    [ph,pl] = check_rb_piv(len)

    var his = array.new_line(na)
    var los = array.new_line(na)

    if not na(ph.price)
    his.push(line.new(ph.bar,ph.price,bar_index,ph.price, color = dropCol))
    if not na(pl.price)
    los.push(line.new(pl.bar,pl.price,bar_index,pl.price, color = rallyCol))

    for [i,ln] in los
    if close[1] < ln.get_y1()
    los.remove(i)
    continue
    ln.set_x2(bar_index)
    for [i,ln] in his
    if close[1] > ln.get_y1()
    his.remove(i)
    continue
    ln.set_x2(bar_index)

    if hideLen > 0
    for bx in box.all
    if bx.get_right() < bar_index-(hideLen+(len*2))
    bx.delete()
    for ln in line.all
    if ln.get_x1() < bar_index-(hideLen+(len*2))
    ln.delete()

    //———————————————————————————————————————}

    Screenshot-2025-05-21-at-10-36-44-Rally-Base-Drop-SND-Pivots-LuxAlgo-—-Indicator-by-LuxAlgo-—-TradingView.png Screenshot-2025-05-21-at-10-36-44-Rally-Base-Drop-SND-Pivots-LuxAlgo-—-Indicator-by-LuxAlgo-—-TradingView.png
    #247479 quote
    Iván GonzálezIván González
    Moderator
    Legend

    Ecco

    //----------------------------------------//
    //PRC_Rally Base Drop SND
    //version = 0
    //22.05.25
    //Iván González @ www.prorealcode.com
    //Sharing ProRealTime knowledge
    //----------------------------------------//
    // Inputs
    //----------------------------------------//
    len=3
    //----------------------------------------//
    // Basic Variables
    //----------------------------------------//
    gc=close>open
    rc=close<open
    rally=gc and gc[1]
    drop=rc and rc[1]
    base=rally=0 and drop=0
    atr=averagetruerange[14](close)
    //----------------------------------------//
    // Pivots High and Low
    //----------------------------------------//
    hst=highest[len](max(close,open))
    lst=lowest[len](min(close,open))
    
    for i=0 to len-1 do
    if gc[i]=0 or rc[len+i]=0 then
    break
    endif
    if i=len-1 and close>open[len+i] and close[len]<close[len+i] then
    $pivlow[n+1]=low[i]
    $pivlowIdx[n+1]=barindex[i]
    $pivlowBroken[n+1]=0
    $pivlowBrokenidx[n+1]=barindex
    n=n+1
    drawrectangle(barindex[len+i],hst[len],barindex[len],lst[len])coloured("red")fillcolor("red",30)
    drawrectangle(barindex[i],hst,barindex,lst)coloured("green")fillcolor("green",30)
    endif
    next
    for i=0 to len-1 do
    if rc[i]=0 or gc[len+i]=0 then
    break
    endif
    if i=len-1 and close<open[len+i] and close[len]>close[len+i] then
    $pivhigh[t+1]=high[i]
    $pivhighIdx[t+1]=barindex[i]
    $pivhighBroken[t+1]=0
    $pivhighBrokenidx[t+1]=barindex
    t=t+1
    drawrectangle(barindex[len+i],hst[len],barindex[len],lst[len])coloured("green")fillcolor("green",30)
    drawrectangle(barindex[i],hst,barindex,lst)coloured("red")fillcolor("red",30)
    endif
    next
    
    if islastbarupdate then
    
    for i=n downto 1 do
    for k=barindex-($pivlowIdx[i]+1) downto 0 do 
    if low[k]<$pivlow[i] and $pivlowBroken[i]=0 then
    $pivlowBroken[i]=1
    $pivlowBrokenidx[i]=barindex[k]
    break
    endif
    next
    if $pivlowBroken[i]=1 then
    drawsegment($pivlowIdx[i],$pivlow[i],$pivlowBrokenidx[i],$pivlow[i])coloured("green")
    else
    drawsegment($pivlowIdx[i],$pivlow[i],barindex,$pivlow[i])coloured("green")
    endif
    next
    
    for i=t downto 1 do
    for k=barindex-($pivhighIdx[i]+1) downto 0 do
    if high[k]>$pivhigh[i] and $pivhighBroken[i]=0 then
    $pivhighBroken[i]=1
    $pivhighBrokenidx[i]=barindex[k]
    break
    endif
    next
    if $pivhighBroken[i]=1 then
    drawsegment($pivhighIdx[i],$pivhigh[i],$pivhighBrokenidx[i],$pivhigh[i])coloured("red")
    else
    drawsegment($pivhighIdx[i],$pivhigh[i],barindex,$pivhigh[i])coloured("red")
    endif
    next
    endif
    //----------------------------------------//
    return
    Msport71 thanked this post
    #247486 quote
    Msport71Msport71
    Participant
    Senior

    Grazie!

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

Traduzione codice TW Rally Base Drop


ProBuilder: Indicatori & Strumenti Personalizzati

New Reply
Author
author-avatar
Msport71 @carlo-pasca Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by Msport71Msport71
1 year, 3 months ago.

Topic Details
Forum: ProBuilder: Indicatori & Strumenti Personalizzati
Language: Italian
Started: 05/21/2025
Status: Active
Attachments: 1 files
ProRealCode ProRealCode
Loading...