//+------------------------------------------------------------------+
//|                                                  MMA COLORED.mq4 |
//|                      Copyright © 2010, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+

#property copyright "pipsforever"
#property link      "http://www.trader-forex.fr/forum/programmation/30240-changer-la-couleur-dune-mm.html#post87444"
////Modified by Sohocool December 2011

#property indicator_chart_window
#property indicator_buffers 4

#property indicator_width1 3
#property indicator_width2 3
#property indicator_width3 2
#property indicator_width4 2

#property indicator_color1 Yellow
#property indicator_color2 Red
#property indicator_color3 Yellow
#property indicator_color4 Red

extern int Fast = 8;
extern int MODE_Fast = 0;
extern int Shift_Fast =0;
extern int PRICE_Fast =0;

//////////////////////
extern int Slow = 24;
extern int MODE_Slow = 0;
extern int Shift_Slow =0;
extern int PRICE_Slow =0;

extern color Up = Yellow;
extern color Down=Red;
extern int HistoWidth =3;
////////////////////////////
extern color Ma_1 = Yellow;
extern color Ma_2 = Red;
extern int LineWidth =2;
double H1[];
double H2[];
double M1[];
double M2[];


//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
SetIndexBuffer(0,H1);
SetIndexStyle(0,DRAW_HISTOGRAM,0,HistoWidth,Up);

SetIndexBuffer(1,H2);
SetIndexStyle(1, DRAW_HISTOGRAM,0,HistoWidth,Down);

SetIndexBuffer(2,M1);
SetIndexStyle(2,DRAW_LINE,0,LineWidth,Ma_1);

SetIndexBuffer(3,M2);
SetIndexStyle(3,DRAW_LINE,0,LineWidth,Ma_2);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int    counted_bars=IndicatorCounted();
//----
   for (int i =0; i<Bars-Slow; i++)
   
   {
     H1[i] = iMA(Symbol(),0,Fast,Shift_Fast,MODE_Fast,PRICE_Fast,i);
     H2[i] = iMA(Symbol(),0,Slow,Shift_Slow,MODE_Slow,PRICE_Slow,i);
     
     M1[i] = iMA(Symbol(),0,Fast,Shift_Fast,MODE_Fast,PRICE_Fast,i);
     M2[i] = iMA(Symbol(),0,Slow,Shift_Slow,MODE_Slow,PRICE_Slow,i);
   
   }
//----
   return(0);
  }
//+------------------------------------------------------------------+