traduzione codice Donchian Channel Strenght

Forums ProRealTime forum Italiano Supporto ProBuilder traduzione codice Donchian Channel Strenght

Viewing 3 posts - 1 through 3 (of 3 total)
  • #232747

    Buongiorno,

    sempre in tema di Canale di Donchain, mi piacerebbe testare questo codice che sembra un oscillatore RSI applicato a Donchian, con evidenziazione di zone

    di overbought e oversold.

    Ringrazio sempre per il cortese aiuto.

    https://it.tradingview.com/script/hCfZsNU2-Donchian-Channels-Strength/

    // This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
    // © Daniel_Ge

    //@version=5
    indicator(title=”Donchian Channels Strength”, shorttitle=”DC Strength”, overlay=false, timeframe=””, timeframe_gaps=true)

    // Input
    src = input(close, “Source”, inline = “Source”)
    include_wicks = input.bool(false, “Include Wicks”, inline = “Source”)
    length = input.int(13, “Length”, minval=2)
    maTypeInput = input.string(“SMMA (RMA)”, title=”MA Type”, options=[“SMA”, “EMA”, “SMMA (RMA)”, “WMA”, “VWMA”])
    signal_length = input.int(9, “Signal Length”)
    overbought_zone = input.int(80, “Overbought Zone”, tooltip = “Can be used for alerts”)
    oversold_zone = input.int(20, “Oversold Zone”, tooltip = “Can be used for alerts”)

    // MA Switch
    ma(source, length, type) =>
    switch type
    “SMA” => ta.sma(source, length)
    “EMA” => ta.ema(source, length)
    “SMMA (RMA)” => ta.rma(source, length)
    “WMA” => ta.wma(source, length)
    “VWMA” => ta.vwma(source, length)

    // Calculations
    lower = ta.lowest(src, length)
    upper = ta.highest(src, length)

    if include_wicks
    lower := ta.lowest(low, length)
    upper := ta.highest(high, length)

    basis = math.avg(upper, lower)
    dif = src – basis
    ma_dif = ma(dif, length, maTypeInput)
    ma_dif_abs = ma(math.abs(dif), length, maTypeInput)
    dc_strength = ma_dif / ma_dif_abs * 50 + 50

    // Lines
    hline(overbought_zone, linestyle = hline.style_dotted, display = display.none)
    hline(50, linestyle = hline.style_solid)
    hline(oversold_zone, linestyle = hline.style_dotted, display = display.none)

    // Plots
    p_50 = plot(50, editable = false, display = display.none) // only used for filling
    p_strength = plot(dc_strength, “DC Strength”, color = dc_strength > 50 ? color(#00cbff) : color(#ff0099))
    plot(ta.ema(dc_strength, signal_length), “Signal”, color = color(#d1d4dc))

    // Filling
    fill(p_strength, p_50, 80, 50, color.new(#00cbff, 70), na, title = “Upper Filling”)
    fill(p_50, p_strength, 50, 20, na, color.new(#ff0099, 70), title = “Lower Filling”)

    // Alerts
    alertcondition(ta.crossover(dc_strength, 50), “DC Strength crossover 50”, “DC Strength crossover 50”)
    alertcondition(ta.crossunder(dc_strength, 50), “DC Strength crossunder 50”, “DC Strength crossunder 50”)
    alertcondition(ta.crossover(dc_strength, overbought_zone), “DC Strength entered overbought zone”, “DC Strength entered overbought zone”)
    alertcondition(ta.crossunder(dc_strength, overbought_zone), “DC Strength left overbought zone”, “DC Strength left overbought zone”)
    alertcondition(ta.crossunder(dc_strength, oversold_zone), “DC Strength entered oversold zone”, “DC Strength entered oversold zone”)
    alertcondition(ta.crossover(dc_strength, oversold_zone), “DC Strength left oversold zone”, “DC Strength left oversold zone”)

     

     

     

    #232822

    Ciao. Ecco il codice tradotto:

    #232826

    Grazie e mille!

Viewing 3 posts - 1 through 3 (of 3 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login