1 //+------------------------------------------------------------------+
\r
3 //| Copyright © 2005, MetaQuotes Software Corp. |
\r
4 //| http://www.metaquotes.net/ |
\r
5 //+------------------------------------------------------------------+
\r
6 #property copyright "Copyright © 2005, MetaQuotes Software Corp."
\r
7 #property link "http://www.metaquotes.net/"
\r
9 #property indicator_separate_window
\r
10 #property indicator_buffers 1
\r
11 #property indicator_color1 Silver
\r
12 //---- input parameters
\r
13 extern int BullsPeriod=13;
\r
15 double BullsBuffer[];
\r
16 double TempBuffer[];
\r
17 //+------------------------------------------------------------------+
\r
18 //| Custom indicator initialization function |
\r
19 //+------------------------------------------------------------------+
\r
23 //---- 1 additional buffer used for counting.
\r
24 IndicatorBuffers(2);
\r
25 IndicatorDigits(Digits);
\r
26 //---- indicator line
\r
27 SetIndexStyle(0,DRAW_HISTOGRAM);
\r
28 SetIndexBuffer(0,BullsBuffer);
\r
29 SetIndexBuffer(1,TempBuffer);
\r
30 //---- name for DataWindow and indicator subwindow label
\r
31 short_name="Bulls("+BullsPeriod+")";
\r
32 IndicatorShortName(short_name);
\r
33 SetIndexLabel(0,short_name);
\r
37 //+------------------------------------------------------------------+
\r
39 //+------------------------------------------------------------------+
\r
42 int i,counted_bars=IndicatorCounted();
\r
44 if(Bars<=BullsPeriod) return(0);
\r
46 int limit=Bars-counted_bars;
\r
47 if(counted_bars>0) limit++;
\r
48 for(i=0; i<limit; i++)
\r
49 TempBuffer[i]=iMA(NULL,0,BullsPeriod,0,MODE_EMA,PRICE_CLOSE,i);
\r
51 i=Bars-counted_bars-1;
\r
54 BullsBuffer[i]=High[i]-TempBuffer[i];
\r
60 //+------------------------------------------------------------------+