Miscellaneous
0
Views
0
Downloads
0
Favorites
_2523MTF_NonLagMA_v4.mtf
/*-----------------------------+
| |
| Shared by www.Aptrafx.com |
| |
+------------------------------*/
//+------------------------------------------------------------------+
//| NonLagMA_v4.mq4 |
//| Copyright © 2006, TrendLaboratory |
//| http://finance.groups.yahoo.com/group/TrendLaboratory |
//| E-mail: igorad2003@yahoo.co.uk |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, TrendLaboratory"
#property link "http://finance.groups.yahoo.com/group/TrendLaboratory"
#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 Yellow
#property indicator_width1 2
#property indicator_color2 SkyBlue
#property indicator_width2 2
#property indicator_color3 Tomato
#property indicator_width3 2
//---- input parameters
extern int TimeFrame = 0;
extern int Price = 0;
extern int Length = 9;
extern int Displace = 0;
extern int Filter = 0;
extern int Color = 1;
extern int ColorBarBack = 0;
extern double Deviation = 0;
double Cycle = 4;
//---- indicator buffers
double MABuffer[];
double UpBuffer[];
double DnBuffer[];
double price[];
double trend[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
int ft=0;
string short_name;
//---- indicator line
IndicatorBuffers(5);
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,MABuffer);
SetIndexStyle(1,DRAW_LINE);
SetIndexBuffer(1,UpBuffer);
SetIndexStyle(2,DRAW_LINE);
SetIndexBuffer(2,DnBuffer);
SetIndexBuffer(3,price);
SetIndexBuffer(4,trend);
IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS));
//---- name for DataWindow and indicator subwindow label
switch(TimeFrame)
{
case 1 : string TimeFrameStr="Period_M1"; break;
case 5 : TimeFrameStr="Period_M5"; break;
case 15 : TimeFrameStr="Period_M15"; break;
case 30 : TimeFrameStr="Period_M30"; break;
case 60 : TimeFrameStr="Period_H1"; break;
case 240 : TimeFrameStr="Period_H4"; break;
case 1440 : TimeFrameStr="Period_D1"; break;
case 10080 : TimeFrameStr="Period_W1"; break;
case 43200 : TimeFrameStr="Period_MN1"; break;
default : TimeFrameStr="Current Timeframe";
}
IndicatorShortName("NonLagMa("+TimeFrameStr+")");
}
//----
return(0);
//+------------------------------------------------------------------+
//| NonLagMA_v4 |
//+------------------------------------------------------------------+
int start()
{
datetime TimeArray[];
int i,limit,y=0,counted_bars=IndicatorCounted();
// Plot defined time frame on to current time frame
ArrayCopySeries(TimeArray,MODE_TIME,Symbol(),TimeFrame);
limit=Bars-counted_bars;
for(i=0,y=0;i<limit;i++)
{
if (Time[i]<TimeArray[y]) y++;
MABuffer[i]=iCustom(NULL,TimeFrame,"NonLagMA_v4",Price,Length,Displace,Filter,Color,ColorBarBack,Deviation,Cycle,0,y);
UpBuffer[i]=iCustom(NULL,TimeFrame,"NonLagMA_v4",Price,Length,Displace,Filter,Color,ColorBarBack,Deviation,Cycle,1,y);
DnBuffer[i]=iCustom(NULL,TimeFrame,"NonLagMA_v4",Price,Length,Displace,Filter,Color,ColorBarBack,Deviation,Cycle,2,y);
price[i]=iCustom(NULL,TimeFrame,"NonLagMA_v4",Price,Length,Displace,Filter,Color,ColorBarBack,Deviation,3,y);
trend[i]=iCustom(NULL,TimeFrame,"NonLagMA_v4",Price,Length,Displace,Filter,Color,ColorBarBack,Deviation,4,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
---