How to make a shaded area between 2 line in Stochastic

Back to topics list To post a new topic, please log in or register
avatar
82
scfx 2015.03.25 03:55
 

Hi Everyone,

I am trying to shade the area between the Main and Signal line of the Stochastic and I cannot do it.

I try the trick in MA_Shade but it doesn't work.

Can you help me to correct it?

Thank you,

SCFX

 

//+------------------------------------------------------------------+
//|                                                     MA_Shade.mq4 |
//|                                                           oromek |
//|                                                oromeks@gmail.com |
//+------------------------------------------------------------------+
#property copyright "oromek"
#property link      "oromeks@gmail.com"
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 Red
#property indicator_color2 Blue


double Main, Signal;
double Main_Buffer[], Signal_Buffer[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   SetIndexStyle(0,DRAW_HISTOGRAM,STYLE_DOT);
   SetIndexBuffer(0,Main_Buffer);
   
   SetIndexStyle(1,DRAW_HISTOGRAM,STYLE_DOT);
   SetIndexBuffer(1,Signal_Buffer);
//---- indicators
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int    counted_bars=IndicatorCounted();
   
   int limit=Bars-counted_bars;
   if(counted_bars>0) limit++;
   
   for(int i=1; i<limit; i++)
   {
      Main=iStochastic(Symbol(),0,5,3,3,MODE_SMA,0,0,i);
      Signal=iStochastic(Symbol(),0,5,3,3,MODE_SMA,0,1,i);
   
      Main_Buffer[i]=Main;
      Signal_Buffer[i]=Signal;
   }
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+

 

Back to topics list  

To add comments, please log in or register