Ripster EMA Clouds
Forums › ProRealTime forum Français › Support ProBuilder › Ripster EMA Clouds
- This topic has 6 replies, 3 voices, and was last updated 1 year ago by jprt.
-
-
12/02/2023 at 10:59 PM #224738
Bonjour,
est-il possible de convertir ce script pour le rendre compatible avec PRT 11 ?
Merci
Source : https://www.tradingview.com/script/7LPOiiMN-Ripster-EMA-Clouds/
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/// © ripster47//@version=4study("Ripster EMA Clouds","Ripster EMA Clouds", overlay=true)matype = input(title="MA Type", type=input.string, defval="EMA", options=["EMA", "SMA"])ma_len1 = input(title="Short EMA1 Length", type=input.integer, defval=8)ma_len2 = input(title="Long EMA1 Length", type=input.integer, defval=9)ma_len3 = input(title="Short EMA2 Length", type=input.integer, defval=5)ma_len4 = input(title="Long EMA2 Length", type=input.integer, defval=12)ma_len5 = input(title="Short EMA3 Length", type=input.integer, defval=34)ma_len6 = input(title="Long EMA3 Length", type=input.integer, defval=50)ma_len7 = input(title="Short EMA4 Length", type=input.integer, defval=72)ma_len8 = input(title="Long EMA4 Length", type=input.integer, defval=89)ma_len9 = input(title="Short EMA5 Length", type=input.integer, defval=180)ma_len10 = input(title="Long EMA5 Length", type=input.integer, defval=200)src = input(title="Source", type=input.source, defval=hl2)ma_offset = input(title="Offset", type=input.integer, defval=0)//res = input(title="Resolution", type=resolution, defval="240")f_ma(malen) =>float result = 0if (matype == "EMA")result := ema(src, malen)if (matype == "SMA")result := sma(src, malen)resulthtf_ma1 = f_ma(ma_len1)htf_ma2 = f_ma(ma_len2)htf_ma3 = f_ma(ma_len3)htf_ma4 = f_ma(ma_len4)htf_ma5 = f_ma(ma_len5)htf_ma6 = f_ma(ma_len6)htf_ma7 = f_ma(ma_len7)htf_ma8 = f_ma(ma_len8)htf_ma9 = f_ma(ma_len9)htf_ma10 = f_ma(ma_len10)//plot(out1, color=green, offset=ma_offset)//plot(out2, color=red, offset=ma_offset)//lengthshort = input(8, minval = 1, title = "Short EMA Length")//lengthlong = input(200, minval = 2, title = "Long EMA Length")//emacloudleading = input(50, minval = 0, title = "Leading Period For EMA Cloud")//src = input(hl2, title = "Source")showlong = input(false, title="Show Long Alerts")showshort = input(false, title="Show Short Alerts")showLine = input(false, title="Display EMA Line")ema1 = input(true, title="Show EMA Cloud-1")ema2 = input(true, title="Show EMA Cloud-2")ema3 = input(true, title="Show EMA Cloud-3")ema4 = input(false, title="Show EMA Cloud-4")ema5 = input(false, title="Show EMA Cloud-5")emacloudleading = input(0, minval=0, title="Leading Period For EMA Cloud")mashort1 = htf_ma1malong1 = htf_ma2mashort2 = htf_ma3malong2 = htf_ma4mashort3 = htf_ma5malong3 = htf_ma6mashort4 = htf_ma7malong4 = htf_ma8mashort5 = htf_ma9malong5 = htf_ma10cloudcolour1 = mashort1 >= malong1 ? #036103 : #880e4fcloudcolour2 = mashort2 >= malong2 ? #4caf50 : #f44336cloudcolour3 = mashort3 >= malong3 ? #2196f3 : #ffb74dcloudcolour4 = mashort4 >= malong4 ? #009688 : #f06292cloudcolour5 = mashort5 >= malong5 ? #05bed5 : #e65100//03abc1mashortcolor1 = mashort1 >= mashort1[1] ? color.olive : color.maroonmashortcolor2 = mashort2 >= mashort2[1] ? color.olive : color.maroonmashortcolor3 = mashort3 >= mashort3[1] ? color.olive : color.maroonmashortcolor4 = mashort4 >= mashort4[1] ? color.olive : color.maroonmashortcolor5 = mashort5 >= mashort5[1] ? color.olive : color.maroonmashortline1 = plot(ema1 ? mashort1 : na, color=showLine ? mashortcolor1 : na, linewidth=1, offset=emacloudleading, title="Short Leading EMA1")mashortline2 = plot(ema2 ? mashort2 : na, color=showLine ? mashortcolor2 : na, linewidth=1, offset=emacloudleading, title="Short Leading EMA2")mashortline3 = plot(ema3 ?mashort3 : na, color=showLine ? mashortcolor3 : na, linewidth=1, offset=emacloudleading, title="Short Leading EMA3")mashortline4 = plot(ema4 ? mashort4 :na , color=showLine ? mashortcolor4 : na, linewidth=1, offset=emacloudleading, title="Short Leading EMA4")mashortline5 = plot(ema5 ? mashort5 : na, color=showLine ? mashortcolor5 : na, linewidth=1, offset=emacloudleading, title="Short Leading EMA5")malongcolor1 = malong1 >= malong1[1] ? color.green : color.redmalongcolor2 = malong2 >= malong2[1] ? color.green : color.redmalongcolor3 = malong3 >= malong3[1] ? color.green : color.redmalongcolor4 = malong4 >= malong4[1] ? color.green : color.redmalongcolor5 = malong5 >= malong5[1] ? color.green : color.redmalongline1 = plot(ema1 ? malong1 : na, color=showLine ? malongcolor1 : na, linewidth=3, offset=emacloudleading, title="Long Leading EMA1")malongline2 = plot(ema2 ? malong2 : na, color=showLine ? malongcolor2 : na, linewidth=3, offset=emacloudleading, title="Long Leading EMA2")malongline3 = plot(ema3 ? malong3 : na, color=showLine ? malongcolor3 : na, linewidth=3, offset=emacloudleading, title="Long Leading EMA3")malongline4 = plot(ema4 ? malong4 : na, color=showLine ? malongcolor4 : na, linewidth=3, offset=emacloudleading, title="Long Leading EMA4")malongline5 = plot(ema5 ? malong5 : na, color=showLine ? malongcolor5 : na, linewidth=3, offset=emacloudleading, title="Long Leading EMA5")// Updated fill function calls using color.new() for transparencyfill(mashortline1, malongline1, color=color.new(cloudcolour1, 45), title="MA Cloud1")fill(mashortline2, malongline2, color=color.new(cloudcolour2, 65), title="MA Cloud2")fill(mashortline3, malongline3, color=color.new(cloudcolour3, 70), title="MA Cloud3")fill(mashortline4, malongline4, color=color.new(cloudcolour4, 65), title="MA Cloud4")fill(mashortline5, malongline5, color=color.new(cloudcolour5, 65), title="MA Cloud5")12/04/2023 at 8:49 AM #224790Bonjour,
Voici pour afficher les 5 nuages de 10 moyennes 2 à 2, avec paramètre matype =1 pour les rendre exponentielles, ou =0 pour les rendre simples
Pour éventuellement ne pas garder les lignes en noir, elles peuvent être colorées ou rendues invisibles dans la fenêtre de propriétés, ou bien dans la ligne return en se servant du mot-clé coloured.
Si tu choisis de rajouter coloured, tu peux aussi y inclure un paramètre de transparence optionnel qui permettrait de sélectionner ou pas l’affichage des lignes.
https://www.prorealcode.com/documentation/coloured/
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263Matype=1 // =0 pour ma simple ou =1 pour ma exponentielle// ou mettre en param externe booléen 0 ou 1ma1=average[8,Matype](close)ma2=average[9,Matype](close)ma3=average[5,Matype](close)ma4=average[12,Matype](close)ma5=average[34,Matype](close)ma6=average[50,Matype](close)ma7=average[72,Matype](close)ma8=average[89,Matype](close)ma9=average[180,Matype](close)ma10=average[200,Matype](close)red1=150g1=0b1=0if ma1>ma2 thenred1=0g=150endifcolorbetween(ma1,ma2,red1,g1,b1,50)//red2=250g2=0b2=0if ma3>ma4 thenred2=0g2=250endifcolorbetween(ma3,ma4,red2,g2,b2,50)//red3=100g3=149b3=237if ma5>ma6 thenred3=255g3=215b3=0endifcolorbetween(ma5,ma6,red3,g3,b3,50)//red4=100g4=149b4=237if ma7>ma8 thenred4=255g4=215b4=0endifcolorbetween(ma7,ma8,red4,g4,b4,50)//red5=100g5=149b5=237if ma9>ma10 thenred5=255g5=215b5=0endifcolorbetween(ma9,ma10,red5,g5,b5,50)//return ma1 as "Short EMA cloud1", ma2 as "Long EMA cloud1", ma3 as "Short EMA cloud2", ma4 as "Long EMA cloud2", ma5 as "Short EMA cloud3", ma6 as "Long EMA cloud3", ma7 as "Short EMA cloud4", ma8 as "Long EMA cloud4", ma9 as "Short EMA cloud5", ma10 as "Long EMA cloud5"12/04/2023 at 12:22 PM #224805Je l’avais déjà converti il y a quelques semaines/mois… Je post aussi l’itf au cas où
Ripster EMA Clouds123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248// Ripster EMA Cloudsonce OLIVER = 128once OLIVEG = 128once OLIVEB = 0once MAROONR = 128once MAROONG = 0once MAROONB = 0once GREENR = 0once GREENG = 128once GREENB = 0once REDR = 255once REDG = 0once REDB = 0// Input ParametersMAShort1Length = 8MAlong1Length = 9MAShort2Length = 5MAlong2Length = 12MAShort3Length = 34MAlong3Length = 50MAShort4Length = 72MAlong4Length = 89MAShort5Length = 180MAlong5Length = 200EmaCloudLeading = 0Src = customcloseMAOffset = 0// Calculate moving averagesMASHORT1 = Average[MAShort1Length, MAType](Src)MASHORT2 = Average[MAShort2Length, MAType](Src)MASHORT3 = Average[MAShort3Length, MAType](Src)MASHORT4 = Average[MAShort4Length, MAType](Src)MASHORT5 = Average[MAShort5Length, MAType](Src)MALONG1 = Average[MAlong1Length, MAType](Src)MALONG2 = Average[MAlong2Length, MAType](Src)MALONG3 = Average[MAlong3Length, MAType](Src)MALONG4 = Average[MAlong4Length, MAType](Src)MALONG5 = Average[MAlong5Length, MAType](Src)// Cloud Colors (broken down into individual RGB components)IF MASHORT1 >= MALONG1 THENCloudColour1R = 3CloudColour1G = 97CloudColour1B = 3ELSECloudColour1R = 136CloudColour1G = 14CloudColour1B = 79ENDIFIF MASHORT2 >= MALONG2 THENCloudColour2R = 76CloudColour2G = 175CloudColour2B = 80ELSECloudColour2R = 244CloudColour2G = 67CloudColour2B = 54ENDIFIF MASHORT3 >= MALONG3 THENCloudColour3R = 33CloudColour3G = 150CloudColour3B = 243ELSECloudColour3R = 255CloudColour3G = 183CloudColour3B = 77ENDIFIF MASHORT4 >= MALONG4 THENCloudColour4R = 0CloudColour4G = 150CloudColour4B = 136ELSECloudColour4R = 240CloudColour4G = 98CloudColour4B = 146ENDIFIF MASHORT5 >= MALONG5 THENCloudColour5R = 5CloudColour5G = 190CloudColour5B = 213ELSECloudColour5R = 230CloudColour5G = 81CloudColour5B = 0ENDIFIF MASHORT1 >= MASHORT1[1] THENMASHORTCOLOR1R = OLIVER // Olive Red valueMASHORTCOLOR1G = OLIVEG // Olive Green valueMASHORTCOLOR1B = OLIVEB // Olive Blue valueELSEMASHORTCOLOR1R = MAROONR // Maroon Red valueMASHORTCOLOR1G = MAROONG // Maroon Green valueMASHORTCOLOR1B = MAROONB // Maroon Blue valueENDIFIF MASHORT2 >= MASHORT2[1] THENMASHORTCOLOR2R = OLIVER // Olive Red valueMASHORTCOLOR2G = OLIVEG // Olive Green valueMASHORTCOLOR2B = OLIVEB // Olive Blue valueELSEMASHORTCOLOR2R = MAROONR // Maroon Red valueMASHORTCOLOR2G = MAROONG // Maroon Green valueMASHORTCOLOR2B = MAROONB// Maroon Blue valueENDIFIF MASHORT3 >= MASHORT3[1] THENMASHORTCOLOR3R = OLIVER // Olive Red valueMASHORTCOLOR3G = OLIVEG // Olive Green valueMASHORTCOLOR3B = OLIVEB // Olive Blue valueELSEMASHORTCOLOR3R = MAROONR // Maroon Red valueMASHORTCOLOR3G = MAROONG // Maroon Green valueMASHORTCOLOR3B = MAROONB// Maroon Blue valueENDIFIF MASHORT4 >= MASHORT4[1] THENMASHORTCOLOR4R = OLIVER // Olive Red valueMASHORTCOLOR4G = OLIVEG // Olive Green valueMASHORTCOLOR4B = OLIVEB // Olive Blue valueELSEMASHORTCOLOR4R = MAROONR // Maroon Red valueMASHORTCOLOR4G = MAROONG // Maroon Green valueMASHORTCOLOR4B = MAROONB// Maroon Blue valueENDIFIF MASHORT5 >= MASHORT5[1] THENMASHORTCOLOR5R = OLIVER // Olive Red valueMASHORTCOLOR5G = OLIVEG // Olive Green valueMASHORTCOLOR5B = OLIVEB // Olive Blue valueELSEMASHORTCOLOR5R = MAROONR // Maroon Red valueMASHORTCOLOR5G = MAROONG // Maroon Green valueMASHORTCOLOR5B = MAROONB// Maroon Blue valueENDIFIF MALONG1 >= MALONG1[1] THENMALONGCOLOR1R = GREENRMALONGCOLOR1G = GREENGMALONGCOLOR1B = GREENBELSEMALONGCOLOR1R = REDRMALONGCOLOR1G = REDGMALONGCOLOR1B = REDBENDIFIF MALONG2 >= MALONG2[1] THENMALONGCOLOR2R = GREENRMALONGCOLOR2G = GREENGMALONGCOLOR2B = GREENBELSEMALONGCOLOR2R = REDRMALONGCOLOR2G = REDGMALONGCOLOR2B = REDBENDIFIF MALONG3 >= MALONG3[1] THENMALONGCOLOR3R = GREENRMALONGCOLOR3G = GREENGMALONGCOLOR3B = GREENBELSEMALONGCOLOR3R = REDRMALONGCOLOR3G = REDGMALONGCOLOR3B = REDBENDIFIF MALONG4 >= MALONG4[1] THENMALONGCOLOR4R = GREENRMALONGCOLOR4G = GREENGMALONGCOLOR4B = GREENBELSEMALONGCOLOR4R = REDRMALONGCOLOR4G = REDGMALONGCOLOR4B = REDBENDIFIF MALONG5 >= MALONG5[1] THENMALONGCOLOR5R = GREENRMALONGCOLOR5G = GREENGMALONGCOLOR5B = GREENBELSEMALONGCOLOR5R = REDRMALONGCOLOR5G = REDGMALONGCOLOR5B = REDBENDIF// Plotting mashortline1IF ema1 AND ShowLine THENDRAWSEGMENT(barindex-1, mashort1[1], barindex, mashort1) STYLE(LINE, 1) COLOURED(MASHORTCOLOR1R, MASHORTCOLOR1G, MASHORTCOLOR1B, 255)DRAWSEGMENT(barindex-1, MALONG1[1], barindex, MALONG1) STYLE(LINE, 3) COLOURED(MALONGCOLOR1R, MALONGCOLOR1G, MALONGCOLOR1B, 255)ENDIF// Plotting mashortline2IF ema2 AND ShowLine THENDRAWSEGMENT(barindex-1, mashort2[1], barindex, mashort2) STYLE(LINE, 1) COLOURED(MASHORTCOLOR2R, MASHORTCOLOR2G, MASHORTCOLOR2B, 255)DRAWSEGMENT(barindex-1, MALONG2[1], barindex, MALONG2) STYLE(LINE, 3) COLOURED(MALONGCOLOR2R, MALONGCOLOR2G, MALONGCOLOR2B, 255)ENDIF// Plotting mashortline3IF ema3 AND ShowLine THENDRAWSEGMENT(barindex-1, mashort3[1], barindex, mashort3) STYLE(LINE, 1) COLOURED(MASHORTCOLOR3R, MASHORTCOLOR3G, MASHORTCOLOR3B, 255)DRAWSEGMENT(barindex-1, MALONG3[1], barindex, MALONG3) STYLE(LINE, 3) COLOURED(MALONGCOLOR3R, MALONGCOLOR3G, MALONGCOLOR3B, 255)ENDIF// Plotting mashortline4IF ema4 AND ShowLine THENDRAWSEGMENT(barindex-1, mashort4[1], barindex, mashort4) STYLE(LINE, 1) COLOURED(MASHORTCOLOR4R, MASHORTCOLOR4G, MASHORTCOLOR4B, 255)DRAWSEGMENT(barindex-1, MALONG4[1], barindex, MALONG4) STYLE(LINE, 3) COLOURED(MALONGCOLOR4R, MALONGCOLOR4G, MALONGCOLOR4B, 255)ENDIF// Plotting mashortline5IF ema5 AND ShowLine THENDRAWSEGMENT(barindex-1, mashort5[1], barindex, mashort5) STYLE(LINE, 1) COLOURED(MASHORTCOLOR5R, MASHORTCOLOR5G, MASHORTCOLOR5B, 255)DRAWSEGMENT(barindex-1, MALONG5[1], barindex, MALONG5) STYLE(LINE, 3) COLOURED(MALONGCOLOR5R, MALONGCOLOR5G, MALONGCOLOR5B, 255)ENDIFIF EMA1 THENColorbetween(mashort1,MALONG1,CloudColour1R,CloudColour1G,CloudColour1B,45)ENDIFIF EMA2 THENColorbetween(mashort2,MALONG2,CloudColour2R,CloudColour2G,CloudColour2B,65)ENDIFIF EMA3 THENColorbetween(mashort3,MALONG3,CloudColour3R,CloudColour3G,CloudColour3B,70)ENDIFIF EMA4 THENColorbetween(mashort4,MALONG4,CloudColour4R,CloudColour4G,CloudColour4B,65)ENDIFIF EMA5 THENColorbetween(mashort5,MALONG5,CloudColour5R,CloudColour5G,CloudColour5B,65)ENDIFReturn12/06/2023 at 10:57 AM #224918Bonjour,
merci pour vos retours.
C’est bizarre LucasBest ton code n’affiche pas tout en meme temps. Si je décoche des EMA dans les propriétés, là des nuages s’affichent mais je peux pas tout afficher en meme temps.
Pour le 1er code je ne vois quasiment aucun nuage. Par defaut j’ai plein de lignes uniquement.
12/06/2023 at 11:01 AM #22492012/06/2023 at 11:09 AM #22492212/06/2023 at 1:01 PM #224938j’ai importé ton ITF
j’ajoute l’indicateur sur les prix, graphique jour.
je v ai dans les paramètres et décoche tout. Je coche juste EMA2 par exemple. Elle apparait bien. Si je coche aussi EMA3 par exemple et bien le nuage EMA2 disparait et EMA3 s’affiche.
Je peux avoir qu’un nuage a la fois on dirait
-
AuthorPosts