Professional Documents
Culture Documents
//| DarvasBoxes.mq5 |
//| Copyright � 2004, MetaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright � 2004, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net"
//---- indicator version
#property version "1.00"
//---- drawing the indicator in the main window
#property indicator_chart_window
//---- number of indicator buffers
#property indicator_buffers 2
//---- 2 plots are used
#property indicator_plots 2
//+-----------------------------------+
//| Indicator drawing parameters |
//+-----------------------------------+
//---- drawing the indicator as a line
#property indicator_type1 DRAW_LINE
//---- red color is used as the color of the indicator line
#property indicator_color1 Blue
//---- the indicator line is a solid one
#property indicator_style1 STYLE_SOLID
//---- indicator line width is equal to 2
#property indicator_width1 2
//---- displaying the indicator label
#property indicator_label1 "Upper DarvasBoxes"
switch(state)
{
case 1: box_top=high[bar]; if(symmetry)box_bottom=low[bar]; break;
case 2: if(box_top<=high[bar]) box_top=high[bar]; break;
case 3: if(box_top>high[bar]) box_bottom=low[bar]; else
box_top=high[bar]; break;
case 4: if(box_top > high[bar]) {if(box_bottom >= low[bar])
box_bottom=low[bar];} else box_top=high[bar]; break;
case 5: if(box_top > high[bar]) {if(box_bottom >= low[bar])
box_bottom=low[bar];} else box_top=high[bar]; state=0; break;
}
UpperBuffer[bar] = box_top;
LowerBuffer[bar] = box_bottom;
state++;
}
//----
return(rates_total);
}
//+------------------------------------------------------------------+