2 type=INDICATOR_ADVISOR
\r
3 description=Awesome Oscilator
\r
16 #property copyright "#copyright#"
\r
17 #property link "#link#"
\r
19 #indicator_properties#
\r
22 //---- indicator buffers
\r
23 double ExtGreenBuffer[];
\r
24 double ExtRedBuffer[];
\r
25 double ExtMABuffer[];
\r
26 //+------------------------------------------------------------------+
\r
27 //| Custom indicator initialization function |
\r
28 //+------------------------------------------------------------------+
\r
32 //---- drawing settings
\r
35 SetIndexDrawBegin(0,34);
\r
36 SetIndexDrawBegin(1,34);
\r
37 //---- indicator buffers mapping
\r
38 SetIndexBuffer(0, ExtGreenBuffer);
\r
39 SetIndexBuffer(1, ExtRedBuffer);
\r
40 SetIndexBuffer(2, ExtMABuffer);
\r
41 //---- name for DataWindow and indicator subwindow label
\r
42 IndicatorShortName("AO");
\r
43 //---- initialization done
\r
46 //+------------------------------------------------------------------+
\r
47 //| Awesome Oscillator |
\r
48 //+------------------------------------------------------------------+
\r
52 int counted_bars=IndicatorCounted();
\r
53 double prev,current;
\r
54 //---- check for possible errors
\r
55 if(counted_bars<0) return(-1);
\r
56 //---- last counted bar will be recounted
\r
57 if(counted_bars>0) counted_bars--;
\r
58 limit=Bars-counted_bars;
\r
59 //---- macd counted in the 1-st additional buffer
\r
60 for(int i=0; i<limit; i++)
\r
61 ExtMABuffer[i]=iMA(NULL,0,5,0,MODE_SMA,PRICE_MEDIAN,i)-iMA(NULL,0,34,0,MODE_SMA,PRICE_MEDIAN,i);
\r
62 //---- dispatch values between 2 buffers
\r
64 for(i=limit-1; i>=0; i--)
\r
66 current=ExtMABuffer[i];
\r
67 prev=ExtMABuffer[i+1];
\r
68 if(current>prev) up=true;
\r
69 if(current<prev) up=false;
\r
72 ExtRedBuffer[i]=current;
\r
73 ExtGreenBuffer[i]=0.0;
\r
77 ExtGreenBuffer[i]=current;
\r
78 ExtRedBuffer[i]=0.0;
\r
84 //+------------------------------------------------------------------+
\r