bleh
[mqlkit.git] / include / PriceSeries.mqh
blob2cb4af7a743cc371b1f90de9621cbd05dd83da19
1 //+SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS+\r
2 //|                                                  PriceSeries.mqh |\r
3 //|                        Copyright © 2006,        Nikolay Kositsin | \r
4 //|                              Khabarovsk,   farria@mail.redcom.ru | \r
5 //+SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS+ \r
6 // Ôóíêöèÿ PriceSeries() âîçâðàùàåò âõîäíóþ öåíó áàðà ïî åãî íîìåðó nPriceSeries.Bar è\r
7 // ïî íîìåðó öåíû PriceSeries.Input_Price_Customs:\r
8 //(0-CLOSE, 1-OPEN, 2-HIGH, 3-LOW, 4-MEDIAN, 5-TYPICAL, 6-WEIGHTED, 7-Heiken Ashi Close, 8-SIMPL, 9-TRENDFOLLOW, 10-0.5*TRENDFOLLOW,\r
9 //11-Heiken Ashi High, 12-Heiken Ashi Low, 13-Heiken Ashi Open, 14-Heiken Ashi Close,\r
10 // ïðèìåð: minuse = PriceSeries(Input_Price_Customs, bar) - PriceSeries(Input_Price_Customs, bar+1);\r
11 // èëè;  Momentum = PriceSeries(Input_Price_Customs, bar) - PriceSeries(Input_Price_Customs, bar+Momentum_Period); \r
12   \r
13 //SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS+\r
14 //++++++++++++++++++++++++++++++++++++ <<< PriceSeries >>> +++++++++++++++++++++++++++++++++++++++++++++++++++++++++|\r
15 //SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS+\r
17 double PriceSeries(int PriceSeries.Input_Price_Customs, int nPriceSeries.Bar)\r
18 {\r
19 double dPriceSeries;\r
20 switch(PriceSeries.Input_Price_Customs)\r
21 {\r
22 case  0: dPriceSeries = Close[nPriceSeries.Bar];break;\r
23 case  1: dPriceSeries = Open [nPriceSeries.Bar];break;\r
24 case  2: dPriceSeries =(High [nPriceSeries.Bar]+Low  [nPriceSeries.Bar])/2;break;\r
25 case  3: dPriceSeries = High [nPriceSeries.Bar];break;\r
26 case  4: dPriceSeries = Low  [nPriceSeries.Bar];break;\r
27 case  5: dPriceSeries =(Open [nPriceSeries.Bar]+High [nPriceSeries.Bar]+Low[nPriceSeries.Bar]+Close[nPriceSeries.Bar])/4;break;\r
28 case  6: dPriceSeries =(Open [nPriceSeries.Bar]+Close[nPriceSeries.Bar])/2;break;\r
29 case  7: dPriceSeries =(Close[nPriceSeries.Bar]+High [nPriceSeries.Bar]+Low[nPriceSeries.Bar])/3;break;\r
30 case  8: dPriceSeries =(Close[nPriceSeries.Bar]+High [nPriceSeries.Bar]+Low[nPriceSeries.Bar]+Close[nPriceSeries.Bar])/4;break;\r
31 case  9: dPriceSeries = TrendFollow00(nPriceSeries.Bar);break;\r
32 case 10: dPriceSeries = TrendFollow01(nPriceSeries.Bar);break;\r
33 case 11: dPriceSeries = iCustom(NULL,0,"Heiken Ashi#",0,nPriceSeries.Bar);break;\r
34 case 12: dPriceSeries = iCustom(NULL,0,"Heiken Ashi#",1,nPriceSeries.Bar);break;\r
35 case 13: dPriceSeries = iCustom(NULL,0,"Heiken Ashi#",2,nPriceSeries.Bar);break;\r
36 case 14: dPriceSeries = iCustom(NULL,0,"Heiken Ashi#",3,nPriceSeries.Bar);break;\r
38 default: dPriceSeries = Close[nPriceSeries.Bar];\r
39 }\r
40 return(dPriceSeries);\r
41 }\r
42 //+SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS+\r
44 //----+ ââåäåíèå ôóíêöèè PriceSeriesAlert -------------------------------------------------------+\r
45 // Ôóíêöèÿ PriceSeriesAlert() ïðåäíàçíà÷åíà äëÿ èíäèêàöèè íåäîïóñòèìîãî çíà÷åíèÿ ïàðàìåòðà       |\r
46 // PriceSeries.Input_Price_Customs ïåðåäàâàåìîãî â ôóíêöèþ PriceSeries().                        |\r
47 //----+ -----------------------------------------------------------------------------------------+\r
48 void PriceSeriesAlert(int nPriceSeriesAlert.IPC)\r
49 {\r
50 //+===================================================================================================================================================================+\r
51 if(nPriceSeriesAlert.IPC< 0){Alert("Ïàðàìåòð Input_Price_Customs äîëæåí áûòü íå ìåíåå  0" + " Âû ââåëè íåäîïóñòèìîå "+nPriceSeriesAlert.IPC+ " áóäåò èñïîëüçîâàíî 0");}\r
52 if(nPriceSeriesAlert.IPC>14){Alert("Ïàðàìåòð Input_Price_Customs äîëæåí áûòü íå áîëåå 14" + " Âû ââåëè íåäîïóñòèìîå "+nPriceSeriesAlert.IPC+ " áóäåò èñïîëüçîâàíî 0");}\r
53 //+===================================================================================================================================================================+\r
54 }\r
55 //----+ ----------------------------------------------------------------------------------------+\r
57 //----+ ââåäåíèå ôóíêöèè TrendFollow00. äëÿ case 9 ---------------------------------------------+\r
58 double TrendFollow00(int nTrendFollow00.Bar)\r
59 {\r
60 double dTrendFollow00;\r
61 if(Close[nTrendFollow00.Bar]>Open[nTrendFollow00.Bar])dTrendFollow00 = High [nTrendFollow00.Bar];\r
62 else\r
63 {\r
64 if(Close[nTrendFollow00.Bar]<Open[nTrendFollow00.Bar])dTrendFollow00 = Low  [nTrendFollow00.Bar];\r
65                                                  else dTrendFollow00 = Close[nTrendFollow00.Bar];\r
66 }\r
67 return(dTrendFollow00);\r
68 }\r
69 //----+ ---------------------------------------------------------------------------------------+\r
71 //----+ ââåäåíèå ôóíêöèè TrendFollow01. äëÿ case 10 -------------------------------------------+\r
72 double TrendFollow01(int nTrendFollow01.Bar)\r
73 {\r
74 double dTrendFollow01;\r
75 if(Close[nTrendFollow01.Bar]>Open[nTrendFollow01.Bar])\r
76                         dTrendFollow01 =(High [nTrendFollow01.Bar]+Close[nTrendFollow01.Bar])/2;\r
77 else\r
78  {\r
79 if(Close[nTrendFollow01.Bar]<Open[nTrendFollow01.Bar])\r
80                         dTrendFollow01 = (Low [nTrendFollow01.Bar]+Close[nTrendFollow01.Bar])/2;\r
81                    else dTrendFollow01 = Close[nTrendFollow01.Bar];\r
82  }\r
83 return(dTrendFollow01);\r
84 }\r
85 //----+ --------------------------------------------------------------------------------------+