Miscellaneous
0
Views
0
Downloads
0
Favorites
High_N
#property copyright "Copyright © 2014 Serkov Alexandr"
#property link "serkov-alexandr@mail.ru"
//+------------------------------------------------------------------+
//| Properties |
//+------------------------------------------------------------------+
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Green
#property indicator_color2 Red
#property indicator_width1 3
#property indicator_width2 3
extern int N=10;
double Buf1[];
double Buf2[];
//+------------------------------------------------------------------+
//| Initialization |
//+------------------------------------------------------------------+
int init()
{SetIndexStyle(0,DRAW_LINE);
SetIndexStyle(1,DRAW_LINE);
SetIndexDrawBegin(1,1);
IndicatorDigits(Digits+1);
SetIndexBuffer(0,Buf1);
SetIndexBuffer(1,Buf2);
if(N<=0) N=3;
return(0);}
//+------------------------------------------------------------------+
//| Main function |
//+------------------------------------------------------------------+
int start()
{int i;bool dir;
for(i=Bars-2*N;i>=0;i--)
{if(High[i]>High[i+N])
dir=true;
if(Low[i]<Low[i+N])
dir=false;
if(dir==true)
{Buf1[i]=High[i];Buf1[i+1]=High[i+1];}
else
{Buf2[i]=Low[i];Buf2[i+1]=Low[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
---