Indicators Used
Miscellaneous
1
Views
0
Downloads
0
Favorites
MFI_MACD_mtf
//+------------------------------------------------------------------+
//|MFI_MACD_mtf Waddah_Attar_Def_RSI.mq4 |
//| Copyright © 2007, Eng. Waddah Attar |
//| mtf 2008forextsd Keris2112 ki waddahattar@hotmail.com |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2007, Eng. Waddah Attar mtf2008forex-tsd.com"
#property link "waddahattar@hotmail.com"
//----
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 Crimson
#property indicator_color2 BlueViolet
#property indicator_width1 1
#property indicator_width2 1
#property indicator_level1 0
#property indicator_levelcolor Teal
//----
extern int MFIPeriod1 =14;
extern int MFIPeriod2 =34;
extern int MFISig =7;
double ind_buffer1[];
double MABuffer1[];
double MABuffer1h[];
extern int MaxBarsToCount = 1500;
extern int TimeFrame = 0;
extern string note_TimeFrames = "M1;5,15,30,60H1;240H4;1440D1;10080W1;43200MN|0-CurrentTF";
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int init()
{
IndicatorBuffers(3);
SetIndexStyle(0, DRAW_LINE);
SetIndexStyle(1, DRAW_LINE);
SetIndexBuffer(0, ind_buffer1);
SetIndexBuffer(1, MABuffer1);
SetIndexBuffer(2, MABuffer1h);
//----
switch(TimeFrame)
{
case 1 : string TimeFrameStr= "M1"; break;
case 5 : TimeFrameStr= "M5"; break;
case 15 : TimeFrameStr= "M15"; break;
case 30 : TimeFrameStr= "M30"; break;
case 60 : TimeFrameStr= "H1"; break;
case 240 : TimeFrameStr= "H4"; break;
case 1440 : TimeFrameStr= "D1"; break;
case 10080 : TimeFrameStr= "W1"; break;
case 43200 : TimeFrameStr= "MN1"; break;
default : TimeFrameStr= "CurrTF";
}
IndicatorShortName("MFI_MACD ("+MFIPeriod1+","+MFIPeriod2+","+MFISig+") ["+TimeFrameStr+"]");
if (TimeFrame<Period()) TimeFrame=Period();
return(0);
}
//+------------------------------------------------------------------+
int deinit()
{
return(0);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int start()
{
double MFI1,MFI2;
datetime TimeArray[];
datetime TimeArray1[];
int limit, i, y=0, counted_bars = IndicatorCounted();
if(counted_bars < 0) return(-1);
if(counted_bars > 0) counted_bars--;
ArrayCopySeries(TimeArray,MODE_TIME,Symbol(),TimeFrame);
ArrayCopySeries(TimeArray1,MODE_TIME,Symbol(),TimeFrame);
limit = Bars - counted_bars;
limit=MathMax(limit,TimeFrame/Period());
limit= MathMin(limit,MaxBarsToCount);
//----
for(i=0,y=0;i<limit;i++)
{
if (Time[i]<TimeArray[y]) y++;
MFI1 = iMFI(NULL, TimeFrame, MFIPeriod1, y);
MFI2 = iMFI(NULL, TimeFrame, MFIPeriod2, y);
MABuffer1[i] = (MFI1-MFI2);
MABuffer1h[y] = (MFI1-MFI2);
}
for(i=0,y=0;i<limit;i++)
{
if (Time[i]<TimeArray1[y]) y++;
ind_buffer1[i] = iMAOnArray(MABuffer1h,0,MFISig,0,MODE_SMA,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
---