Schaff Trend CD

Author: mladen
Schaff Trend CD
Indicators Used
Moving average indicatorMoving average indicator
0 Views
0 Downloads
0 Favorites
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);
}

Comments

Markdown supported. Formatting help

Markdown Formatting Guide

Element Markdown Syntax
Heading # H1
## H2
### H3
Bold **bold text**
Italic *italicized text*
Link [title](https://www.example.com)
Image ![alt text](image.jpg)
Code `code`
Code Block ```
code block
```
Quote > blockquote
Unordered List - Item 1
- Item 2
Ordered List 1. First item
2. Second item
Horizontal Rule ---