bleh
[mqlkit.git] / ExportFunctions.mq4
blob80a08d6816db13ea69bddf2e0ab35e0575d4c6cb
1 //+------------------------------------------------------------------+\r
2 //|                                              ExportFunctions.mq4 |\r
3 //|                      Copyright © 2005, MetaQuotes Software Corp. |\r
4 //|                                       http://www.metaquotes.net/ |\r
5 //+------------------------------------------------------------------+\r
6 \r
7 #property copyright "Copyright © 2005, MetaQuotes Software Corp."\r
8 #property link      "http://www.metaquotes.net/"\r
9 #include <sampledll.mqh>\r
13 #define TIME_INDEX   0\r
14 #define OPEN_INDEX   1\r
15 #define LOW_INDEX    2\r
16 #define HIGH_INDEX   3\r
17 #define CLOSE_INDEX  4\r
18 #define VOLUME_INDEX 5\r
21 //+------------------------------------------------------------------+\r
22 //| expert initialization function                                   |\r
23 //+------------------------------------------------------------------+\r
25 int\r
26 init()\r
27 {\r
28     double ret,some_value=10.5;\r
29     string sret;\r
30     int    cnt;\r
31     string strarray[6]={ "first", "second", "third", "fourth", "fifth" };\r
33 //---- simple dll-functions call\r
34     cnt=GetIntValue(some_value);\r
35     Print("Returned value is ",cnt);\r
36     ret=GetDoubleValue(some_value);\r
37     Print("Returned value is ",ret);\r
38     sret=GetStringValue("some string");\r
39     Print("Returned value is ",sret);\r
41 //----\r
42     cnt=SortStringArray(strarray,ArraySize(strarray));\r
43     for(int i=0; i<cnt; i++) Print(i," - ",strarray[i]);\r
44     cnt=ProcessStringArray(strarray,ArraySize(strarray));\r
45     for(i=0; i<cnt; i++) Print(i," - ",strarray[i]);\r
47 //----\r
48     return(0);\r
49 }\r
53 //+------------------------------------------------------------------+\r
54 //| array functions call                                             |\r
55 //+------------------------------------------------------------------+\r
56 int start()\r
57 {\r
58     double price;\r
59     double arr[5]={1.5, 2.6, 3.7, 4.8, 5.9 };\r
60     double rates[][6];\r
62 //---- get first item from passed array\r
63     price=GetArrayItemValue(arr,5,0);\r
64     Print("Returned from arr[0] ",price);\r
66 //---- change second item in the passed array\r
67     if(SetArrayItemValue(arr,5,1,1234.5)==true)\r
68         Print("Changed to ",arr[1]);\r
70 //---- get current close\r
71     ArrayCopyRates(rates);\r
72     price=GetRatesItemValue(rates,Bars,0,CLOSE_INDEX);\r
73     Print("Returned from Close ",price);\r
75 //----\r
76     return(0);\r
77 }\r
78 //+------------------------------------------------------------------+\r