Download MetaTrader 5

How to make a shaded area between 2 line in Stochastic

To add comments, please log in or register
Ask your broker to open the official channel. Thousands of traders will read the news!
Harry
267
Harry 2015.03.25 02: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);
  }
//+------------------------------------------------------------------+
To add comments, please log in or register