Download MetaTrader 5

MA Crossover forming a cloud

To add comments, please log in or register
EJ
14
EJ  

Hello,

I have this indicator that use to paint the moving averages and fill the space between them with a color of my choosing but now it no longer paints the moving averages and it only paints the space between them.  Can someone help me fixing this?  Here's the code:

#property indicator_chart_window
#property indicator_buffers 4
#property indicator_color1 Red
#property indicator_color2 Lime
#property indicator_color3 Red
#property indicator_color4 Lime
#property indicator_width1 1
#property indicator_width2 1
#property indicator_width3 2
#property indicator_width4 2

//
//
//
//
//

extern int       MA1Period=12;
extern int       MA1Method=MODE_EMA;
extern int       MA1Price =PRICE_CLOSE;
extern int       MA2Period=26;
extern int       MA2Method=MODE_EMA;
extern int       MA2Price =PRICE_CLOSE;

//
//
//
//
//

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=limit; i>=0; i--)
   {
      buffer1[i] = iMA(NULL,0,MA1Period,0,MA1Method,MA1Price,i);
      buffer2[i] = iMA(NULL,0,MA2Period,0,MA2Method,MA2Price,i);
      buffer3[i] = buffer1[i];
      buffer4[i] = buffer2[i];
   }
   return(0);
}

whroeder1
16764
whroeder1  
EJ: but now it no longer paints the moving averages and it only paints the space between them. 
  1. Bug in 1090. Either recompile until it does or add the #property indicator_type1 DRAW_LINE
  2. Start using the new Event Handling Functions.
              Event Handling Functions - Functions - Language Basics - MQL4 Reference
    And do your lookbacks correctly.
EJ
14
EJ  

I added the #property indicator_type1 DRAW_LINE

but it still doesn't paint!  I'm not a programmer that's why I was hoping someone would help me.

To add comments, please log in or register