Miscellaneous
0
Views
0
Downloads
0
Favorites
Fractals5-diapazon
//+------------------------------------------------------------------+
//| Fractals5+Signal.mq4 |
//+------------------------------------------------------------------+
#property copyright "© Maloma"
#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 Magenta
#property indicator_color2 Teal
#property indicator_color3 GreenYellow
//---- input parameters
//---- buffers
double UpDiapazonBuffer[];
double DnDiapazonBuffer[];
double MdDiapazonBuffer[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicator buffers mapping
SetIndexBuffer(0,UpDiapazonBuffer);
SetIndexBuffer(1,DnDiapazonBuffer);
SetIndexBuffer(2,MdDiapazonBuffer);
//---- drawing settings
SetIndexStyle(0,DRAW_SECTION,EMPTY,2);
SetIndexStyle(1,DRAW_SECTION,EMPTY,2);
SetIndexStyle(2,DRAW_SECTION,STYLE_DASH);
//----
SetIndexEmptyValue(0,0.0);
SetIndexEmptyValue(1,0.0);
SetIndexEmptyValue(2,0.0);
//---- name for DataWindow
SetIndexLabel(0,"Diapazon Up");
SetIndexLabel(1,"Diapazon Down");
SetIndexLabel(2,"Diapazon Middle");
//---- initialization done
IndicatorShortName("F5-Diapazon");
return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//---- TODO: add your code here
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int i,j,nCountedBars;
nCountedBars=IndicatorCounted();
//---- check for possible errors
if(nCountedBars<0 || Bars<5) return(-1);
//----
i=Bars-nCountedBars-1;
while(i>=0)
{
//----Up and Down Fractals
//----5 bars Fractal
if(High[i+3]>High[i+4] && High[i+3]>High[i+5] && High[i+3]>High[i+2] && High[i+3]>High[i+1])
{
UpDiapazonBuffer[i]= Open[i];
MdDiapazonBuffer[i]= Open[i];
}
if(Low[i+3]<Low[i+4] && Low[i+3]<Low[i+5] && Low[i+3]<Low[i+2] && Low[i+3]<Low[i+1])
{
DnDiapazonBuffer[i]= Open[i];
MdDiapazonBuffer[i]= Open[i];
}
i--;
}
//----
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
---