Schaff Trend CD





//+------------------------------------------------------------------+
//|                                              Schaff Trend CD.mq4 |
//|                                                           mladen |
//|                                                                  |
//| Shaff trend CD is equal to MACD signal line                      |
//| For sake of series programing I kept                             |
//| the "Shaff trend CD" name                                        |
//+------------------------------------------------------------------+
#property copyright "mladen"
#property link      "mladenfx@gmail.com"

#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1  Red

//
//
//
//
//

extern int CDPeriod     = 25;
extern int FastMAPeriod = 23;
extern int SlowMAPeriod = 50;

//
//
//
//
//

double cdBuffer[];
double macdBuffer[];


//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
//
//
//
//
//

int init()
{
   IndicatorBuffers(2);
      SetIndexBuffer(0,cdBuffer);
      SetIndexBuffer(1,macdBuffer);
   IndicatorShortName("Schaff Trend CD ("+FastMAPeriod+","+SlowMAPeriod+","+CDPeriod+")");
   return(0);
}

int deinit()
{
   return(0);
}

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
//
//
//
//
//

int start()
{
   int      counted_bars=IndicatorCounted();
   int      limit,i;

   if(counted_bars < 0) return(-1);
   if(counted_bars>0) counted_bars--;
         limit = Bars-counted_bars;

   //
   //
   //
   //
   //
   
   for(i = limit; i >= 0; i--) macdBuffer[i] = iMA(NULL,0,FastMAPeriod,0,MODE_EMA,PRICE_CLOSE,i)-
                                               iMA(NULL,0,SlowMAPeriod,0,MODE_EMA,PRICE_CLOSE,i);
   for(i = limit; i >= 0; i--) cdBuffer[i]   = iMAOnArray(macdBuffer,0,CDPeriod,0,MODE_EMA,i);
   return(0);
}



Sample





Analysis



Market Information Used:



Indicator Curves created:



Indicators Used:

Moving average indicator


Custom Indicators Used:

Order Management characteristics:

Other Features: