Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Indicator logic refactor #642

Merged
merged 97 commits into from
Jul 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
97 commits
Select commit Hold shift + click to select a range
dbf7af0
Indicator: Adds IndicatorTick
kenorb Oct 28, 2021
6cc1f53
Merge tag 'v2.009' into dev-indicatortick
kenorb Nov 8, 2021
d829961
Indicator: Fixes compilation errors
kenorb Nov 9, 2021
b05cd01
Merge remote-tracking branch 'nseam/dev-getvalue-refactor' into dev-i…
kenorb Nov 9, 2021
e8554a1
IndicatorTick: Fixes compilation errors
kenorb Nov 9, 2021
53310b4
Indicators: Adds Indi_TickMt
kenorb Oct 31, 2021
ad83367
Tick/Indi_TickMt: Renames GetValue() to GetMixedValue()
kenorb Nov 9, 2021
28ff4d4
IndicatorTick: Implements tick fetching logic
kenorb Nov 9, 2021
565e493
Indicator: Renames GetMixedValue to GetEntryValue
kenorb Nov 8, 2021
42a6879
Indicator/IndicatorTick: Fixes return type
kenorb Nov 8, 2021
16385fd
Indicator: Moving some methods from base class to main
kenorb Nov 9, 2021
cbfb318
Merge remote-tracking branch 'origin/master' into dev-indicatortick
kenorb Nov 9, 2021
9f9c620
IndicatorTick: Adds SetTick()
kenorb Nov 9, 2021
4115a08
IndicatorTick: Implements test
kenorb Nov 9, 2021
ef95f6f
Indicator: Adds IndicatorCandle class
kenorb Nov 9, 2021
cc38869
Indicator: Adds IndicatorTf class
kenorb Nov 10, 2021
4fbbc91
Indicator: Adds README.md with info about indicators
kenorb Nov 11, 2021
1c9a5eb
Adds CandleOHLC and CandleTOHLC structs
kenorb Nov 11, 2021
b7b85d6
Buffer: Adds BufferCandle
kenorb Nov 11, 2021
e80fd94
Indicator/IndicatorCandle: Adds BufferCandle
kenorb Nov 11, 2021
88e4c71
Renames MqlTick.h to MqlTick.struct.h
kenorb Nov 11, 2021
e0632a6
Renames MqlTick.struct.h to Tick.struct.h
kenorb Nov 11, 2021
f47bd09
Adds TickAB and TickTAB structs
kenorb Nov 11, 2021
cb7ba0d
Buffer: Adds BufferTick
kenorb Nov 11, 2021
11dd812
Chart: ChartTf: Adds SecsToTf()
kenorb Oct 28, 2021
0b2e66f
Indicator/IndicatorTf: Improves constructors
kenorb Nov 11, 2021
112a998
Just some WIP.
nseam Nov 19, 2021
7696319
WIP. Added idea of event listeners for indicators and emitting a hist…
nseam Nov 22, 2021
1d2427a
WIP. Added candle grouping when receiving ticks via OnDataSourceEntry().
nseam Nov 23, 2021
e625d6f
Working simulation of real ticking indicator.
nseam Nov 25, 2021
04378bd
Moved example indicator classes into separate files. Added OnIndicato…
nseam Nov 26, 2021
f7b99ec
Added support for MT4.
nseam Nov 26, 2021
3537a04
WIP. Trying to make "AMA on Candle indicator on Tick indicator" to pr…
nseam Nov 30, 2021
f92dda0
Probably working scenario of AMA <- IndicatorTfDummy(IndicatorCandle)…
nseam Dec 3, 2021
6f3b99a
Fixed Util::ArrayRemove() method.
nseam Dec 3, 2021
83676b6
Merge pull request #619 from nseam/dev-indicator-refactor
kenorb Dec 5, 2021
28bc1e9
Account/SymbolInfo: Adds copy constructors
kenorb Dec 5, 2021
3871dd8
Adds Exchange class and tests
kenorb Dec 5, 2021
3f09d09
Exchange: Adds Trade
kenorb Dec 5, 2021
92bb334
SymbolInfo: Adds class constructor with symbol properties
kenorb Dec 5, 2021
78323e0
Exchange: Adds methods to add/remove account and symbol
kenorb Dec 5, 2021
9603dc3
WIP. i*OnIndicator versions of all indicators (except MA).
nseam Dec 7, 2021
a94b5c4
SymbolInfo: SymbolInfoEntry: Fixes struct copy constructor
kenorb Dec 8, 2021
a493f36
WIP. Finished i*OnIndicator mode for all indicators except MA. Change…
nseam Dec 9, 2021
f4c946d
WIP. AMA now requires refactor back to be parent of Indicator or some…
nseam Dec 11, 2021
761face
WIP. Introduces IndicatorCandleSource and IndicatorTickSource indicat…
nseam Dec 15, 2021
fea144a
WIP. Almost working AMA indicator (still varies to much with original…
nseam Dec 16, 2021
0e14527
WIP. Partially working Tick/Candle/TickOrCandle indicators differenti…
nseam Dec 22, 2021
c5be80f
WIP. Closer to the end. Now we need to find a way to feed indicator w…
nseam Dec 29, 2021
88d0a7c
WIP. Now we need to find a way to make BufferTick to provide continuo…
nseam Dec 30, 2021
c2a87cd
AS-IS.
nseam Jan 4, 2022
435f1d1
WIP. IndicatorsTest ready for testing!
nseam Jan 5, 2022
c6bc378
Merge branch 'dev' of https://github.com/EA31337/EA31337-classes into…
nseam Jan 6, 2022
58f94f9
Fixed bug with IndicatorBase::GetValue() which called GetEntryValue()…
nseam Jan 7, 2022
2640ceb
Merge branch 'dev' of https://github.com/EA31337/EA31337-classes into…
nseam Jan 12, 2022
e950493
State of the art
nseam Jan 12, 2022
078af3a
Looks like there is nothing more to do with AMA. Differences are marg…
nseam Jan 13, 2022
35af70c
Merge pull request #621 from EA31337/dev-exchange
kenorb Jan 15, 2022
af586ee
Moves Deal enums to Deal.enum.h
kenorb Jan 17, 2022
f6fb496
Moves enums and structs from Std and MQL5 to appropriate files
kenorb Jan 17, 2022
19a1a84
Adds .extern.h files
kenorb Jan 18, 2022
79e542c
Adds code page defines
kenorb Jan 18, 2022
df9180d
Adds Common and File defines
kenorb Jan 18, 2022
a70c358
Integrates extern includes
kenorb Jan 18, 2022
c3bb151
Refs: Uses PTR_ATTRIB syntax
kenorb Jan 18, 2022
871cc70
Fixed order of mode and shift when calling Indicator::GetValue<T>(). …
nseam Jan 18, 2022
fde05e4
Adds .extern.h file for DateTime
kenorb Jan 18, 2022
471e417
Adds StringSplit() as extern
kenorb Jan 18, 2022
f2142ea
Adds Compile workflow for CPP
kenorb Jan 18, 2022
8e39201
Fixed order of mode and shift when calling Indicator::GetValue<T>(). …
nseam Jan 18, 2022
9afdefb
Merge pull request #632 from nseam/dev-indicator-refactor
kenorb Jan 18, 2022
71108dc
Fixed typo in auxiliary indicator fetching by ID.
nseam Jan 18, 2022
a469c5e
Merge branch 'dev-indicator-refactor' of https://github.com/EA31337/E…
nseam Jan 18, 2022
e17381a
GHA: Compiles based on the file list
kenorb Jan 18, 2022
0b8be3b
Adds TradeSignal and TradeSignalManager C++ compilation tests
kenorb Jan 18, 2022
6ee889c
Fixes EOL characters
kenorb Jan 18, 2022
8826b3d
Trade: Fixes C++ compilation errors
kenorb Jan 18, 2022
74eb036
IndicatorsTest was set to test only AMA or Pattern indicator. Now it …
nseam Jan 19, 2022
1dc8803
Making MQL code to compile in C++. Especially the TradeSignalManager.…
nseam Jan 19, 2022
57af000
Merge pull request #634 from nseam/dev-indicator-refactor
kenorb Jan 19, 2022
1c8a2ed
State in the art of MQL/C++ compatibility.
nseam Jan 20, 2022
98f7b4e
Working compilation via GCC for TradeSignal.test.cpp and TradeSignalM…
nseam Jan 21, 2022
abf3b60
Merge pull request #636 from EA31337/dev-indicator-refactor
kenorb Jan 23, 2022
8d1e4a5
Should fix all GCC warnings.
nseam Jan 24, 2022
e76c4e5
Merge pull request #637 from nseam/dev-cpp
kenorb Jan 24, 2022
208de59
Merge remote-tracking branch 'origin/dev-cpp' into dev-v2011
kenorb Jan 25, 2022
afb673c
Should fix new issues with C++ compatibility.
nseam Jan 26, 2022
4355ade
Merge pull request #640 from nseam/dev-cpp
kenorb Jan 26, 2022
dc609ad
Merge branch 'dev-account' into dev-v2011
kenorb Jan 30, 2022
118347d
Merge tag 'v2.010' into dev-v2011
kenorb Mar 24, 2022
e61fe6c
CPP: Removes EnumToString
kenorb Mar 24, 2022
66f4342
Refactors IndicatorData class to be inherited by Indicator class
kenorb May 29, 2022
cb29a33
Splits IndicatorParams struct into IndicatorDataParams
kenorb Jun 19, 2022
2e47d5c
Indicator: Moves GetValuePrice() to IndicatorData
kenorb Jun 19, 2022
17373a5
Moves indicator data related methods to IndicatorData
kenorb Jun 26, 2022
b010f5d
Indicators: Adds Indicator source type and mode to constructor's argu…
kenorb Jun 26, 2022
b26dfa5
Fixes timeframe handling
kenorb Jun 27, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions .github/workflows/compile-cpp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
name: Compile C++

# yamllint disable-line rule:truthy
on:
pull_request:
paths-ignore:
- '**.md'
push:
paths-ignore:
- '**.md'

jobs:

FileList:
outputs:
filelist: ${{ steps.get-files.outputs.filelist }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set output with list of files
id: get-files
run: |
import glob, json, os
files = glob.glob("**/tests/*.cpp")
print("::set-output name=filelist::{}".format(json.dumps(files)))
shell: python
- name: Display output
run: echo ${{ steps.get-files.outputs.filelist }}

Compile:
runs-on: ubuntu-latest
needs: [FileList]
strategy:
matrix:
file: ${{ fromJson(needs.FileList.outputs.filelist) }}
steps:
- uses: actions/checkout@v2
- name: Install compiler
uses: rlalik/[email protected]
with:
compiler: gcc-latest
- name: Compile ${{ matrix.file }}
run: g++ "${{ matrix.file }}"
61 changes: 61 additions & 0 deletions .github/workflows/test-buffer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
---
name: Test Buffer

# yamllint disable-line rule:truthy
on:
pull_request:
paths:
- 'Buffer/**'
- '.github/workflows/test-buffer.yml'
push:
paths:
- 'Buffer/**'
- '.github/workflows/test-buffer.yml'

jobs:

Compile:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: Compile
uses: fx31337/mql-compile-action@master
with:
init-platform: true
path: 'Buffer/tests'
verbose: true
- name: Print compiled files
run: '(Get-ChildItem -Recurse -Path . -Include *.ex[45]).fullname'
shell: powershell
- name: Upload artifacts (MQL4)
uses: actions/upload-artifact@v2
with:
name: files-ex4
path: '**/*.ex4'
- name: Upload artifacts (MQL5)
uses: actions/upload-artifact@v2
with:
name: files-ex5
path: '**/*.ex5'

Buffer-Tests-MQL4:
defaults:
run:
shell: bash
working-directory: Buffer/tests
needs: Compile
runs-on: ubuntu-latest
strategy:
matrix:
test:
- BufferCandle.test
- BufferTick.test
steps:
- uses: actions/download-artifact@v2
with:
name: files-ex4
- name: Run ${{ matrix.test }}
uses: fx31337/mql-tester-action@master
with:
Script: ${{ matrix.test }}
timeout-minutes: 10
62 changes: 62 additions & 0 deletions .github/workflows/test-exchange.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
name: Test Exchange

# yamllint disable-line rule:truthy
on:
pull_request:
paths:
- 'Exchange/**.h'
- 'Exchange/**.mq?'
- '.github/workflows/test-exchange.yml'
push:
paths:
- 'Exchange/**.h'
- 'Exchange/**.mq?'
- '.github/workflows/test-exchange.yml'

jobs:

Compile:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: Compile
uses: fx31337/mql-compile-action@master
with:
init-platform: true
path: 'Exchange/tests'
verbose: true
- name: Print compiled files
run: '(Get-ChildItem -Recurse -Path . -Include *.ex[45]).fullname'
shell: powershell
- name: Upload artifacts (MQL4)
uses: actions/upload-artifact@v2
with:
name: files-ex4
path: '**/*.ex4'
- name: Upload artifacts (MQL5)
uses: actions/upload-artifact@v2
with:
name: files-ex5
path: '**/*.ex5'

Exchange-Tests-MQL4:
defaults:
run:
shell: bash
working-directory: Exchange/tests
needs: Compile
runs-on: ubuntu-latest
strategy:
matrix:
test:
- Exchange.test
steps:
- uses: actions/download-artifact@v2
with:
name: files-ex4
- name: Run ${{ matrix.test }}
uses: fx31337/mql-tester-action@master
with:
Script: ${{ matrix.test }}
timeout-minutes: 10
67 changes: 67 additions & 0 deletions .github/workflows/test-indicator.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
---
name: Test Indicator

# yamllint disable-line rule:truthy
on:
pull_request:
paths:
- 'Indicator**'
- 'Indicator/**'
- '.github/workflows/test-indicator.yml'
push:
paths:
- 'Indicator**'
- 'Indicator/**'
- '.github/workflows/test-indicator.yml'

jobs:

Compile:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: Compile
uses: fx31337/mql-compile-action@master
with:
init-platform: true
path: 'Indicator/tests'
verbose: true
- name: Print compiled files
run: '(Get-ChildItem -Recurse -Path . -Include *.ex[45]).fullname'
shell: powershell
- name: Upload artifacts (MQL4)
uses: actions/upload-artifact@v2
with:
name: files-ex4
path: '**/*.ex4'
- name: Upload artifacts (MQL5)
uses: actions/upload-artifact@v2
with:
name: files-ex5
path: '**/*.ex5'

Indicator-Tests-MQL4:
defaults:
run:
shell: bash
working-directory: Indicator/tests
needs: Compile
runs-on: ubuntu-latest
strategy:
matrix:
test:
- IndicatorCandle.test
- IndicatorTf.test
- IndicatorTick.test
steps:
- uses: actions/download-artifact@v2
with:
name: files-ex4
- name: Run ${{ matrix.test }}
uses: fx31337/mql-tester-action@master
with:
BtDays: 4-8
BtMonths: 1
BtYears: 2020
TestExpert: ${{ matrix.test }}
timeout-minutes: 10
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
- CompileIndicatorsTest
- ConditionTest
- DatabaseTest
- DrawIndicatorTest
# - DrawIndicatorTest
- EATest
- IndicatorDataTest
- IndicatorTest
Expand Down
6 changes: 6 additions & 0 deletions Account.mqh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class Account;
// Includes.
#include "Account/Account.define.h"
#include "Account/Account.enum.h"
#include "Account/Account.extern.h"
#include "Account/Account.struct.h"
#include "Array.mqh"
#include "BufferStruct.mqh"
Expand Down Expand Up @@ -63,6 +64,11 @@ class Account {
*/
Account() : init_balance(CalcInitDeposit()), start_balance(GetBalance()), start_credit(GetCredit()) {}

/**
* Class copy constructor.
*/
Account(const Account &_account) {}

/**
* Class deconstructor.
*/
Expand Down
29 changes: 29 additions & 0 deletions Account/Account.extern.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
//+------------------------------------------------------------------+
//| EA31337 framework |
//| Copyright 2016-2022, EA31337 Ltd |
//| https://github.com/EA31337 |
//+------------------------------------------------------------------+

/*
* This file is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

// Includes.
#include "Account.enum.h"

// Define external global functions.
#ifndef __MQL__
extern string AccountInfoString(ENUM_ACCOUNT_INFO_STRING property_id);
#endif
1 change: 1 addition & 0 deletions Account/Account.struct.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class Serializer;

// Includes.
#include "../Serializer.mqh"
#include "../Terminal.define.h"

// Struct for account entries.
struct AccountEntry {
Expand Down
1 change: 1 addition & 0 deletions Account/AccountBase.struct.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class Serializer;

// Includes.
#include "../Serializer.mqh"
#include "../Terminal.define.h"

// Struct for account entries.
struct AccountBaseEntry {
Expand Down
1 change: 1 addition & 0 deletions Account/AccountForex.struct.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class Serializer;

// Includes.
#include "../Serializer.mqh"
#include "../Terminal.define.h"

// Struct for account entries.
struct AccountForexEntry : public AccountBaseEntry {
Expand Down
2 changes: 1 addition & 1 deletion Account/tests/Account.test.mq5
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ int OnInit() {
bool _result = true;
Account<AccountBaseState, AccountBaseEntry> acc1;
// ...
return _result && GetLastError() == ERR_NO_ERROR ? INIT_SUCCEEDED : INIT_FAILED;
return _result && GetLastError() == 0 ? INIT_SUCCEEDED : INIT_FAILED;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion Account/tests/AccountForex.test.mq5
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ int OnInit() {
bool _result = true;
Account<AccountForexState, AccountForexEntry> acc1;
// ...
return _result && GetLastError() == ERR_NO_ERROR ? INIT_SUCCEEDED : INIT_FAILED;
return _result && GetLastError() == 0 ? INIT_SUCCEEDED : INIT_FAILED;
}

/**
Expand Down
18 changes: 10 additions & 8 deletions Action.mqh
Original file line number Diff line number Diff line change
Expand Up @@ -139,14 +139,16 @@ class Action {
break;
#endif
#ifdef INDICATOR_MQH
case ACTION_TYPE_INDICATOR:
if (Object::IsValid(_entry.obj)) {
_result = ((IndicatorBase *)_entry.obj).ExecuteAction((ENUM_INDICATOR_ACTION)_entry.action_id);
} else {
_result = false;
_entry.AddFlags(ACTION_ENTRY_FLAG_IS_INVALID);
}
break;
/*
case ACTION_TYPE_INDICATOR:
if (Object::IsValid(_entry.obj)) {
_result = ((IndicatorBase *)_entry.obj).ExecuteAction((ENUM_INDICATOR_ACTION)_entry.action_id);
} else {
_result = false;
_entry.AddFlags(ACTION_ENTRY_FLAG_IS_INVALID);
}
break;
*/
#endif
#ifdef STRATEGY_MQH
case ACTION_TYPE_STRATEGY:
Expand Down
Loading