generated from EA31337/Strategy-Demo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Stg_Arrows.mq5
88 lines (75 loc) · 2.19 KB
/
Stg_Arrows.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
81
82
83
84
85
86
87
88
/**
* @file
* Implements Arrows strategy.
*/
// Includes conditional compilation directives.
#include "config/define.h"
// Includes EA31337 framework.
#include <EA31337-classes/EA.mqh>
#include <EA31337-classes/Indicators/Indi_Fractals.mqh>
#include <EA31337-classes/Strategy.mqh>
// 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_Arrows.mqh"
// Defines.
#define ea_name "Strategy Arrows"
#define ea_version "2.000"
#define ea_desc "Strategy based on the price-arrow-type indicators."
#define ea_link "https://github.com/EA31337/Strategy-Arrows"
#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"
#ifdef __resource__
#ifdef __MQL5__
#property tester_indicator "::" + INDI_ATR_MA_SLOPE_PATH + "\\ATR_MA_Slope.ex5"
#property tester_library "::" + INDI_ATR_MA_SLOPE_PATH + "\\ATR_MA_Slope.ex5"
#endif
#endif
// Load external resources.
#ifdef __resource__
#ifdef __MQL5__
#resource INDI_ATR_MA_SLOPE_PATH + "\\ATR_MA_Slope.ex5"
#endif
#endif
// 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_Arrows>(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); }