//+------------------------------------------------------------------+
//|                                          Stochastic_mj_vx.xx.mq4 |
//|                      Copyright © 2010,                       mj  |
//|                                       http://www.noweb.net/      |
//+------------------------------------------------------------------+
#property copyright "Copyright © mj"
#property link      "http://www.noweb.net/"

#define INDICATOR_NAME		"Stochastic_mj"
#define INDICATOR_VERSION	"_v1.00"

#property indicator_separate_window
#property indicator_minimum 0
#property indicator_maximum 100
#property indicator_buffers 2
#property indicator_color1 Yellow // Main
#property indicator_width1 1
#property  indicator_style1  STYLE_SOLID
#property indicator_color2 EMPTY // Signal
#property indicator_width2 1
#property  indicator_style2  STYLE_DOT	


//---- input parameters
extern int KPeriod=10;
extern int Slowing=1;
extern int DPeriod=1;
extern int MA_Method = 0; // SMA 0, EMA 1, SMMA 2, LWMA 3
extern int PriceField = 0; // Low/High 0, Close/Close 1
//---- DisplayLastBar
extern string  INFO="Current Bar Display";
extern bool    DisplayLastBar=true;
//---- buffers
double MainBuffer[];
double SignalBuffer[];


//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   string short_name;

//---- indicator lines
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0, MainBuffer);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexBuffer(1, SignalBuffer);
//---- name for DataWindow and indicator subwindow label
   short_name="";
   IndicatorShortName(short_name);
   SetIndexLabel(0,NULL);
   SetIndexLabel(1,NULL);
//----

   return(0);
  }
//+------------------------------------------------------------------+
//| Stochastic oscillator                                            |
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
int start()
  {
   int limit, i, dlb;
   int counted_bars=IndicatorCounted();
//---- check for possible errors
   if(counted_bars<0) return(-1);
//---- last counted bar will be recounted
   if(counted_bars>0) counted_bars--;

   limit=Bars-counted_bars;
   
   //
   //
   //
   //
   //
   
   // Check NoLastBar;
   if (DisplayLastBar) dlb=0;
   else dlb=1;
   
   for(i=dlb; i<limit; i++)
   {
 
             
      MainBuffer[i] = iStochastic(NULL, 0, KPeriod, DPeriod, Slowing,MA_Method, PriceField, MODE_MAIN, i);
      SignalBuffer[i] = iStochastic(NULL, 0, KPeriod, DPeriod, Slowing,MA_Method, PriceField, MODE_SIGNAL, i);
   }
      
//---- done
   return(0);
  }
//+------------------------------------------------------------------+
