CYCLE SWING MOMENTUM

Forums ProRealTime foro Español Soporte ProBuilder CYCLE SWING MOMENTUM

Viewing 1 post (of 1 total)
  • #228521

    Hola a tod@s. Puede alguien transcribir el siguiente indicador de Tradingview a PRT?:

    https://es.tradingview.com/v/b7o7GmWT/

    Cycle1(i, waveThrottle, cycs) =>
        ret = 6.0*waveThrottle+1.0
        if (i==0)
            ret := 1.0+waveThrottle
        else if (i==1)
            ret := 1.0+waveThrottle*5.0
        else if (i==(cycs-1))
            ret := 1.0+waveThrottle
        else if (i==(cycs-2))
            ret := 1.0+waveThrottle*5.0
        ret
    Cycle2(i, waveThrottle, cycs) =>
        ret=-4.0*waveThrottle
        if (i==0)
            ret := -2.0*waveThrottle
        else if (i==(cycs-1))
            ret := 0.0
        else if (i==(cycs-2))
            ret := -2.0*waveThrottle
        ret
    Cycle3(i, waveThrottle, cycs) =>
        ret = waveThrottle
        if (i==(cycs-1))
            ret := 0.0
        else if (i==(cycs-2))
            ret := 0.0
        ret
    iWTT_CSI_processor(CycleCount) =>
        wtt1=0.0
        wtt2=0.0
        wtt3=0.0
        wtt4=0.0
        wtt5=0.0
        _wtt1=0.0
        _wtt2=0.0
        _wtt3=0.0
        _wtt4=0.0
        _wtt5=0.0
        momentum=0.0
        acceleration=0.0
        swing=0.0
        cycs=50
        waveThrottle=float(160*CycleCount)
        currentVal=0.0
        for i = 0 to cycs – 1 by 1
            swing:=Cycle1(i,waveThrottle,cycs)-wtt4*wtt1-_wtt5*_wtt2
            if(swing==0)
                break
            momentum := Cycle2(i,waveThrottle,cycs)
            _wtt1 := wtt1
            wtt1 := (momentum-wtt4*wtt2)/swing
            acceleration:=Cycle3(i,waveThrottle,cycs)
            _wtt2 := wtt2
            wtt2 := acceleration/swing
            currentVal:=(close[49-i]-_wtt3*_wtt5-wtt3*wtt4)/swing
            _wtt3  := wtt3
            wtt3   := currentVal
            wtt4   := momentum-wtt5*_wtt1
            _wtt5  := wtt5
            wtt5   := acceleration
        currentVal
    banding(CRSI, Period, Leveling) =>
        var percent = Leveling / 100.0
        periodMinusOne = Period-1
        maxima = -999999.0
        minima =  999999.0
        for i=0 to periodMinusOne
            crsi = nz(CRSI[i])
            if      crsi > maxima
                maxima := crsi
            else if crsi < minima
                minima := crsi
        stepFactor = (maxima – minima) / 100.0
        float lowBand = na
        for steps=0 to 100
            testValue = minima + stepFactor * steps
            below = 0
            for m=0 to periodMinusOne
                if CRSI[m] < testValue
                    below := below + 1
            if below/Period >= percent
                lowBand := testValue
                break
        float highBand = na
        for steps=0 to 100
            testValue = maxima – stepFactor * steps
            above = 0
            for m=0 to periodMinusOne
                if CRSI[m] >= testValue
                    above := above + 1
            if above/Period >= percent
                highBand := testValue
                break
        [highBand, lowBand]
    //==== Vars
    var leveling  = 10
    var cyclicMemory = 34
    //===== Calculations
    thrust1=iWTT_CSI_processor(1)
    thrust2=iWTT_CSI_processor(10)
    CSIBuffer = thrust1-thrust2
    [highBand, lowBand] = banding( CSIBuffer, cyclicMemory,  leveling)
    highband = plot(highBand, “HighBand”, color=color.aqua , editable=false)
    lowband  = plot( lowBand,  “LowBand”, color=color.aqua , editable=false)
    fill( highband,  lowband, transp=90 , color=#CCCC77   )
    plot(0, color=color.black, linewidth=1, transp=25)
    plot(CSIBuffer, color=color.fuchsia, linewidth=1)

     

Viewing 1 post (of 1 total)

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