Skip to content

Commit 53af429

Browse files
authored
Merge pull request #8 from erlonfs/develop
Develop
2 parents f071d4c + 86c0017 commit 53af429

File tree

8 files changed

+16
-48
lines changed

8 files changed

+16
-48
lines changed

Experts/Benchmark/benchmark.mq5

4 Bytes
Binary file not shown.
-192 Bytes
Binary file not shown.

Include/Framework/Base.mqh

230 Bytes
Binary file not shown.

Include/Robots/Benchmark.mqh

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -77,18 +77,9 @@ class Benchmark : public Base
7777
};
7878

7979
void Execute() {
80-
81-
RefreshLastPrice();
82-
83-
if (HasPositionOpen()) {
84-
ManagePosition();
85-
return;
86-
}
87-
88-
if (!Validate()) {
89-
return;
90-
}
91-
80+
81+
if(!Base::ExecuteBase()) return;
82+
9283
if (GetBuffers()) {
9384
ShowInfo();
9485

-290 Bytes
Binary file not shown.

Include/Robots/FirstCandle.mqh

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
#property copyright "Copyright 2016, Erlon F. Souza"
77
#property link "https://github.com/erlonfs"
8-
#property version "1.00"
8+
#property version "1.01"
99

1010
#include <Trade\Trade.mqh>
1111
#include <Trade\PositionInfo.mqh>
@@ -29,7 +29,6 @@ private:
2929
//Grafico
3030
color _corBuy;
3131
color _corSell;
32-
color _cor;
3332
bool _isDesenhar;
3433
bool _isEnviarParaTras;
3534
bool _isPreencher;
@@ -42,7 +41,7 @@ private:
4241
double _auxStopGain = NormalizeDouble((_entrada + GetStopGain()), _Digits);
4342
double _auxStopLoss = NormalizeDouble((_entrada - GetStopLoss()), _Digits);
4443

45-
if (GetLastPrice().last >= _entrada) {
44+
if (GetPrice().last >= _entrada) {
4645

4746
if (!HasPositionOpen()) {
4847
_waitBuy = false;
@@ -62,7 +61,7 @@ private:
6261
double _auxStopGain = NormalizeDouble((_entrada - GetStopGain()), _Digits);
6362
double _auxStopLoss = NormalizeDouble((_entrada + GetStopLoss()), _Digits);
6463

65-
if (GetLastPrice().last <= _entrada) {
64+
if (GetPrice().last <= _entrada) {
6665

6766
if (!HasPositionOpen()) {
6867
_waitSell = false;
@@ -95,7 +94,7 @@ private:
9594
isMatch = false;
9695
}
9796

98-
if (GetLastPrice().last > _maxima + GetSpread() || GetLastPrice().last < _minima - GetSpread()) {
97+
if (GetPrice().last > _maxima + GetSpread() || GetPrice().last < _minima - GetSpread()) {
9998
isMatch = false;
10099
}
101100

@@ -173,10 +172,6 @@ private:
173172

174173
public:
175174

176-
void SetColor(color cor) {
177-
_cor = cor;
178-
}
179-
180175
void SetIsDesenhar(bool isDesenhar) {
181176
_isDesenhar = isDesenhar;
182177
}
@@ -203,16 +198,7 @@ public:
203198

204199
void Execute() {
205200

206-
RefreshLastPrice();
207-
208-
if (HasPositionOpen()) {
209-
ManagePosition();
210-
return;
211-
}
212-
213-
if (!Validate()) {
214-
return;
215-
}
201+
if(!Base::ExecuteBase()) return;
216202

217203
if (GetBuffers()) {
218204

Include/Robots/TheLineOfDivision.mqh

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ private:
5252
double _auxStopGain = NormalizeDouble((_entrada + GetStopGain()), _Digits);
5353
double _auxStopLoss = NormalizeDouble((_entrada - GetStopLoss()), _Digits);
5454

55-
if (GetLastPrice().last >= _entrada) {
55+
if (GetPrice().last >= _entrada) {
5656

5757
if (!HasPositionOpen()) {
5858
_waitBuy = false;
@@ -72,7 +72,7 @@ private:
7272
double _auxStopGain = NormalizeDouble((_entrada - GetStopGain()), _Digits);
7373
double _auxStopLoss = NormalizeDouble((_entrada + GetStopLoss()), _Digits);
7474

75-
if (GetLastPrice().last <= _entrada) {
75+
if (GetPrice().last <= _entrada) {
7676

7777
if (!HasPositionOpen()) {
7878
_waitSell = false;
@@ -122,7 +122,7 @@ private:
122122
}
123123

124124
isFound = auxMaxCount >= _qtdToques;
125-
isFound = isFound && GetLastPrice().last <= auxMax;
125+
isFound = isFound && GetPrice().last <= auxMax;
126126

127127
}
128128

@@ -177,7 +177,7 @@ private:
177177
}
178178

179179
isFound = auxMinCount >= _qtdToques;
180-
isFound = isFound && GetLastPrice().last >= auxMin;
180+
isFound = isFound && GetPrice().last >= auxMin;
181181

182182
}
183183

@@ -311,16 +311,7 @@ public:
311311

312312
void Execute() {
313313

314-
RefreshLastPrice();
315-
316-
if (HasPositionOpen()) {
317-
ManagePosition();
318-
return;
319-
}
320-
321-
if (!Validate()) {
322-
return;
323-
}
314+
if(!Base::ExecuteBase()) return;
324315

325316
if (GetBuffers()) {
326317

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ Por [email protected]
66

77
Esse projeto foi desenvolvido para facilitar a criação de robôs traders escritos na linguagem [mql5](https://www.mql5.com/pt)
88
para a plataforma metatrader 5. Todos os robôs encontram se no diretorio "/Experts", acompanhados de um arquivo .set
9-
de configuração da estratégia. Inicialmente o projeto foi feito para atender ao mercado de mini contratos futuros da
10-
bolsa de valores de são paulo (BOVESPA). Para compilar os robôs é necessario acessar o editor de código do metatrader 5.
9+
de configuração da estratégia. Inicialmente o projeto foi feito para atender ao mercado de BMF, mais especificamente os mini-contratos
10+
de índice e dólar. Para compilar os robôs é necessario acessar o editor de código do metatrader 5.
1111

12-
Cada robô possui sua estratégia, contudo todos possuem funcionalidades basicas em comun, muitas delas já conhecidas
12+
Cada robô possui sua estratégia, contudo todos possuem funcionalidades basicas em comum, muitas delas já conhecidas
1313
no mercado de negociação, porém outras nem tanto. Irei retratar todas as funcionalidades que o framework
1414
de criação de robôs proporciona. Logo abaixo estão as configurações por seções, e em cada seção suas respectivas
1515
variáveis.

0 commit comments

Comments
 (0)