traduzione codice Range Detector [LuxAlgo]

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

    Buongiorno,

     

    vorrei chiedere la traduzione del seguente codice che indentifica i range in tempo reale, piuttosto interessante.

     

    Ringrazio per la consueta collaborazione.

    https://it.tradingview.com/script/QOuZIuvH-Range-Detector-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=5
    indicator(“Range Detector [LuxAlgo]”, “LuxAlgo – Range Detector”, overlay = true, max_boxes_count = 500, max_lines_count = 500)
    //——————————————————————————
    //Settings
    //—————————————————————————–{
    length = input.int(20, ‘Minimum Range Length’, minval = 2)
    mult = input.float(1., ‘Range Width’, minval = 0, step = 0.1)
    atrLen = input.int(500, ‘ATR Length’, minval = 1)

    //Style
    upCss = input(#089981, ‘Broken Upward’, group = ‘Style’)
    dnCss = input(#f23645, ‘Broken Downward’, group = ‘Style’)
    unbrokenCss = input(#2157f3, ‘Unbroken’, group = ‘Style’)

    //—————————————————————————–}
    //Detect and highlight ranges
    //—————————————————————————–{
    //Ranges drawings
    var box bx = na
    var line lvl = na

    //Extensions
    var float max = na
    var float min = na

    var os = 0
    color detect_css = na

    n = bar_index
    atr = ta.atr(atrLen) * mult
    ma = ta.sma(close, length)

    count = 0
    for i = 0 to length-1
    count += math.abs(close[i] – ma) > atr ? 1 : 0

    if count == 0 and count[1] != count
    //Test for overlap and change coordinates
    if n[length] <= bx.get_right()
    max := math.max(ma + atr, bx.get_top())
    min := math.min(ma – atr, bx.get_bottom())

    //Box new coordinates
    bx.set_top(max)
    bx.set_rightbottom(n, min)
    bx.set_bgcolor(color.new(unbrokenCss, 80))

    //Line new coordinates
    avg = math.avg(max, min)
    lvl.set_y1(avg)
    lvl.set_xy2(n, avg)
    lvl.set_color(unbrokenCss)
    else
    max := ma + atr
    min := ma – atr

    //Set new box and level
    bx := box.new(n[length], ma + atr, n, ma – atr, na
    , bgcolor = color.new(unbrokenCss, 80))

    lvl := line.new(n[length], ma, n, ma
    , color = unbrokenCss
    , style = line.style_dotted)

    detect_css := color.new(color.gray, 80)
    os := 0

    else if count == 0
    bx.set_right(n)
    lvl.set_x2(n)

    //Set color
    if close > bx.get_top()
    bx.set_bgcolor(color.new(upCss, 80))
    lvl.set_color(upCss)
    os := 1
    else if close < bx.get_bottom()
    bx.set_bgcolor(color.new(dnCss, 80))
    lvl.set_color(dnCss)
    os := -1

    //—————————————————————————–}
    //Plots
    //—————————————————————————–{
    //Range detection bgcolor
    bgcolor(detect_css)

    plot(max, ‘Range Top’
    , max != max[1] ? na : os == 0 ? unbrokenCss : os == 1 ? upCss : dnCss)

    plot(min, ‘Range Bottom’
    , min != min[1] ? na : os == 0 ? unbrokenCss : os == 1 ? upCss : dnCss)

    //—————————————————————————–}

    Screenshot-2024-04-08-at-18-18-28-Squeeze-—-Indicatori-e-segnali-—-TradingView.png Screenshot-2024-04-08-at-18-18-28-Squeeze-—-Indicatori-e-segnali-—-TradingView.png
    #231300 quote
    Iván González
    Moderator
    Legend
    #231309 quote
    Msport71
    Participant
    Senior

    Ivan,

    grazie e mille.

    Posso chiederti la cortesia se puoi recuperare lo script dell’altro codice di cui ho chiesto la traduzione?

    traduzione codice TW Squeeze & Release

    Scusa il disturbo ma non riesco a postarlo in nessuna maniera.

    Grazie

    #231323 quote
    Iván González
    Moderator
    Legend

    Ciao, è già tradotto. Si è verificato un problema con i simboli utilizzati nel codice tradingview che non venivano accettati sul forum.

Viewing 4 posts - 1 through 4 (of 4 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 Range Detector [LuxAlgo]


ProBuilder: Indicatori & Strumenti Personalizzati

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

This topic contains 3 replies,
has 2 voices, and was last updated by Iván González
2 years, 5 months ago.

Topic Details
Forum: ProBuilder: Indicatori & Strumenti Personalizzati
Language: Italian
Started: 04/08/2024
Status: Active
Attachments: 1 files
Logo Logo
Loading...