Price Data Components
Miscellaneous
0
Views
0
Downloads
0
Favorites
WASD_FR1
//+------------------------------------------------------------------+
//| WASD_FR.mq4 |
//| Copyright 2015, WASD |
//| https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2015, WASD"
#property link "https://www.mql5.com"
#property version "1.00"
#property strict
#property indicator_chart_window
//--- input parameters
#property indicator_color1 clrMidnightBlue
#property indicator_color2 clrMidnightBlue
#property indicator_buffers 2
double arr_fr_dwn[];
double arr_fr_up[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
IndicatorDigits(Digits);
//--- indicator buffers mapping
SetIndexBuffer(0,arr_fr_dwn);
SetIndexStyle(0,DRAW_ARROW,0,1);
SetIndexArrow(0,218);
SetIndexLabel(0,"Fractal Down");
SetIndexBuffer(1,arr_fr_up);
SetIndexStyle(1,DRAW_ARROW,0,1);
SetIndexArrow(1,217);
SetIndexLabel(1,"Fractal Up");
//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int start()
{
int idx_right_bar=Bars-IndicatorCounted();
for(int i=idx_right_bar;i>0; i--)
{
if(IsStopped())
break;
if((iLow(NULL,0,i+1)<iLow(NULL,0,i)) && (iLow(NULL,0,i+1)<iLow(NULL,0,i+2)))
{
arr_fr_dwn[i+1]=iLow(NULL,0,i+1);
}
if((iHigh(NULL,0,i+1)>iHigh(NULL,0,i)) && (iHigh(NULL,0,i+1)>iHigh(NULL,0,i+2)))
{
arr_fr_up[i+1]=iHigh(NULL,0,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
---