Code created on the basis of Nicolas’ work, thanks to him and the time he spends for us.
18 moving averages which are in fact the same with a time lag. You can change the period in the code and thus adjust it. Ideally buy on a rebound when the price is below the rainbow with stop loss just below the previous low. Or sell on a retracement candle when the price is above the rainbow.
Or sell on a retracement candle when the price is above the rainbow. Basic but visual.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 |
//---settings MAmode=0 Period=3 NumberOfMA=100 //---end of settings MA2=undefined MA3=undefined MA4=undefined MA5=undefined MA6=undefined MA7=undefined MA8=undefined MA9=undefined MA10=undefined MA11=undefined MA12=undefined MA13=undefined MA14=undefined MA15=undefined MA16=undefined MA17=undefined MA18=undefined M19=undefined numberofMA=max(min(numberofma,18),1) MA1=average[period](close) if numberofMA=2 then MA2=average[period,mamode](MA1) elsif numberofMA=3 then MA2=average[period,mamode](MA1) MA3=average[period,mamode](MA2) elsif numberofMA=4 then MA2=average[period,mamode](MA1) MA3=average[period,mamode](MA2) MA4=average[period,mamode](MA3) elsif numberofMA=5 then MA2=average[period,mamode](MA1) MA3=average[period,mamode](MA2) MA4=average[period,mamode](MA3) MA5=average[period,mamode](MA4) elsif numberofMA=6 then MA2=average[period,mamode](MA1) MA3=average[period,mamode](MA2) MA4=average[period,mamode](MA3) MA5=average[period,mamode](MA4) MA6=average[period,mamode](MA5) elsif numberofMA=7 then MA2=average[period,mamode](MA1) MA3=average[period,mamode](MA2) MA4=average[period,mamode](MA3) MA5=average[period,mamode](MA4) MA6=average[period,mamode](MA5) MA7=average[period,mamode](MA6) elsif numberofMA=8 then MA2=average[period,mamode](MA1) MA3=average[period,mamode](MA2) MA4=average[period,mamode](MA3) MA5=average[period,mamode](MA4) MA6=average[period,mamode](MA5) MA7=average[period,mamode](MA6) MA8=average[period,mamode](MA7) elsif numberofMA=9 then MA2=average[period,mamode](MA1) MA3=average[period,mamode](MA2) MA4=average[period,mamode](MA3) MA5=average[period,mamode](MA4) MA6=average[period,mamode](MA5) MA7=average[period,mamode](MA6) MA8=average[period,mamode](MA7) MA9=average[period,mamode](MA8) elsif numberofMA=10 then MA2=average[period,mamode](MA1) MA3=average[period,mamode](MA2) MA4=average[period,mamode](MA3) MA5=average[period,mamode](MA4) MA6=average[period,mamode](MA5) MA7=average[period,mamode](MA6) MA8=average[period,mamode](MA7) MA9=average[period,mamode](MA8) MA10=average[period,mamode](MA9) elsif numberofMA=11 then MA2=average[period,mamode](MA1) MA3=average[period,mamode](MA2) MA4=average[period,mamode](MA3) MA5=average[period,mamode](MA4) MA6=average[period,mamode](MA5) MA7=average[period,mamode](MA6) MA8=average[period,mamode](MA7) MA9=average[period,mamode](MA8) MA10=average[period,mamode](MA9) MA11=average[period,mamode](MA10) elsif numberofMA=12 then MA2=average[period,mamode](MA1) MA3=average[period,mamode](MA2) MA4=average[period,mamode](MA3) MA5=average[period,mamode](MA4) MA6=average[period,mamode](MA5) MA7=average[period,mamode](MA6) MA8=average[period,mamode](MA7) MA9=average[period,mamode](MA8) MA10=average[period,mamode](MA9) MA11=average[period,mamode](MA10) MA12=average[period,mamode](MA11) elsif numberofMA=13 then MA2=average[period,mamode](MA1) MA3=average[period,mamode](MA2) MA4=average[period,mamode](MA3) MA5=average[period,mamode](MA4) MA6=average[period,mamode](MA5) MA7=average[period,mamode](MA6) MA8=average[period,mamode](MA7) MA9=average[period,mamode](MA8) MA10=average[period,mamode](MA9) MA11=average[period,mamode](MA10) MA12=average[period,mamode](MA11) MA13=average[period,mamode](MA12) elsif numberofMA=14 then MA2=average[period,mamode](MA1) MA3=average[period,mamode](MA2) MA4=average[period,mamode](MA3) MA5=average[period,mamode](MA4) MA6=average[period,mamode](MA5) MA7=average[period,mamode](MA6) MA8=average[period,mamode](MA7) MA9=average[period,mamode](MA8) MA10=average[period,mamode](MA9) MA11=average[period,mamode](MA10) MA12=average[period,mamode](MA11) MA13=average[period,mamode](MA12) MA14 =average[period,mamode](MA13) elsif numberofMA=15 then MA2=average[period,mamode](MA1) MA3=average[period,mamode](MA2) MA4=average[period,mamode](MA3) MA5=average[period,mamode](MA4) MA6=average[period,mamode](MA5) MA7=average[period,mamode](MA6) MA8=average[period,mamode](MA7) MA9=average[period,mamode](MA8) MA10=average[period,mamode](MA9) MA11=average[period,mamode](MA10) MA12=average[period,mamode](MA11) MA13=average[period,mamode](MA12) MA14 =average[period,mamode](MA13) MA15 =average[period,mamode](MA14) elsif numberofMA=16 then MA2=average[period,mamode](MA1) MA3=average[period,mamode](MA2) MA4=average[period,mamode](MA3) MA5=average[period,mamode](MA4) MA6=average[period,mamode](MA5) MA7=average[period,mamode](MA6) MA8=average[period,mamode](MA7) MA9=average[period,mamode](MA8) MA10=average[period,mamode](MA9) MA11=average[period,mamode](MA10) MA12=average[period,mamode](MA11) MA13=average[period,mamode](MA12) MA14 =average[period,mamode](MA13) MA15 =average[period,mamode](MA14) MA16 =average[period,mamode](MA15) elsif numberofMA=17 then MA2=average[period,mamode](MA1) MA3=average[period,mamode](MA2) MA4=average[period,mamode](MA3) MA5=average[period,mamode](MA4) MA6=average[period,mamode](MA5) MA7=average[period,mamode](MA6) MA8=average[period,mamode](MA7) MA9=average[period,mamode](MA8) MA10=average[period,mamode](MA9) MA11=average[period,mamode](MA10) MA12=average[period,mamode](MA11) MA13=average[period,mamode](MA12) MA14 =average[period,mamode](MA13) MA15 =average[period,mamode](MA14) MA16 =average[period,mamode](MA15) MA17 =average[period,mamode](MA16) elsif numberofMA=18 then MA2=average[period,mamode](MA1) MA3=average[period,mamode](MA2) MA4=average[period,mamode](MA3) MA5=average[period,mamode](MA4) MA6=average[period,mamode](MA5) MA7=average[period,mamode](MA6) MA8=average[period,mamode](MA7) MA9=average[period,mamode](MA8) MA10=average[period,mamode](MA9) MA11=average[period,mamode](MA10) MA12=average[period,mamode](MA11) MA13=average[period,mamode](MA12) MA14=average[period,mamode](MA13) MA15=average[period,mamode](MA14) MA16=average[period,mamode](MA15) MA17=average[period,mamode](MA16) MA18=average[period,mamode](MA17) endif return ma1 coloured("blue"), ma2 coloured("blue"), ma3 coloured("green"), ma4 coloured("green"), ma5 coloured("yellow"),MA6 coloured("yellow"),MA7 coloured("orange"),MA8 coloured("orange"),MA9 coloured("red")style(line,3),MA10 coloured("red"),MA11 coloured("pink"),MA12 coloured("pink"),MA13 coloured("fuchsia"),MA14 coloured("fuchsia"),MA15 coloured("brown"),MA16 coloured("brown"),MA17 coloured("cyan"),MA18 coloured("cyan") // couleur "blue" "purple" "red" "orange" "fuchsia" "yellow" "brown" "white" "green" "pink" |
Share this
No information on this site is investment advice or a solicitation to buy or sell any financial instrument. Past performance is not indicative of future results. Trading may expose you to risk of loss greater than your deposits and is only suitable for experienced investors who have sufficient financial means to bear such risk.
ProRealTime ITF files and other attachments :PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials
Bonsoir,
j’aimerai pouvoir mettre sur un même graphique 2 fois cet indicateur. le premier tel quel, le second 10 fois superieur . J’ai donc installé celui ci et est change la period en la remplaçant par 30 dans le second mais je n’ai rien touché d’autre et le resultat n’est pas terrible. Je pense qu’il doit y avoir une histoire de numberofMA a modifier mais n’etant pas douée en programation je ne trouve pas. Pouvez vous m’aider cdlt
//—settings
MAmode=0
Period=150
NumberOfMA=100
//—end of settings
MA2=undefined
MA3=undefined
MA4=undefined
MA5=undefined
MA6=undefined
MA7=undefined
MA8=undefined
MA9=undefined
MA10=undefined
MA11=undefined
MA12=undefined
MA13=undefined
MA14=undefined
MA15=undefined
MA16=undefined
MA17=undefined
MA18=undefined
M19=undefined
numberofMA=max(min(numberofma,18),1)
MA1=average[period](close)
if numberofMA=2 then
MA2=average[period,mamode](MA1)
elsif numberofMA=3 then
MA2=average[period,mamode](MA1)
MA3=average[period,mamode](MA2)
elsif numberofMA=4 then
MA2=average[period,mamode](MA1)
MA3=average[period,mamode](MA2)
MA4=average[period,mamode](MA3)
elsif numberofMA=5 then
MA2=average[period,mamode](MA1)
MA3=average[period,mamode](MA2)
MA4=average[period,mamode](MA3)
MA5=average[period,mamode](MA4)
elsif numberofMA=6 then
MA2=average[period,mamode](MA1)
MA3=average[period,mamode](MA2)
MA4=average[period,mamode](MA3)
MA5=average[period,mamode](MA4)
MA6=average[period,mamode](MA5)
elsif numberofMA=7 then
MA2=average[period,mamode](MA1)
MA3=average[period,mamode](MA2)
MA4=average[period,mamode](MA3)
MA5=average[period,mamode](MA4)
MA6=average[period,mamode](MA5)
MA7=average[period,mamode](MA6)
elsif numberofMA=8 then
MA2=average[period,mamode](MA1)
MA3=average[period,mamode](MA2)
MA4=average[period,mamode](MA3)
MA5=average[period,mamode](MA4)
MA6=average[period,mamode](MA5)
MA7=average[period,mamode](MA6)
MA8=average[period,mamode](MA7)
elsif numberofMA=9 then
MA2=average[period,mamode](MA1)
MA3=average[period,mamode](MA2)
MA4=average[period,mamode](MA3)
MA5=average[period,mamode](MA4)
MA6=average[period,mamode](MA5)
MA7=average[period,mamode](MA6)
MA8=average[period,mamode](MA7)
MA9=average[period,mamode](MA8)
elsif numberofMA=10 then
MA2=average[period,mamode](MA1)
MA3=average[period,mamode](MA2)
MA4=average[period,mamode](MA3)
MA5=average[period,mamode](MA4)
MA6=average[period,mamode](MA5)
MA7=average[period,mamode](MA6)
MA8=average[period,mamode](MA7)
MA9=average[period,mamode](MA8)
MA10=average[period,mamode](MA9)
elsif numberofMA=11 then
MA2=average[period,mamode](MA1)
MA3=average[period,mamode](MA2)
MA4=average[period,mamode](MA3)
MA5=average[period,mamode](MA4)
MA6=average[period,mamode](MA5)
MA7=average[period,mamode](MA6)
MA8=average[period,mamode](MA7)
MA9=average[period,mamode](MA8)
MA10=average[period,mamode](MA9)
MA11=average[period,mamode](MA10)
elsif numberofMA=12 then
MA2=average[period,mamode](MA1)
MA3=average[period,mamode](MA2)
MA4=average[period,mamode](MA3)
MA5=average[period,mamode](MA4)
MA6=average[period,mamode](MA5)
MA7=average[period,mamode](MA6)
MA8=average[period,mamode](MA7)
MA9=average[period,mamode](MA8)
MA10=average[period,mamode](MA9)
MA11=average[period,mamode](MA10)
MA12=average[period,mamode](MA11)
elsif numberofMA=13 then
MA2=average[period,mamode](MA1)
MA3=average[period,mamode](MA2)
MA4=average[period,mamode](MA3)
MA5=average[period,mamode](MA4)
MA6=average[period,mamode](MA5)
MA7=average[period,mamode](MA6)
MA8=average[period,mamode](MA7)
MA9=average[period,mamode](MA8)
MA10=average[period,mamode](MA9)
MA11=average[period,mamode](MA10)
MA12=average[period,mamode](MA11)
MA13=average[period,mamode](MA12)
elsif numberofMA=14 then
MA2=average[period,mamode](MA1)
MA3=average[period,mamode](MA2)
MA4=average[period,mamode](MA3)
MA5=average[period,mamode](MA4)
MA6=average[period,mamode](MA5)
MA7=average[period,mamode](MA6)
MA8=average[period,mamode](MA7)
MA9=average[period,mamode](MA8)
MA10=average[period,mamode](MA9)
MA11=average[period,mamode](MA10)
MA12=average[period,mamode](MA11)
MA13=average[period,mamode](MA12)
MA14 =average[period,mamode](MA13)
elsif numberofMA=15 then
MA2=average[period,mamode](MA1)
MA3=average[period,mamode](MA2)
MA4=average[period,mamode](MA3)
MA5=average[period,mamode](MA4)
MA6=average[period,mamode](MA5)
MA7=average[period,mamode](MA6)
MA8=average[period,mamode](MA7)
MA9=average[period,mamode](MA8)
MA10=average[period,mamode](MA9)
MA11=average[period,mamode](MA10)
MA12=average[period,mamode](MA11)
MA13=average[period,mamode](MA12)
MA14 =average[period,mamode](MA13)
MA15 =average[period,mamode](MA14)
elsif numberofMA=16 then
MA2=average[period,mamode](MA1)
MA3=average[period,mamode](MA2)
MA4=average[period,mamode](MA3)
MA5=average[period,mamode](MA4)
MA6=average[period,mamode](MA5)
MA7=average[period,mamode](MA6)
MA8=average[period,mamode](MA7)
MA9=average[period,mamode](MA8)
MA10=average[period,mamode](MA9)
MA11=average[period,mamode](MA10)
MA12=average[period,mamode](MA11)
MA13=average[period,mamode](MA12)
MA14 =average[period,mamode](MA13)
MA15 =average[period,mamode](MA14)
MA16 =average[period,mamode](MA15)
elsif numberofMA=17 then
MA2=average[period,mamode](MA1)
MA3=average[period,mamode](MA2)
MA4=average[period,mamode](MA3)
MA5=average[period,mamode](MA4)
MA6=average[period,mamode](MA5)
MA7=average[period,mamode](MA6)
MA8=average[period,mamode](MA7)
MA9=average[period,mamode](MA8)
MA10=average[period,mamode](MA9)
MA11=average[period,mamode](MA10)
MA12=average[period,mamode](MA11)
MA13=average[period,mamode](MA12)
MA14 =average[period,mamode](MA13)
MA15 =average[period,mamode](MA14)
MA16 =average[period,mamode](MA15)
MA17 =average[period,mamode](MA16)
elsif numberofMA=18 then
MA2=average[period,mamode](MA1)
MA3=average[period,mamode](MA2)
MA4=average[period,mamode](MA3)
MA5=average[period,mamode](MA4)
MA6=average[period,mamode](MA5)
MA7=average[period,mamode](MA6)
MA8=average[period,mamode](MA7)
MA9=average[period,mamode](MA8)
MA10=average[period,mamode](MA9)
MA11=average[period,mamode](MA10)
MA12=average[period,mamode](MA11)
MA13=average[period,mamode](MA12)
MA14=average[period,mamode](MA13)
MA15=average[period,mamode](MA14)
MA16=average[period,mamode](MA15)
MA17=average[period,mamode](MA16)
MA18=average[period,mamode](MA17)
endif
return ma1 coloured(“blue”), ma2 coloured(“blue”), ma3 coloured(“green”), ma4 coloured(“green”), ma5 coloured(“yellow”),MA6 coloured(“yellow”),MA7 coloured(“orange”),MA8 coloured(“orange”),MA9 coloured(“red”)style(line,3),MA10 coloured(“red”),MA11 coloured(“pink”),MA12 coloured(“pink”),MA13 coloured(“fuchsia”),MA14 coloured(“fuchsia”),MA15 coloured(“brown”),MA16 coloured(“brown”),MA17 coloured(“cyan”),MA18 coloured(“cyan”)
// couleur “blue” “purple” “red” “orange” “fuchsia” “yellow” “brown” “white” “green” “pink”
dites moi si cela correspond à ce que vous cherchez
bonjour
merci de ta reponse mais non ca fonctionne pas
sympa quand même d’avoir essayé
cdlt