MACD+OsMA+BB





//ææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææ
//|                                                                                             MACD+OsMA+BB_MOD.mq4 |
//|                                                                      Copyright © 2004, MetaQuotes Software Corp. |
//|                                                                                       http://www.metaquotes.net/ |
//ææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææ
#property copyright ""
#property link ""
//ææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææ
#property indicator_separate_window
#property indicator_buffers 8
#property indicator_color1 Lime
#property indicator_color2 Red
#property indicator_color3 Blue
#property indicator_color4 Lime
#property indicator_color5 Red
#property indicator_color6 Peru
#property indicator_color7 Peru
#property indicator_color8 Yellow
//ææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææ
extern int FastEMA=12;
extern int SlowEMA=26;
extern int SignalSMA=9;
extern int BollingerPeriod=21;
extern int BollingerDeviation=2;
extern int BollingerShift=0;
//ææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææ
double redBuffer[];
double blueBuffer[];
double blueBorder[];
double ind_buffer4[];
double ind_buffer5[];
double bandsUpper[];
double bandsLower[];
double bandsMiddle[];

int i;

double osma1,
       osma2,
       fast,
       slow1,
       slow2;
//ææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææ
int init()
{
   IndicatorShortName("MACD("+FastEMA+","+SlowEMA+","+SignalSMA+")");
   IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS)+1);
   
   SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,3);
   SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,3);
   SetIndexStyle(2,DRAW_LINE,STYLE_SOLID,2);
   SetIndexStyle(3,DRAW_HISTOGRAM,STYLE_SOLID,1);
   SetIndexStyle(4,DRAW_HISTOGRAM,STYLE_SOLID,1);
   SetIndexStyle(5,DRAW_LINE,STYLE_SOLID,1);
   SetIndexStyle(6,DRAW_LINE,STYLE_SOLID,1);
   SetIndexStyle(7,DRAW_LINE,STYLE_DOT,1);
//ææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææ
   SetIndexEmptyValue(0,0.0);
   SetIndexEmptyValue(1,0.0);
//ææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææ
   SetIndexDrawBegin(0,SignalSMA);
   SetIndexDrawBegin(1,SignalSMA);
   SetIndexDrawBegin(2,SignalSMA);
   SetIndexDrawBegin(3,SignalSMA);
   SetIndexDrawBegin(4,SignalSMA);
//ææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææ
   SetIndexBuffer(0,redBuffer);
   SetIndexBuffer(1,blueBuffer);
   SetIndexBuffer(2,blueBorder);
   SetIndexBuffer(3,ind_buffer4);
   SetIndexBuffer(4,ind_buffer5);
   SetIndexBuffer(5,bandsUpper);
   SetIndexBuffer(6,bandsLower);
   SetIndexBuffer(7,bandsMiddle);
//ææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææ
   SetIndexLabel(0,"MACD");
   SetIndexLabel(1,"Signal");
   SetIndexLabel(2,"OsMA");
   SetIndexLabel(3,"OsMAup");
   SetIndexLabel(4,"OsMAdown");
   SetIndexLabel(5,"bandsUpper");
   SetIndexLabel(6,"bandsLower");
   SetIndexLabel(7,"bandsMiddle");

   return(0);
}
//ææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææ
int start()
{
   int limit,
       counted_bars=IndicatorCounted();

   if(counted_bars>0) 
      counted_bars--;

   limit=Bars-counted_bars-1;
   
   for(i=0;i<limit;i++)
   redBuffer[i]=iCustom(NULL,0,"macdHelp",FastEMA,SlowEMA,SignalSMA,BollingerPeriod,BollingerDeviation,BollingerShift,3,i);

   for(i=0;i<limit;i++)
   {
      blueBuffer[i]=iCustom(NULL,0,"macdHelp",FastEMA,SlowEMA,SignalSMA,BollingerPeriod,BollingerDeviation,BollingerShift,4,i);
   }   
      
   for(i=0;i<limit;i++)
   {
      osma1=iCustom(NULL,0,"macdHelp",FastEMA,SlowEMA,SignalSMA,BollingerPeriod,BollingerDeviation,BollingerShift,0,i);
      osma2=iCustom(NULL,0,"macdHelp",FastEMA,SlowEMA,SignalSMA,BollingerPeriod,BollingerDeviation,BollingerShift,0,i+1);
      fast=iCustom(NULL,0,"macdHelp",FastEMA,SlowEMA,SignalSMA,BollingerPeriod,BollingerDeviation,BollingerShift,3,i);
      slow1=iCustom(NULL,0,"macdHelp",FastEMA,SlowEMA,SignalSMA,BollingerPeriod,BollingerDeviation,BollingerShift,4,i);
            
      redBuffer[i]=slow1;
      blueBuffer[i]=slow1;
      
      if(i>0)
      {       
         slow2=iCustom(NULL,0,"macdHelp",FastEMA,SlowEMA,SignalSMA,BollingerPeriod,BollingerDeviation,BollingerShift,4,i-1);
         
         if(fast<slow1)
         {
            redBuffer[i]=0.0;
            blueBuffer[i-1]=slow2;
         }
         else
         {
            redBuffer[i-1]=slow2;
            blueBuffer[i]=0.0;
         }
      }      
      
      if(osma1>osma2)
         ind_buffer4[i]=osma1;
      else
         ind_buffer4[i]=0.0;
         
      if(osma1<osma2)
         ind_buffer5[i]=osma1;
      else
         ind_buffer5[i]=0.0;
         
      blueBorder[i]=osma1;
      
      bandsUpper[i]=iCustom(NULL,0,"macdHelp",FastEMA,SlowEMA,SignalSMA,BollingerPeriod,BollingerDeviation,BollingerShift,1,i);         
      bandsLower[i]=iCustom(NULL,0,"macdHelp",FastEMA,SlowEMA,SignalSMA,BollingerPeriod,BollingerDeviation,BollingerShift,2,i);               
      bandsMiddle[i]=(bandsUpper[i]+bandsLower[i])/2.0;
   }
   return(0);
}
//ææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææ 



Sample





Analysis



Market Information Used:



Indicator Curves created:

Implements a curve of type DRAW_LINE
Implements a curve of type DRAW_HISTOGRAM


Indicators Used:




Custom Indicators Used:
macdHelp

Order Management characteristics:

Other Features: