From f2bb79a174608c7180f819209edfd653c516fe37 Mon Sep 17 00:00:00 2001 From: kenorb Date: Mon, 9 Sep 2024 18:38:40 +0100 Subject: [PATCH 01/12] CONTRIBUTING: Clarifies Ref syntax --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 313e71c91..f0b20e908 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -36,11 +36,11 @@ To improve code compatibility, please use the following syntax: |:------------------|:------------------------|:---------------------------| | `&this` | `this` | `THIS_PTR` | | `GetPointer(obj)` | `*obj` | `GET_PTR(obj)` | +| `Ref.Ptr().a` | `Ref.Ptr()->a` | `Ref REF_DEREF a` | | `T name[]` | `_cpp_array name` | `ARRAY(T, name)` | | `T N[]` | `_cpp_array> N` | `ARRAY(T, N)` | | `long` | `long long` | `int64` | | `obj.Method()` | `obj->Method()` | `obj PTR_DEREF Method()` | -| `obj.Ptr().a` | `obj.Ptr()->a` | `obj REF_DEREF a` | | `obj.a1.a2` | `obj->a1->a2` | `PTR_ATTRIB2(obj, a1, a2)` | | `obj.attr` | `obj->attr` | `PTR_ATTRIB(obj, attr)` | | `str == NULL` | `str == NULL` | `IsNull(str)` | From 4692e26dd760bfe4efdd213d290e28302ec02399 Mon Sep 17 00:00:00 2001 From: kenorb Date: Mon, 9 Sep 2024 22:28:32 +0100 Subject: [PATCH 02/12] Moves Strategy class to subdir --- .github/workflows/test-strategy.yml | 73 +++++++++++++++++++ .github/workflows/test.yml | 2 - EA.mqh | 2 +- Strategy.enum.h => Strategy/Strategy.enum.h | 0 Strategy.mqh => Strategy/Strategy.h | 26 +++---- .../Strategy.struct.h | 4 +- .../Strategy.struct.pricestop.h | 2 +- Strategy/tests/Makefile | 12 +++ .../tests/Strategy-RSI.test.mq4 | 2 +- .../tests/Strategy-RSI.test.mq5 | 12 +-- {tests => Strategy/tests}/Strategy.test.cpp | 4 +- .../tests/Strategy.test.mq4 | 2 +- .../tests/Strategy.test.mq5 | 6 +- tests/CompileTest.mq5 | 2 +- 14 files changed, 116 insertions(+), 33 deletions(-) create mode 100644 .github/workflows/test-strategy.yml rename Strategy.enum.h => Strategy/Strategy.enum.h (100%) rename Strategy.mqh => Strategy/Strategy.h (99%) rename Strategy.struct.h => Strategy/Strategy.struct.h (99%) rename Strategy.struct.pricestop.h => Strategy/Strategy.struct.pricestop.h (99%) create mode 100644 Strategy/tests/Makefile rename tests/StrategyTest-RSI.mq4 => Strategy/tests/Strategy-RSI.test.mq4 (97%) rename tests/StrategyTest-RSI.mq5 => Strategy/tests/Strategy-RSI.test.mq5 (96%) rename {tests => Strategy/tests}/Strategy.test.cpp (94%) rename tests/StrategyTest.mq4 => Strategy/tests/Strategy.test.mq4 (97%) rename tests/StrategyTest.mq5 => Strategy/tests/Strategy.test.mq5 (98%) diff --git a/.github/workflows/test-strategy.yml b/.github/workflows/test-strategy.yml new file mode 100644 index 000000000..bc5c78103 --- /dev/null +++ b/.github/workflows/test-strategy.yml @@ -0,0 +1,73 @@ +--- +name: Test Strategy + +env: + TEST_PATH: Strategy/tests + TEST_SKIP: ${{ secrets.MT5_LOGIN == '' }} + +# yamllint disable-line rule:truthy +on: + pull_request: + paths: + - .github/workflows/test-strategy.yml + - Strategy/** + push: + paths: + - .github/workflows/test-strategy.yml + - Strategy/** + +jobs: + + compile: + name: Compile + uses: ./.github/workflows/compile-mql.yml + with: + artifact_prefix: mt + path: Strategy/tests + skip_cleanup: true + + test: + defaults: + run: + shell: bash + working-directory: ${{ env.TEST_PATH }} + name: Test + needs: compile + runs-on: ubuntu-latest + strategy: + matrix: + test: + - Strategy.test + - Strategy-RSI.test + version: [5] + max-parallel: 4 + steps: + - uses: actions/download-artifact@v4 + with: + name: files-ex${{ matrix.version }} + - name: List compiled files + run: find . -name '*.ex?' -type f -print + - if: ${{ env.TEST_SKIP != true && env.TEST_SKIP != 'true' }} + name: Run ${{ matrix.test }} + uses: fx31337/mql-tester-action@master + with: + Login: ${{ secrets.MT5_LOGIN }} + Password: ${{ secrets.MT5_PASSWORD }} + Server: MetaQuotes-Demo + TestDeposit: 2000 + TestExpert: ${{ matrix.test }} + TestFromDate: ${{ matrix.year }}.01.01 + TestPeriod: M1 + TestSymbol: EURUSD + TestToDate: ${{ matrix.year }}.01.14 + # yamllint disable-line rule:line-length + UrlExpert: file://${{ github.workspace }}/${{ env.TEST_PATH }}/${{ matrix.test }}.ex${{ matrix.version }} + Version: 5 + - if: ${{ failure() && runner.debug == '1' }} + uses: mxschmitt/action-tmate@v3 + timeout-minutes: 20 + + cleanup: + name: Clean-up + needs: [compile] + uses: ./.github/workflows/cleanup.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d80482805..e4c38cdd7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -46,8 +46,6 @@ jobs: - EATest - MailTest - MarketTest - - StrategyTest - - StrategyTest-RSI - SummaryReportTest - TradeTest version: [5] diff --git a/EA.mqh b/EA.mqh index 82b5c9cb2..21f7aec76 100644 --- a/EA.mqh +++ b/EA.mqh @@ -46,7 +46,7 @@ #include "Storage/Data.struct.h" #include "Storage/Dict/Dict.h" #include "Storage/Dict/DictObject.h" -#include "Strategy.mqh" +#include "Strategy/Strategy.h" #include "SummaryReport.mqh" #include "Task/Task.h" #include "Task/TaskAction.enum.h" diff --git a/Strategy.enum.h b/Strategy/Strategy.enum.h similarity index 100% rename from Strategy.enum.h rename to Strategy/Strategy.enum.h diff --git a/Strategy.mqh b/Strategy/Strategy.h similarity index 99% rename from Strategy.mqh rename to Strategy/Strategy.h index 4f51cc261..f397ef318 100644 --- a/Strategy.mqh +++ b/Strategy/Strategy.h @@ -21,25 +21,25 @@ */ // Prevents processing this includes file for the second time. -#ifndef STRATEGY_MQH -#define STRATEGY_MQH +#ifndef STRATEGY_H +#define STRATEGY_H // Forward declaration. class Trade; // Includes. -#include "Indicator/Indicator.h" -#include "Market.mqh" -#include "Math/Math.h" -#include "Storage/Data.struct.h" -#include "Storage/Dict/Dict.h" -#include "Storage/Object.h" -#include "Storage/String.h" +#include "../Indicator/Indicator.h" +#include "../Market.mqh" +#include "../Math/Math.h" +#include "../Storage/Data.struct.h" +#include "../Storage/Dict/Dict.h" +#include "../Storage/Object.h" +#include "../Storage/String.h" #include "Strategy.enum.h" #include "Strategy.struct.h" -#include "Task/TaskManager.h" -#include "Task/Taskable.h" -#include "Trade.mqh" +#include "../Task/TaskManager.h" +#include "../Task/Taskable.h" +#include "../Trade.mqh" // Defines. // Primary inputs. @@ -1285,4 +1285,4 @@ class Strategy : public Taskable { return SerializerNodeObject; } }; -#endif // STRATEGY_MQH +#endif // STRATEGY_H diff --git a/Strategy.struct.h b/Strategy/Strategy.struct.h similarity index 99% rename from Strategy.struct.h rename to Strategy/Strategy.struct.h index 178197aed..74adf6efc 100644 --- a/Strategy.struct.h +++ b/Strategy/Strategy.struct.h @@ -31,10 +31,10 @@ #endif // Includes. -#include "Serializer/Serializer.h" +#include "../Serializer/Serializer.h" #include "Strategy.enum.h" #include "Strategy.struct.pricestop.h" -#include "Task/Task.struct.h" +#include "../Task/Task.struct.h" // Forward class declaration. class Strategy; diff --git a/Strategy.struct.pricestop.h b/Strategy/Strategy.struct.pricestop.h similarity index 99% rename from Strategy.struct.pricestop.h rename to Strategy/Strategy.struct.pricestop.h index 772a3862f..9794e49fd 100644 --- a/Strategy.struct.pricestop.h +++ b/Strategy/Strategy.struct.pricestop.h @@ -35,7 +35,7 @@ struct ChartParams; struct IndicatorParams; // Includes. -#include "Platform/Chart/Chart.struct.h" +#include "../Platform/Chart/Chart.struct.h" /* Structure for strategy price stops. */ struct StrategyPriceStop { diff --git a/Strategy/tests/Makefile b/Strategy/tests/Makefile new file mode 100644 index 000000000..e792364f0 --- /dev/null +++ b/Strategy/tests/Makefile @@ -0,0 +1,12 @@ +CC := g++ # C++ compiler +CFLAGS := -Wall -Wextra -std=c++17 -w # Compiler flags +SRCS := $(wildcard *.cpp) # Get all .cpp files in the current directory +OBJS := $(SRCS:.cpp=.o) # Object files corresponding to the source files + +all: $(OBJS) + +%.o: %.cpp + $(CC) $(CFLAGS) -c $< -o $@ + +clean: + rm -v $(OBJS) diff --git a/tests/StrategyTest-RSI.mq4 b/Strategy/tests/Strategy-RSI.test.mq4 similarity index 97% rename from tests/StrategyTest-RSI.mq4 rename to Strategy/tests/Strategy-RSI.test.mq4 index 2517e2405..29b948365 100644 --- a/tests/StrategyTest-RSI.mq4 +++ b/Strategy/tests/Strategy-RSI.test.mq4 @@ -27,4 +27,4 @@ #define __debug__ // Includes. -#include "StrategyTest-RSI.mq5" +#include "Strategy-RSI.test.mq5" diff --git a/tests/StrategyTest-RSI.mq5 b/Strategy/tests/Strategy-RSI.test.mq5 similarity index 96% rename from tests/StrategyTest-RSI.mq5 rename to Strategy/tests/Strategy-RSI.test.mq5 index 0ce6b299b..9b8c7df7d 100644 --- a/tests/StrategyTest-RSI.mq5 +++ b/Strategy/tests/Strategy-RSI.test.mq5 @@ -28,12 +28,12 @@ //#define __debug_verbose__ // Includes. -#include "../Indicator/tests/classes/IndicatorTfDummy.h" -#include "../Indicators/Oscillator/Indi_RSI.h" -#include "../Indicators/Tick/Indi_TickMt.h" -#include "../Platform/Chart/ChartMt.h" -#include "../Strategy.mqh" -#include "../Test.mqh" +#include "../../Indicator/tests/classes/IndicatorTfDummy.h" +#include "../../Indicators/Oscillator/Indi_RSI.h" +#include "../../Indicators/Tick/Indi_TickMt.h" +#include "../../Platform/Chart/ChartMt.h" +#include "../Strategy.h" +#include "../../Test.mqh" // Define strategy classes. class Stg_RSI : public Strategy { diff --git a/tests/Strategy.test.cpp b/Strategy/tests/Strategy.test.cpp similarity index 94% rename from tests/Strategy.test.cpp rename to Strategy/tests/Strategy.test.cpp index 30f554008..a3af9807d 100644 --- a/tests/Strategy.test.cpp +++ b/Strategy/tests/Strategy.test.cpp @@ -25,8 +25,8 @@ */ // Includes. -#include "../Strategy.mqh" -#include "../Platform/Platform.h" +#include "../Strategy.h" +#include "../../Platform/Platform.h" int main(int argc, char **argv) { // @todo diff --git a/tests/StrategyTest.mq4 b/Strategy/tests/Strategy.test.mq4 similarity index 97% rename from tests/StrategyTest.mq4 rename to Strategy/tests/Strategy.test.mq4 index 981f90c9e..6fd28390f 100644 --- a/tests/StrategyTest.mq4 +++ b/Strategy/tests/Strategy.test.mq4 @@ -25,4 +25,4 @@ */ // Includes. -#include "StrategyTest.mq5" +#include "Strategy.test.mq5" diff --git a/tests/StrategyTest.mq5 b/Strategy/tests/Strategy.test.mq5 similarity index 98% rename from tests/StrategyTest.mq5 rename to Strategy/tests/Strategy.test.mq5 index 6ebf91b9e..468f7963e 100644 --- a/tests/StrategyTest.mq5 +++ b/Strategy/tests/Strategy.test.mq5 @@ -28,9 +28,9 @@ struct DataParamEntry; // Includes. -#include "../Indicators/Indi_Demo.mqh" -#include "../Strategy.mqh" -#include "../Test.mqh" +#include "../../Indicators/Indi_Demo.mqh" +#include "../Strategy.h" +#include "../../Test.mqh" // Define strategy classes. class Stg1 : public Strategy { diff --git a/tests/CompileTest.mq5 b/tests/CompileTest.mq5 index 6cc33363b..59d0e9de2 100644 --- a/tests/CompileTest.mq5 +++ b/tests/CompileTest.mq5 @@ -84,7 +84,7 @@ struct IndicatorParams; #include "../Socket.mqh" #include "../Std.h" #include "../Storage/Singleton.h" -#include "../Strategy.mqh" +#include "../Strategy/Strategy.h" #include "../Storage/String.h" #include "../SummaryReport.mqh" #include "../Exchange/SymbolInfo/SymbolInfo.h" From e66f603ccccf7e05057fb8685df3e4a001334f99 Mon Sep 17 00:00:00 2001 From: Adrian Kierzkowski Date: Tue, 10 Sep 2024 14:37:30 +0200 Subject: [PATCH 03/12] Updated c++ compatibility table. --- CONTRIBUTING.md | 42 ++++++++++++++++++++++++++++++------------ 1 file changed, 30 insertions(+), 12 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 313e71c91..fe650f54d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -32,18 +32,36 @@ For example, to format file inplace, run: To improve code compatibility, please use the following syntax: -| MQL | C++ | Syntax to use | -|:------------------|:------------------------|:---------------------------| -| `&this` | `this` | `THIS_PTR` | -| `GetPointer(obj)` | `*obj` | `GET_PTR(obj)` | -| `T name[]` | `_cpp_array name` | `ARRAY(T, name)` | -| `T N[]` | `_cpp_array> N` | `ARRAY(T, N)` | -| `long` | `long long` | `int64` | -| `obj.Method()` | `obj->Method()` | `obj PTR_DEREF Method()` | -| `obj.Ptr().a` | `obj.Ptr()->a` | `obj REF_DEREF a` | -| `obj.a1.a2` | `obj->a1->a2` | `PTR_ATTRIB2(obj, a1, a2)` | -| `obj.attr` | `obj->attr` | `PTR_ATTRIB(obj, attr)` | -| `str == NULL` | `str == NULL` | `IsNull(str)` | +| MQL | C++ | Syntax to use | +|:-------------------|:-------------------------|:---------------------------| +| `&this` | `this` | `THIS_PTR` | +| `this` | `*this` | `THIS_REF` | +| `GetPointer(obj)` | `&obj` | `GET_PTR(obj)` | +| `T name[]` | `std::vector name` | `ARRAY(T, name)` | +| `T name[5]` | `T name[5]` | `FIXED_ARRAY(T, name, 5)` | +| `X f(T[] v)` [ ]=5| `X f(T(&n)[5])` | `FIXED_ARRAY_REF(T, n, 5)` | +| `T name[]` | `vector> name` | `ARRAY(T, N)` | +| `long` | `long long` | `int64` | +| `unsigned long` | `unsigned long long` | `uint64` | +| `obj.Method()` *1| `obj->Method()` | `obj PTR_DEREF Method()` | +| `obj.Ptr().a` *3| `obj.Ptr()->a` | `obj REF_DEREF a` | +| `obj.a1.a2` *1| `obj->a1->a2` | `PTR_ATTRIB2(obj, a1, a2)` | +| `obj.attr` *1| `obj->attr` | `PTR_ATTRIB(obj, attr)` | +| `str == NULL` | `str == NULL` | `IsNull(str)` | +| `foo((Ba&)obj)` *2| `foo(*obj)` | `foo(PTR_TO_REF(obj))` | +| `foo((Ba*)obj)` *1| `foo(&obj)` | `foo(REF_TO_PTR(obj))` | +| `void* N` *4| `void*& N[]` | `VOID_DATA(N)` | +| `int foo` | `const int foo` | `CONST_CPP int foo` | +| `int foo(int v)` | `int foo(int& v)` | `int foo(int REF_CPP v)` | +| `X foo()` | `X& foo()` | `X REF_CPP foo()` | +| `obj == NULL` *1| `obj == nullptr` | `obj == nullptr` | +| `X foo(T* v)` | `X foo(T* v)` | `obj == nullptr` | +| `datetime d = NULL`| `datetime d = 0` | `datetime = 0` | + +**\*1** - Only if `obj` is a pointer. +**\*2** - Only if `obj` is an object or reference type (e.g., `Foo &`). +**\*3** - Only if `obj` is `Ref`. +**\*4** - Only when used as a parameter to function. ## Proposing changes From 6c09de3ab3264836704fe90d1b92dffb925beed5 Mon Sep 17 00:00:00 2001 From: Adrian Kierzkowski Date: Tue, 10 Sep 2024 17:25:52 +0200 Subject: [PATCH 04/12] Fixes to C++ compatibility table. --- CONTRIBUTING.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index fe650f54d..3e8525322 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -51,17 +51,17 @@ To improve code compatibility, please use the following syntax: | `foo((Ba&)obj)` *2| `foo(*obj)` | `foo(PTR_TO_REF(obj))` | | `foo((Ba*)obj)` *1| `foo(&obj)` | `foo(REF_TO_PTR(obj))` | | `void* N` *4| `void*& N[]` | `VOID_DATA(N)` | -| `int foo` | `const int foo` | `CONST_CPP int foo` | -| `int foo(int v)` | `int foo(int& v)` | `int foo(int REF_CPP v)` | -| `X foo()` | `X& foo()` | `X REF_CPP foo()` | +| `int foo` *5| `const int foo` | `CONST_CPP int foo` | +| `int foo(int v)` *5| `int foo(int& v)` | `int foo(int REF_CPP v)` | +| `X foo()` *5| `X& foo()` | `X REF_CPP foo()` | | `obj == NULL` *1| `obj == nullptr` | `obj == nullptr` | -| `X foo(T* v)` | `X foo(T* v)` | `obj == nullptr` | | `datetime d = NULL`| `datetime d = 0` | `datetime = 0` | **\*1** - Only if `obj` is a pointer. **\*2** - Only if `obj` is an object or reference type (e.g., `Foo &`). **\*3** - Only if `obj` is `Ref`. **\*4** - Only when used as a parameter to function. +**\*5** - In C++ we could want to return structure by reference or add `const` to the variable or result. ## Proposing changes From 01a5be911944831db79aa01a3d1aa52be4417e9d Mon Sep 17 00:00:00 2001 From: kenorb Date: Tue, 10 Sep 2024 18:59:24 +0100 Subject: [PATCH 05/12] CONTRIBUTING: Adds footnotes --- CONTRIBUTING.md | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3e8525322..480ea4df3 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -26,7 +26,7 @@ We use a `clang-format` code formatter tool to format the code For example, to format file inplace, run: - clang-format -i File.mqh + clang-format -i File.h ### Syntax @@ -39,29 +39,31 @@ To improve code compatibility, please use the following syntax: | `GetPointer(obj)` | `&obj` | `GET_PTR(obj)` | | `T name[]` | `std::vector name` | `ARRAY(T, name)` | | `T name[5]` | `T name[5]` | `FIXED_ARRAY(T, name, 5)` | -| `X f(T[] v)` [ ]=5| `X f(T(&n)[5])` | `FIXED_ARRAY_REF(T, n, 5)` | +| `X f(T[] v)` ⁵| `X f(T(&n)[5])` | `FIXED_ARRAY_REF(T, n, 5)` | | `T name[]` | `vector> name` | `ARRAY(T, N)` | | `long` | `long long` | `int64` | | `unsigned long` | `unsigned long long` | `uint64` | -| `obj.Method()` *1| `obj->Method()` | `obj PTR_DEREF Method()` | -| `obj.Ptr().a` *3| `obj.Ptr()->a` | `obj REF_DEREF a` | -| `obj.a1.a2` *1| `obj->a1->a2` | `PTR_ATTRIB2(obj, a1, a2)` | -| `obj.attr` *1| `obj->attr` | `PTR_ATTRIB(obj, attr)` | +| `obj.Method()` ¹| `obj->Method()` | `obj PTR_DEREF Method()` | +| `obj.Ptr().a` ³| `obj.Ptr()->a` | `obj REF_DEREF a` | +| `obj.a1.a2` ¹| `obj->a1->a2` | `PTR_ATTRIB2(obj, a1, a2)` | +| `obj.attr` ¹| `obj->attr` | `PTR_ATTRIB(obj, attr)` | | `str == NULL` | `str == NULL` | `IsNull(str)` | -| `foo((Ba&)obj)` *2| `foo(*obj)` | `foo(PTR_TO_REF(obj))` | -| `foo((Ba*)obj)` *1| `foo(&obj)` | `foo(REF_TO_PTR(obj))` | -| `void* N` *4| `void*& N[]` | `VOID_DATA(N)` | -| `int foo` *5| `const int foo` | `CONST_CPP int foo` | -| `int foo(int v)` *5| `int foo(int& v)` | `int foo(int REF_CPP v)` | -| `X foo()` *5| `X& foo()` | `X REF_CPP foo()` | -| `obj == NULL` *1| `obj == nullptr` | `obj == nullptr` | +| `foo((Ba&)obj)` ²| `foo(*obj)` | `foo(PTR_TO_REF(obj))` | +| `foo((Ba*)obj)` ¹| `foo(&obj)` | `foo(REF_TO_PTR(obj))` | +| `void* N` ⁴| `void*& N[]` | `VOID_DATA(N)` | +| `int foo` ⁵| `const int foo` | `CONST_CPP int foo` | +| `int foo(int v)` ⁵| `int foo(int& v)` | `int foo(int REF_CPP v)` | +| `X foo()` ⁵| `X& foo()` | `X REF_CPP foo()` | +| `obj == NULL` ¹| `obj == nullptr` | `obj == nullptr` | | `datetime d = NULL`| `datetime d = 0` | `datetime = 0` | -**\*1** - Only if `obj` is a pointer. -**\*2** - Only if `obj` is an object or reference type (e.g., `Foo &`). -**\*3** - Only if `obj` is `Ref`. -**\*4** - Only when used as a parameter to function. -**\*5** - In C++ we could want to return structure by reference or add `const` to the variable or result. +Footnotes: + +* ¹ Only if `obj` is a pointer. +* ² Only if `obj` is an object or reference type (e.g., `Foo &`). +* ³ Only if `obj` is `Ref`. +* ⁴ Only when used as a parameter to function. +* ⁵ In C++ we could want to return structure by reference or add `const` to the variable or result. ## Proposing changes From 4dd8b8356bec75bb39891abadd67b4a8398137b5 Mon Sep 17 00:00:00 2001 From: kenorb Date: Tue, 10 Sep 2024 19:18:12 +0100 Subject: [PATCH 06/12] Updates .vscode/settings.json --- .vscode/settings.json | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 7417eab66..bb0dddd03 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,6 +1,8 @@ { "files.associations": { - "indicatorcandle.h": "c", - "*.mqh": "c" + "*.h": "cpp", + "*.mq4": "cpp", + "*.mq5": "cpp", + "*.mqh": "cpp" } } From f6174a42172c69e3e25cf78c34c8193e6ad07856 Mon Sep 17 00:00:00 2001 From: kenorb Date: Tue, 10 Sep 2024 19:18:32 +0100 Subject: [PATCH 07/12] Moves Instances.h to Storage/ --- Platform/Chart3D/Chart3D.h | 2 +- Instances.h => Storage/Instances.h | 4 ++-- tests/CompileTest.mq5 | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) rename Instances.h => Storage/Instances.h (97%) diff --git a/Platform/Chart3D/Chart3D.h b/Platform/Chart3D/Chart3D.h index 4f9cbcd64..1535497a3 100644 --- a/Platform/Chart3D/Chart3D.h +++ b/Platform/Chart3D/Chart3D.h @@ -33,7 +33,7 @@ #include "../../Bar.struct.h" #include "../../Indicator/IndicatorData.h" #include "../../Indicators/Price/Indi_MA.h" -#include "../../Instances.h" +#include "../../Storage/Instances.h" #include "../../Refs.mqh" #include "../../Serializer/SerializerConverter.h" #include "../../Serializer/SerializerJson.h" diff --git a/Instances.h b/Storage/Instances.h similarity index 97% rename from Instances.h rename to Storage/Instances.h index 548aaa015..35f0bfb97 100644 --- a/Instances.h +++ b/Storage/Instances.h @@ -34,8 +34,8 @@ #ifndef INSTANCES_H #define INSTANCES_H -#include "Storage/Dict/Dict.h" -#include "Util.h" +#include "Dict/Dict.h" +#include "../Util.h" template class Instances { diff --git a/tests/CompileTest.mq5 b/tests/CompileTest.mq5 index 59d0e9de2..da6870b4a 100644 --- a/tests/CompileTest.mq5 +++ b/tests/CompileTest.mq5 @@ -57,6 +57,7 @@ struct IndicatorParams; #include "../Storage/Dict/DictObject.h" #include "../Storage/Dict/DictSlot.h" #include "../Storage/Dict/DictStruct.h" +#include "../Storage/Instances.h" #include "../Platform/Plot.h" #include "../Indicators/DrawIndicator.mqh" #include "../EA.mqh" From f54be8f0319eed5fcb869baa52512a27471db0c5 Mon Sep 17 00:00:00 2001 From: kenorb Date: Tue, 10 Sep 2024 19:25:36 +0100 Subject: [PATCH 08/12] CI: Adds tests for Instances class --- .github/workflows/test-storage.yml | 1 + Storage/Instances.h | 2 +- Storage/tests/Instances.test.mq4 | 28 +++++++++++++++++++ Storage/tests/Instances.test.mq5 | 45 ++++++++++++++++++++++++++++++ 4 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 Storage/tests/Instances.test.mq4 create mode 100644 Storage/tests/Instances.test.mq5 diff --git a/.github/workflows/test-storage.yml b/.github/workflows/test-storage.yml index 81c19879f..5b3b795c0 100644 --- a/.github/workflows/test-storage.yml +++ b/.github/workflows/test-storage.yml @@ -40,6 +40,7 @@ jobs: - Collection.test - Database.test - DateTime.test + - Instances.test - ItemsHistory.test - Object.test - Redis.test diff --git a/Storage/Instances.h b/Storage/Instances.h index 35f0bfb97..e6faaed78 100644 --- a/Storage/Instances.h +++ b/Storage/Instances.h @@ -55,4 +55,4 @@ T* Instances::instances[]; T* Instances::instances[]; #endif -#endif // INSTANCES_MQH +#endif // INSTANCES_H diff --git a/Storage/tests/Instances.test.mq4 b/Storage/tests/Instances.test.mq4 new file mode 100644 index 000000000..b5d94b5f1 --- /dev/null +++ b/Storage/tests/Instances.test.mq4 @@ -0,0 +1,28 @@ +//+------------------------------------------------------------------+ +//| EA31337 framework | +//| Copyright 2016-2024, EA31337 Ltd | +//| https://ea31337.github.io | +//+------------------------------------------------------------------+ + +/* + * 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 . + */ + +/** + * @file + * Test functionality of Instances class. + */ + +// Includes. +#include "Instances.test.mq5" diff --git a/Storage/tests/Instances.test.mq5 b/Storage/tests/Instances.test.mq5 new file mode 100644 index 000000000..c46c59ff0 --- /dev/null +++ b/Storage/tests/Instances.test.mq5 @@ -0,0 +1,45 @@ +//+------------------------------------------------------------------+ +//| EA31337 framework | +//| Copyright 2016-2024, EA31337 Ltd | +//| https://ea31337.github.io | +//+------------------------------------------------------------------+ + +/* + * 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 . + */ + +/** + * @file + * Test functionality of Instances class. + */ + +// Includes. +#include "../../Test.mqh" +#include "../Instances.h" + +/** + * Implements OnInit(). + */ +int OnInit() { + // Create a new object. + // Instances *obj = new Instances(); + + // @todo: Add more tests. + // ... + + // Clean up. + // Instances::Delete(obj); + + return (GetLastError() > 0 ? INIT_FAILED : INIT_SUCCEEDED); +} From b74eaebd0c90dd9ac03058cee6ce786c2f368950 Mon Sep 17 00:00:00 2001 From: kenorb Date: Tue, 10 Sep 2024 19:26:27 +0100 Subject: [PATCH 09/12] Adds Instances.test.cpp --- Storage/Instances.h | 3 ++- Storage/tests/Instances.test.cpp | 41 ++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 Storage/tests/Instances.test.cpp diff --git a/Storage/Instances.h b/Storage/Instances.h index e6faaed78..726bf072d 100644 --- a/Storage/Instances.h +++ b/Storage/Instances.h @@ -52,7 +52,8 @@ template #ifdef __MQL__ T* Instances::instances[]; #else -T* Instances::instances[]; +//T* Instances::instances[]; +ARRAY(T*, Instances::instances); #endif #endif // INSTANCES_H diff --git a/Storage/tests/Instances.test.cpp b/Storage/tests/Instances.test.cpp new file mode 100644 index 000000000..2dc6b3f7a --- /dev/null +++ b/Storage/tests/Instances.test.cpp @@ -0,0 +1,41 @@ +//+------------------------------------------------------------------+ +//| EA31337 framework | +//| Copyright 2016-2024, EA31337 Ltd | +//| https://ea31337.github.io | +//+------------------------------------------------------------------+ + +/* + * 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 . + */ + +/** + * @file + * Test C++ compilation of Instances class. + */ + +// Includes. +#include "../Instances.h" + +int main(int argc, char **argv) { + // Create a new object. + // Instances *obj = new Instances(); + + // @todo: Add more tests. + // ... + + // Clean up. + // Instances::Delete(obj); + + return 0; +} From 64a2cc17769a43bd337f18acea822a93ab6ca87a Mon Sep 17 00:00:00 2001 From: kenorb Date: Tue, 10 Sep 2024 20:01:13 +0100 Subject: [PATCH 10/12] Moves Bar/Candle/Pattern to Platform/Chart/ --- Indicator/IndicatorBase.h | 2 +- Indicator/IndicatorCandle.h | 2 +- Indicator/IndicatorCandle.provider.h | 2 +- Indicator/IndicatorData.h | 2 +- Indicators/Bitwise/Indi_Candle.mqh | 4 ++-- Indicators/Bitwise/Indi_Pattern.mqh | 4 ++-- Indicators/PriceRange/Indi_Pivot.h | 2 +- Bar.enum.h => Platform/Chart/Bar.enum.h | 0 Bar.struct.h => Platform/Chart/Bar.struct.h | 12 ++++++------ Candle.struct.h => Platform/Chart/Candle.struct.h | 12 ++++++------ Platform/Chart/Chart.struct.h | 2 +- Pattern.enum.h => Platform/Chart/Pattern.enum.h | 0 Pattern.mqh => Platform/Chart/Pattern.h | 0 Pattern.struct.h => Platform/Chart/Pattern.struct.h | 2 +- Platform/Chart/tests/Chart.test.mq5 | 2 ++ Platform/Chart3D/Chart3D.h | 2 +- Storage/Dict/Buffer/BufferCandle.h | 2 +- tests/CompileTest.mq5 | 2 +- 18 files changed, 28 insertions(+), 26 deletions(-) rename Bar.enum.h => Platform/Chart/Bar.enum.h (100%) rename Bar.struct.h => Platform/Chart/Bar.struct.h (98%) rename Candle.struct.h => Platform/Chart/Candle.struct.h (98%) rename Pattern.enum.h => Platform/Chart/Pattern.enum.h (100%) rename Pattern.mqh => Platform/Chart/Pattern.h (100%) rename Pattern.struct.h => Platform/Chart/Pattern.struct.h (99%) diff --git a/Indicator/IndicatorBase.h b/Indicator/IndicatorBase.h index e15aaff42..a2bfbe26c 100644 --- a/Indicator/IndicatorBase.h +++ b/Indicator/IndicatorBase.h @@ -31,7 +31,7 @@ #endif // Includes. -#include "../Bar.struct.h" +#include "../Platform/Chart/Bar.struct.h" #include "../Log.mqh" #include "../Platform/Chart/Chart.struct.tf.h" #include "../Platform/Platform.extern.h" diff --git a/Indicator/IndicatorCandle.h b/Indicator/IndicatorCandle.h index c97d9a9d9..8e8319268 100644 --- a/Indicator/IndicatorCandle.h +++ b/Indicator/IndicatorCandle.h @@ -26,7 +26,7 @@ #endif // Includes. -#include "../Candle.struct.h" +#include "../Platform/Chart/Candle.struct.h" #include "../Storage/ItemsHistory.h" #include "../Storage/ValueStorage.price_median.h" #include "../Storage/ValueStorage.price_typical.h" diff --git a/Indicator/IndicatorCandle.provider.h b/Indicator/IndicatorCandle.provider.h index 4eb894c06..d050a9ee0 100644 --- a/Indicator/IndicatorCandle.provider.h +++ b/Indicator/IndicatorCandle.provider.h @@ -30,7 +30,7 @@ #endif // Includes. -#include "../Candle.struct.h" +#include "../Platform/Chart/Candle.struct.h" #include "../Storage/ItemsHistory.h" /** diff --git a/Indicator/IndicatorData.h b/Indicator/IndicatorData.h index 2c5f9073f..2561ee71e 100644 --- a/Indicator/IndicatorData.h +++ b/Indicator/IndicatorData.h @@ -35,7 +35,7 @@ struct ExternInstantiateIndicatorBufferValueStorageDouble { }; // Includes. -#include "../Bar.struct.h" +#include "../Platform/Chart/Bar.struct.h" #include "../Exchange/SymbolInfo/SymbolInfo.struct.h" #include "../Platform/Chart/Chart.struct.tf.h" #include "../Storage/Cache/IndiBufferCache.h" diff --git a/Indicators/Bitwise/Indi_Candle.mqh b/Indicators/Bitwise/Indi_Candle.mqh index bd2bd31e0..1a286092d 100644 --- a/Indicators/Bitwise/Indi_Candle.mqh +++ b/Indicators/Bitwise/Indi_Candle.mqh @@ -26,9 +26,9 @@ #endif // Includes. -#include "../../Bar.struct.h" +#include "../../Platform/Chart/Bar.struct.h" #include "../../Indicator/Indicator.h" -#include "../../Pattern.struct.h" +#include "../../Platform/Chart/Pattern.struct.h" #include "../../Serializer/Serializer.h" #include "../../Storage/Dict/Buffer/BufferStruct.h" #include "../Price/Indi_Price.h" diff --git a/Indicators/Bitwise/Indi_Pattern.mqh b/Indicators/Bitwise/Indi_Pattern.mqh index 6ad40f135..13f805124 100644 --- a/Indicators/Bitwise/Indi_Pattern.mqh +++ b/Indicators/Bitwise/Indi_Pattern.mqh @@ -26,10 +26,10 @@ #endif // Includes. -#include "../../Bar.struct.h" +#include "../../Platform/Chart/Bar.struct.h" #include "../../Indicator/Indicator.define.h" #include "../../Indicator/Indicator.h" -#include "../../Pattern.struct.h" +#include "../../Platform/Chart/Pattern.struct.h" #include "../../Serializer/Serializer.h" #include "../../Storage/Dict/Buffer/BufferStruct.h" #include "../Price/Indi_Price.h" diff --git a/Indicators/PriceRange/Indi_Pivot.h b/Indicators/PriceRange/Indi_Pivot.h index 47d45cfe7..c27387015 100644 --- a/Indicators/PriceRange/Indi_Pivot.h +++ b/Indicators/PriceRange/Indi_Pivot.h @@ -26,7 +26,7 @@ #endif // Includes. -#include "../../Bar.struct.h" +#include "../../Platform/Chart/Bar.struct.h" #include "../../Indicator/Indicator.struct.h" #include "../../Serializer/Serializer.h" #include "../Special/Indi_Math.mqh" diff --git a/Bar.enum.h b/Platform/Chart/Bar.enum.h similarity index 100% rename from Bar.enum.h rename to Platform/Chart/Bar.enum.h diff --git a/Bar.struct.h b/Platform/Chart/Bar.struct.h similarity index 98% rename from Bar.struct.h rename to Platform/Chart/Bar.struct.h index f931af0a4..6b372d08f 100644 --- a/Bar.struct.h +++ b/Platform/Chart/Bar.struct.h @@ -35,12 +35,12 @@ class Serializer; // Includes. #include "Bar.enum.h" -#include "Platform/Chart/Chart.enum.h" -#include "Serializer/Serializable.h" -#include "Serializer/Serializer.enum.h" -#include "Serializer/Serializer.h" -#include "Serializer/SerializerNode.enum.h" -#include "Std.h" +#include "Chart.enum.h" +#include "../../Serializer/Serializable.h" +#include "../../Serializer/Serializer.enum.h" +#include "../../Serializer/Serializer.h" +#include "../../Serializer/SerializerNode.enum.h" +#include "../../Std.h" /* Struct for storing OHLC values. */ struct BarOHLC diff --git a/Candle.struct.h b/Platform/Chart/Candle.struct.h similarity index 98% rename from Candle.struct.h rename to Platform/Chart/Candle.struct.h index 4d01e0474..55d0da7aa 100644 --- a/Candle.struct.h +++ b/Platform/Chart/Candle.struct.h @@ -35,12 +35,12 @@ class Serializer; // Includes. #include "Bar.enum.h" -#include "Platform/Chart/Chart.enum.h" -#include "Serializer/Serializable.h" -#include "Serializer/Serializer.enum.h" -#include "Serializer/Serializer.h" -#include "Serializer/SerializerNode.enum.h" -#include "Std.h" +#include "Chart.enum.h" +#include "../../Serializer/Serializable.h" +#include "../../Serializer/Serializer.enum.h" +#include "../../Serializer/Serializer.h" +#include "../../Serializer/SerializerNode.enum.h" +#include "../../Std.h" /* Structure for storing OHLC values. */ template diff --git a/Platform/Chart/Chart.struct.h b/Platform/Chart/Chart.struct.h index ef0d2e3f0..d7a690c06 100644 --- a/Platform/Chart/Chart.struct.h +++ b/Platform/Chart/Chart.struct.h @@ -35,7 +35,7 @@ class Class; struct ChartTf; // Includes. -#include "../../Bar.struct.h" +#include "Bar.struct.h" #include "../../Serializer/Serializer.h" #include "../../Serializer/SerializerNode.enum.h" #include "../../Std.h" diff --git a/Pattern.enum.h b/Platform/Chart/Pattern.enum.h similarity index 100% rename from Pattern.enum.h rename to Platform/Chart/Pattern.enum.h diff --git a/Pattern.mqh b/Platform/Chart/Pattern.h similarity index 100% rename from Pattern.mqh rename to Platform/Chart/Pattern.h diff --git a/Pattern.struct.h b/Platform/Chart/Pattern.struct.h similarity index 99% rename from Pattern.struct.h rename to Platform/Chart/Pattern.struct.h index f8aebe7d8..4a0377287 100644 --- a/Pattern.struct.h +++ b/Platform/Chart/Pattern.struct.h @@ -32,7 +32,7 @@ // Includes. #include "Bar.struct.h" -#include "Math/Math.define.h" +#include "../../Math/Math.define.h" #include "Pattern.enum.h" // Defines structure for bitwise pattern values. diff --git a/Platform/Chart/tests/Chart.test.mq5 b/Platform/Chart/tests/Chart.test.mq5 index f3b9f9779..10875e102 100644 --- a/Platform/Chart/tests/Chart.test.mq5 +++ b/Platform/Chart/tests/Chart.test.mq5 @@ -25,6 +25,8 @@ */ // Includes. +#include "../Bar.struct.h" +#include "../Candle.struct.h" #include "../Chart.h" #include "../../../Convert.mqh" #include "../../../Test.mqh" diff --git a/Platform/Chart3D/Chart3D.h b/Platform/Chart3D/Chart3D.h index 1535497a3..435eeedaf 100644 --- a/Platform/Chart3D/Chart3D.h +++ b/Platform/Chart3D/Chart3D.h @@ -30,7 +30,7 @@ #pragma once #endif -#include "../../Bar.struct.h" +#include "../Chart/Bar.struct.h" #include "../../Indicator/IndicatorData.h" #include "../../Indicators/Price/Indi_MA.h" #include "../../Storage/Instances.h" diff --git a/Storage/Dict/Buffer/BufferCandle.h b/Storage/Dict/Buffer/BufferCandle.h index 1126963b8..eb0406f66 100644 --- a/Storage/Dict/Buffer/BufferCandle.h +++ b/Storage/Dict/Buffer/BufferCandle.h @@ -26,7 +26,7 @@ #endif // Includes. -#include "../../../Candle.struct.h" +#include "../../../Platform/Chart/Candle.struct.h" #include "../../../Serializer/SerializerConverter.h" #include "../../../Serializer/SerializerJson.h" #include "BufferStruct.h" diff --git a/tests/CompileTest.mq5 b/tests/CompileTest.mq5 index da6870b4a..bc7f1602a 100644 --- a/tests/CompileTest.mq5 +++ b/tests/CompileTest.mq5 @@ -74,7 +74,7 @@ struct IndicatorParams; #include "../Storage/Object.h" #include "../Platform/Order.h" #include "../Platform/Orders.h" -#include "../Pattern.mqh" +#include "../Platform/Chart/Pattern.h" // #include "../Profiler.mqh" #include "../Storage/Redis.h" #include "../Refs.mqh" From 7d7d39636563912acff0c5e7732e0af03639f091 Mon Sep 17 00:00:00 2001 From: kenorb Date: Tue, 10 Sep 2024 20:53:20 +0100 Subject: [PATCH 11/12] Removes Math.h as duplicate --- Math.h | 267 --------------------------------------------------------- 1 file changed, 267 deletions(-) delete mode 100644 Math.h diff --git a/Math.h b/Math.h deleted file mode 100644 index 371451f66..000000000 --- a/Math.h +++ /dev/null @@ -1,267 +0,0 @@ -//+------------------------------------------------------------------+ -//| EA31337 framework | -//| Copyright 2016-2023, 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 . - * - */ - -#ifndef __MQL__ -// Allows the preprocessor to include a header file when it is needed. -#pragma once -#endif - -// Includes. -#include "Data.struct.h" -#include "Indicator/Indicator.struct.h" -#include "Math.define.h" -#include "Math.enum.h" -#include "Math.extern.h" -#include "Math.struct.h" - -/** - * Class to provide math related methods. - */ -class Math { - protected: - public: - Math() {} - - /* Calculation */ - - template - static X ReLU(X _value) { - return (X)fmax(0, _value); - } - - /** - * Returns value changed by the given percentage. - * - * @param double _value - * Base value to change. - * @param float _pct - * Percentage to change (1 is 100%). - * - * @return - * Returns value after the change. - */ - static double ChangeByPct(double _v, float _pct) { return _v != 0 ? _v + (fabs(_v) * _pct) : 0; } - - /** - * Calculates change between 2 values in percentage. - * - * @docs: https://stackoverflow.com/a/65511594/55075 - * - * @param double _v1 - * First value. - * @param double _v2 - * Second value. - * @param bool _hundreds - * When true, 100% is 100, otherwise 1. - * @return - * Returns percentage change. - */ - static double ChangeInPct(double _v1, double _v2, bool _hundreds = false) { - double _result = 0; - if (_v1 == 0 || _v2 == 0) { - // Change is zero when both values are zeros, otherwise it's 1 (100%). - _result = _v1 == 0 && _v2 == 0 ? 0 : 1; - } else { - // If values are non-zero, use the standard formula. - _result = (_v2 / _v1) - 1; - } - _result = _v2 > _v1 ? fabs(_result) : -fabs(_result); - return _hundreds ? _result * 100 : _result; - } - - /** - * Checks condition for 2 values based on the given comparison operator. - */ - template - static bool Compare(T1 _v1, T2 _v2, ENUM_MATH_CONDITION _op = MATH_COND_EQ) { - switch (_op) { - case MATH_COND_EQ: - return _v1 == _v2; - case MATH_COND_GT: - return _v1 > _v2; - case MATH_COND_LE: - return _v1 < _v2; - default: - break; - } - return false; - } - - /** - * Gets number of digits after decimal in a floating point number. - */ - template - static short FloatDigits(V _value) { - short _cnt = 0; - while ((int)_value != _value) { - _value *= 10; - _cnt++; - } - return _cnt; - } - - /** - * Returns a non-zero value. - * - * @return - * Returns a non-zero value. - */ - static double NonZero(double _v) { return _v == 0 ? DBL_MIN : _v; } - - /* Conditions */ - - /** - * Checks for math condition. - * - * @param ENUM_MATH_CONDITION _cond - * Math condition. - * @param MqlParam[] _args - * Condition arguments. - * @return - * Returns true when the condition is met. - */ - /* - bool CheckCondition(ENUM_MATH_CONDITION _cond, DataParamEntry &_args[]) { - switch (_cond) { - case MATH_COND_EQ: - // @todo - return false; - case MATH_COND_GT: - // @todo - return false; - case MATH_COND_LE: - // @todo - return false; - default: - // logger.Error(StringFormat("Invalid math condition: %s!", EnumToString(_cond), __FUNCTION_LINE__)); - return false; - } - } - bool CheckCondition(ENUM_MATH_CONDITION _cond) { - DataParamEntry _args[] = {}; - return Math::CheckCondition(_cond, _args); - } - */ - - template - static T Add(T a, T b) { - return a + b; - } - template - static T Sub(T a, T b) { - return a - b; - } - template - static T Mul(T a, T b) { - return a * b; - } - template - static T Div(T a, T b) { - return a / b; - } - template - static T Sin(T a) { - return sin(a); - } - template - static T Cos(T a) { - return cos(a); - } - template - static T Tang(T a) { - return tan(a); - } - template - static T Min(T a, T b) { - return MathMin(a, b); - } - template - static T Min(T a, T b, T c) { - return MathMin(MathMin(a, b), c); - } - template - static T Min(T a, T b, T c, T d) { - return MathMin(MathMin(MathMin(a, b), c), d); - } - template - static T Max(T a, T b) { - return MathMax(a, b); - } - template - static T Max(T a, T b, T c) { - return MathMax(MathMax(a, b), c); - } - template - static T Max(T a, T b, T c, T d) { - return MathMax(MathMax(MathMax(a, b), c), d); - } - template - static T Avg(T a, T b) { - return (a + b) / 2; - } - template - static T Avg(T a, T b, T c) { - return (a + b + c) / 3; - } - template - static T Avg(T a, T b, T c, T d) { - return (a + b + c + d) / 4; - } - template - static T Abs(T a) { - return MathAbs(a); - } - - template - static T Op(ENUM_MATH_OP _op, T _val_1, T _val_2 = 0) { - switch (_op) { - case MATH_OP_ADD: - return Add(_val_1, _val_2); - case MATH_OP_SUB: - return Sub(_val_1, _val_2); - case MATH_OP_MUL: - return Mul(_val_1, _val_2); - case MATH_OP_DIV: - return Div(_val_1, _val_2); - case MATH_OP_SIN: - return Sin(_val_1); - case MATH_OP_COS: - return Cos(_val_2); - case MATH_OP_TAN: - return Tang(_val_2); - case MATH_OP_MIN: - return Min(_val_1, _val_2); - case MATH_OP_MAX: - return Max(_val_1, _val_2); - case MATH_OP_AVG: - return Avg(_val_1, _val_2); - case MATH_OP_RELU: - return ReLU(_val_1); - case MATH_OP_ABS: - return Abs(_val_1); - case MATH_OP_ABS_DIFF: - return Abs(_val_1 - _val_2); - default: - return EMPTY_VALUE; - } - } -}; From 3fc6cad0e005bfd9d657ba78909667c6629898c6 Mon Sep 17 00:00:00 2001 From: kenorb Date: Tue, 10 Sep 2024 20:57:16 +0100 Subject: [PATCH 12/12] Makefile: Adds support for MQL4/MQL5 compilation --- Exchange/Account/tests/Makefile | 38 ++++++++++++++++++++++++---- Exchange/SymbolInfo/tests/Makefile | 38 ++++++++++++++++++++++++---- Exchange/tests/Makefile | 38 ++++++++++++++++++++++++---- Indicator/tests/Makefile | 38 ++++++++++++++++++++++++---- Indicators/Bitwise/tests/Makefile | 38 ++++++++++++++++++++++++---- Indicators/OHLC/tests/Makefile | 38 ++++++++++++++++++++++++---- Indicators/Oscillator/tests/Makefile | 38 ++++++++++++++++++++++++---- Indicators/Price/tests/Makefile | 38 ++++++++++++++++++++++++---- Indicators/PriceMulti/tests/Makefile | 38 ++++++++++++++++++++++++---- Indicators/PriceRange/tests/Makefile | 38 ++++++++++++++++++++++++---- Indicators/Special/tests/Makefile | 38 ++++++++++++++++++++++++---- Indicators/Tick/tests/Makefile | 38 ++++++++++++++++++++++++---- Indicators/tests/Makefile | 38 ++++++++++++++++++++++++---- Math/tests/Makefile | 38 ++++++++++++++++++++++++---- Platform/Chart/tests/Makefile | 38 ++++++++++++++++++++++++---- Platform/Chart3D/tests/Makefile | 38 ++++++++++++++++++++++++---- Platform/Web/tests/Makefile | 38 ++++++++++++++++++++++++---- Platform/tests/Makefile | 38 ++++++++++++++++++++++++---- Serializer/tests/Makefile | 38 ++++++++++++++++++++++++---- Storage/Cache/tests/Makefile | 38 ++++++++++++++++++++++++---- Storage/Dict/Buffer/tests/Makefile | 38 ++++++++++++++++++++++++---- Storage/Dict/tests/Makefile | 38 ++++++++++++++++++++++++---- Storage/tests/Makefile | 38 ++++++++++++++++++++++++---- Strategy/tests/Makefile | 38 ++++++++++++++++++++++++---- Task/tests/Makefile | 38 ++++++++++++++++++++++++---- Tick/tests/Makefile | 38 ++++++++++++++++++++++++---- Trade/tests/Makefile | 38 ++++++++++++++++++++++++---- tests/Makefile | 38 ++++++++++++++++++++++++---- 28 files changed, 924 insertions(+), 140 deletions(-) diff --git a/Exchange/Account/tests/Makefile b/Exchange/Account/tests/Makefile index e792364f0..ba14b9322 100644 --- a/Exchange/Account/tests/Makefile +++ b/Exchange/Account/tests/Makefile @@ -1,12 +1,40 @@ CC := g++ # C++ compiler -CFLAGS := -Wall -Wextra -std=c++17 -w # Compiler flags -SRCS := $(wildcard *.cpp) # Get all .cpp files in the current directory -OBJS := $(SRCS:.cpp=.o) # Object files corresponding to the source files +MTE4 := metaeditor.exe +MTE5 := metaeditor64.exe +CFLAGS := -Wall -Wextra -std=c++17 -w +SRCS_CPP := $(wildcard *.cpp) +SRCS_MQ4 := $(wildcard *.mq4) +SRCS_MQ5 := $(wildcard *.mq5) +OBJS_EX4 := $(SRCS_MQ4:.mq4=.ex4) +OBJS_EX5 := $(SRCS_MQ5:.mq5=.ex5) +OBJS_O := $(SRCS_CPP:.cpp=.o) -all: $(OBJS) +# Check if the system is Linux +UNAME_S := $(shell uname -s) +ifeq ($(UNAME_S),Linux) + WINE := wine + # Set WINEPATH to include MetaTrader directory. + export WINEPATH := $(WINEPATH);"C:\Program Files\MetaTrader 4;C:\Program Files\MetaTrader 5" +else + WINE := +endif + +.PHONY: all cpp mql mql4 mql5 + +all: $(OBJS_O) +cpp: $(OBJS_O) +mql4: $(OBJS_EX4) +mql5: $(OBJS_EX5) +mql: mql4 mql5 + +%.ex4: %.mq4 + $(WINE) $(MTE4) /compile:$< /log:CON + +%.ex5: %.mq5 + $(WINE) $(MTE5) /compile:$< /log:CON %.o: %.cpp $(CC) $(CFLAGS) -c $< -o $@ clean: - rm -v $(OBJS) + rm -v $(OBJS_EX4) $(OBJS_EX5) $(OBJS_O) diff --git a/Exchange/SymbolInfo/tests/Makefile b/Exchange/SymbolInfo/tests/Makefile index e792364f0..ba14b9322 100644 --- a/Exchange/SymbolInfo/tests/Makefile +++ b/Exchange/SymbolInfo/tests/Makefile @@ -1,12 +1,40 @@ CC := g++ # C++ compiler -CFLAGS := -Wall -Wextra -std=c++17 -w # Compiler flags -SRCS := $(wildcard *.cpp) # Get all .cpp files in the current directory -OBJS := $(SRCS:.cpp=.o) # Object files corresponding to the source files +MTE4 := metaeditor.exe +MTE5 := metaeditor64.exe +CFLAGS := -Wall -Wextra -std=c++17 -w +SRCS_CPP := $(wildcard *.cpp) +SRCS_MQ4 := $(wildcard *.mq4) +SRCS_MQ5 := $(wildcard *.mq5) +OBJS_EX4 := $(SRCS_MQ4:.mq4=.ex4) +OBJS_EX5 := $(SRCS_MQ5:.mq5=.ex5) +OBJS_O := $(SRCS_CPP:.cpp=.o) -all: $(OBJS) +# Check if the system is Linux +UNAME_S := $(shell uname -s) +ifeq ($(UNAME_S),Linux) + WINE := wine + # Set WINEPATH to include MetaTrader directory. + export WINEPATH := $(WINEPATH);"C:\Program Files\MetaTrader 4;C:\Program Files\MetaTrader 5" +else + WINE := +endif + +.PHONY: all cpp mql mql4 mql5 + +all: $(OBJS_O) +cpp: $(OBJS_O) +mql4: $(OBJS_EX4) +mql5: $(OBJS_EX5) +mql: mql4 mql5 + +%.ex4: %.mq4 + $(WINE) $(MTE4) /compile:$< /log:CON + +%.ex5: %.mq5 + $(WINE) $(MTE5) /compile:$< /log:CON %.o: %.cpp $(CC) $(CFLAGS) -c $< -o $@ clean: - rm -v $(OBJS) + rm -v $(OBJS_EX4) $(OBJS_EX5) $(OBJS_O) diff --git a/Exchange/tests/Makefile b/Exchange/tests/Makefile index e792364f0..ba14b9322 100644 --- a/Exchange/tests/Makefile +++ b/Exchange/tests/Makefile @@ -1,12 +1,40 @@ CC := g++ # C++ compiler -CFLAGS := -Wall -Wextra -std=c++17 -w # Compiler flags -SRCS := $(wildcard *.cpp) # Get all .cpp files in the current directory -OBJS := $(SRCS:.cpp=.o) # Object files corresponding to the source files +MTE4 := metaeditor.exe +MTE5 := metaeditor64.exe +CFLAGS := -Wall -Wextra -std=c++17 -w +SRCS_CPP := $(wildcard *.cpp) +SRCS_MQ4 := $(wildcard *.mq4) +SRCS_MQ5 := $(wildcard *.mq5) +OBJS_EX4 := $(SRCS_MQ4:.mq4=.ex4) +OBJS_EX5 := $(SRCS_MQ5:.mq5=.ex5) +OBJS_O := $(SRCS_CPP:.cpp=.o) -all: $(OBJS) +# Check if the system is Linux +UNAME_S := $(shell uname -s) +ifeq ($(UNAME_S),Linux) + WINE := wine + # Set WINEPATH to include MetaTrader directory. + export WINEPATH := $(WINEPATH);"C:\Program Files\MetaTrader 4;C:\Program Files\MetaTrader 5" +else + WINE := +endif + +.PHONY: all cpp mql mql4 mql5 + +all: $(OBJS_O) +cpp: $(OBJS_O) +mql4: $(OBJS_EX4) +mql5: $(OBJS_EX5) +mql: mql4 mql5 + +%.ex4: %.mq4 + $(WINE) $(MTE4) /compile:$< /log:CON + +%.ex5: %.mq5 + $(WINE) $(MTE5) /compile:$< /log:CON %.o: %.cpp $(CC) $(CFLAGS) -c $< -o $@ clean: - rm -v $(OBJS) + rm -v $(OBJS_EX4) $(OBJS_EX5) $(OBJS_O) diff --git a/Indicator/tests/Makefile b/Indicator/tests/Makefile index e792364f0..ba14b9322 100644 --- a/Indicator/tests/Makefile +++ b/Indicator/tests/Makefile @@ -1,12 +1,40 @@ CC := g++ # C++ compiler -CFLAGS := -Wall -Wextra -std=c++17 -w # Compiler flags -SRCS := $(wildcard *.cpp) # Get all .cpp files in the current directory -OBJS := $(SRCS:.cpp=.o) # Object files corresponding to the source files +MTE4 := metaeditor.exe +MTE5 := metaeditor64.exe +CFLAGS := -Wall -Wextra -std=c++17 -w +SRCS_CPP := $(wildcard *.cpp) +SRCS_MQ4 := $(wildcard *.mq4) +SRCS_MQ5 := $(wildcard *.mq5) +OBJS_EX4 := $(SRCS_MQ4:.mq4=.ex4) +OBJS_EX5 := $(SRCS_MQ5:.mq5=.ex5) +OBJS_O := $(SRCS_CPP:.cpp=.o) -all: $(OBJS) +# Check if the system is Linux +UNAME_S := $(shell uname -s) +ifeq ($(UNAME_S),Linux) + WINE := wine + # Set WINEPATH to include MetaTrader directory. + export WINEPATH := $(WINEPATH);"C:\Program Files\MetaTrader 4;C:\Program Files\MetaTrader 5" +else + WINE := +endif + +.PHONY: all cpp mql mql4 mql5 + +all: $(OBJS_O) +cpp: $(OBJS_O) +mql4: $(OBJS_EX4) +mql5: $(OBJS_EX5) +mql: mql4 mql5 + +%.ex4: %.mq4 + $(WINE) $(MTE4) /compile:$< /log:CON + +%.ex5: %.mq5 + $(WINE) $(MTE5) /compile:$< /log:CON %.o: %.cpp $(CC) $(CFLAGS) -c $< -o $@ clean: - rm -v $(OBJS) + rm -v $(OBJS_EX4) $(OBJS_EX5) $(OBJS_O) diff --git a/Indicators/Bitwise/tests/Makefile b/Indicators/Bitwise/tests/Makefile index e792364f0..ba14b9322 100644 --- a/Indicators/Bitwise/tests/Makefile +++ b/Indicators/Bitwise/tests/Makefile @@ -1,12 +1,40 @@ CC := g++ # C++ compiler -CFLAGS := -Wall -Wextra -std=c++17 -w # Compiler flags -SRCS := $(wildcard *.cpp) # Get all .cpp files in the current directory -OBJS := $(SRCS:.cpp=.o) # Object files corresponding to the source files +MTE4 := metaeditor.exe +MTE5 := metaeditor64.exe +CFLAGS := -Wall -Wextra -std=c++17 -w +SRCS_CPP := $(wildcard *.cpp) +SRCS_MQ4 := $(wildcard *.mq4) +SRCS_MQ5 := $(wildcard *.mq5) +OBJS_EX4 := $(SRCS_MQ4:.mq4=.ex4) +OBJS_EX5 := $(SRCS_MQ5:.mq5=.ex5) +OBJS_O := $(SRCS_CPP:.cpp=.o) -all: $(OBJS) +# Check if the system is Linux +UNAME_S := $(shell uname -s) +ifeq ($(UNAME_S),Linux) + WINE := wine + # Set WINEPATH to include MetaTrader directory. + export WINEPATH := $(WINEPATH);"C:\Program Files\MetaTrader 4;C:\Program Files\MetaTrader 5" +else + WINE := +endif + +.PHONY: all cpp mql mql4 mql5 + +all: $(OBJS_O) +cpp: $(OBJS_O) +mql4: $(OBJS_EX4) +mql5: $(OBJS_EX5) +mql: mql4 mql5 + +%.ex4: %.mq4 + $(WINE) $(MTE4) /compile:$< /log:CON + +%.ex5: %.mq5 + $(WINE) $(MTE5) /compile:$< /log:CON %.o: %.cpp $(CC) $(CFLAGS) -c $< -o $@ clean: - rm -v $(OBJS) + rm -v $(OBJS_EX4) $(OBJS_EX5) $(OBJS_O) diff --git a/Indicators/OHLC/tests/Makefile b/Indicators/OHLC/tests/Makefile index e792364f0..ba14b9322 100644 --- a/Indicators/OHLC/tests/Makefile +++ b/Indicators/OHLC/tests/Makefile @@ -1,12 +1,40 @@ CC := g++ # C++ compiler -CFLAGS := -Wall -Wextra -std=c++17 -w # Compiler flags -SRCS := $(wildcard *.cpp) # Get all .cpp files in the current directory -OBJS := $(SRCS:.cpp=.o) # Object files corresponding to the source files +MTE4 := metaeditor.exe +MTE5 := metaeditor64.exe +CFLAGS := -Wall -Wextra -std=c++17 -w +SRCS_CPP := $(wildcard *.cpp) +SRCS_MQ4 := $(wildcard *.mq4) +SRCS_MQ5 := $(wildcard *.mq5) +OBJS_EX4 := $(SRCS_MQ4:.mq4=.ex4) +OBJS_EX5 := $(SRCS_MQ5:.mq5=.ex5) +OBJS_O := $(SRCS_CPP:.cpp=.o) -all: $(OBJS) +# Check if the system is Linux +UNAME_S := $(shell uname -s) +ifeq ($(UNAME_S),Linux) + WINE := wine + # Set WINEPATH to include MetaTrader directory. + export WINEPATH := $(WINEPATH);"C:\Program Files\MetaTrader 4;C:\Program Files\MetaTrader 5" +else + WINE := +endif + +.PHONY: all cpp mql mql4 mql5 + +all: $(OBJS_O) +cpp: $(OBJS_O) +mql4: $(OBJS_EX4) +mql5: $(OBJS_EX5) +mql: mql4 mql5 + +%.ex4: %.mq4 + $(WINE) $(MTE4) /compile:$< /log:CON + +%.ex5: %.mq5 + $(WINE) $(MTE5) /compile:$< /log:CON %.o: %.cpp $(CC) $(CFLAGS) -c $< -o $@ clean: - rm -v $(OBJS) + rm -v $(OBJS_EX4) $(OBJS_EX5) $(OBJS_O) diff --git a/Indicators/Oscillator/tests/Makefile b/Indicators/Oscillator/tests/Makefile index e792364f0..ba14b9322 100644 --- a/Indicators/Oscillator/tests/Makefile +++ b/Indicators/Oscillator/tests/Makefile @@ -1,12 +1,40 @@ CC := g++ # C++ compiler -CFLAGS := -Wall -Wextra -std=c++17 -w # Compiler flags -SRCS := $(wildcard *.cpp) # Get all .cpp files in the current directory -OBJS := $(SRCS:.cpp=.o) # Object files corresponding to the source files +MTE4 := metaeditor.exe +MTE5 := metaeditor64.exe +CFLAGS := -Wall -Wextra -std=c++17 -w +SRCS_CPP := $(wildcard *.cpp) +SRCS_MQ4 := $(wildcard *.mq4) +SRCS_MQ5 := $(wildcard *.mq5) +OBJS_EX4 := $(SRCS_MQ4:.mq4=.ex4) +OBJS_EX5 := $(SRCS_MQ5:.mq5=.ex5) +OBJS_O := $(SRCS_CPP:.cpp=.o) -all: $(OBJS) +# Check if the system is Linux +UNAME_S := $(shell uname -s) +ifeq ($(UNAME_S),Linux) + WINE := wine + # Set WINEPATH to include MetaTrader directory. + export WINEPATH := $(WINEPATH);"C:\Program Files\MetaTrader 4;C:\Program Files\MetaTrader 5" +else + WINE := +endif + +.PHONY: all cpp mql mql4 mql5 + +all: $(OBJS_O) +cpp: $(OBJS_O) +mql4: $(OBJS_EX4) +mql5: $(OBJS_EX5) +mql: mql4 mql5 + +%.ex4: %.mq4 + $(WINE) $(MTE4) /compile:$< /log:CON + +%.ex5: %.mq5 + $(WINE) $(MTE5) /compile:$< /log:CON %.o: %.cpp $(CC) $(CFLAGS) -c $< -o $@ clean: - rm -v $(OBJS) + rm -v $(OBJS_EX4) $(OBJS_EX5) $(OBJS_O) diff --git a/Indicators/Price/tests/Makefile b/Indicators/Price/tests/Makefile index e792364f0..ba14b9322 100644 --- a/Indicators/Price/tests/Makefile +++ b/Indicators/Price/tests/Makefile @@ -1,12 +1,40 @@ CC := g++ # C++ compiler -CFLAGS := -Wall -Wextra -std=c++17 -w # Compiler flags -SRCS := $(wildcard *.cpp) # Get all .cpp files in the current directory -OBJS := $(SRCS:.cpp=.o) # Object files corresponding to the source files +MTE4 := metaeditor.exe +MTE5 := metaeditor64.exe +CFLAGS := -Wall -Wextra -std=c++17 -w +SRCS_CPP := $(wildcard *.cpp) +SRCS_MQ4 := $(wildcard *.mq4) +SRCS_MQ5 := $(wildcard *.mq5) +OBJS_EX4 := $(SRCS_MQ4:.mq4=.ex4) +OBJS_EX5 := $(SRCS_MQ5:.mq5=.ex5) +OBJS_O := $(SRCS_CPP:.cpp=.o) -all: $(OBJS) +# Check if the system is Linux +UNAME_S := $(shell uname -s) +ifeq ($(UNAME_S),Linux) + WINE := wine + # Set WINEPATH to include MetaTrader directory. + export WINEPATH := $(WINEPATH);"C:\Program Files\MetaTrader 4;C:\Program Files\MetaTrader 5" +else + WINE := +endif + +.PHONY: all cpp mql mql4 mql5 + +all: $(OBJS_O) +cpp: $(OBJS_O) +mql4: $(OBJS_EX4) +mql5: $(OBJS_EX5) +mql: mql4 mql5 + +%.ex4: %.mq4 + $(WINE) $(MTE4) /compile:$< /log:CON + +%.ex5: %.mq5 + $(WINE) $(MTE5) /compile:$< /log:CON %.o: %.cpp $(CC) $(CFLAGS) -c $< -o $@ clean: - rm -v $(OBJS) + rm -v $(OBJS_EX4) $(OBJS_EX5) $(OBJS_O) diff --git a/Indicators/PriceMulti/tests/Makefile b/Indicators/PriceMulti/tests/Makefile index e792364f0..ba14b9322 100644 --- a/Indicators/PriceMulti/tests/Makefile +++ b/Indicators/PriceMulti/tests/Makefile @@ -1,12 +1,40 @@ CC := g++ # C++ compiler -CFLAGS := -Wall -Wextra -std=c++17 -w # Compiler flags -SRCS := $(wildcard *.cpp) # Get all .cpp files in the current directory -OBJS := $(SRCS:.cpp=.o) # Object files corresponding to the source files +MTE4 := metaeditor.exe +MTE5 := metaeditor64.exe +CFLAGS := -Wall -Wextra -std=c++17 -w +SRCS_CPP := $(wildcard *.cpp) +SRCS_MQ4 := $(wildcard *.mq4) +SRCS_MQ5 := $(wildcard *.mq5) +OBJS_EX4 := $(SRCS_MQ4:.mq4=.ex4) +OBJS_EX5 := $(SRCS_MQ5:.mq5=.ex5) +OBJS_O := $(SRCS_CPP:.cpp=.o) -all: $(OBJS) +# Check if the system is Linux +UNAME_S := $(shell uname -s) +ifeq ($(UNAME_S),Linux) + WINE := wine + # Set WINEPATH to include MetaTrader directory. + export WINEPATH := $(WINEPATH);"C:\Program Files\MetaTrader 4;C:\Program Files\MetaTrader 5" +else + WINE := +endif + +.PHONY: all cpp mql mql4 mql5 + +all: $(OBJS_O) +cpp: $(OBJS_O) +mql4: $(OBJS_EX4) +mql5: $(OBJS_EX5) +mql: mql4 mql5 + +%.ex4: %.mq4 + $(WINE) $(MTE4) /compile:$< /log:CON + +%.ex5: %.mq5 + $(WINE) $(MTE5) /compile:$< /log:CON %.o: %.cpp $(CC) $(CFLAGS) -c $< -o $@ clean: - rm -v $(OBJS) + rm -v $(OBJS_EX4) $(OBJS_EX5) $(OBJS_O) diff --git a/Indicators/PriceRange/tests/Makefile b/Indicators/PriceRange/tests/Makefile index e792364f0..ba14b9322 100644 --- a/Indicators/PriceRange/tests/Makefile +++ b/Indicators/PriceRange/tests/Makefile @@ -1,12 +1,40 @@ CC := g++ # C++ compiler -CFLAGS := -Wall -Wextra -std=c++17 -w # Compiler flags -SRCS := $(wildcard *.cpp) # Get all .cpp files in the current directory -OBJS := $(SRCS:.cpp=.o) # Object files corresponding to the source files +MTE4 := metaeditor.exe +MTE5 := metaeditor64.exe +CFLAGS := -Wall -Wextra -std=c++17 -w +SRCS_CPP := $(wildcard *.cpp) +SRCS_MQ4 := $(wildcard *.mq4) +SRCS_MQ5 := $(wildcard *.mq5) +OBJS_EX4 := $(SRCS_MQ4:.mq4=.ex4) +OBJS_EX5 := $(SRCS_MQ5:.mq5=.ex5) +OBJS_O := $(SRCS_CPP:.cpp=.o) -all: $(OBJS) +# Check if the system is Linux +UNAME_S := $(shell uname -s) +ifeq ($(UNAME_S),Linux) + WINE := wine + # Set WINEPATH to include MetaTrader directory. + export WINEPATH := $(WINEPATH);"C:\Program Files\MetaTrader 4;C:\Program Files\MetaTrader 5" +else + WINE := +endif + +.PHONY: all cpp mql mql4 mql5 + +all: $(OBJS_O) +cpp: $(OBJS_O) +mql4: $(OBJS_EX4) +mql5: $(OBJS_EX5) +mql: mql4 mql5 + +%.ex4: %.mq4 + $(WINE) $(MTE4) /compile:$< /log:CON + +%.ex5: %.mq5 + $(WINE) $(MTE5) /compile:$< /log:CON %.o: %.cpp $(CC) $(CFLAGS) -c $< -o $@ clean: - rm -v $(OBJS) + rm -v $(OBJS_EX4) $(OBJS_EX5) $(OBJS_O) diff --git a/Indicators/Special/tests/Makefile b/Indicators/Special/tests/Makefile index e792364f0..ba14b9322 100644 --- a/Indicators/Special/tests/Makefile +++ b/Indicators/Special/tests/Makefile @@ -1,12 +1,40 @@ CC := g++ # C++ compiler -CFLAGS := -Wall -Wextra -std=c++17 -w # Compiler flags -SRCS := $(wildcard *.cpp) # Get all .cpp files in the current directory -OBJS := $(SRCS:.cpp=.o) # Object files corresponding to the source files +MTE4 := metaeditor.exe +MTE5 := metaeditor64.exe +CFLAGS := -Wall -Wextra -std=c++17 -w +SRCS_CPP := $(wildcard *.cpp) +SRCS_MQ4 := $(wildcard *.mq4) +SRCS_MQ5 := $(wildcard *.mq5) +OBJS_EX4 := $(SRCS_MQ4:.mq4=.ex4) +OBJS_EX5 := $(SRCS_MQ5:.mq5=.ex5) +OBJS_O := $(SRCS_CPP:.cpp=.o) -all: $(OBJS) +# Check if the system is Linux +UNAME_S := $(shell uname -s) +ifeq ($(UNAME_S),Linux) + WINE := wine + # Set WINEPATH to include MetaTrader directory. + export WINEPATH := $(WINEPATH);"C:\Program Files\MetaTrader 4;C:\Program Files\MetaTrader 5" +else + WINE := +endif + +.PHONY: all cpp mql mql4 mql5 + +all: $(OBJS_O) +cpp: $(OBJS_O) +mql4: $(OBJS_EX4) +mql5: $(OBJS_EX5) +mql: mql4 mql5 + +%.ex4: %.mq4 + $(WINE) $(MTE4) /compile:$< /log:CON + +%.ex5: %.mq5 + $(WINE) $(MTE5) /compile:$< /log:CON %.o: %.cpp $(CC) $(CFLAGS) -c $< -o $@ clean: - rm -v $(OBJS) + rm -v $(OBJS_EX4) $(OBJS_EX5) $(OBJS_O) diff --git a/Indicators/Tick/tests/Makefile b/Indicators/Tick/tests/Makefile index e792364f0..ba14b9322 100644 --- a/Indicators/Tick/tests/Makefile +++ b/Indicators/Tick/tests/Makefile @@ -1,12 +1,40 @@ CC := g++ # C++ compiler -CFLAGS := -Wall -Wextra -std=c++17 -w # Compiler flags -SRCS := $(wildcard *.cpp) # Get all .cpp files in the current directory -OBJS := $(SRCS:.cpp=.o) # Object files corresponding to the source files +MTE4 := metaeditor.exe +MTE5 := metaeditor64.exe +CFLAGS := -Wall -Wextra -std=c++17 -w +SRCS_CPP := $(wildcard *.cpp) +SRCS_MQ4 := $(wildcard *.mq4) +SRCS_MQ5 := $(wildcard *.mq5) +OBJS_EX4 := $(SRCS_MQ4:.mq4=.ex4) +OBJS_EX5 := $(SRCS_MQ5:.mq5=.ex5) +OBJS_O := $(SRCS_CPP:.cpp=.o) -all: $(OBJS) +# Check if the system is Linux +UNAME_S := $(shell uname -s) +ifeq ($(UNAME_S),Linux) + WINE := wine + # Set WINEPATH to include MetaTrader directory. + export WINEPATH := $(WINEPATH);"C:\Program Files\MetaTrader 4;C:\Program Files\MetaTrader 5" +else + WINE := +endif + +.PHONY: all cpp mql mql4 mql5 + +all: $(OBJS_O) +cpp: $(OBJS_O) +mql4: $(OBJS_EX4) +mql5: $(OBJS_EX5) +mql: mql4 mql5 + +%.ex4: %.mq4 + $(WINE) $(MTE4) /compile:$< /log:CON + +%.ex5: %.mq5 + $(WINE) $(MTE5) /compile:$< /log:CON %.o: %.cpp $(CC) $(CFLAGS) -c $< -o $@ clean: - rm -v $(OBJS) + rm -v $(OBJS_EX4) $(OBJS_EX5) $(OBJS_O) diff --git a/Indicators/tests/Makefile b/Indicators/tests/Makefile index e792364f0..ba14b9322 100644 --- a/Indicators/tests/Makefile +++ b/Indicators/tests/Makefile @@ -1,12 +1,40 @@ CC := g++ # C++ compiler -CFLAGS := -Wall -Wextra -std=c++17 -w # Compiler flags -SRCS := $(wildcard *.cpp) # Get all .cpp files in the current directory -OBJS := $(SRCS:.cpp=.o) # Object files corresponding to the source files +MTE4 := metaeditor.exe +MTE5 := metaeditor64.exe +CFLAGS := -Wall -Wextra -std=c++17 -w +SRCS_CPP := $(wildcard *.cpp) +SRCS_MQ4 := $(wildcard *.mq4) +SRCS_MQ5 := $(wildcard *.mq5) +OBJS_EX4 := $(SRCS_MQ4:.mq4=.ex4) +OBJS_EX5 := $(SRCS_MQ5:.mq5=.ex5) +OBJS_O := $(SRCS_CPP:.cpp=.o) -all: $(OBJS) +# Check if the system is Linux +UNAME_S := $(shell uname -s) +ifeq ($(UNAME_S),Linux) + WINE := wine + # Set WINEPATH to include MetaTrader directory. + export WINEPATH := $(WINEPATH);"C:\Program Files\MetaTrader 4;C:\Program Files\MetaTrader 5" +else + WINE := +endif + +.PHONY: all cpp mql mql4 mql5 + +all: $(OBJS_O) +cpp: $(OBJS_O) +mql4: $(OBJS_EX4) +mql5: $(OBJS_EX5) +mql: mql4 mql5 + +%.ex4: %.mq4 + $(WINE) $(MTE4) /compile:$< /log:CON + +%.ex5: %.mq5 + $(WINE) $(MTE5) /compile:$< /log:CON %.o: %.cpp $(CC) $(CFLAGS) -c $< -o $@ clean: - rm -v $(OBJS) + rm -v $(OBJS_EX4) $(OBJS_EX5) $(OBJS_O) diff --git a/Math/tests/Makefile b/Math/tests/Makefile index e792364f0..ba14b9322 100644 --- a/Math/tests/Makefile +++ b/Math/tests/Makefile @@ -1,12 +1,40 @@ CC := g++ # C++ compiler -CFLAGS := -Wall -Wextra -std=c++17 -w # Compiler flags -SRCS := $(wildcard *.cpp) # Get all .cpp files in the current directory -OBJS := $(SRCS:.cpp=.o) # Object files corresponding to the source files +MTE4 := metaeditor.exe +MTE5 := metaeditor64.exe +CFLAGS := -Wall -Wextra -std=c++17 -w +SRCS_CPP := $(wildcard *.cpp) +SRCS_MQ4 := $(wildcard *.mq4) +SRCS_MQ5 := $(wildcard *.mq5) +OBJS_EX4 := $(SRCS_MQ4:.mq4=.ex4) +OBJS_EX5 := $(SRCS_MQ5:.mq5=.ex5) +OBJS_O := $(SRCS_CPP:.cpp=.o) -all: $(OBJS) +# Check if the system is Linux +UNAME_S := $(shell uname -s) +ifeq ($(UNAME_S),Linux) + WINE := wine + # Set WINEPATH to include MetaTrader directory. + export WINEPATH := $(WINEPATH);"C:\Program Files\MetaTrader 4;C:\Program Files\MetaTrader 5" +else + WINE := +endif + +.PHONY: all cpp mql mql4 mql5 + +all: $(OBJS_O) +cpp: $(OBJS_O) +mql4: $(OBJS_EX4) +mql5: $(OBJS_EX5) +mql: mql4 mql5 + +%.ex4: %.mq4 + $(WINE) $(MTE4) /compile:$< /log:CON + +%.ex5: %.mq5 + $(WINE) $(MTE5) /compile:$< /log:CON %.o: %.cpp $(CC) $(CFLAGS) -c $< -o $@ clean: - rm -v $(OBJS) + rm -v $(OBJS_EX4) $(OBJS_EX5) $(OBJS_O) diff --git a/Platform/Chart/tests/Makefile b/Platform/Chart/tests/Makefile index e792364f0..ba14b9322 100644 --- a/Platform/Chart/tests/Makefile +++ b/Platform/Chart/tests/Makefile @@ -1,12 +1,40 @@ CC := g++ # C++ compiler -CFLAGS := -Wall -Wextra -std=c++17 -w # Compiler flags -SRCS := $(wildcard *.cpp) # Get all .cpp files in the current directory -OBJS := $(SRCS:.cpp=.o) # Object files corresponding to the source files +MTE4 := metaeditor.exe +MTE5 := metaeditor64.exe +CFLAGS := -Wall -Wextra -std=c++17 -w +SRCS_CPP := $(wildcard *.cpp) +SRCS_MQ4 := $(wildcard *.mq4) +SRCS_MQ5 := $(wildcard *.mq5) +OBJS_EX4 := $(SRCS_MQ4:.mq4=.ex4) +OBJS_EX5 := $(SRCS_MQ5:.mq5=.ex5) +OBJS_O := $(SRCS_CPP:.cpp=.o) -all: $(OBJS) +# Check if the system is Linux +UNAME_S := $(shell uname -s) +ifeq ($(UNAME_S),Linux) + WINE := wine + # Set WINEPATH to include MetaTrader directory. + export WINEPATH := $(WINEPATH);"C:\Program Files\MetaTrader 4;C:\Program Files\MetaTrader 5" +else + WINE := +endif + +.PHONY: all cpp mql mql4 mql5 + +all: $(OBJS_O) +cpp: $(OBJS_O) +mql4: $(OBJS_EX4) +mql5: $(OBJS_EX5) +mql: mql4 mql5 + +%.ex4: %.mq4 + $(WINE) $(MTE4) /compile:$< /log:CON + +%.ex5: %.mq5 + $(WINE) $(MTE5) /compile:$< /log:CON %.o: %.cpp $(CC) $(CFLAGS) -c $< -o $@ clean: - rm -v $(OBJS) + rm -v $(OBJS_EX4) $(OBJS_EX5) $(OBJS_O) diff --git a/Platform/Chart3D/tests/Makefile b/Platform/Chart3D/tests/Makefile index e792364f0..ba14b9322 100644 --- a/Platform/Chart3D/tests/Makefile +++ b/Platform/Chart3D/tests/Makefile @@ -1,12 +1,40 @@ CC := g++ # C++ compiler -CFLAGS := -Wall -Wextra -std=c++17 -w # Compiler flags -SRCS := $(wildcard *.cpp) # Get all .cpp files in the current directory -OBJS := $(SRCS:.cpp=.o) # Object files corresponding to the source files +MTE4 := metaeditor.exe +MTE5 := metaeditor64.exe +CFLAGS := -Wall -Wextra -std=c++17 -w +SRCS_CPP := $(wildcard *.cpp) +SRCS_MQ4 := $(wildcard *.mq4) +SRCS_MQ5 := $(wildcard *.mq5) +OBJS_EX4 := $(SRCS_MQ4:.mq4=.ex4) +OBJS_EX5 := $(SRCS_MQ5:.mq5=.ex5) +OBJS_O := $(SRCS_CPP:.cpp=.o) -all: $(OBJS) +# Check if the system is Linux +UNAME_S := $(shell uname -s) +ifeq ($(UNAME_S),Linux) + WINE := wine + # Set WINEPATH to include MetaTrader directory. + export WINEPATH := $(WINEPATH);"C:\Program Files\MetaTrader 4;C:\Program Files\MetaTrader 5" +else + WINE := +endif + +.PHONY: all cpp mql mql4 mql5 + +all: $(OBJS_O) +cpp: $(OBJS_O) +mql4: $(OBJS_EX4) +mql5: $(OBJS_EX5) +mql: mql4 mql5 + +%.ex4: %.mq4 + $(WINE) $(MTE4) /compile:$< /log:CON + +%.ex5: %.mq5 + $(WINE) $(MTE5) /compile:$< /log:CON %.o: %.cpp $(CC) $(CFLAGS) -c $< -o $@ clean: - rm -v $(OBJS) + rm -v $(OBJS_EX4) $(OBJS_EX5) $(OBJS_O) diff --git a/Platform/Web/tests/Makefile b/Platform/Web/tests/Makefile index e792364f0..ba14b9322 100644 --- a/Platform/Web/tests/Makefile +++ b/Platform/Web/tests/Makefile @@ -1,12 +1,40 @@ CC := g++ # C++ compiler -CFLAGS := -Wall -Wextra -std=c++17 -w # Compiler flags -SRCS := $(wildcard *.cpp) # Get all .cpp files in the current directory -OBJS := $(SRCS:.cpp=.o) # Object files corresponding to the source files +MTE4 := metaeditor.exe +MTE5 := metaeditor64.exe +CFLAGS := -Wall -Wextra -std=c++17 -w +SRCS_CPP := $(wildcard *.cpp) +SRCS_MQ4 := $(wildcard *.mq4) +SRCS_MQ5 := $(wildcard *.mq5) +OBJS_EX4 := $(SRCS_MQ4:.mq4=.ex4) +OBJS_EX5 := $(SRCS_MQ5:.mq5=.ex5) +OBJS_O := $(SRCS_CPP:.cpp=.o) -all: $(OBJS) +# Check if the system is Linux +UNAME_S := $(shell uname -s) +ifeq ($(UNAME_S),Linux) + WINE := wine + # Set WINEPATH to include MetaTrader directory. + export WINEPATH := $(WINEPATH);"C:\Program Files\MetaTrader 4;C:\Program Files\MetaTrader 5" +else + WINE := +endif + +.PHONY: all cpp mql mql4 mql5 + +all: $(OBJS_O) +cpp: $(OBJS_O) +mql4: $(OBJS_EX4) +mql5: $(OBJS_EX5) +mql: mql4 mql5 + +%.ex4: %.mq4 + $(WINE) $(MTE4) /compile:$< /log:CON + +%.ex5: %.mq5 + $(WINE) $(MTE5) /compile:$< /log:CON %.o: %.cpp $(CC) $(CFLAGS) -c $< -o $@ clean: - rm -v $(OBJS) + rm -v $(OBJS_EX4) $(OBJS_EX5) $(OBJS_O) diff --git a/Platform/tests/Makefile b/Platform/tests/Makefile index e792364f0..ba14b9322 100644 --- a/Platform/tests/Makefile +++ b/Platform/tests/Makefile @@ -1,12 +1,40 @@ CC := g++ # C++ compiler -CFLAGS := -Wall -Wextra -std=c++17 -w # Compiler flags -SRCS := $(wildcard *.cpp) # Get all .cpp files in the current directory -OBJS := $(SRCS:.cpp=.o) # Object files corresponding to the source files +MTE4 := metaeditor.exe +MTE5 := metaeditor64.exe +CFLAGS := -Wall -Wextra -std=c++17 -w +SRCS_CPP := $(wildcard *.cpp) +SRCS_MQ4 := $(wildcard *.mq4) +SRCS_MQ5 := $(wildcard *.mq5) +OBJS_EX4 := $(SRCS_MQ4:.mq4=.ex4) +OBJS_EX5 := $(SRCS_MQ5:.mq5=.ex5) +OBJS_O := $(SRCS_CPP:.cpp=.o) -all: $(OBJS) +# Check if the system is Linux +UNAME_S := $(shell uname -s) +ifeq ($(UNAME_S),Linux) + WINE := wine + # Set WINEPATH to include MetaTrader directory. + export WINEPATH := $(WINEPATH);"C:\Program Files\MetaTrader 4;C:\Program Files\MetaTrader 5" +else + WINE := +endif + +.PHONY: all cpp mql mql4 mql5 + +all: $(OBJS_O) +cpp: $(OBJS_O) +mql4: $(OBJS_EX4) +mql5: $(OBJS_EX5) +mql: mql4 mql5 + +%.ex4: %.mq4 + $(WINE) $(MTE4) /compile:$< /log:CON + +%.ex5: %.mq5 + $(WINE) $(MTE5) /compile:$< /log:CON %.o: %.cpp $(CC) $(CFLAGS) -c $< -o $@ clean: - rm -v $(OBJS) + rm -v $(OBJS_EX4) $(OBJS_EX5) $(OBJS_O) diff --git a/Serializer/tests/Makefile b/Serializer/tests/Makefile index e792364f0..ba14b9322 100644 --- a/Serializer/tests/Makefile +++ b/Serializer/tests/Makefile @@ -1,12 +1,40 @@ CC := g++ # C++ compiler -CFLAGS := -Wall -Wextra -std=c++17 -w # Compiler flags -SRCS := $(wildcard *.cpp) # Get all .cpp files in the current directory -OBJS := $(SRCS:.cpp=.o) # Object files corresponding to the source files +MTE4 := metaeditor.exe +MTE5 := metaeditor64.exe +CFLAGS := -Wall -Wextra -std=c++17 -w +SRCS_CPP := $(wildcard *.cpp) +SRCS_MQ4 := $(wildcard *.mq4) +SRCS_MQ5 := $(wildcard *.mq5) +OBJS_EX4 := $(SRCS_MQ4:.mq4=.ex4) +OBJS_EX5 := $(SRCS_MQ5:.mq5=.ex5) +OBJS_O := $(SRCS_CPP:.cpp=.o) -all: $(OBJS) +# Check if the system is Linux +UNAME_S := $(shell uname -s) +ifeq ($(UNAME_S),Linux) + WINE := wine + # Set WINEPATH to include MetaTrader directory. + export WINEPATH := $(WINEPATH);"C:\Program Files\MetaTrader 4;C:\Program Files\MetaTrader 5" +else + WINE := +endif + +.PHONY: all cpp mql mql4 mql5 + +all: $(OBJS_O) +cpp: $(OBJS_O) +mql4: $(OBJS_EX4) +mql5: $(OBJS_EX5) +mql: mql4 mql5 + +%.ex4: %.mq4 + $(WINE) $(MTE4) /compile:$< /log:CON + +%.ex5: %.mq5 + $(WINE) $(MTE5) /compile:$< /log:CON %.o: %.cpp $(CC) $(CFLAGS) -c $< -o $@ clean: - rm -v $(OBJS) + rm -v $(OBJS_EX4) $(OBJS_EX5) $(OBJS_O) diff --git a/Storage/Cache/tests/Makefile b/Storage/Cache/tests/Makefile index e792364f0..ba14b9322 100644 --- a/Storage/Cache/tests/Makefile +++ b/Storage/Cache/tests/Makefile @@ -1,12 +1,40 @@ CC := g++ # C++ compiler -CFLAGS := -Wall -Wextra -std=c++17 -w # Compiler flags -SRCS := $(wildcard *.cpp) # Get all .cpp files in the current directory -OBJS := $(SRCS:.cpp=.o) # Object files corresponding to the source files +MTE4 := metaeditor.exe +MTE5 := metaeditor64.exe +CFLAGS := -Wall -Wextra -std=c++17 -w +SRCS_CPP := $(wildcard *.cpp) +SRCS_MQ4 := $(wildcard *.mq4) +SRCS_MQ5 := $(wildcard *.mq5) +OBJS_EX4 := $(SRCS_MQ4:.mq4=.ex4) +OBJS_EX5 := $(SRCS_MQ5:.mq5=.ex5) +OBJS_O := $(SRCS_CPP:.cpp=.o) -all: $(OBJS) +# Check if the system is Linux +UNAME_S := $(shell uname -s) +ifeq ($(UNAME_S),Linux) + WINE := wine + # Set WINEPATH to include MetaTrader directory. + export WINEPATH := $(WINEPATH);"C:\Program Files\MetaTrader 4;C:\Program Files\MetaTrader 5" +else + WINE := +endif + +.PHONY: all cpp mql mql4 mql5 + +all: $(OBJS_O) +cpp: $(OBJS_O) +mql4: $(OBJS_EX4) +mql5: $(OBJS_EX5) +mql: mql4 mql5 + +%.ex4: %.mq4 + $(WINE) $(MTE4) /compile:$< /log:CON + +%.ex5: %.mq5 + $(WINE) $(MTE5) /compile:$< /log:CON %.o: %.cpp $(CC) $(CFLAGS) -c $< -o $@ clean: - rm -v $(OBJS) + rm -v $(OBJS_EX4) $(OBJS_EX5) $(OBJS_O) diff --git a/Storage/Dict/Buffer/tests/Makefile b/Storage/Dict/Buffer/tests/Makefile index e792364f0..ba14b9322 100644 --- a/Storage/Dict/Buffer/tests/Makefile +++ b/Storage/Dict/Buffer/tests/Makefile @@ -1,12 +1,40 @@ CC := g++ # C++ compiler -CFLAGS := -Wall -Wextra -std=c++17 -w # Compiler flags -SRCS := $(wildcard *.cpp) # Get all .cpp files in the current directory -OBJS := $(SRCS:.cpp=.o) # Object files corresponding to the source files +MTE4 := metaeditor.exe +MTE5 := metaeditor64.exe +CFLAGS := -Wall -Wextra -std=c++17 -w +SRCS_CPP := $(wildcard *.cpp) +SRCS_MQ4 := $(wildcard *.mq4) +SRCS_MQ5 := $(wildcard *.mq5) +OBJS_EX4 := $(SRCS_MQ4:.mq4=.ex4) +OBJS_EX5 := $(SRCS_MQ5:.mq5=.ex5) +OBJS_O := $(SRCS_CPP:.cpp=.o) -all: $(OBJS) +# Check if the system is Linux +UNAME_S := $(shell uname -s) +ifeq ($(UNAME_S),Linux) + WINE := wine + # Set WINEPATH to include MetaTrader directory. + export WINEPATH := $(WINEPATH);"C:\Program Files\MetaTrader 4;C:\Program Files\MetaTrader 5" +else + WINE := +endif + +.PHONY: all cpp mql mql4 mql5 + +all: $(OBJS_O) +cpp: $(OBJS_O) +mql4: $(OBJS_EX4) +mql5: $(OBJS_EX5) +mql: mql4 mql5 + +%.ex4: %.mq4 + $(WINE) $(MTE4) /compile:$< /log:CON + +%.ex5: %.mq5 + $(WINE) $(MTE5) /compile:$< /log:CON %.o: %.cpp $(CC) $(CFLAGS) -c $< -o $@ clean: - rm -v $(OBJS) + rm -v $(OBJS_EX4) $(OBJS_EX5) $(OBJS_O) diff --git a/Storage/Dict/tests/Makefile b/Storage/Dict/tests/Makefile index e792364f0..ba14b9322 100644 --- a/Storage/Dict/tests/Makefile +++ b/Storage/Dict/tests/Makefile @@ -1,12 +1,40 @@ CC := g++ # C++ compiler -CFLAGS := -Wall -Wextra -std=c++17 -w # Compiler flags -SRCS := $(wildcard *.cpp) # Get all .cpp files in the current directory -OBJS := $(SRCS:.cpp=.o) # Object files corresponding to the source files +MTE4 := metaeditor.exe +MTE5 := metaeditor64.exe +CFLAGS := -Wall -Wextra -std=c++17 -w +SRCS_CPP := $(wildcard *.cpp) +SRCS_MQ4 := $(wildcard *.mq4) +SRCS_MQ5 := $(wildcard *.mq5) +OBJS_EX4 := $(SRCS_MQ4:.mq4=.ex4) +OBJS_EX5 := $(SRCS_MQ5:.mq5=.ex5) +OBJS_O := $(SRCS_CPP:.cpp=.o) -all: $(OBJS) +# Check if the system is Linux +UNAME_S := $(shell uname -s) +ifeq ($(UNAME_S),Linux) + WINE := wine + # Set WINEPATH to include MetaTrader directory. + export WINEPATH := $(WINEPATH);"C:\Program Files\MetaTrader 4;C:\Program Files\MetaTrader 5" +else + WINE := +endif + +.PHONY: all cpp mql mql4 mql5 + +all: $(OBJS_O) +cpp: $(OBJS_O) +mql4: $(OBJS_EX4) +mql5: $(OBJS_EX5) +mql: mql4 mql5 + +%.ex4: %.mq4 + $(WINE) $(MTE4) /compile:$< /log:CON + +%.ex5: %.mq5 + $(WINE) $(MTE5) /compile:$< /log:CON %.o: %.cpp $(CC) $(CFLAGS) -c $< -o $@ clean: - rm -v $(OBJS) + rm -v $(OBJS_EX4) $(OBJS_EX5) $(OBJS_O) diff --git a/Storage/tests/Makefile b/Storage/tests/Makefile index e792364f0..ba14b9322 100644 --- a/Storage/tests/Makefile +++ b/Storage/tests/Makefile @@ -1,12 +1,40 @@ CC := g++ # C++ compiler -CFLAGS := -Wall -Wextra -std=c++17 -w # Compiler flags -SRCS := $(wildcard *.cpp) # Get all .cpp files in the current directory -OBJS := $(SRCS:.cpp=.o) # Object files corresponding to the source files +MTE4 := metaeditor.exe +MTE5 := metaeditor64.exe +CFLAGS := -Wall -Wextra -std=c++17 -w +SRCS_CPP := $(wildcard *.cpp) +SRCS_MQ4 := $(wildcard *.mq4) +SRCS_MQ5 := $(wildcard *.mq5) +OBJS_EX4 := $(SRCS_MQ4:.mq4=.ex4) +OBJS_EX5 := $(SRCS_MQ5:.mq5=.ex5) +OBJS_O := $(SRCS_CPP:.cpp=.o) -all: $(OBJS) +# Check if the system is Linux +UNAME_S := $(shell uname -s) +ifeq ($(UNAME_S),Linux) + WINE := wine + # Set WINEPATH to include MetaTrader directory. + export WINEPATH := $(WINEPATH);"C:\Program Files\MetaTrader 4;C:\Program Files\MetaTrader 5" +else + WINE := +endif + +.PHONY: all cpp mql mql4 mql5 + +all: $(OBJS_O) +cpp: $(OBJS_O) +mql4: $(OBJS_EX4) +mql5: $(OBJS_EX5) +mql: mql4 mql5 + +%.ex4: %.mq4 + $(WINE) $(MTE4) /compile:$< /log:CON + +%.ex5: %.mq5 + $(WINE) $(MTE5) /compile:$< /log:CON %.o: %.cpp $(CC) $(CFLAGS) -c $< -o $@ clean: - rm -v $(OBJS) + rm -v $(OBJS_EX4) $(OBJS_EX5) $(OBJS_O) diff --git a/Strategy/tests/Makefile b/Strategy/tests/Makefile index e792364f0..ba14b9322 100644 --- a/Strategy/tests/Makefile +++ b/Strategy/tests/Makefile @@ -1,12 +1,40 @@ CC := g++ # C++ compiler -CFLAGS := -Wall -Wextra -std=c++17 -w # Compiler flags -SRCS := $(wildcard *.cpp) # Get all .cpp files in the current directory -OBJS := $(SRCS:.cpp=.o) # Object files corresponding to the source files +MTE4 := metaeditor.exe +MTE5 := metaeditor64.exe +CFLAGS := -Wall -Wextra -std=c++17 -w +SRCS_CPP := $(wildcard *.cpp) +SRCS_MQ4 := $(wildcard *.mq4) +SRCS_MQ5 := $(wildcard *.mq5) +OBJS_EX4 := $(SRCS_MQ4:.mq4=.ex4) +OBJS_EX5 := $(SRCS_MQ5:.mq5=.ex5) +OBJS_O := $(SRCS_CPP:.cpp=.o) -all: $(OBJS) +# Check if the system is Linux +UNAME_S := $(shell uname -s) +ifeq ($(UNAME_S),Linux) + WINE := wine + # Set WINEPATH to include MetaTrader directory. + export WINEPATH := $(WINEPATH);"C:\Program Files\MetaTrader 4;C:\Program Files\MetaTrader 5" +else + WINE := +endif + +.PHONY: all cpp mql mql4 mql5 + +all: $(OBJS_O) +cpp: $(OBJS_O) +mql4: $(OBJS_EX4) +mql5: $(OBJS_EX5) +mql: mql4 mql5 + +%.ex4: %.mq4 + $(WINE) $(MTE4) /compile:$< /log:CON + +%.ex5: %.mq5 + $(WINE) $(MTE5) /compile:$< /log:CON %.o: %.cpp $(CC) $(CFLAGS) -c $< -o $@ clean: - rm -v $(OBJS) + rm -v $(OBJS_EX4) $(OBJS_EX5) $(OBJS_O) diff --git a/Task/tests/Makefile b/Task/tests/Makefile index e792364f0..ba14b9322 100644 --- a/Task/tests/Makefile +++ b/Task/tests/Makefile @@ -1,12 +1,40 @@ CC := g++ # C++ compiler -CFLAGS := -Wall -Wextra -std=c++17 -w # Compiler flags -SRCS := $(wildcard *.cpp) # Get all .cpp files in the current directory -OBJS := $(SRCS:.cpp=.o) # Object files corresponding to the source files +MTE4 := metaeditor.exe +MTE5 := metaeditor64.exe +CFLAGS := -Wall -Wextra -std=c++17 -w +SRCS_CPP := $(wildcard *.cpp) +SRCS_MQ4 := $(wildcard *.mq4) +SRCS_MQ5 := $(wildcard *.mq5) +OBJS_EX4 := $(SRCS_MQ4:.mq4=.ex4) +OBJS_EX5 := $(SRCS_MQ5:.mq5=.ex5) +OBJS_O := $(SRCS_CPP:.cpp=.o) -all: $(OBJS) +# Check if the system is Linux +UNAME_S := $(shell uname -s) +ifeq ($(UNAME_S),Linux) + WINE := wine + # Set WINEPATH to include MetaTrader directory. + export WINEPATH := $(WINEPATH);"C:\Program Files\MetaTrader 4;C:\Program Files\MetaTrader 5" +else + WINE := +endif + +.PHONY: all cpp mql mql4 mql5 + +all: $(OBJS_O) +cpp: $(OBJS_O) +mql4: $(OBJS_EX4) +mql5: $(OBJS_EX5) +mql: mql4 mql5 + +%.ex4: %.mq4 + $(WINE) $(MTE4) /compile:$< /log:CON + +%.ex5: %.mq5 + $(WINE) $(MTE5) /compile:$< /log:CON %.o: %.cpp $(CC) $(CFLAGS) -c $< -o $@ clean: - rm -v $(OBJS) + rm -v $(OBJS_EX4) $(OBJS_EX5) $(OBJS_O) diff --git a/Tick/tests/Makefile b/Tick/tests/Makefile index e792364f0..ba14b9322 100644 --- a/Tick/tests/Makefile +++ b/Tick/tests/Makefile @@ -1,12 +1,40 @@ CC := g++ # C++ compiler -CFLAGS := -Wall -Wextra -std=c++17 -w # Compiler flags -SRCS := $(wildcard *.cpp) # Get all .cpp files in the current directory -OBJS := $(SRCS:.cpp=.o) # Object files corresponding to the source files +MTE4 := metaeditor.exe +MTE5 := metaeditor64.exe +CFLAGS := -Wall -Wextra -std=c++17 -w +SRCS_CPP := $(wildcard *.cpp) +SRCS_MQ4 := $(wildcard *.mq4) +SRCS_MQ5 := $(wildcard *.mq5) +OBJS_EX4 := $(SRCS_MQ4:.mq4=.ex4) +OBJS_EX5 := $(SRCS_MQ5:.mq5=.ex5) +OBJS_O := $(SRCS_CPP:.cpp=.o) -all: $(OBJS) +# Check if the system is Linux +UNAME_S := $(shell uname -s) +ifeq ($(UNAME_S),Linux) + WINE := wine + # Set WINEPATH to include MetaTrader directory. + export WINEPATH := $(WINEPATH);"C:\Program Files\MetaTrader 4;C:\Program Files\MetaTrader 5" +else + WINE := +endif + +.PHONY: all cpp mql mql4 mql5 + +all: $(OBJS_O) +cpp: $(OBJS_O) +mql4: $(OBJS_EX4) +mql5: $(OBJS_EX5) +mql: mql4 mql5 + +%.ex4: %.mq4 + $(WINE) $(MTE4) /compile:$< /log:CON + +%.ex5: %.mq5 + $(WINE) $(MTE5) /compile:$< /log:CON %.o: %.cpp $(CC) $(CFLAGS) -c $< -o $@ clean: - rm -v $(OBJS) + rm -v $(OBJS_EX4) $(OBJS_EX5) $(OBJS_O) diff --git a/Trade/tests/Makefile b/Trade/tests/Makefile index e792364f0..ba14b9322 100644 --- a/Trade/tests/Makefile +++ b/Trade/tests/Makefile @@ -1,12 +1,40 @@ CC := g++ # C++ compiler -CFLAGS := -Wall -Wextra -std=c++17 -w # Compiler flags -SRCS := $(wildcard *.cpp) # Get all .cpp files in the current directory -OBJS := $(SRCS:.cpp=.o) # Object files corresponding to the source files +MTE4 := metaeditor.exe +MTE5 := metaeditor64.exe +CFLAGS := -Wall -Wextra -std=c++17 -w +SRCS_CPP := $(wildcard *.cpp) +SRCS_MQ4 := $(wildcard *.mq4) +SRCS_MQ5 := $(wildcard *.mq5) +OBJS_EX4 := $(SRCS_MQ4:.mq4=.ex4) +OBJS_EX5 := $(SRCS_MQ5:.mq5=.ex5) +OBJS_O := $(SRCS_CPP:.cpp=.o) -all: $(OBJS) +# Check if the system is Linux +UNAME_S := $(shell uname -s) +ifeq ($(UNAME_S),Linux) + WINE := wine + # Set WINEPATH to include MetaTrader directory. + export WINEPATH := $(WINEPATH);"C:\Program Files\MetaTrader 4;C:\Program Files\MetaTrader 5" +else + WINE := +endif + +.PHONY: all cpp mql mql4 mql5 + +all: $(OBJS_O) +cpp: $(OBJS_O) +mql4: $(OBJS_EX4) +mql5: $(OBJS_EX5) +mql: mql4 mql5 + +%.ex4: %.mq4 + $(WINE) $(MTE4) /compile:$< /log:CON + +%.ex5: %.mq5 + $(WINE) $(MTE5) /compile:$< /log:CON %.o: %.cpp $(CC) $(CFLAGS) -c $< -o $@ clean: - rm -v $(OBJS) + rm -v $(OBJS_EX4) $(OBJS_EX5) $(OBJS_O) diff --git a/tests/Makefile b/tests/Makefile index e792364f0..ba14b9322 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -1,12 +1,40 @@ CC := g++ # C++ compiler -CFLAGS := -Wall -Wextra -std=c++17 -w # Compiler flags -SRCS := $(wildcard *.cpp) # Get all .cpp files in the current directory -OBJS := $(SRCS:.cpp=.o) # Object files corresponding to the source files +MTE4 := metaeditor.exe +MTE5 := metaeditor64.exe +CFLAGS := -Wall -Wextra -std=c++17 -w +SRCS_CPP := $(wildcard *.cpp) +SRCS_MQ4 := $(wildcard *.mq4) +SRCS_MQ5 := $(wildcard *.mq5) +OBJS_EX4 := $(SRCS_MQ4:.mq4=.ex4) +OBJS_EX5 := $(SRCS_MQ5:.mq5=.ex5) +OBJS_O := $(SRCS_CPP:.cpp=.o) -all: $(OBJS) +# Check if the system is Linux +UNAME_S := $(shell uname -s) +ifeq ($(UNAME_S),Linux) + WINE := wine + # Set WINEPATH to include MetaTrader directory. + export WINEPATH := $(WINEPATH);"C:\Program Files\MetaTrader 4;C:\Program Files\MetaTrader 5" +else + WINE := +endif + +.PHONY: all cpp mql mql4 mql5 + +all: $(OBJS_O) +cpp: $(OBJS_O) +mql4: $(OBJS_EX4) +mql5: $(OBJS_EX5) +mql: mql4 mql5 + +%.ex4: %.mq4 + $(WINE) $(MTE4) /compile:$< /log:CON + +%.ex5: %.mq5 + $(WINE) $(MTE5) /compile:$< /log:CON %.o: %.cpp $(CC) $(CFLAGS) -c $< -o $@ clean: - rm -v $(OBJS) + rm -v $(OBJS_EX4) $(OBJS_EX5) $(OBJS_O)