//--------------------------------------------------------------------
// indicatorstyle.mq4
// The code should be used for educational purpose only.
//--------------------------------------------------------------- 1 --
[HASHTAG]#property[/HASHTAG] indicator_chart_window // Indic. is drawn in the main window
[HASHTAG]#property[/HASHTAG] indicator_buffers 2 // Amount of buffers
[HASHTAG]#property[/HASHTAG] indicator_color1 Red // Color of the first line
[HASHTAG]#property[/HASHTAG] indicator_color2 Blue // Color of the first line
double Buf_0[];
double Buf_1[]; // Indicator array opening
// Indicator array opening
//--------------------------------------------------------------- 2 --
int init() // Special function init()
{
SetIndexBuffer(0,Buf_0); // Assigning the array to the buffer
SetIndexStyle (0,DRAW_LINE,STYLE_SOLID,2);// Line style
SetIndexLabel (0,"High Line");
SetIndexBuffer(1,Buf_1); // Assigning the array to the buffer
SetIndexStyle (1,DRAW_LINE,STYLE_SOLID,2);// Line style
SetIndexLabel (1,"Low Line");
return; // Exit spec. function init()
}
//--------------------------------------------------------------- 3 --
int start() // Special function start()
{
int i, // Bar index
Counted_bars; // Amount of calculated bars
Counted_bars=IndicatorCounted(); // Amount of calculated bars
i=Bars-Counted_bars-1; // Index of the first uncounted
while(i>=0) // Cycle for the uncounted bars
{
if (Open > Close && Open[i-1] > Close[i-1]) {Buf_0=High; Buf_0[i-1]=High[i-1];} // value 0 of the buffer on ith bar
if (Open < Close && Open[i-1] < Close[i-1]) {Buf_1=Low; Buf_1[i-1]=Low[i-1]; }
i--; // Index calculation for the next bar
}
return; // Exit spec. function start()
}
//--------------------------------------------------------------- 4 --