Traduzione codice TW Technical Ratings Pro – Pump Wave
Forums › ProRealTime forum Italiano › Supporto ProBuilder › Traduzione codice TW Technical Ratings Pro – Pump Wave
- This topic has 2 replies, 2 voices, and was last updated 6 months ago by Actaru5.
Viewing 3 posts - 1 through 3 (of 3 total)
-
-
05/06/2024 at 11:22 PM #232410
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à.
TRADINGVIEW - Technical Ratings Pro - Pump Wave123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355//@version=4study(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 OscillatorAO() =>sma(hl2, 5) - sma(hl2, 34)// Stochastic RSIStochRSI() =>rsi1 = rsi(close, 14)K = sma(stoch(rsi1, rsi1, rsi1, 14), 3)D = sma(K, 3)[K, D]// Ultimate Oscillatortl() => close[1] < low ? close[1]: lowuo(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 = naif Value1 != 0 and Value2 != 0 and Value3 != 0var0 = LongLen / ShortLenvar1 = LongLen / MiddlLenValue7 = (Value4 / Value1) * (var0)Value8 = (Value5 / Value2) * (var1)Value9 = (Value6 / Value3)UO := (Value7 + Value8 + Value9) / (var0 + var1 + 1)UO// Ichimoku Clouddonchian(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, RSIRSI = rsi(close,14)// StochasticlengthStoch = 14smoothKStoch = 3smoothDStoch = 3kStoch = sma(stoch(close, high, low, lengthStoch), smoothKStoch)dStoch = sma(kStoch, smoothDStoch)// Commodity Channel Index, CCICCI = cci(close, 20)// Average Directional Indexfloat adxValue = na, float adxPlus = na, float adxMinus = na[P, M, V] = dmi(14, 14)adxValue := VadxPlus := PadxMinus := M// Awesome Oscillatorao = AO()// MomentumMom = 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 RangeWR = wpr(14)// Bull / Bear PowerBullPower = high - ema(close, 13)BearPower = low - ema(close, 13)// Ultimate OscillatorUO = uo(7,14,28)if not na(UO)UO := UO * 100////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////PriceAvg = ema(close, 50)DownTrend = close < PriceAvgUpTrend = close > PriceAvg// calculate trading recommendation based on SMA/EMAfloat ratingMA = 0float ratingMAC = 0if not na(SMA10)ratingMA := ratingMA + calcRatingMA(SMA10, close)ratingMAC := ratingMAC + 1if not na(SMA20)ratingMA := ratingMA + calcRatingMA(SMA20, close)ratingMAC := ratingMAC + 1if not na(SMA30)ratingMA := ratingMA + calcRatingMA(SMA30, close)ratingMAC := ratingMAC + 1if not na(SMA50)ratingMA := ratingMA + calcRatingMA(SMA50, close)ratingMAC := ratingMAC + 1if not na(SMA100)ratingMA := ratingMA + calcRatingMA(SMA100, close)ratingMAC := ratingMAC + 1if not na(SMA200)ratingMA := ratingMA + calcRatingMA(SMA200, close)ratingMAC := ratingMAC + 1if not na(EMA10)ratingMA := ratingMA + calcRatingMA(EMA10, close)ratingMAC := ratingMAC + 1if not na(EMA20)ratingMA := ratingMA + calcRatingMA(EMA20, close)ratingMAC := ratingMAC + 1if not na(EMA30)ratingMA := ratingMA + calcRatingMA(EMA30, close)ratingMAC := ratingMAC + 1if not na(EMA50)ratingMA := ratingMA + calcRatingMA(EMA50, close)ratingMAC := ratingMAC + 1if not na(EMA100)ratingMA := ratingMA + calcRatingMA(EMA100, close)ratingMAC := ratingMAC + 1if not na(EMA200)ratingMA := ratingMA + calcRatingMA(EMA200, close)ratingMAC := ratingMAC + 1if not na(HullMA9)ratingHullMA9 = calcRatingMA(HullMA9, close)ratingMA := ratingMA + ratingHullMA9ratingMAC := ratingMAC + 1if not na(VWMA)ratingVWMA = calcRatingMA(VWMA, close)ratingMA := ratingMA + ratingVWMAratingMAC := ratingMAC + 1float ratingIC = naif 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 + ratingICratingMAC := ratingMAC + 1ratingMA := ratingMAC > 0 ? ratingMA / ratingMAC : nafloat ratingOther = 0float ratingOtherC = 0ratingRSI = RSIif not(na(ratingRSI) or na(ratingRSI[1]))ratingOtherC := ratingOtherC + 1ratingOther := 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 + 1ratingOther := 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 = CCIif not(na(ratingCCI) or na(ratingCCI[1]))ratingOtherC := ratingOtherC + 1ratingOther := 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 + 1ratingOther := 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 + 1ratingOther := 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 + 1ratingOther := ratingOther + calcRating(Mom > Mom[1], Mom < Mom[1])if not(na(macdMACD) or na(signalMACD))ratingOtherC := ratingOtherC + 1ratingOther := ratingOther + calcRating(macdMACD > signalMACD, macdMACD < signalMACD)float ratingStoch_RSI = naif 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 + 1ratingOther := ratingOther + ratingStoch_RSIfloat ratingWR = naif 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 + 1ratingOther := ratingOther + ratingWRfloat ratingBBPower = naif 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 + 1ratingOther := ratingOther + ratingBBPowerfloat ratingUO = naif not(na(UO))ratingUO := calcRating(UO > 70, UO < 30)if not na(ratingUO)ratingOtherC := ratingOtherC + 1ratingOther := ratingOther + ratingUOratingOther := ratingOtherC > 0 ? ratingOther / ratingOtherC : nafloat ratingTotal = 0float ratingTotalC = 0if not na(ratingMA)ratingTotal := ratingTotal + ratingMAratingTotalC := ratingTotalC + 1if not na(ratingOther)ratingTotal := ratingTotal + ratingOtherratingTotalC := ratingTotalC + 1ratingTotal := ratingTotalC > 0 ? ratingTotal / ratingTotalC : na[ratingTotal, ratingOther, ratingMA, ratingOtherC, ratingMAC][ratingTotal, ratingOther, ratingMA, ratingOtherC, ratingMAC] = security(syminfo.tickerid, res, calcRatingAll())StrongBound = 0.5WeakBound = 0.1getSignal(ratingTotal, ratingOther, ratingMA) =>float _res = ratingTotalif ratingSignal == "MAs"_res := ratingMAif ratingSignal == "Oscillators"_res := ratingOther_restradeSignal = getSignal(ratingTotal, ratingOther, ratingMA)poscol = input(color.blue, "Buy Color")neutralcolor = input(color.gray, "Neutral Color")negcol = input(color.red, "Sell Color")poscond = tradeSignal > WeakBoundnegcond = tradeSignal < -WeakBoundposseries = poscond ? tradeSignal : 0negseries = negcond ? tradeSignal : 0count_rising(plot) =>v_plot = plot > 0 ? plot : -plotvar count = 0if v_plot == 0count := 0else if v_plot >= v_plot[1]count := min(5, count + 1)else if v_plot < v_plot[1]count := max(1, count - 1)countposcount = count_rising(posseries)negcount = count_rising(negseries)_pc = poscond ? poscount : negcond ? negcount : 0colorTransp(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 = changeTimeminChange := 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)05/07/2024 at 8:09 PM #232442Hola,
Aquí tienes una aproximación de este indicador:123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641//-----Inputs-----------------------------------------------//defparam DRAWONLASTBARONLY = trueratingSignal=0//0=All 1=MAs 2=Oscillatorsshowema=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))/2donchian26 = (highest[26](high)+lowest[26](low))/2donchian52 = (highest[52](high)+lowest[52](low))/2conversionLine=donchian9baseLine=donchian26leadLine1=(conversionLine+baseLine)/2leadLine2=donchian52//----------------------------------------------------------////-----RSI--------------------------------------------------//myrsi = rsi[14](close)//----------------------------------------------------------////-----Stochastic-------------------------------------------//lengthStoch=14smoothKStoch = 3smoothDStoch = 3kStoch=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)/2ao = 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 periodsmoothK = 3 //Smooth signal of stochastic RSIsmoothD = 3 //Smooth signal of smoothed stochastic RSIMinRSI = lowest[lengthStoch](myrsi)MaxRSI = highest[lengthStoch](myrsi)StochRSI = (myRSI-MinRSI) / (MaxRSI-MinRSI)StochRSIK = average[smoothK](stochrsi)*100StochRSID = average[smoothD](StochRSIK)//----------------------------------------------------------////-----Ultimate Oscillator----------------------------------//if close[1]<low thentl=close[1]elsetl=lowendif//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 thenvar0=28/7var1=28/14value7=(value4/value1)*var0value8=(value5/value2)*var1value9=value6/value3uo=(value7+value8+value9)/(var0+var1+1)*100endif//----------------------------------------------------------////-----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<priceavguptrend=close>priceavg//----------------------------------------------------------////-----Rating MA Calculation--------------------------------////---SMA10if barindex < 10 thencalcRatingSMA10=undefinedelseif sma10=close thencalcRatingSMA10=0elsif sma10<close thencalcRatingSMA10=1elsif sma10>close thencalcRatingSMA10=-1endifcalcSMA10=1endif//---SMA20if barindex < 20 thencalcRatingSMA20=undefinedelseif sma20=close thencalcRatingSMA20=0elsif sma20<close thencalcRatingSMA20=1elsif sma20>close thencalcRatingSMA20=-1endifcalcSMA20=1endif//---SMA30if barindex < 30 thencalcRatingSMA30=undefinedelseif SMA30=close thencalcRatingSMA30=0elsif SMA30<close thencalcRatingSMA30=1elsif SMA30>close thencalcRatingSMA30=-1endifcalcSMA30=1endif//---SMA50if barindex < 50 thencalcRatingSMA50=undefinedelseif SMA50=close thencalcRatingSMA50=0elsif SMA50<close thencalcRatingSMA50=1elsif SMA50>close thencalcRatingSMA50=-1endifcalcSMA50=1endif//---SMA100if barindex < 100 thencalcRatingSMA100=undefinedelseif SMA100=close thencalcRatingSMA100=0elsif SMA100<close thencalcRatingSMA100=1elsif SMA100>close thencalcRatingSMA100=-1endifcalcSMA100=1endif//---SMA200if barindex < 200 thencalcRatingSMA200=undefinedelseif SMA200=close thencalcRatingSMA200=0elsif SMA200<close thencalcRatingSMA200=1elsif SMA200>close thencalcRatingSMA200=-1endifcalcSMA200=1endif//---EMA10if barindex < 10 thencalcRatingEMA10=undefinedelseif EMA10=close thencalcRatingEMA10=0elsif EMA10<close thencalcRatingEMA10=1elsif EMA10>close thencalcRatingEMA10=-1endifcalcEMA10=1endif//---EMA20if barindex < 20 thencalcRatingEMA20=undefinedelseif EMA20=close thencalcRatingEMA20=0elsif EMA20<close thencalcRatingEMA20=1elsif EMA20>close thencalcRatingEMA20=-1endifcalcEMA20=1endif//---EMA30if barindex < 30 thencalcRatingEMA30=undefinedelseif EMA30=close thencalcRatingEMA30=0elsif EMA30<close thencalcRatingEMA30=1elsif EMA30>close thencalcRatingEMA30=-1endifcalcEMA30=1endif//---EMA50if barindex < 50 thencalcRatingEMA50=undefinedelseif EMA50=close thencalcRatingEMA50=0elsif EMA50<close thencalcRatingEMA50=1elsif EMA50>close thencalcRatingEMA50=-1endifcalcEMA50=1endif//---EMA100if barindex < 100 thencalcRatingEMA100=undefinedelseif EMA100=close thencalcRatingEMA100=0elsif EMA100<close thencalcRatingEMA100=1elsif EMA100>close thencalcRatingEMA100=-1endifcalcEMA100=1endif//---EMA200if barindex < 200 thencalcRatingEMA200=undefinedelseif EMA200=close thencalcRatingEMA200=0elsif EMA200<close thencalcRatingEMA200=1elsif EMA200>close thencalcRatingEMA200=-1endifcalcEMA200=1endif//---hull9if barindex < 9 thencalcRatinghullMA9=undefinedelseif hullMA9=close thencalcRatinghullMA9=0elsif hullMA9<close thencalcRatinghullMA9=1elsif hullMA9>close thencalcRatinghullMA9=-1endifcalchullMA9=1endif//---VWMAif barindex < 20 thencalcRatingVWMA=undefinedelseif VWMA=close thencalcRatingVWMA=0elsif VWMA<close thencalcRatingVWMA=1elsif VWMA>close thencalcRatingVWMA=-1endifcalcVWMA=1endif//---Ichimokuma=leadLine1 > leadLine2 and close > leadLine1 and close < baseLine and close[1] < conversionLine and close > conversionLinesrc=leadLine2 > leadLine1 and close < leadLine2 and close > baseLine and close[1] > conversionLine and close < conversionLineif barindex < 52 thencalcRatingichimoku=undefinedelseif ma=src thencalcRatingichimoku=0elsif ma<src thencalcRatingichimoku=1elsif ma>src thencalcRatingichimoku=-1endifcalcichimoku=1endif//---Rating calculationratingMA=calcRatingSMA10+calcRatingSMA20+calcRatingSMA30+calcRatingSMA50+calcRatingSMA100+calcRatingSMA200+calcRatingEMA10+calcRatingEMA20+calcRatingEMA30+calcRatingEMA50+calcRatingEMA100+calcRatingEMA200+calcRatinghullMA9+calcRatingVWMA+calcRatingichimokuratingMAC=calcSMA10+calcSMA20+calcSMA30+calcSMA50+calcSMA100+calcSMA200+calcEMA10+calcEMA20+calcEMA30+calcEMA50+calcEMA100+calcEMA200+calchullMA9+calcVWMA+calcichimokuif ratingMAC > 0 thenrateMA = ratingMA/ratingMACelserateMA = undefinedendif//----------------------------------------------------------////-----Rating Others----------------------------------------////---RSIratingRSI = myrsimaRSI = ratingRSI < 30 and ratingRSI[1] < ratingRSIsrcRSI = ratingRSI > 70 and ratingRSI[1] > ratingRSIif barindex < 14 thencalcRatingRSI=undefinedelseif maRSI=srcRSI thencalcRatingRSI=0elsif maRSI<srcRSI thencalcRatingRSI=1elsif maRSI>srcRSI thencalcRatingRSI=-1endifcalcRSI=1endif//---StockasticmaSto = 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 thencalcRatingSto=undefinedelseif maSto=srcSto thencalcRatingSto=0elsif maSto<srcSto thencalcRatingSto=1elsif maSto>srcSto thencalcRatingSto=-1endifcalcSto=1endif//---CCIratingCCI = myCCImaCCI = ratingCCI < -100 and ratingCCI[1]<ratingCCIsrcCCI = ratingCCI > 100 and ratingCCI[1] > ratingCCIif barindex < 20 thencalcRatingCCI=undefinedelseif maCCI=srcCCI thencalcRatingCCI=0elsif maCCI<srcCCI thencalcRatingCCI=1elsif maCCI>srcCCI thencalcRatingCCI=-1endifcalcCCI=1endif//---ADXmaADX = adxValue > 20 and adxPlus[1] < adxMinus[1] and adxPlus > adxMinussrcADX = adxValue > 20 and adxPlus[1] > adxMinus[1] and adxPlus < adxMinusif barindex < 14 thencalcRatingADX=undefinedelseif maADX=srcADX thencalcRatingADX=0elsif maADX<srcADX thencalcRatingADX=1elsif maADX>srcADX thencalcRatingADX=-1endifcalcADX=1endif//---AOmaAO = 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 thencalcRatingAO=undefinedelseif maAO=srcAO thencalcRatingAO=0elsif maAO<srcAO thencalcRatingAO=1elsif maAO>srcAO thencalcRatingAO=-1endifcalcAO=1endif//---MOMmaMOM = Mom > Mom[1]srcMOM = Mom < Mom[1]if barindex < 10 thencalcRatingMOM=undefinedelseif maMOM=srcMOM thencalcRatingMOM=0elsif maMOM<srcMOM thencalcRatingMOM=1elsif maMOM>srcMOM thencalcRatingMOM=-1endifcalcMOM=1endif//---MACDmaMACD = macdMACD > signalMACDsrcMACD = macdMACD < signalMACDif barindex < 26 thencalcRatingMACD=undefinedelseif maMACD=srcMACD thencalcRatingMACD=0elsif maMACD<srcMACD thencalcRatingMACD=1elsif maMACD>srcMACD thencalcRatingMACD=-1endifcalcMACD=1endif//---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 thencalcRatingStoRSI=undefinedelseif maStoRSI=srcStoRSI thencalcRatingStoRSI=0elsif maStoRSI<srcStoRSI thencalcRatingStoRSI=1elsif maStoRSI>srcStoRSI thencalcRatingStoRSI=-1endifcalcStoRSI=1endif//---WRmaWR = WR < -80 and WR > WR[1]srcWR = WR > -20 and WR < WR[1]if barindex < 20 thencalcRatingWR=undefinedelseif maWR=srcWR thencalcRatingWR=0elsif maWR<srcWR thencalcRatingWR=1elsif maWR>srcWR thencalcRatingWR=-1endifcalcWR=1endif//---BBpowermaBBpower = UpTrend and BearPower < 0 and BearPower > BearPower[1]srcBBpower = DownTrend and BullPower > 0 and BullPower < BullPower[1]if barindex < 20 thencalcRatingBBpower=undefinedelseif maBBpower=srcBBpower thencalcRatingBBpower=0elsif maBBpower<srcBBpower thencalcRatingBBpower=1elsif maBBpower>srcBBpower thencalcRatingBBpower=-1endifcalcBBpower=1endif//---UOmaUO = UO > 70srcUO = UO < 30if barindex < 56 thencalcRatingUO=undefinedelseif maUO=srcUO thencalcRatingUO=0elsif maUO<srcUO thencalcRatingUO=1elsif maUO>srcUO thencalcRatingUO=-1endifcalcUO=1endif//---Rating calculationratingOtherC = calcUO+calcBBpower+calcWR+calcStoRSI+calcMACD+calcMOM+calcAO+calcADX+calcCCI+calcSto+calcRSIratingOther = calcRatingUO+calcRatingBBpower+calcRatingWR+calcRatingStoRSI+calcRatingMACD+calcRatingMOM+calcRatingAO+calcRatingADX+calcRatingCCI+calcRatingSto+calcRatingRSIif ratingOtherC>0 thenrateOther = ratingOther/ratingOtherCelserateOther = undefinedendif//----------------------------------------------------------////-----Rating Total-----------------------------------------//rateTotal = (rateMA+rateOther)/2//----------------------------------------------------------//StrongBound = 0.5WeakBound = 0.1if ratingSignal=1 thentradeSignal = rateMAelsif ratingSignal=2 thentradeSignal = rateOtherelsetradeSignal = rateTotalendif//----------------------------------------------------------////----------------------------------------------------------//myrate1=round(rateMA,2)*100if -StrongBound > rateMA thendrawtext("MAs: Strong Sell #myrate1#%",-100,-30)anchor(topright,xshift,yshift)r=255g=0b=0elsif rateMA < -weakbound thendrawtext("MAs: Sell #myrate1#%",-100,-30)anchor(topright,xshift,yshift)r=125g=0b=0elsif rateMA > Strongbound thendrawtext("MAs: Strong Buy #myrate1#%",-100,-30)anchor(topright,xshift,yshift)r=0g=0b=255elsif rateMA > weakbound thendrawtext("MAs: Buy #myrate1#%",-100,-30)anchor(topright,xshift,yshift)r=0g=0b=125elsedrawtext("MAs: Neutral #myrate1#%",-100,-30)anchor(topright,xshift,yshift)r=124g=124b=124endifmyrate2=round(rateOther,2)*100if -StrongBound > rateOther thendrawtext("Oscillators: Strong Sell #myrate2#%",-100,-50)anchor(topright,xshift,yshift)r=255g=0b=0elsif rateOther < -weakbound thendrawtext("Oscillators: Sell #myrate2#%",-100,-50)anchor(topright,xshift,yshift)r=125g=0b=0elsif rateOther > Strongbound thendrawtext("Oscillators: Strong Buy #myrate2#%",-100,-50)anchor(topright,xshift,yshift)r=0g=0b=255elsif rateOther > weakbound thendrawtext("Oscillators: Buy #myrate2#%",-100,-50)anchor(topright,xshift,yshift)r=0g=0b=125elsedrawtext("Oscillators: Neutral #myrate2#%",-100,-50)anchor(topright,xshift,yshift)r=124g=124b=124endifmyrate3=round(rateTotal,2)*100if -StrongBound > rateTotal thendrawtext("All: Strong Sell #myrate3#%",-100,-70)anchor(topright,xshift,yshift)r=255g=0b=0elsif rateTotal < -weakbound thendrawtext("All: Sell #myrate3#%",-100,-70)anchor(topright,xshift,yshift)r=125g=0b=0elsif rateTotal > Strongbound thendrawtext("All: Strong Buy #myrate3#%",-100,-70)anchor(topright,xshift,yshift)r=0g=0b=255elsif rateTotal > weakbound thendrawtext("All: Buy #myrate3#%",-100,-70)anchor(topright,xshift,yshift)r=0g=0b=125elsedrawtext("All: Neutral #myrate3#%",-100,-70)anchor(topright,xshift,yshift)r=124g=124b=124endif//----------------------------------------------------------//stradeSignal=average[6,1](tradeSignal)//----------------------------------------------------------//if showema thenp1 = rateMAp2 = rateMA*(-1)COLORBETWEEN(p1,p2,r,g,b)elsep1 = undefinedp2 = undefinedendifif showosc thenp3 = rateOther-2.5p4 = rateOther*(-1)-1.5COLORBETWEEN(p3,p4,r,g,b)elsep3 = undefinedp4 = undefinedendifif showtotal thenp5 = stradeSignal + 2p6 = stradeSignal*(-1) + 2COLORBETWEEN(p5,p6,r,g,b)elsep5 = undefinedp6 = undefinedendif//----------------------------------------------------------////-----Trend Line-------------------------------------------//sline = average[6,2](rateMA)if showtrend thenuplevel=-3dwlevel=-7p7=(sline*2)-5elseuplevel=undefineddwlevel=undefinedp7=undefinedendif//----------------------------------------------------------//return p1,p2,p3,p4,p5,p6,p7 as "Trend Line"coloured(r,g,b)style(line,5),uplevel,dwlevel05/07/2024 at 9:14 PM #232445 -
AuthorPosts
Viewing 3 posts - 1 through 3 (of 3 total)
Find exclusive trading pro-tools on
Similar topics: