Miscellaneous
0
Views
0
Downloads
0
Favorites
FTLM-STLM_MTF
//+------------------------------------------------------------------+
//| FTLM-STLM.mq4 |
//| Copyright © 2005, Finware Technologies Ltd |
//| http://www.finware.ru |
//+------------------------------------------------------------------+
//2009mtf Copyright © 2006, Keris2112" "http://www.forex-tsd.com"
#property copyright "Copyright © 2005, Finware Technologies Ltd"
#property link "http://www.finware.ru"
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 DarkKhaki
#property indicator_color2 DarkSalmon
#property indicator_width1 2
#property indicator_width2 2
//---- input parameters
extern int TimeFrame=0;
extern int CountBars=300;
extern string TimeFrames = "M1;5,15,30,60H1;240H4;1440D1;10080W1;43200MN|0-CurrentTF";
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexStyle(1,DRAW_LINE);
SetIndexBuffer(1,ExtMapBuffer2);
//----
TimeFrame=MathMax(TimeFrame,Period());
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="TF0";
}
string sname="FTLM-STLM ["+TimeFrameStr+"]";
IndicatorShortName(sname);
SetIndexLabel(0,sname);
SetIndexLabel(1,sname);
return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//---- TODO: add your code here
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
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;
limit=MathMax(limit,TimeFrame/Period());
limit=MathMin(limit,CountBars);
for(i=0,y=0;i<limit;i++)
{
if (TimeFrame<Period()) TimeFrame=Period();
if (Time[i]<TimeArray[y]) y++;
ExtMapBuffer1[i]=iCustom(NULL,TimeFrame,"FTLM-STLM",CountBars,0, y);
ExtMapBuffer2[i]=iCustom(NULL,TimeFrame,"FTLM-STLM",CountBars,1, 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
---