Skip to content

Commit 78a0fbd

Browse files
committed
Merge pull request #642 from EA31337/dev-v2011
Indicator logic refactor
2 parents b550609 + b26dfa5 commit 78a0fbd

File tree

210 files changed

+8687
-4055
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

210 files changed

+8687
-4055
lines changed

.github/workflows/compile-cpp.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
name: Compile C++
3+
4+
# yamllint disable-line rule:truthy
5+
on:
6+
pull_request:
7+
paths-ignore:
8+
- '**.md'
9+
push:
10+
paths-ignore:
11+
- '**.md'
12+
13+
jobs:
14+
15+
FileList:
16+
outputs:
17+
filelist: ${{ steps.get-files.outputs.filelist }}
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v2
21+
- name: Set output with list of files
22+
id: get-files
23+
run: |
24+
import glob, json, os
25+
files = glob.glob("**/tests/*.cpp")
26+
print("::set-output name=filelist::{}".format(json.dumps(files)))
27+
shell: python
28+
- name: Display output
29+
run: echo ${{ steps.get-files.outputs.filelist }}
30+
31+
Compile:
32+
runs-on: ubuntu-latest
33+
needs: [FileList]
34+
strategy:
35+
matrix:
36+
file: ${{ fromJson(needs.FileList.outputs.filelist) }}
37+
steps:
38+
- uses: actions/checkout@v2
39+
- name: Install compiler
40+
uses: rlalik/setup-cpp-compiler@v1.1
41+
with:
42+
compiler: gcc-latest
43+
- name: Compile ${{ matrix.file }}
44+
run: g++ "${{ matrix.file }}"

.github/workflows/test-buffer.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
---
2+
name: Test Buffer
3+
4+
# yamllint disable-line rule:truthy
5+
on:
6+
pull_request:
7+
paths:
8+
- 'Buffer/**'
9+
- '.github/workflows/test-buffer.yml'
10+
push:
11+
paths:
12+
- 'Buffer/**'
13+
- '.github/workflows/test-buffer.yml'
14+
15+
jobs:
16+
17+
Compile:
18+
runs-on: windows-latest
19+
steps:
20+
- uses: actions/checkout@v2
21+
- name: Compile
22+
uses: fx31337/mql-compile-action@master
23+
with:
24+
init-platform: true
25+
path: 'Buffer/tests'
26+
verbose: true
27+
- name: Print compiled files
28+
run: '(Get-ChildItem -Recurse -Path . -Include *.ex[45]).fullname'
29+
shell: powershell
30+
- name: Upload artifacts (MQL4)
31+
uses: actions/upload-artifact@v2
32+
with:
33+
name: files-ex4
34+
path: '**/*.ex4'
35+
- name: Upload artifacts (MQL5)
36+
uses: actions/upload-artifact@v2
37+
with:
38+
name: files-ex5
39+
path: '**/*.ex5'
40+
41+
Buffer-Tests-MQL4:
42+
defaults:
43+
run:
44+
shell: bash
45+
working-directory: Buffer/tests
46+
needs: Compile
47+
runs-on: ubuntu-latest
48+
strategy:
49+
matrix:
50+
test:
51+
- BufferCandle.test
52+
- BufferTick.test
53+
steps:
54+
- uses: actions/download-artifact@v2
55+
with:
56+
name: files-ex4
57+
- name: Run ${{ matrix.test }}
58+
uses: fx31337/mql-tester-action@master
59+
with:
60+
Script: ${{ matrix.test }}
61+
timeout-minutes: 10

.github/workflows/test-exchange.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
---
2+
name: Test Exchange
3+
4+
# yamllint disable-line rule:truthy
5+
on:
6+
pull_request:
7+
paths:
8+
- 'Exchange/**.h'
9+
- 'Exchange/**.mq?'
10+
- '.github/workflows/test-exchange.yml'
11+
push:
12+
paths:
13+
- 'Exchange/**.h'
14+
- 'Exchange/**.mq?'
15+
- '.github/workflows/test-exchange.yml'
16+
17+
jobs:
18+
19+
Compile:
20+
runs-on: windows-latest
21+
steps:
22+
- uses: actions/checkout@v2
23+
- name: Compile
24+
uses: fx31337/mql-compile-action@master
25+
with:
26+
init-platform: true
27+
path: 'Exchange/tests'
28+
verbose: true
29+
- name: Print compiled files
30+
run: '(Get-ChildItem -Recurse -Path . -Include *.ex[45]).fullname'
31+
shell: powershell
32+
- name: Upload artifacts (MQL4)
33+
uses: actions/upload-artifact@v2
34+
with:
35+
name: files-ex4
36+
path: '**/*.ex4'
37+
- name: Upload artifacts (MQL5)
38+
uses: actions/upload-artifact@v2
39+
with:
40+
name: files-ex5
41+
path: '**/*.ex5'
42+
43+
Exchange-Tests-MQL4:
44+
defaults:
45+
run:
46+
shell: bash
47+
working-directory: Exchange/tests
48+
needs: Compile
49+
runs-on: ubuntu-latest
50+
strategy:
51+
matrix:
52+
test:
53+
- Exchange.test
54+
steps:
55+
- uses: actions/download-artifact@v2
56+
with:
57+
name: files-ex4
58+
- name: Run ${{ matrix.test }}
59+
uses: fx31337/mql-tester-action@master
60+
with:
61+
Script: ${{ matrix.test }}
62+
timeout-minutes: 10

.github/workflows/test-indicator.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
---
2+
name: Test Indicator
3+
4+
# yamllint disable-line rule:truthy
5+
on:
6+
pull_request:
7+
paths:
8+
- 'Indicator**'
9+
- 'Indicator/**'
10+
- '.github/workflows/test-indicator.yml'
11+
push:
12+
paths:
13+
- 'Indicator**'
14+
- 'Indicator/**'
15+
- '.github/workflows/test-indicator.yml'
16+
17+
jobs:
18+
19+
Compile:
20+
runs-on: windows-latest
21+
steps:
22+
- uses: actions/checkout@v2
23+
- name: Compile
24+
uses: fx31337/mql-compile-action@master
25+
with:
26+
init-platform: true
27+
path: 'Indicator/tests'
28+
verbose: true
29+
- name: Print compiled files
30+
run: '(Get-ChildItem -Recurse -Path . -Include *.ex[45]).fullname'
31+
shell: powershell
32+
- name: Upload artifacts (MQL4)
33+
uses: actions/upload-artifact@v2
34+
with:
35+
name: files-ex4
36+
path: '**/*.ex4'
37+
- name: Upload artifacts (MQL5)
38+
uses: actions/upload-artifact@v2
39+
with:
40+
name: files-ex5
41+
path: '**/*.ex5'
42+
43+
Indicator-Tests-MQL4:
44+
defaults:
45+
run:
46+
shell: bash
47+
working-directory: Indicator/tests
48+
needs: Compile
49+
runs-on: ubuntu-latest
50+
strategy:
51+
matrix:
52+
test:
53+
- IndicatorCandle.test
54+
- IndicatorTf.test
55+
- IndicatorTick.test
56+
steps:
57+
- uses: actions/download-artifact@v2
58+
with:
59+
name: files-ex4
60+
- name: Run ${{ matrix.test }}
61+
uses: fx31337/mql-tester-action@master
62+
with:
63+
BtDays: 4-8
64+
BtMonths: 1
65+
BtYears: 2020
66+
TestExpert: ${{ matrix.test }}
67+
timeout-minutes: 10

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ jobs:
6161
- CompileIndicatorsTest
6262
- ConditionTest
6363
- DatabaseTest
64-
- DrawIndicatorTest
64+
# - DrawIndicatorTest
6565
- EATest
6666
- IndicatorDataTest
6767
- IndicatorTest

