Indicators Used
Miscellaneous
0
Views
0
Downloads
0
Favorites
VS_FractalMTF
//+-------------------------------------------------------------------------------------------------+
//| VS_FractalMTF.mq4 |
//| Copyright © 2011, Vladimir Sautkin |
//| sly_fox@list.ru |
//|Ïîñòðîåíèå ôðàêòàëîâ ñî ñòàðøèõ ÒÔ |
//+-------------------------------------------------------------------------------------------------+
#property copyright "Copyright © 2010,Vladimir Sautkin"
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Blue
#property indicator_color2 Red
extern int TF=0;
double Up[],
Dn[];
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
int init()
{
IndicatorBuffers(2);
SetIndexStyle(0,DRAW_ARROW,EMPTY,1); SetIndexArrow(0,167); SetIndexBuffer(0,Up);
SetIndexStyle(1,DRAW_ARROW,EMPTY,1); SetIndexArrow(1,167); SetIndexBuffer(1,Dn);
SetIndexEmptyValue(0,0);
SetIndexEmptyValue(1,0);
if (TF!=1 && TF!=5 && TF!=15 && TF!=30 && TF!=60 && TF!=240 && TF!=1440 && TF!=10080 && TF!=43200) TF=Period();
if (TF ==0 || TF<Period()) TF=Period();
IndicatorShortName("1VS_FractalMTF "+TF);
SetIndexLabel(0,"1VS_FractalMTF "+TF+" UP");
SetIndexLabel(1,"1VS_FractalMTF "+TF+" DOWN");
return(0);
}
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
int start()
{
int i,
iTF,
iLastTF=0;
double FrUp,
FrDn;
int counted_bars = IndicatorCounted();
if(counted_bars < 0) return(-1);
if(counted_bars > 0) counted_bars--;
int Limit = Bars - counted_bars;
if(counted_bars==0) Limit-=1+TF/Period()+1;
for( i=Limit; i>=0; i-- )
{
iTF=iBarShift(NULL,TF,Time[i],false);
if (iTF!=iLastTF)
{
FrUp=iFractals(NULL,TF,MODE_UPPER ,iTF);
FrDn=iFractals(NULL,TF,MODE_LOWER ,iTF);
if (FrUp>0) Up[i]=FrUp;
if (FrDn>0) Dn[i]=FrDn;
iLastTF=iTF;
}
else
{
Up[i]=Up[i+1];
Dn[i]=Dn[i+1];
}
}
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
---