Traduzione codice TW Technical Ratings Pro – Pump Wave

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #232410 quote
    Actaru5
    Participant
    Veteran

    Buonasera a tutti,

    vorrei provare questo codice di cui richiedo cortese traduzione.

    https://it.tradingview.com/script/A9tEtrNW-Technical-Ratings-Pro-Pump-Wave/

    Ringrazianto, saluto la comunità.

    //@version=4
    study(title="Technical Ratings Pro - Pump Wave", shorttitle="Technicals Pro", precision=0)
    res = input("", title="Indicator Timeframe", type=input.resolution)
    ratingSignal = input(defval = "All", title = "Rating is based on", options = ["MAs", "Oscillators", "All"])
    showtotal = input(defval = false, title = "Show Total Rating Pump Wave?")
    showema = input(defval = true, title = "Show MA Pump Wave?")
    showosc = input(defval = true, title = "Show Oscillator Pump Wave?")
    showtrend = input(defval = true, title = "Show MA Trend Line?")
    showsignals = input(defval = false, title = "Show Alert Signals?")
    
    // Awesome Oscillator
    AO() => 
        sma(hl2, 5) - sma(hl2, 34)
    // Stochastic RSI
    StochRSI() =>
        rsi1 = rsi(close, 14)
        K = sma(stoch(rsi1, rsi1, rsi1, 14), 3)
        D = sma(K, 3)
        [K, D]
    // Ultimate Oscillator
    tl() => close[1] < low ? close[1]: low
    uo(ShortLen, MiddlLen, LongLen) =>
        Value1 = sum(tr, ShortLen)
        Value2 = sum(tr, MiddlLen)
        Value3 = sum(tr, LongLen)
        Value4 = sum(close - tl(), ShortLen)
        Value5 = sum(close - tl(), MiddlLen)
        Value6 = sum(close - tl(), LongLen)
        float UO = na
        if Value1 != 0 and Value2 != 0 and Value3 != 0
            var0 = LongLen / ShortLen
            var1 = LongLen / MiddlLen
            Value7 = (Value4 / Value1) * (var0)
            Value8 = (Value5 / Value2) * (var1)
            Value9 = (Value6 / Value3)
            UO := (Value7 + Value8 + Value9) / (var0 + var1 + 1)
        UO
    // Ichimoku Cloud
    donchian(len) => avg(lowest(len), highest(len))
    ichimoku_cloud() =>
        conversionLine = donchian(9)
        baseLine = donchian(26)
        leadLine1 = avg(conversionLine, baseLine)
        leadLine2 = donchian(52)
        [conversionLine, baseLine, leadLine1, leadLine2]
        
    calcRatingMA(ma, src) => na(ma) or na(src) ? na : (ma == src ? 0 : ( ma < src ? 1 : -1 ))
    calcRating(buy, sell) => buy ? 1 : ( sell ? -1 : 0 )
    calcRatingAll() =>
        //============== MA =================
        SMA10 = sma(close, 10)
        SMA20 = sma(close, 20)
        SMA30 = sma(close, 30)
        SMA50 = sma(close, 50)
        SMA100 = sma(close, 100)
        SMA200 = sma(close, 200)
        
        EMA10 = ema(close, 10)
        EMA20 = ema(close, 20)
        EMA30 = ema(close, 30)
        EMA50 = ema(close, 50)
        EMA100 = ema(close, 100)
        EMA200 = ema(close, 200)
        
        HullMA9 = hma(close, 9)
        
        // Volume Weighted Moving Average (VWMA)
        VWMA = vwma(close, 20)
        
        [IC_CLine, IC_BLine, IC_Lead1, IC_Lead2] = ichimoku_cloud()
        
        // ======= Other =============
        // Relative Strength Index, RSI
        RSI = rsi(close,14)
        
        // Stochastic
        lengthStoch = 14
        smoothKStoch = 3
        smoothDStoch = 3
        kStoch = sma(stoch(close, high, low, lengthStoch), smoothKStoch)
        dStoch = sma(kStoch, smoothDStoch)
        
        // Commodity Channel Index, CCI
        CCI = cci(close, 20)
        
        // Average Directional Index
        float adxValue = na, float adxPlus = na, float adxMinus = na
        [P, M, V] = dmi(14, 14)
        adxValue := V
        adxPlus := P
        adxMinus := M
        // Awesome Oscillator
        ao = AO()
        
        // Momentum
        Mom = mom(close, 10)
        // Moving Average Convergence/Divergence, MACD
        [macdMACD, signalMACD, _] = macd(close, 12, 26, 9)
        // Stochastic RSI
        [Stoch_RSI_K, Stoch_RSI_D] = StochRSI()
        // Williams Percent Range
        WR = wpr(14)
        
        // Bull / Bear Power
        BullPower = high - ema(close, 13)
        BearPower = low - ema(close, 13)
        // Ultimate Oscillator
        UO = uo(7,14,28)
        if not na(UO)
            UO := UO * 100
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        
        PriceAvg = ema(close, 50)
        DownTrend = close < PriceAvg
        UpTrend = close > PriceAvg
        // calculate trading recommendation based on SMA/EMA
        float ratingMA = 0
        float ratingMAC = 0
        
        if not na(SMA10)
            ratingMA := ratingMA + calcRatingMA(SMA10, close)
            ratingMAC := ratingMAC + 1
        if not na(SMA20)
            ratingMA := ratingMA + calcRatingMA(SMA20, close)
            ratingMAC := ratingMAC + 1
        if not na(SMA30)
            ratingMA := ratingMA + calcRatingMA(SMA30, close)
            ratingMAC := ratingMAC + 1
        if not na(SMA50)
            ratingMA := ratingMA + calcRatingMA(SMA50, close)
            ratingMAC := ratingMAC + 1
        if not na(SMA100)
            ratingMA := ratingMA + calcRatingMA(SMA100, close)
            ratingMAC := ratingMAC + 1
        if not na(SMA200)
            ratingMA := ratingMA + calcRatingMA(SMA200, close)
            ratingMAC := ratingMAC + 1
        if not na(EMA10)
            ratingMA := ratingMA + calcRatingMA(EMA10, close)
            ratingMAC := ratingMAC + 1
        if not na(EMA20)
            ratingMA := ratingMA + calcRatingMA(EMA20, close)
            ratingMAC := ratingMAC + 1
        if not na(EMA30)
            ratingMA := ratingMA + calcRatingMA(EMA30, close)
            ratingMAC := ratingMAC + 1
        if not na(EMA50)
            ratingMA := ratingMA + calcRatingMA(EMA50, close)
            ratingMAC := ratingMAC + 1
        if not na(EMA100)
            ratingMA := ratingMA + calcRatingMA(EMA100, close)
            ratingMAC := ratingMAC + 1
        if not na(EMA200)
            ratingMA := ratingMA + calcRatingMA(EMA200, close)
            ratingMAC := ratingMAC + 1
        
        if not na(HullMA9)
            ratingHullMA9 = calcRatingMA(HullMA9, close)
            ratingMA := ratingMA + ratingHullMA9
            ratingMAC := ratingMAC + 1
        
        if not na(VWMA)
            ratingVWMA = calcRatingMA(VWMA, close)
            ratingMA := ratingMA + ratingVWMA
            ratingMAC := ratingMAC + 1
        
        float ratingIC = na
        if not (na(IC_Lead1) or na(IC_Lead2) or na(close) or na(close[1]) or na(IC_BLine) or na(IC_CLine))
            ratingIC := calcRating(
             IC_Lead1 > IC_Lead2 and close > IC_Lead1 and close < IC_BLine and close[1] < IC_CLine and close > IC_CLine,
             IC_Lead2 > IC_Lead1 and close < IC_Lead2 and close > IC_BLine and close[1] > IC_CLine and close < IC_CLine)
        if not na(ratingIC)
            ratingMA := ratingMA + ratingIC
            ratingMAC := ratingMAC + 1
        
        ratingMA := ratingMAC > 0 ? ratingMA / ratingMAC : na
        
        float ratingOther = 0
        float ratingOtherC = 0
        
        ratingRSI = RSI
        if not(na(ratingRSI) or na(ratingRSI[1]))
            ratingOtherC := ratingOtherC + 1
            ratingOther := ratingOther + calcRating(ratingRSI < 30 and ratingRSI[1] < ratingRSI, ratingRSI > 70 and ratingRSI[1] > ratingRSI)
        
        if not(na(kStoch) or na(dStoch) or na(kStoch[1]) or na(dStoch[1]))
            ratingOtherC := ratingOtherC + 1
            ratingOther := ratingOther + calcRating(kStoch < 20 and dStoch < 20 and kStoch > dStoch and kStoch[1] < dStoch[1], kStoch > 80 and dStoch > 80 and kStoch < dStoch and kStoch[1] > dStoch[1])
        
        ratingCCI = CCI
        if not(na(ratingCCI) or na(ratingCCI[1]))
            ratingOtherC := ratingOtherC + 1
            ratingOther := ratingOther + calcRating(ratingCCI < -100 and ratingCCI > ratingCCI[1], ratingCCI > 100 and ratingCCI < ratingCCI[1])
        
        if not(na(adxValue) or na(adxPlus[1]) or na(adxMinus[1]) or na(adxPlus) or na(adxMinus))
            ratingOtherC := ratingOtherC + 1
            ratingOther := ratingOther + calcRating(adxValue > 20 and adxPlus[1] < adxMinus[1] and adxPlus > adxMinus, adxValue > 20 and adxPlus[1] > adxMinus[1] and adxPlus < adxMinus)
        
        if not(na(ao) or na(ao[1]))
            ratingOtherC := ratingOtherC + 1
            ratingOther := ratingOther + calcRating(crossover(ao,0) or (ao > 0 and ao[1] > 0 and ao > ao[1] and ao[2] > ao[1]), crossunder(ao,0) or (ao < 0 and ao[1] < 0 and ao < ao[1] and ao[2] < ao[1]))
        
        if not(na(Mom) or na(Mom[1]))
            ratingOtherC := ratingOtherC + 1
            ratingOther := ratingOther + calcRating(Mom > Mom[1], Mom < Mom[1])
        
        if not(na(macdMACD) or na(signalMACD))
            ratingOtherC := ratingOtherC + 1
            ratingOther := ratingOther + calcRating(macdMACD > signalMACD, macdMACD < signalMACD)
        
        float ratingStoch_RSI = na
        if not(na(DownTrend) or na(UpTrend) or na(Stoch_RSI_K) or na(Stoch_RSI_D) or na(Stoch_RSI_K[1]) or na(Stoch_RSI_D[1]))
            ratingStoch_RSI := calcRating(
             DownTrend and Stoch_RSI_K < 20 and Stoch_RSI_D < 20 and Stoch_RSI_K > Stoch_RSI_D and Stoch_RSI_K[1] < Stoch_RSI_D[1],
             UpTrend and Stoch_RSI_K > 80 and Stoch_RSI_D > 80 and Stoch_RSI_K < Stoch_RSI_D and Stoch_RSI_K[1] > Stoch_RSI_D[1])
        if not na(ratingStoch_RSI)
            ratingOtherC := ratingOtherC + 1
            ratingOther := ratingOther + ratingStoch_RSI
        
        float ratingWR = na
        if not(na(WR) or na(WR[1]))
            ratingWR := calcRating(WR < -80 and WR > WR[1], WR > -20 and WR < WR[1])
        if not na(ratingWR)
            ratingOtherC := ratingOtherC + 1
            ratingOther := ratingOther + ratingWR
        
        float ratingBBPower = na
        if not(na(UpTrend) or na(DownTrend) or na(BearPower) or na(BearPower[1]) or na(BullPower) or na(BullPower[1]))
            ratingBBPower := calcRating(
             UpTrend and BearPower < 0 and BearPower > BearPower[1],
             DownTrend and BullPower > 0 and BullPower < BullPower[1])
        if not na(ratingBBPower)
            ratingOtherC := ratingOtherC + 1
            ratingOther := ratingOther + ratingBBPower
        
        float ratingUO = na
        if not(na(UO))
            ratingUO := calcRating(UO > 70, UO < 30)
        if not na(ratingUO)
            ratingOtherC := ratingOtherC + 1
            ratingOther := ratingOther + ratingUO
        
        ratingOther := ratingOtherC > 0 ? ratingOther / ratingOtherC : na
        
        float ratingTotal = 0
        float ratingTotalC = 0
        if not na(ratingMA)
            ratingTotal := ratingTotal + ratingMA
            ratingTotalC := ratingTotalC + 1
        if not na(ratingOther)
            ratingTotal := ratingTotal + ratingOther
            ratingTotalC := ratingTotalC + 1
        ratingTotal := ratingTotalC > 0 ? ratingTotal / ratingTotalC : na
        
        [ratingTotal, ratingOther, ratingMA, ratingOtherC, ratingMAC]
    [ratingTotal, ratingOther, ratingMA, ratingOtherC, ratingMAC]  = security(syminfo.tickerid, res, calcRatingAll())
    StrongBound = 0.5
    WeakBound = 0.1
    getSignal(ratingTotal, ratingOther, ratingMA) =>
        float _res = ratingTotal
        if ratingSignal == "MAs"
            _res := ratingMA
        if ratingSignal == "Oscillators"
            _res := ratingOther
        _res
    tradeSignal = getSignal(ratingTotal, ratingOther, ratingMA)
    
    poscol = input(color.blue, "Buy Color")
    neutralcolor = input(color.gray, "Neutral Color")
    negcol = input(color.red, "Sell Color")
    poscond = tradeSignal > WeakBound
    negcond = tradeSignal < -WeakBound
    posseries = poscond ? tradeSignal : 0
    negseries = negcond ? tradeSignal : 0
    count_rising(plot) =>
        v_plot = plot > 0 ? plot : -plot
        var count = 0
        if v_plot == 0
            count := 0
        else if v_plot >= v_plot[1]
            count := min(5, count + 1)
        else if v_plot < v_plot[1]
            count := max(1, count - 1)
        count
    poscount = count_rising(posseries)
    negcount = count_rising(negseries)
    _pc = poscond ? poscount : negcond ? negcount : 0
    colorTransp(col, transp) =>
        red = color.r(col)
        green = color.g(col)
        blue = color.b(col)
        color.rgb(red, green, blue, transp)
    getTimeOfNextBar() =>
        currentTime = time(timeframe.period)
        changeTime = change(currentTime)
        minChange = if (not na(changeTime))
            var float minChange = changeTime
            minChange := min(minChange, changeTime)
        int(currentTime + minChange)
    drawInfo(txt, value) =>
        var info = label.new(0, 0, "", yloc = yloc.price, xloc = xloc.bar_time, textalign = text.align_left, textcolor = color.white)
        label.set_x(info, getTimeOfNextBar())
        label.set_text(info, txt)
        label.set_color(info, poscond ? poscol : negcond ? negcol : color.gray)
        label.set_style(info, label.style_label_left)
    calcRatingStatus(value) =>
        if -StrongBound > value
            "Strong Sell"
        else if value < -WeakBound
            "Sell"
        else if value > StrongBound
            "Strong Buy"
        else if value > WeakBound
            "Buy"
        else
            "Neutral"
    MAText = ratingMAC == 0 ? "" : "MAs: " + calcRatingStatus(ratingMA) + " " + tostring(ratingMA * 100, '#.##') + "%" + "\n" 
    OtherText = ratingOtherC == 0 ? "" : "Oscillators: " + calcRatingStatus(ratingOther) + " " + tostring(ratingOther * 100, '#.##') + "%" + "\n" 
    TotaText = "All: " + calcRatingStatus(ratingTotal) + " " + tostring(ratingTotal * 100, '#.##') + "%" 
    drawInfo(MAText + OtherText + TotaText, tradeSignal)
    col_buy = color.from_gradient(tradeSignal, 0.0, 0.2, neutralcolor, poscol)
    col_sell = color.from_gradient(tradeSignal, -0.2, 0.0, negcol, neutralcolor)
    col_gradient = color.from_gradient(tradeSignal, -0.2, 0.2, col_sell, col_buy)
    col_ma = color.from_gradient(ratingMA, -1, 1, negcol, poscol)
    stradeSignal = ema(tradeSignal,6)
    p1 = plot(showema ? ratingMA : na, color = col_ma)
    p2 = plot(showema ? ratingMA * -1 : na, color = col_ma)  
    p3 = plot(showosc ? ratingOther - 2.5 : na, color = colorTransp(col_gradient, 50 - _pc * 10))
    p4 = plot(showosc ? ratingOther * -1 - 1.5 : na, color = colorTransp(col_gradient, 50 - _pc * 10))
    p5 = plot(showtotal ? stradeSignal + 2 : na, color = colorTransp(col_gradient, 50 - _pc * 10))
    p6 = plot(showtotal ? stradeSignal * -1 + 2 : na, color = colorTransp(col_gradient, 50 - _pc * 10))
    fill(p3,p4, color = colorTransp(col_gradient, 50 - _pc * 10))
    fill(p1,p2, color = col_ma)
    fill(p5,p6, color = colorTransp(col_gradient, 50 - _pc * 10))
    sline = wma(ratingMA,6)
    c_grad = color.from_gradient(ratingMA, -1, 1, col_sell, col_buy)
    plot(showtrend ? -3 : na, color= c_grad)
    plot(showtrend ? -7 : na, color= c_grad)
    p7 = plot(showtrend ? (sline * 2) - 5 : na, color=c_grad,linewidth=4)
    
    barcolor(color = col_gradient)  // remove this line to disable colored candles
    
    _cond1 = crossunder(tradeSignal, -WeakBound)
    alertcondition(_cond1, "Sell", "Ratings changed to Sell")
    _cond2 = crossover(tradeSignal, WeakBound)
    alertcondition(_cond2, "Buy", "Ratings changed to Buy")
    _cond3 = crossunder(tradeSignal, -StrongBound)
    alertcondition(_cond3, "Strong Sell", "Ratings changed to Strong Sell")
    _cond4 = crossover(tradeSignal, StrongBound)
    alertcondition(_cond4, "Strong Buy", "Ratings changed to Strong Buy")
    
    plotshape(showsignals ? _cond3 : na, title="Sell - Ratings changed to Sell", location=location.absolute, style=shape.triangledown, size=size.tiny, color=col_sell, transp=0)
    plotshape(showsignals ? _cond4 : na, title="Buy - Ratings changed to Buy", location=location.absolute, style=shape.triangleup, size=size.tiny, color=col_buy, transp=0)
    plotshape(showsignals ? _cond3 : na, title="Strong Sell - Ratings changed to Strong Sell", location=location.absolute, style=shape.circle, size=size.tiny, color=col_sell, transp=0)
    plotshape(showsignals ? _cond4 : na, title="Strong Buy - Ratings changed to Strong Buy", location=location.absolute, style=shape.circle, size=size.tiny, color=col_buy, transp=0)
    
    Technical-Ratings-Pro-Pump-Wave.jpg Technical-Ratings-Pro-Pump-Wave.jpg
    #232442 quote
    Iván González
    Moderator
    Master

    Hola,
    Aquí tienes una aproximación de este indicador:

    //-----Inputs-----------------------------------------------//
    defparam DRAWONLASTBARONLY = true
    ratingSignal=0//0=All 1=MAs 2=Oscillators
    showema=1//Show MA Pump Wave?
    showosc=1//Show Oscillator Pump Wave?
    showtotal=1//Show Total Rating Pump Wave?
    showtrend=1//Show MA Trend Line?
    //----------------------------------------------------------//
    //-----Moving Averages--------------------------------------//
    sma10=average[10,0](close)
    sma20=average[20,0](close)
    sma30=average[30,0](close)
    sma50=average[50,0](close)
    sma100=average[100,0](close)
    sma200=average[200,0](close)
    
    ema10=average[10,1](close)
    ema20=average[20,1](close)
    ema30=average[30,1](close)
    ema50=average[50,1](close)
    ema100=average[100,1](close)
    ema200=average[200,1](close)
    
    hullMA9=hullaverage[9](close)
    
    vwma=VolumeAdjustedAverage[20](close)
    //----------------------------------------------------------//
    //-----Ichimoku Cloud---------------------------------------//
    donchian9 = (highest[9](high)+lowest[9](low))/2
    donchian26 = (highest[26](high)+lowest[26](low))/2
    donchian52 = (highest[52](high)+lowest[52](low))/2
    
    conversionLine=donchian9
    baseLine=donchian26
    leadLine1=(conversionLine+baseLine)/2
    leadLine2=donchian52
    //----------------------------------------------------------//
    //-----RSI--------------------------------------------------//
    myrsi = rsi[14](close)
    //----------------------------------------------------------//
    //-----Stochastic-------------------------------------------//
    lengthStoch=14
    smoothKStoch = 3
    smoothDStoch = 3
    kStoch=Stochastic[lengthStoch,smoothKStoch](close)
    Dstoch=Stochasticd[lengthStoch,smoothKStoch,smoothDStoch](close)
    //----------------------------------------------------------//
    //-----CCI--------------------------------------------------//
    mycci = cci[20](close)
    //----------------------------------------------------------//
    //-----ADX--------------------------------------------------//
    adxvalue = ADX[14]
    adxPlus = DIplus[14](close)
    adxMinus = DIminus[14](close)
    //----------------------------------------------------------//
    //-----awesome Oscilator------------------------------------//
    hl2 = (high+low)/2
    ao = average[5](hl2)-average[34](hl2)
    //----------------------------------------------------------//
    //-----Momentum---------------------------------------------//
    mom = momentum[10](close)
    //----------------------------------------------------------//
    //-----MACD-------------------------------------------------//
    macdMACD = MACDline[12,26,9](close)
    signalMACD = MACDSignal[12,26,9](close)
    //----------------------------------------------------------//
    //-----Stochastic RSI---------------------------------------//
    lengthStoch = 14 //Stochastic period
    smoothK = 3 //Smooth signal of stochastic RSI
    smoothD = 3 //Smooth signal of smoothed stochastic RSI
     
    MinRSI = lowest[lengthStoch](myrsi)
    MaxRSI = highest[lengthStoch](myrsi)
     
    StochRSI = (myRSI-MinRSI) / (MaxRSI-MinRSI)
     
    StochRSIK = average[smoothK](stochrsi)*100
    StochRSID = average[smoothD](StochRSIK)
    //----------------------------------------------------------//
    //-----Ultimate Oscillator----------------------------------//
    if close[1]<low then
    tl=close[1]
    else
    tl=low
    endif
    //uo(ShortLen, MiddlLen, LongLen)(7,14,28)
    value1=summation[7](tr)
    value2=summation[14](tr)
    value3=summation[28](tr)
    value4=summation[7](close-tl)
    value5=summation[14](close-tl)
    value6=summation[28](close-tl)
    if value1<>0 and value2<>0 and value3<>0 then
    var0=28/7
    var1=28/14
    value7=(value4/value1)*var0
    value8=(value5/value2)*var1
    value9=value6/value3
    uo=(value7+value8+value9)/(var0+var1+1)*100
    endif
    //----------------------------------------------------------//
    //-----Williams Percent Range-------------------------------//
    wr = Williams[14](close)
    //----------------------------------------------------------//
    //-----Bull & Bear Power------------------------------------//
    BullPower = high - average[13,1](close)
    BearPower = low - average[13,1](close)
    //----------------------------------------------------------//
    priceavg=average[50,1](close)
    downtrend=close<priceavg
    uptrend=close>priceavg
    //----------------------------------------------------------//
    //-----Rating MA Calculation--------------------------------//
    //---SMA10
    if barindex < 10 then
    calcRatingSMA10=undefined
    else
    if sma10=close then
    calcRatingSMA10=0
    elsif sma10<close then
    calcRatingSMA10=1
    elsif sma10>close then
    calcRatingSMA10=-1
    endif
    calcSMA10=1
    endif
    //---SMA20
    if barindex < 20 then
    calcRatingSMA20=undefined
    else
    if sma20=close then
    calcRatingSMA20=0
    elsif sma20<close then
    calcRatingSMA20=1
    elsif sma20>close then
    calcRatingSMA20=-1
    endif
    calcSMA20=1
    endif
    //---SMA30
    if barindex < 30 then
    calcRatingSMA30=undefined
    else
    if SMA30=close then
    calcRatingSMA30=0
    elsif SMA30<close then
    calcRatingSMA30=1
    elsif SMA30>close then
    calcRatingSMA30=-1
    endif
    calcSMA30=1
    endif
    //---SMA50
    if barindex < 50 then
    calcRatingSMA50=undefined
    else
    if SMA50=close then
    calcRatingSMA50=0
    elsif SMA50<close then
    calcRatingSMA50=1
    elsif SMA50>close then
    calcRatingSMA50=-1
    endif
    calcSMA50=1
    endif
    //---SMA100
    if barindex < 100 then
    calcRatingSMA100=undefined
    else
    if SMA100=close then
    calcRatingSMA100=0
    elsif SMA100<close then
    calcRatingSMA100=1
    elsif SMA100>close then
    calcRatingSMA100=-1
    endif
    calcSMA100=1
    endif
    //---SMA200
    if barindex < 200 then
    calcRatingSMA200=undefined
    else
    if SMA200=close then
    calcRatingSMA200=0
    elsif SMA200<close then
    calcRatingSMA200=1
    elsif SMA200>close then
    calcRatingSMA200=-1
    endif
    calcSMA200=1
    endif
    //---EMA10
    if barindex < 10 then
    calcRatingEMA10=undefined
    else
    if EMA10=close then
    calcRatingEMA10=0
    elsif EMA10<close then
    calcRatingEMA10=1
    elsif EMA10>close then
    calcRatingEMA10=-1
    endif
    calcEMA10=1
    endif
    //---EMA20
    if barindex < 20 then
    calcRatingEMA20=undefined
    else
    if EMA20=close then
    calcRatingEMA20=0
    elsif EMA20<close then
    calcRatingEMA20=1
    elsif EMA20>close then
    calcRatingEMA20=-1
    endif
    calcEMA20=1
    endif
    //---EMA30
    if barindex < 30 then
    calcRatingEMA30=undefined
    else
    if EMA30=close then
    calcRatingEMA30=0
    elsif EMA30<close then
    calcRatingEMA30=1
    elsif EMA30>close then
    calcRatingEMA30=-1
    endif
    calcEMA30=1
    endif
    //---EMA50
    if barindex < 50 then
    calcRatingEMA50=undefined
    else
    if EMA50=close then
    calcRatingEMA50=0
    elsif EMA50<close then
    calcRatingEMA50=1
    elsif EMA50>close then
    calcRatingEMA50=-1
    endif
    calcEMA50=1
    endif
    //---EMA100
    if barindex < 100 then
    calcRatingEMA100=undefined
    else
    if EMA100=close then
    calcRatingEMA100=0
    elsif EMA100<close then
    calcRatingEMA100=1
    elsif EMA100>close then
    calcRatingEMA100=-1
    endif
    calcEMA100=1
    endif
    //---EMA200
    if barindex < 200 then
    calcRatingEMA200=undefined
    else
    if EMA200=close then
    calcRatingEMA200=0
    elsif EMA200<close then
    calcRatingEMA200=1
    elsif EMA200>close then
    calcRatingEMA200=-1
    endif
    calcEMA200=1
    endif
    //---hull9
    if barindex < 9 then
    calcRatinghullMA9=undefined
    else
    if hullMA9=close then
    calcRatinghullMA9=0
    elsif hullMA9<close then
    calcRatinghullMA9=1
    elsif hullMA9>close then
    calcRatinghullMA9=-1
    endif
    calchullMA9=1
    endif
    //---VWMA
    if barindex < 20 then
    calcRatingVWMA=undefined
    else
    if VWMA=close then
    calcRatingVWMA=0
    elsif VWMA<close then
    calcRatingVWMA=1
    elsif VWMA>close then
    calcRatingVWMA=-1
    endif
    calcVWMA=1
    endif
    //---Ichimoku
    ma=leadLine1 > leadLine2 and close > leadLine1 and close < baseLine and close[1] < conversionLine and close > conversionLine
    src=leadLine2 > leadLine1 and close < leadLine2 and close > baseLine and close[1] > conversionLine and close < conversionLine
    if barindex < 52 then
    calcRatingichimoku=undefined
    else
    if ma=src then
    calcRatingichimoku=0
    elsif ma<src then
    calcRatingichimoku=1
    elsif ma>src then
    calcRatingichimoku=-1
    endif
    calcichimoku=1
    endif
    //---Rating calculation
    ratingMA=calcRatingSMA10+calcRatingSMA20+calcRatingSMA30+calcRatingSMA50+calcRatingSMA100+calcRatingSMA200+calcRatingEMA10+calcRatingEMA20+calcRatingEMA30+calcRatingEMA50+calcRatingEMA100+calcRatingEMA200+calcRatinghullMA9+calcRatingVWMA+calcRatingichimoku
    
    ratingMAC=calcSMA10+calcSMA20+calcSMA30+calcSMA50+calcSMA100+calcSMA200+calcEMA10+calcEMA20+calcEMA30+calcEMA50+calcEMA100+calcEMA200+calchullMA9+calcVWMA+calcichimoku
    
    if ratingMAC > 0 then
    rateMA = ratingMA/ratingMAC
    else
    rateMA = undefined
    endif
    //----------------------------------------------------------//
    //-----Rating Others----------------------------------------//
    //---RSI
    ratingRSI = myrsi
    maRSI = ratingRSI < 30 and ratingRSI[1] < ratingRSI
    srcRSI = ratingRSI > 70 and ratingRSI[1] > ratingRSI
    if barindex < 14 then
    calcRatingRSI=undefined
    else
    if maRSI=srcRSI then
    calcRatingRSI=0
    elsif maRSI<srcRSI then
    calcRatingRSI=1
    elsif maRSI>srcRSI then
    calcRatingRSI=-1
    endif
    calcRSI=1
    endif
    //---Stockastic
    maSto = kStoch < 20 and dStoch < 20 and kStoch > dStoch and kStoch[1] < dStoch[1]
    srcSto = kStoch > 80 and dStoch > 80 and kStoch < dStoch and kStoch[1] > dStoch[1]
    if barindex < 14 then
    calcRatingSto=undefined
    else
    if maSto=srcSto then
    calcRatingSto=0
    elsif maSto<srcSto then
    calcRatingSto=1
    elsif maSto>srcSto then
    calcRatingSto=-1
    endif
    calcSto=1
    endif
    //---CCI
    ratingCCI = myCCI
    maCCI = ratingCCI < -100 and ratingCCI[1]<ratingCCI
    srcCCI = ratingCCI > 100 and ratingCCI[1] > ratingCCI
    if barindex < 20 then
    calcRatingCCI=undefined
    else
    if maCCI=srcCCI then
    calcRatingCCI=0
    elsif maCCI<srcCCI then
    calcRatingCCI=1
    elsif maCCI>srcCCI then
    calcRatingCCI=-1
    endif
    calcCCI=1
    endif
    //---ADX
    maADX = adxValue > 20 and adxPlus[1] < adxMinus[1] and adxPlus > adxMinus
    srcADX = adxValue > 20 and adxPlus[1] > adxMinus[1] and adxPlus < adxMinus
    if barindex < 14 then
    calcRatingADX=undefined
    else
    if maADX=srcADX then
    calcRatingADX=0
    elsif maADX<srcADX then
    calcRatingADX=1
    elsif maADX>srcADX then
    calcRatingADX=-1
    endif
    calcADX=1
    endif
    //---AO
    maAO = ao crosses over 0 or (ao > 0 and ao[1] > 0 and ao > ao[1] and ao[2] > ao[1])
    srcAO = ao crosses under 0 or (ao < 0 and ao[1] < 0 and ao < ao[1] and ao[2] < ao[1])
    if barindex < 34 then
    calcRatingAO=undefined
    else
    if maAO=srcAO then
    calcRatingAO=0
    elsif maAO<srcAO then
    calcRatingAO=1
    elsif maAO>srcAO then
    calcRatingAO=-1
    endif
    calcAO=1
    endif
    //---MOM
    maMOM = Mom > Mom[1]
    srcMOM = Mom < Mom[1]
    if barindex < 10 then
    calcRatingMOM=undefined
    else
    if maMOM=srcMOM then
    calcRatingMOM=0
    elsif maMOM<srcMOM then
    calcRatingMOM=1
    elsif maMOM>srcMOM then
    calcRatingMOM=-1
    endif
    calcMOM=1
    endif
    //---MACD
    maMACD = macdMACD > signalMACD
    srcMACD = macdMACD < signalMACD
    if barindex < 26 then
    calcRatingMACD=undefined
    else
    if maMACD=srcMACD then
    calcRatingMACD=0
    elsif maMACD<srcMACD then
    calcRatingMACD=1
    elsif maMACD>srcMACD then
    calcRatingMACD=-1
    endif
    calcMACD=1
    endif
    //---Stoch RSI
    //ratingStoRSI =
    maStoRSI = DownTrend and StochRSIK < 20 and StochRSID < 20 and StochRSIK > StochRSID and StochRSIK[1] < StochRSID[1]
    srcStoRSI = UpTrend and StochRSIK > 80 and StochRSID > 80 and StochRSIK < StochRSID and StochRSIK[1] > StochRSID[1]
    if barindex < 20 then
    calcRatingStoRSI=undefined
    else
    if maStoRSI=srcStoRSI then
    calcRatingStoRSI=0
    elsif maStoRSI<srcStoRSI then
    calcRatingStoRSI=1
    elsif maStoRSI>srcStoRSI then
    calcRatingStoRSI=-1
    endif
    calcStoRSI=1
    endif
    //---WR
    maWR = WR < -80 and WR > WR[1]
    srcWR = WR > -20 and WR < WR[1]
    if barindex < 20 then
    calcRatingWR=undefined
    else
    if maWR=srcWR then
    calcRatingWR=0
    elsif maWR<srcWR then
    calcRatingWR=1
    elsif maWR>srcWR then
    calcRatingWR=-1
    endif
    calcWR=1
    endif
    //---BBpower
    maBBpower = UpTrend and BearPower < 0 and BearPower > BearPower[1]
    srcBBpower = DownTrend and BullPower > 0 and BullPower < BullPower[1]
    if barindex < 20 then
    calcRatingBBpower=undefined
    else
    if maBBpower=srcBBpower then
    calcRatingBBpower=0
    elsif maBBpower<srcBBpower then
    calcRatingBBpower=1
    elsif maBBpower>srcBBpower then
    calcRatingBBpower=-1
    endif
    calcBBpower=1
    endif
    //---UO
    maUO = UO > 70
    srcUO = UO < 30
    if barindex < 56 then
    calcRatingUO=undefined
    else
    if maUO=srcUO then
    calcRatingUO=0
    elsif maUO<srcUO then
    calcRatingUO=1
    elsif maUO>srcUO then
    calcRatingUO=-1
    endif
    calcUO=1
    endif
    //---Rating calculation
    ratingOtherC = calcUO+calcBBpower+calcWR+calcStoRSI+calcMACD+calcMOM+calcAO+calcADX+calcCCI+calcSto+calcRSI
    
    ratingOther = calcRatingUO+calcRatingBBpower+calcRatingWR+calcRatingStoRSI+calcRatingMACD+calcRatingMOM+calcRatingAO+calcRatingADX+calcRatingCCI+calcRatingSto+calcRatingRSI
    
    if ratingOtherC>0 then
    rateOther = ratingOther/ratingOtherC
    else
    rateOther = undefined
    endif
    //----------------------------------------------------------//
    //-----Rating Total-----------------------------------------//
    rateTotal = (rateMA+rateOther)/2
    //----------------------------------------------------------//
    StrongBound = 0.5
    WeakBound = 0.1
    
    if ratingSignal=1 then
    tradeSignal = rateMA
    elsif ratingSignal=2 then
    tradeSignal = rateOther
    else
    tradeSignal = rateTotal
    endif
    //----------------------------------------------------------//
    //----------------------------------------------------------//
    
    myrate1=round(rateMA,2)*100
    if -StrongBound > rateMA then
    drawtext("MAs: Strong Sell #myrate1#%",-100,-30)anchor(topright,xshift,yshift)
    r=255
    g=0
    b=0
    elsif rateMA < -weakbound then
    drawtext("MAs: Sell #myrate1#%",-100,-30)anchor(topright,xshift,yshift)
    r=125
    g=0
    b=0
    elsif rateMA > Strongbound then
    drawtext("MAs: Strong Buy #myrate1#%",-100,-30)anchor(topright,xshift,yshift)
    r=0
    g=0
    b=255
    elsif rateMA > weakbound then
    drawtext("MAs: Buy #myrate1#%",-100,-30)anchor(topright,xshift,yshift)
    r=0
    g=0
    b=125
    else
    drawtext("MAs: Neutral #myrate1#%",-100,-30)anchor(topright,xshift,yshift)
    r=124
    g=124
    b=124
    endif
    
    myrate2=round(rateOther,2)*100
    if -StrongBound > rateOther then
    drawtext("Oscillators: Strong Sell #myrate2#%",-100,-50)anchor(topright,xshift,yshift)
    r=255
    g=0
    b=0
    elsif rateOther < -weakbound then
    drawtext("Oscillators: Sell #myrate2#%",-100,-50)anchor(topright,xshift,yshift)
    r=125
    g=0
    b=0
    elsif rateOther > Strongbound then
    drawtext("Oscillators: Strong Buy #myrate2#%",-100,-50)anchor(topright,xshift,yshift)
    r=0
    g=0
    b=255
    elsif rateOther > weakbound then
    drawtext("Oscillators: Buy #myrate2#%",-100,-50)anchor(topright,xshift,yshift)
    r=0
    g=0
    b=125
    else
    drawtext("Oscillators: Neutral #myrate2#%",-100,-50)anchor(topright,xshift,yshift)
    r=124
    g=124
    b=124
    endif
    myrate3=round(rateTotal,2)*100
    if -StrongBound > rateTotal then
    drawtext("All: Strong Sell #myrate3#%",-100,-70)anchor(topright,xshift,yshift)
    r=255
    g=0
    b=0
    elsif rateTotal < -weakbound then
    drawtext("All: Sell #myrate3#%",-100,-70)anchor(topright,xshift,yshift)
    r=125
    g=0
    b=0
    elsif rateTotal > Strongbound then
    drawtext("All: Strong Buy #myrate3#%",-100,-70)anchor(topright,xshift,yshift)
    r=0
    g=0
    b=255
    elsif rateTotal > weakbound then
    drawtext("All: Buy #myrate3#%",-100,-70)anchor(topright,xshift,yshift)
    r=0
    g=0
    b=125
    else
    drawtext("All: Neutral #myrate3#%",-100,-70)anchor(topright,xshift,yshift)
    r=124
    g=124
    b=124
    endif
    
    //----------------------------------------------------------//
    stradeSignal=average[6,1](tradeSignal)
    //----------------------------------------------------------//
    if showema then
    p1 = rateMA
    p2 = rateMA*(-1)
    COLORBETWEEN(p1,p2,r,g,b)
    else
    p1 = undefined
    p2 = undefined
    endif
    if showosc then
    p3 = rateOther-2.5
    p4 = rateOther*(-1)-1.5
    COLORBETWEEN(p3,p4,r,g,b)
    else
    p3 = undefined
    p4 = undefined
    endif
    if showtotal then
    p5 = stradeSignal + 2
    p6 = stradeSignal*(-1) + 2
    COLORBETWEEN(p5,p6,r,g,b)
    else
    p5 = undefined
    p6 = undefined
    endif
    //----------------------------------------------------------//
    //-----Trend Line-------------------------------------------//
    sline = average[6,2](rateMA)
    if showtrend then
    uplevel=-3
    dwlevel=-7
    p7=(sline*2)-5
    else
    uplevel=undefined
    dwlevel=undefined
    p7=undefined
    endif
    //----------------------------------------------------------//
    return p1,p2,p3,p4,p5,p6,p7 as "Trend Line"coloured(r,g,b)style(line,5),uplevel,dwlevel
    #232445 quote
    Actaru5
    Participant
    Veteran

    Grazie,

    mi sei stato di grande aiuto.

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.

Traduzione codice TW Technical Ratings Pro – Pump Wave


ProBuilder: Indicatori & Strumenti Personalizzati

New Reply
Author
author-avatar
Actaru5 @actaru5 Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by Actaru5
1 year, 10 months ago.

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