generated from EA31337/Strategy-Demo
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Stg_Indicator.mq5
80 lines (68 loc) · 2.1 KB
/
Stg_Indicator.mq5
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
73
74
75
76
77
78
79
80
/**
* @file
* Implements Indicator strategy.
*/
// Includes conditional compilation directives.
#include "config/define.h"
// Includes EA31337 framework.
#include <EA31337-classes/EA.mqh>
#include <EA31337-classes/Strategy.mqh>
// Includes indicator classes.
#include <EA31337-classes/Indicators/Bitwise/indicators.h>
#include <EA31337-classes/Indicators/OHLC/indicators.h>
#include <EA31337-classes/Indicators/Price/indicators.h>
#include <EA31337-classes/Indicators/Special/indicators.h>
#include <EA31337-classes/Indicators/indicators.h>
// Inputs.
input int Active_Tfs = M15B + M30B + H1B + H2B + H3B + H4B + H6B +
H8B; // Timeframes (M1=1,M2=2,M5=16,M15=256,M30=1024,H1=2048,H2=4096,H3,H4,H6,H8)
input ENUM_LOG_LEVEL Log_Level = V_INFO; // Log level.
input bool Info_On_Chart = true; // Display info on chart.
// Includes strategy.
#include "Stg_Indicator.mqh"
// Defines.
#define ea_name "Strategy Indicator"
#define ea_version "1.013"
#define ea_desc "Strategy based on EA31337 framework."
#define ea_link "https://github.com/EA31337/Strategy-Indicator"
#define ea_author "EA31337 Ltd"
// Properties.
#property version ea_version
#ifdef __MQL4__
#property description ea_name
#property description ea_desc
#endif
#property link ea_link
#property copyright "Copyright 2016-2023, EA31337 Ltd"
// Class variables.
EA *ea;
/* EA event handler functions */
/**
* Implements "Init" event handler function.
*
* Invoked once on EA startup.
*/
int OnInit() {
bool _result = true;
EAParams ea_params(__FILE__, Log_Level);
ea = new EA(ea_params);
_result &= ea.StrategyAdd<Stg_Indicator>(Active_Tfs);
return (_result ? INIT_SUCCEEDED : INIT_FAILED);
}
/**
* Implements "Tick" event handler function (EA only).
*
* Invoked when a new tick for a symbol is received, to the chart of which the Expert Advisor is attached.
*/
void OnTick() {
ea.ProcessTick();
if (!ea.GetTerminal().IsOptimization()) {
ea.UpdateInfoOnChart();
}
}
/**
* Implements "Deinit" event handler function.
*
* Invoked once on EA exit.
*/
void OnDeinit(const int reason) { Object::Delete(ea); }