bleh
[mqlkit.git] / templates / Alligator.mqt
blob9fafe004da0f2ba549db7f693e09f3bce0c09298
1 <expert>\r
2 type=INDICATOR_ADVISOR\r
3 description=\r
4 separate_window=1\r
5 used_buffers=3\r
6 <param>\r
7 name=JawsPeriod\r
8 type=int\r
9 value=13\r
10 </param>\r
11 <param>\r
12 name=JawsShift\r
13 type=int\r
14 value=8\r
15 </param>\r
16 <param>\r
17 name=TeethPeriod\r
18 type=int\r
19 value=8\r
20 </param>\r
21 <param>\r
22 name=TeethShift\r
23 type=int\r
24 value=5\r
25 </param>\r
26 <param>\r
27 name=LipsPeriod\r
28 type=int\r
29 value=5\r
30 </param>\r
31 <param>\r
32 name=LipsShift\r
33 type=int\r
34 value=3\r
35 </param>\r
36 <ind>\r
37 color=Blue\r
38 </ind>\r
39 <ind>\r
40 color=Red\r
41 </ind>\r
42 <ind>\r
43 color=Lime\r
44 </ind>\r
45 </expert>\r
46 #header#\r
47 #property copyright "#copyright#"\r
48 #property link      "#link#"\r
50 #indicator_properties#\r
51 #extern_variables#\r
52 #mapping_buffers#\r
53 //---- indicator buffers\r
54 double ExtBlueBuffer[];\r
55 double ExtRedBuffer[];\r
56 double ExtLimeBuffer[];\r
58 //+------------------------------------------------------------------+\r
59 //| Custom indicator initialization function                         |\r
60 //+------------------------------------------------------------------+\r
61 int init()\r
62   {\r
63    #buffers_used#\r
64 //---- line shifts when drawing\r
65    SetIndexShift(0,JawsShift);\r
66    SetIndexShift(1,TeethShift);\r
67    SetIndexShift(2,LipsShift);\r
68 //---- first positions skipped when drawing\r
69    SetIndexDrawBegin(0,JawsShift+JawsPeriod);\r
70    SetIndexDrawBegin(1,TeethShift+TeethPeriod);\r
71    SetIndexDrawBegin(2,LipsShift+LipsPeriod);\r
72 //---- 3 indicator buffers mapping\r
73    SetIndexBuffer(0,ExtBlueBuffer);\r
74    SetIndexBuffer(1,ExtRedBuffer);\r
75    SetIndexBuffer(2,ExtLimeBuffer);\r
76 //---- drawing settings\r
77    #indicators_init#\r
78 //---- initialization done\r
79    return(0);\r
80   }\r
81 //+------------------------------------------------------------------+\r
82 //| Bill Williams' Alligator                                         |\r
83 //+------------------------------------------------------------------+\r
84 int start()\r
85   {\r
86    int limit;\r
87    int counted_bars=IndicatorCounted();\r
88 //---- check for possible errors\r
89    if(counted_bars<0) return(-1);\r
90 //---- last counted bar will be recounted\r
91    if(counted_bars>0) counted_bars--;\r
92    limit=Bars-counted_bars;\r
93 //---- main loop\r
94    for(int i=0; i<limit; i++)\r
95      {\r
96       //---- ma_shift set to 0 because SetIndexShift called abowe\r
97       ExtBlueBuffer[i]=iMA(NULL,0,JawsPeriod,0,MODE_SMMA,PRICE_MEDIAN,i);\r
98       ExtRedBuffer[i]=iMA(NULL,0,TeethPeriod,0,MODE_SMMA,PRICE_MEDIAN,i);\r
99       ExtLimeBuffer[i]=iMA(NULL,0,LipsPeriod,0,MODE_SMMA,PRICE_MEDIAN,i);\r
100      }\r
101 //---- done\r
102    return(0);\r
103   }\r
104 //+------------------------------------------------------------------+\r