Miscellaneous
0
Views
0
Downloads
0
Favorites
4D_-_Range_Switch
//+------------------------------------------------------------------+
//| 4D - Range Switch.mq4 |
//| Copyright © 2009, Vic2008 |
//| |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2009, Vic2008"
#property link ""
#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Red
//---- buffers
double ExtMapBuffer1[];
double PREV=0;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,ExtMapBuffer1);
PREV=0;
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int i;
for( i=Bars-5; i>=0; i-- ){
if( Close[i] > MathMax(MathMax(High[i+1],High[i+4]),MathMax(High[i+2],High[i+3])) ){ ExtMapBuffer1[i]=MathMin(MathMin(Low[i],Low[i+3]),MathMin(Low[i+1],Low[i+2])); }
else{
if( Close[i] < MathMin(MathMin(Low[i+1],Low[i+4]),MathMin(Low[i+2],Low[i+3])) ){ ExtMapBuffer1[i]=MathMax(MathMax(High[i],High[i+3]),MathMax(High[i+1],High[i+2])); }
else{ ExtMapBuffer1[i]=PREV; }
}
PREV=ExtMapBuffer1[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
---