-
Notifications
You must be signed in to change notification settings - Fork 4
/
Stg_Envelopes.mq5
75 lines (64 loc) · 1.89 KB
/
Stg_Envelopes.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
/**
* @file
* Implements Envelopes strategy.
*/
// Includes conditional compilation directives.
#include "config/define.h"
// Includes EA31337 framework.
#include <EA31337-classes/EA.mqh>
#include <EA31337-classes/Indicators/Indi_Envelopes.mqh>
#include <EA31337-classes/Strategy.mqh>
// Inputs.
INPUT_GROUP("Envelopes strategy: main");
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_Envelopes.mqh"
// Defines.
#define ea_name "Strategy Envelopes"
#define ea_version "1.013"
#define ea_desc "Strategy based on EA31337 framework."
#define ea_link "https://github.com/EA31337/Strategy-Envelopes"
#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_Envelopes>(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); }