Indicators Used
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 Formatting Guide
# H1
## H2
### H3
**bold text**
*italicized text*
[title](https://www.example.com)

`code`
```
code block
```
> blockquote
- Item 1
- Item 2
1. First item
2. Second item
---