Miscellaneous
0
Views
0
Downloads
0
Favorites
HighLowBands
//+------------------------------------------------------------------+
//| HighLowBands.mq4 |
//| Copyright © 2006, Maji, Tim |
//| |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, Maji, Tim "
#property link "None"
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Lime
#property indicator_color2 Red
//---- indicator parameters
extern int LookBackPeriod=3;
//---- buffers
double UBBuffer[];
double LBBuffer[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
IndicatorBuffers(2);
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,UBBuffer);
SetIndexStyle(1,DRAW_LINE);
SetIndexBuffer(1,LBBuffer);
//----
//SetIndexDrawBegin(0,0);
//SetIndexDrawBegin(1,0);
//----
return(0);
}
int start()
{
//----
int counted_bars=IndicatorCounted();
int i;
bool long=false;
if(Bars<=LookBackPeriod) return(0);
//---- initial zero
if(counted_bars<1)
for(i=1;i<=LookBackPeriod;i++)
{
UBBuffer[Bars-i]=EMPTY_VALUE;
LBBuffer[Bars-i]=EMPTY_VALUE;
}
//----
int limit=Bars-counted_bars;
if(counted_bars>0) limit++;
//----
i=Bars-LookBackPeriod+1;
if(counted_bars>LookBackPeriod-1) i=Bars-counted_bars-1;
while(i>=0)
{
UBBuffer[i]=High[Highest(NULL,0,MODE_HIGH,LookBackPeriod,i)];
LBBuffer[i]=Low[Lowest(NULL,0,MODE_LOW,LookBackPeriod,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
---