Conversion TTM SQUEEZE PRO de Tradingview

Forums ProRealTime forum Français Support ProBuilder Conversion TTM SQUEEZE PRO de Tradingview

Viewing 2 posts - 1 through 2 (of 2 total)
  • #201769

    Bonjour,
    Sur le site il y a le code pour le TTM SQUEEZE mais celui ci a un peu évolué. Est-il possible d’avoir la version “PRO” que l’on trouve sur TV ?
    Merci

    // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
    // © Beardy_Fred

    //@version=5
    indicator(‘Beardy Squeeze Pro’, shorttitle=’Squeeze’, overlay=false, precision=2)

    length = input.int(20, “TTM Squeeze Length”)

    //BOLLINGER BANDS
    BB_mult = input.float(2.0, “Bollinger Band STD Multiplier”)
    BB_basis = ta.sma(close, length)
    dev = BB_mult * ta.stdev(close, length)
    BB_upper = BB_basis + dev
    BB_lower = BB_basis – dev

    //KELTNER CHANNELS
    KC_mult_high = input.float(1.0, “Keltner Channel #1”)
    KC_mult_mid = input.float(1.5, “Keltner Channel #2”)
    KC_mult_low = input.float(2.0, “Keltner Channel #3”)
    KC_basis = ta.sma(close, length)
    devKC = ta.sma(ta.tr, length)
    KC_upper_high = KC_basis + devKC * KC_mult_high
    KC_lower_high = KC_basis – devKC * KC_mult_high
    KC_upper_mid = KC_basis + devKC * KC_mult_mid
    KC_lower_mid = KC_basis – devKC * KC_mult_mid
    KC_upper_low = KC_basis + devKC * KC_mult_low
    KC_lower_low = KC_basis – devKC * KC_mult_low

    //SQUEEZE CONDITIONS
    NoSqz = BB_lower < KC_lower_low or BB_upper > KC_upper_low //NO SQUEEZE: GREEN
    LowSqz = BB_lower >= KC_lower_low or BB_upper <= KC_upper_low //LOW COMPRESSION: BLACK MidSqz = BB_lower >= KC_lower_mid or BB_upper <= KC_upper_mid //MID COMPRESSION: RED HighSqz = BB_lower >= KC_lower_high or BB_upper <= KC_upper_high //HIGH COMPRESSION: ORANGE //MOMENTUM OSCILLATOR mom = ta.linreg(close - math.avg(math.avg(ta.highest(high, length), ta.lowest(low, length)), ta.sma(close, length)), length, 0) //MOMENTUM HISTOGRAM COLOR iff_1 = mom > nz(mom[1]) ? color.new(color.aqua, 0) : color.new(#2962ff, 0)
    iff_2 = mom < nz(mom[1]) ? color.new(color.red, 0) : color.new(color.yellow, 0) mom_color = mom > 0 ? iff_1 : iff_2

    //SQUEEZE DOTS COLOR
    sq_color = HighSqz ? color.new(color.orange, 0) : MidSqz ? color.new(color.red, 0) : LowSqz ? color.new(color.black, 0) : color.new(color.green, 0)

    //ALERTS
    Detect_Sqz_Start = input.bool(true, “Alert Price Action Squeeze”)
    Detect_Sqz_Fire = input.bool(true, “Alert Squeeze Firing”)

    if Detect_Sqz_Start and NoSqz[1] and not NoSqz
    alert(“Squeeze Started”)
    else if Detect_Sqz_Fire and NoSqz and not NoSqz[1]
    alert(“Squeeze Fired”)

    //PLOTS
    plot(mom, title=’MOM’, color=mom_color, style=plot.style_columns, linewidth=2)
    plot(0, title=’SQZ’, color=sq_color, style=plot.style_circles, linewidth=3)

    #202046

    J’ai tenté de modifier le code de la version standard mais sans grand succés.

    J’ai déclaré les variables multKC2 = 2  et multKC1 = 1 pour les ecarts type du KC

    Car a la lecture du code de TV je pense en déduire que les points rouge correspondent au squeeze sur le KC 1,5 (origine du code), les noirs (low compression) sur le KC = 2 et le orange (high compression) sur le KC = 1
    J’ai fait le code ci dessous, mais cela ne fonctionne pas, quelles sont les modifications a apporter pour voir ces differents points ? Merci pour votre aide

    1 user thanked author for this post.
Viewing 2 posts - 1 through 2 (of 2 total)

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