Miscellaneous
0
Views
0
Downloads
0
Favorites
iHighLow
#property copyright "Copyright © 2007, TradersForecast"
#property link "http://www.TradersForecast.net/"
//---- indicator settings
//#property indicator_separate_window
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Red //Silver
#property indicator_color2 Red //Lime //Green
#property indicator_width1 1
#property indicator_width2 1
//---- indicator parameters
extern int hist4O=3;
extern int hist4C=3;
extern int maxSL=9;
//---- indicator buffers
double highBuf[];
double lowBuf[];
double high = 0;
double low = 0;
int init()
{
//---- drawing settings
SetIndexStyle(0,DRAW_LINE);
SetIndexStyle(1,DRAW_LINE);
//SetIndexDrawBegin(1,SignalSMA);
//IndicatorDigits(Digits+1);
//---- indicator buffers mapping
SetIndexBuffer(0,highBuf);
SetIndexBuffer(1,lowBuf);
//---- name for DataWindow and indicator subwindow label
//IndicatorShortName("MACD("+FastEMA+","+SlowEMA+","+SignalSMA+")"); //, "fExpert(5) = ", fExpert(5)
IndicatorShortName("(highBuf = "+highBuf[0]+"; lowBuf = "+lowBuf[0]+";)"); //, "fExpert(5) = ", fExpert(5)
SetIndexLabel(0,"Highs");
SetIndexLabel(1,"Lows");
//---- initialization done
return(0);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int start()
{
int limit;
int counted_bars=IndicatorCounted();
//---- last counted bar will be recounted
if(counted_bars>0) counted_bars--;
limit = Bars-counted_bars;
//---- macd counted in the 1-st buffer
for(int i=0 ; i<limit; i++){
//dirBuffer[i] =
fExpert(i+1);
highBuf[i] = high;
lowBuf[i] = low;
}
//---- done
return(0);
}
//+------------------------------------------------------------------+
int fExpert(int v) {
//if (v == 0) return(0);
int highPos = iHighest(NULL, 0, MODE_HIGH, hist4O, v);
int lowPos = iLowest(NULL, 0, MODE_LOW, hist4O, v);
high = High[highPos];
low = Low[lowPos];
return(0);
}
// the end.
//+------------------------------------------------------------------+
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
---