ma_4MAs_histo_cw





//+------------------------------------------------------------------+
//|                                              9Squared Trader.mq4 |
//|                                    Copyright © 2007 Steve Bowley |
//|                                        http://www.9squaredfx.com |
//+------------------------------------------------------------------+
//Rads HAS Ext.mq4
//mod 4MAs_histo_cw.mq4
//
#property copyright "Copyright © 2007 Steve Bowley"
#property link      "http://www.9squaredfx.com"

#property indicator_chart_window
#property indicator_buffers 4
#property indicator_color1 Blue
#property indicator_color2 Red
#property indicator_color3 DeepSkyBlue
#property indicator_color4 Orange


#property indicator_width1     3
#property indicator_width2     3
#property indicator_width3     1
#property indicator_width4     1

//---- input parameters
extern int FastClosePeriod=5;
extern int FastCloseShift=0;
extern int FastCloseMode=1;
extern int FastClosePrice=0;

extern int FastOpenPeriod=13;
extern int FastOpenShift=0;
extern int FastOpenMode=1;
extern int FastOpenPrice=0;

extern int SlowClosePeriod=9;
extern int SlowCloseShift=0;
extern int SlowCloseMode=1;
extern int SlowClosePrice=0;

extern int SlowOpenPeriod=21;
extern int SlowOpenShift=0;
extern int SlowOpenMode=1;
extern int SlowOpenPrice=0;





//---- indicator buffers
double FastCloseBuffer[];
double FastOpenBuffer[];
double SlowCloseBuffer[];
double SlowOpenBuffer[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- line shifts when drawing
   SetIndexShift(0,FastCloseShift);
   SetIndexShift(1,FastOpenShift);
   SetIndexShift(2,SlowCloseShift);
   SetIndexShift(3,SlowOpenShift);
//---- first positions skipped when drawing
   SetIndexDrawBegin(0,FastCloseShift+FastClosePeriod);
   SetIndexDrawBegin(1,FastOpenShift+FastOpenPeriod);
   SetIndexDrawBegin(2,SlowCloseShift+SlowClosePeriod);
   SetIndexDrawBegin(3,SlowOpenShift+SlowOpenPeriod);
//---- 3 indicator buffers mapping
   SetIndexBuffer(0,SlowCloseBuffer);
   SetIndexBuffer(1,SlowOpenBuffer);
   SetIndexBuffer(2,FastCloseBuffer);
   SetIndexBuffer(3,FastOpenBuffer);
//---- drawing settings
   SetIndexStyle(0,DRAW_HISTOGRAM);
   SetIndexStyle(1,DRAW_HISTOGRAM);
   SetIndexStyle(2,DRAW_HISTOGRAM);
   SetIndexStyle(3,DRAW_HISTOGRAM);
//---- index labels
   SetIndexLabel(0,"FastClose");
   SetIndexLabel(1,"FastOpen");
   SetIndexLabel(2,"SlowClose");
   SetIndexLabel(3,"SlowOpen");
//---- initialization done
   return(0);
  }
//+------------------------------------------------------------------+
//| 9Squared Trader                                             |
//+------------------------------------------------------------------+
int start()
  {
   int limit;
   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;
//---- main loop
   for(int i=0; i<limit; i++)
     {
      //---- ma_shift set to 0 because SetIndexShift called abowe
      FastCloseBuffer[i]=iMA(NULL,0,FastClosePeriod,0,FastCloseMode,FastClosePrice,i);
      FastOpenBuffer[i] =iMA(NULL,0,FastOpenPeriod, 0,FastOpenMode, FastOpenPrice,i);
      SlowCloseBuffer[i]=iMA(NULL,0,SlowClosePeriod,0,SlowCloseMode,SlowClosePrice,i);
      SlowOpenBuffer[i] =iMA(NULL,0,SlowOpenPeriod, 0,SlowOpenMode, SlowOpenPrice,i);
     }
//---- done
   return(0);
  }
//+------------------------------------------------------------------+






Sample





Analysis



Market Information Used:



Indicator Curves created:


Implements a curve of type DRAW_HISTOGRAM

Indicators Used:

Moving average indicator


Custom Indicators Used:

Order Management characteristics:

Other Features: