-
Notifications
You must be signed in to change notification settings - Fork 0
/
Oraculo_EA_Stage.mq5
82 lines (72 loc) · 6.3 KB
/
Oraculo_EA_Stage.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
//+------------------------------------------------------------------+
//| Oraculo_EA.mq5 |
//| Vagner Ribeiro |
//| https://w3dsoftware.com |
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
#include "./entities/OrderTypeEntity.mq5";
#include "./entities/VolumeForceEntity.mq5";
#include "./dashboard/Painel.mq5";
#include "./utils/Points.mq5";
#include <Trade\Trade.mqh>;
CTrade trade;
bool isStopedLoss = false;
int hForceToOpen;
double valForceToOpen[];
double forceIndexToOpen = 0;
int hForceToClose;
double valForceToClose[];
double forceIndexToClose = 0;
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int OnInit() {
//---
int periodIForceOpen = 0;
int periodIForceClose = 0;
Print("Oraculo EA, Olá mundo!");
Print("Sirva um café e mantenha a calma!");
if(_Period == 1) {
periodIForceOpen = 30;
periodIForceClose = 13;
}
if(_Period >= 2) {
periodIForceOpen = 45;
periodIForceClose = 10;
}
hForceToOpen = iForce(_Symbol, PERIOD_CURRENT, periodIForceOpen, MODE_LWMA, VOLUME_TICK);
hForceToClose = iForce(_Symbol, PERIOD_CURRENT, periodIForceClose, MODE_SMA, VOLUME_TICK);
trade.SetExpertMagicNumber(603217);
//SendNotification("Oraculo EA in action at " + _Symbol + " M" + _Period);
//---
return (INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason) {
//---
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick() {
VolumeForceEntity volumeForceEntity;
OrderTypeEntity orderTypeEntity;
OrderEntity orderEntity;
volumeForceEntity.init();
ArrayResize(volumeForceEntity.iForceIndexToOpen, 3);
ArrayResize(volumeForceEntity.iForceIndexToClose, 3);
ArraySetAsSeries(volumeForceEntity.iForceIndexToOpen, true);
CopyBuffer(hForceToOpen, 0, 0, 3, volumeForceEntity.iForceIndexToOpen);
ArraySetAsSeries(volumeForceEntity.iForceIndexToClose, true);
CopyBuffer(hForceToClose, 0, 0, 3, volumeForceEntity.iForceIndexToClose);
orderTypeEntity.init(volumeForceEntity);
orderEntity.init(volumeForceEntity, orderTypeEntity);
if(!MQLInfoInteger(MQL_TESTER)) {
Print("-----------------------------------------------------------");
}
}
//+------------------------------------------------------------------+