Reversion Index

  • This topic has 1 reply, 2 voices, and was last updated 2 days ago by avatarIván.
Viewing 2 posts - 1 through 2 (of 2 total)
  • #254594

    Please can someone convert this indicator from Tradingview.

    // TASC Issue: January 2026
    // Article: Identifying Peaks And Valleys In Ranging Markets
    // The Reversion Index
    // Article By: John F. Ehlers
    // Language: TradingView’s Pine Script® v6
    // Provided By: PineCoders, for tradingview.com

    //@version=6
    indicator(“TASC 2026.01 The Reversion Index”, “RI”, overlay = false)

    //#region Inputs

    int length = input.int(20, title = “RI Length”, tooltip = “Normalization Length of Data.”)
    riSmooth = 8
    trSmooth = 4

    //#endregion

    //#region Functions

    // Reversion Index
    reversionIndex (int length) =>
    float d = close – close[1]
    float ds = math.sum(d, length)
    float ads = math.sum(math.abs(d), length)
    float ratio = ads != 0.0 ? ds / ads : 0.0
    ratio

    // Super Smoother Filter
    superSmoother(float Series, float Period) =>
    var float ALPHA = math.pi * math.sqrt(2.0) / Period
    var float BETA = math.exp(-ALPHA )
    var float COEF2 = -math.pow(BETA, 2)
    var float COEF1 = math.cos( ALPHA ) * 2.0 * BETA
    var float COEF0 = 1.0 – COEF1 – COEF2
    float sma2 = math.avg(Series, nz(Series[1], Series))
    float smooth = na, smooth := COEF0 * sma2 +
    COEF1 * nz(smooth[1]) +
    COEF2 * nz(smooth[2])

    //#endregion

    //#region Calculations

    float ri = reversionIndex(length)
    float sm = superSmoother(ri, riSmooth)
    float tr = superSmoother(ri, trSmooth)

    //#endregion

    //#region Display

    hline(0)
    plot(sm, “Smooth”, color.red)
    plot(tr, “Trigger”, color.blue)

    //#endregion

    #254608

    Here it is:

    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