//PRC_Colourized MovingAverage | indicator 19.10.2018
//Nicolas @ www.prorealcode.com Sharing ProRealTime knowledge
// --- settings
//ONCE UseCci =0 // CANDLE + COMMODITY CHANNEL INDEX COLOUR
//ONCE UseRsi =0 // CANDLE + RSI COLOUR
//ONCE UseStochastic =0 // CANDLE + STOCASTIC COLOUR
//ONCE UseCycle =0 // CANDLE + CYCLE COLOUR
//ONCE UseDI =0 // CANDLE + DIRECTIONAL INDEX COLOUR
// ---
//ONCE CciPeriod =20
//ONCE RsiPeriod =14
//ONCE N =14
//ONCE K =3
//ONCE DiPeriod =14
//ONCE MAperiod =20 perso = 5
//ONCE MAtype =0 //0=SMA perso = 2 pondérée
// --- end of settings
If UseCci then // CANDLE + COMMODITY CHANNEL INDEX COLOUR
MyCci = Cci[max(1,CciPeriod)](customclose)
R = (200-MyCci)
G =(200+MyCci)
Elsif UseRsi then // CANDLE + RSI COLOUR
MyRsi = RSI[max(1,RsiPeriod)](customclose)
R =50+(200-(MyRsi-50)*12)
G =50+(200+(MyRsi-50)*12)
Elsif UseStochastic then // CANDLE + STOCHASTIC COLOUR
MyStoch = Stochastic[max(1,N),max(1,K)](customclose)
R =50+(200-(MyStoch-50)*6)
G =50+(200+(MyStoch-50)*6)
Elsif UseCycle then // CANDLE + CYCLE COLOUR
MyCycle = Cycle(customclose)
R = (200-MyCycle*10)
G =(200+MyCycle*10)
Elsif UseDI then // CANDLE + DIRECTIONAL INDEX
MyDi = DI[max(1,DiPeriod)](customclose)
R = 50+(200-MyDi*10)
G =50+(200+MyDi*10)
endif
avg = average[MAperiod,MAtype](customclose)
Return avg coloured(R,G,0) style(line,3) as "MA coloured by oscillator"