-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathClusterIndicatorTest.mq4
More file actions
72 lines (67 loc) · 2.5 KB
/
Copy pathClusterIndicatorTest.mq4
File metadata and controls
72 lines (67 loc) · 2.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
//+------------------------------------------------------------------+
//| ClusterIndicatorTest.mq4 |
//| Copyright 2015, MetaQuotes Software Corp. |
//| http://www.mql4.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2015, MetaQuotes Software Corp."
#property link "http://www.mql4.com"
#property version "1.00"
#property strict
#include "SymbolInfo.mqh"
#include "ClusterIndicator.mqh";
//--- input parameters
input int gPricePeriod = 1000;
input int gTimePeriod = 600;
input int gClusterCount = 100;
input int gTimer = 60;
CClusterIndicator *pClusterIndicator;
CSymbolInfo *pSymbol;
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
int clusters[];
Print("OnInit");
EventSetTimer(gTimer);
pSymbol = new CSymbolInfo();
pSymbol.Name(_Symbol);
pClusterIndicator = new CClusterIndicator(pSymbol, gTimePeriod, gPricePeriod, gClusterCount);
ArrayResize(clusters, gClusterCount*2);
pClusterIndicator.GetClusters(clusters);
for(int i=0; i < gClusterCount*2; i++) {
Print(i, ": ", clusters[i], ", ");
}
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
// EventKillTimer();
delete pSymbol;
delete pClusterIndicator;
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
//---
}
//+------------------------------------------------------------------+
//| Timer function |
//+------------------------------------------------------------------+
void OnTimer()
{
//---
Print("OnTimer");
int clusters[];
ArrayResize(clusters, gClusterCount*2);
pClusterIndicator.GetClusters(clusters);
// for(int i=0; i < gClusterCount*2; i++) {
// Print(i, ": ", clusters[i], ", ");
// }
}
//+------------------------------------------------------------------+