//+------------------------------------------------------------------+
//|                                                    MA ribbon.mq4 |
//|                                               mladenfx@gmail.com |
//|                                                                  |
//| original idea by Jose Silva                                      |
//+------------------------------------------------------------------+
#property copyright "mladen"
#property link      "mladenfx@gmail.com"
// modification kinonen Fev 2009
#property indicator_chart_window
#property indicator_buffers 4
#property indicator_color1 C'0,70,0'
#property indicator_color2 C'70,0,0'
#property indicator_color3 Red
#property indicator_color4 Green
#property indicator_width1 3
#property indicator_width2 3
#property indicator_width3 2
#property indicator_width4 2

//
//
//
//
//

extern int       MA1Period=13;
extern double    factor1=0.7;
extern int       MA2Period =20;
extern double    factor2=0.6;

//
//
//
//
//

double buffer1[];
double buffer2[];
double buffer3[];
double buffer4[];

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
//
//
//
//
//

int init()
{
   SetIndexBuffer(0,buffer3); SetIndexStyle(0,DRAW_HISTOGRAM);
   SetIndexBuffer(1,buffer4); SetIndexStyle(1,DRAW_HISTOGRAM);
   SetIndexBuffer(2,buffer1);
   SetIndexBuffer(3,buffer2);
   return(0);
}
int deinit()
{
   return(0);
}

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
//
//
//
//
//

int start()
{
   int counted_bars=IndicatorCounted();
   int limit,i;
   
   if(counted_bars<0) return(-1);
   if(counted_bars>0) counted_bars--;
           limit=Bars-counted_bars;

   //
   //
   //
   //
   //

   for(i=2000; i>=0; i--)  
   // iCustom( string symbol, int timeframe, string name, ..., int mode, int shift) 
   {
      //buffer1[i] = iMA(NULL,0,MA1Period,0,MA1Method,MA1Price,i);
      //buffer2[i] = iMA(NULL,0,MA2Period,0,MA2Method,MA2Price,i);
      buffer1[i] = iCustom(NULL,0,"T3MA",MA1Period,factor1,0,i);
      buffer2[i] = iCustom(NULL,0,"T3MA",MA2Period,factor2,0,i);
      buffer3[i] = buffer1[i];
      buffer4[i] = buffer2[i];
   }
   return(0);
}

