Indicators Used
0
Views
0
Downloads
0
Favorites
macd_x2MTF
//+------------------------------------------------------------------+
//| CCI.mq4 |
//| Copyright © 2004, MetaQuotes Software Corp. |
//| http://www.metaquotes.net/ |
//+------------------------------------------------------------------+
//2009fxtsd
#property copyright "Copyright © 2004, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net/"
//----
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 LightSeaGreen
#property indicator_color2 Green
//---- input parameters
extern int macd1MAfast =5;
extern int macd1MAslow =13;
extern int macd1SigMA =5;
extern int macd2MAfast =12;
extern int macd2MAslow =26;
extern int macd2SigMA =9;
extern int macd1LnMode=0; //0main,1sig
extern int macd2LnMode=0; //0main,1sig
extern int TimeFrame = 0;
//---- buffers
double buffer1[];
double buffer2[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicator lines
SetIndexBuffer(0, buffer1);
SetIndexBuffer(1, buffer2);
//----
//----
TimeFrame=MathMax(TimeFrame,Period());
//---- name for DataWindow and indicator subwindow label
string name1= " macd1 ("+macd1MAfast+","+macd1MAslow+","+macd1SigMA+") ";
string name2= " macd2 ("+macd2MAfast+","+macd2MAslow+","+macd2SigMA+") ";
IndicatorShortName(name1+name2+TimeFrame);
SetIndexLabel(0, name1);
SetIndexLabel(1, name2);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Commodity Channel Index |
//+------------------------------------------------------------------+
int start()
{
datetime TimeArray[];
int i,shift,limit,y=0,counted_bars=IndicatorCounted();
// Plot defined timeframe on to current timeframe
ArrayCopySeries(TimeArray,MODE_TIME,Symbol(),TimeFrame);
limit=Bars-counted_bars+TimeFrame/Period();
for(i=0,y=0;i<limit;i++)
{
if (Time[i]<TimeArray[y]) y++;
//---- main loop
buffer1[i]=iMACD(NULL,TimeFrame,macd1MAfast,macd1MAslow,macd1SigMA,PRICE_CLOSE,macd1LnMode,y);
buffer2[i]=iMACD(NULL,TimeFrame,macd2MAfast,macd2MAslow,macd2SigMA,PRICE_CLOSE,macd2LnMode,y);
}
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
---