Account.mqh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ class Account;
3030
// Includes.
3131
#include "Account/Account.define.h"
3232
#include "Account/Account.enum.h"
33+
#include "Account/Account.extern.h"
3334
#include "Account/Account.struct.h"
3435
#include "Array.mqh"
3536
#include "BufferStruct.mqh"
@@ -63,6 +64,11 @@ class Account {
6364
*/
6465
Account() : init_balance(CalcInitDeposit()), start_balance(GetBalance()), start_credit(GetCredit()) {}
6566

67+
/**
68+
* Class copy constructor.
69+
*/
70+
Account(const Account &_account) {}
71+
6672
/**
6773
* Class deconstructor.
6874
*/

Account/Account.extern.h

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
//+------------------------------------------------------------------+
2+
//| EA31337 framework |
3+
//| Copyright 2016-2022, EA31337 Ltd |
4+
//| https://github.com/EA31337 |
5+
//+------------------------------------------------------------------+
6+
7+
/*
8+
* This file is free software: you can redistribute it and/or modify
9+
* it under the terms of the GNU General Public License as published by
10+
* the Free Software Foundation, either version 3 of the License, or
11+
* (at your option) any later version.
12+
*
13+
* This program is distributed in the hope that it will be useful,
14+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16+
* GNU General Public License for more details.
17+
*
18+
* You should have received a copy of the GNU General Public License
19+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
20+
*
21+
*/
22+
23+
// Includes.
24+
#include "Account.enum.h"
25+
26+
// Define external global functions.
27+
#ifndef __MQL__
28+
extern string AccountInfoString(ENUM_ACCOUNT_INFO_STRING property_id);
29+
#endif

Account/Account.struct.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ class Serializer;
3636

3737
// Includes.
3838
#include "../Serializer.mqh"
39+
#include "../Terminal.define.h"
3940

4041
// Struct for account entries.
4142
struct AccountEntry {

Account/AccountBase.struct.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ class Serializer;
3636

3737
// Includes.
3838
#include "../Serializer.mqh"
39+
#include "../Terminal.define.h"
3940

4041
// Struct for account entries.
4142
struct AccountBaseEntry {

Account/AccountForex.struct.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ class Serializer;
3636

3737
// Includes.
3838
#include "../Serializer.mqh"
39+
#include "../Terminal.define.h"
3940

4041
// Struct for account entries.
4142
struct AccountForexEntry : public AccountBaseEntry {

Account/tests/Account.test.mq5

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ int OnInit() {
3535
bool _result = true;
3636
Account<AccountBaseState, AccountBaseEntry> acc1;
3737
// ...
38-
return _result && GetLastError() == ERR_NO_ERROR ? INIT_SUCCEEDED : INIT_FAILED;
38+
return _result && GetLastError() == 0 ? INIT_SUCCEEDED : INIT_FAILED;
3939
}
4040

4141
/**

Account/tests/AccountForex.test.mq5

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ int OnInit() {
3535
bool _result = true;
3636
Account<AccountForexState, AccountForexEntry> acc1;
3737
// ...
38-
return _result && GetLastError() == ERR_NO_ERROR ? INIT_SUCCEEDED : INIT_FAILED;
38+
return _result && GetLastError() == 0 ? INIT_SUCCEEDED : INIT_FAILED;
3939
}
4040

4141
/**

Action.mqh

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -139,14 +139,16 @@ class Action {
139139
break;
140140
#endif
141141
#ifdef INDICATOR_MQH
142-
case ACTION_TYPE_INDICATOR:
143-
if (Object::IsValid(_entry.obj)) {
144-
_result = ((IndicatorBase *)_entry.obj).ExecuteAction((ENUM_INDICATOR_ACTION)_entry.action_id);
145-
} else {
146-
_result = false;
147-
_entry.AddFlags(ACTION_ENTRY_FLAG_IS_INVALID);
148-
}
149-
break;
142+
/*
143+
case ACTION_TYPE_INDICATOR:
144+
if (Object::IsValid(_entry.obj)) {
145+
_result = ((IndicatorBase *)_entry.obj).ExecuteAction((ENUM_INDICATOR_ACTION)_entry.action_id);
146+
} else {
147+
_result = false;
148+
_entry.AddFlags(ACTION_ENTRY_FLAG_IS_INVALID);
149+
}
150+
break;
151+
*/
150152
#endif
151153
#ifdef STRATEGY_MQH
152154
case ACTION_TYPE_STRATEGY:

0 commit comments

Comments
 (0)