Skip to content

Commit

Permalink
Merge branch 'v3.001-dev-new-cgava' into v3.003-dev-new
Browse files Browse the repository at this point in the history
* v3.001-dev-new-cgava:
  GHA: Compile: Support for workflow calls
  Trade: TradeSignalEnumMacro: Fixes includes to use local path
  Moves enum macros into the main file and fixes compilation errors
  Adds a wrapper file for TradeSignalEnumMacro
  Renames TradeEnumMacro.mq4 to TradeSignalEnumMacro.test.mq5
  CGA(Trade): proposal for macor based computation of SIGNAL BUY/SELL CLOSE/BUY composite signal
  GHA: Compile: Skips clean-up by default
  Adds EA31337.vscode-mql-tools extension
  Fixes new lines [end-of-file-fixer]
  Disables wine package
  devcontainer: Adds node
  Adds wine to devcontainer
  Adds DavidAnson.vscode-markdownlint extension to devcontainer
  Adds initial .vscode/settings.json
  • Loading branch information
kenorb committed Apr 25, 2024
2 parents 5e57d6c + d4d8f50 commit 24ff2f4
Show file tree
Hide file tree
Showing 5 changed files with 119 additions and 3 deletions.
9 changes: 6 additions & 3 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
"customizations": {
"vscode": {
"extensions": [
"L-I-V.mql-tools",
"ms-vscode.cpptools",
"vscodevim.vim"
"vscodevim.vim",
"DavidAnson.vscode-markdownlint",
"EA31337.vscode-mql-tools"
],
}
},
Expand All @@ -18,7 +19,9 @@
"ghcr.io/guiyomh/features/vim:0": {},
"ghcr.io/jungaretti/features/make:1": {},
"ghcr.io/prulloac/devcontainer-features/pre-commit:1": {},
"ghcr.io/hspaans/devcontainer-features/ansible-lint:1": {}
"ghcr.io/hspaans/devcontainer-features/ansible-lint:1": {},
// "ghcr.io/maks1ms/devcontainers-features/wine:0": {},
"ghcr.io/devcontainers-contrib/features/node-asdf:0": {}
},
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/base:jammy",
Expand Down
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"files.associations": {
"indicatorcandle.h": "c"
}
}
7 changes: 7 additions & 0 deletions Trade/TradeSignal.struct.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@
#define SIGNAL_OPEN_TIME_FILTER STRUCT_ENUM(TradeSignalEntry, TRADE_SIGNAL_FLAG_OPEN_TIME_FILTER)
#define SIGNAL_OPEN_UPWARDS STRUCT_ENUM(TradeSignalEntry, TRADE_SIGNAL_FLAG_OPEN_UPWARDS)

// All the following macro return true if the main signal is activated
// AND the filter is not activated AND the time filter is not activated.
#define TRADE_SIGNAL_IS_CLOSE_BUY(x) (((x & SIGNAL_CLOSE_BUY_MAIN) != 0) && !(x & (SIGNAL_CLOSE_BUY_FILTER | SIGNAL_CLOSE_TIME_FILTER)))
#define TRADE_SIGNAL_IS_CLOSE_SELL(x) (((x & SIGNAL_CLOSE_SELL_MAIN) != 0) && !(x & (SIGNAL_CLOSE_SELL_FILTER | SIGNAL_CLOSE_TIME_FILTER)))
#define TRADE_SIGNAL_IS_OPEN_BUY(x) (((x & SIGNAL_OPEN_BUY_MAIN) != 0) && !(x & (SIGNAL_OPEN_BUY_FILTER | SIGNAL_OPEN_TIME_FILTER)))
#define TRADE_SIGNAL_IS_OPEN_SELL(x) (((x & SIGNAL_OPEN_SELL_MAIN) != 0) && !(x & (SIGNAL_OPEN_SELL_FILTER | SIGNAL_OPEN_TIME_FILTER)))

// Structure for a trade signal.
struct TradeSignalEntry {
protected:
Expand Down
28 changes: 28 additions & 0 deletions Trade/tests/TradeSignalEnumMacro.test.mq4
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
//+------------------------------------------------------------------+
//| EA31337 framework |
//| Copyright 2016-2021, 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/>.
*/

/**
* @file
* Test functionality of TradeSignal class.
*/

// Includes.
#include "TradeSignalEnumMacro.test.mq5"
73 changes: 73 additions & 0 deletions Trade/tests/TradeSignalEnumMacro.test.mq5
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
//+------------------------------------------------------------------+
//| EA31337 framework |
//| Copyright 2016-2021, 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 "../../Test.mqh"
#include "../TradeSignal.struct.h"

int testEnum(){
uint s;

s = SIGNAL_CLOSE_BUY_MAIN | 0 | 0 ; assertTrueOrFail(TRADE_SIGNAL_IS_CLOSE_BUY(s)==true ,"Fail!");
s = SIGNAL_CLOSE_BUY_MAIN | SIGNAL_CLOSE_BUY_FILTER | 0 ; assertTrueOrFail(TRADE_SIGNAL_IS_CLOSE_BUY(s)==false,"Fail!");
s = SIGNAL_CLOSE_BUY_MAIN | 0 | SIGNAL_CLOSE_TIME_FILTER ; assertTrueOrFail(TRADE_SIGNAL_IS_CLOSE_BUY(s)==false,"Fail!");
s = SIGNAL_CLOSE_BUY_MAIN | SIGNAL_CLOSE_BUY_FILTER | SIGNAL_CLOSE_TIME_FILTER ; assertTrueOrFail(TRADE_SIGNAL_IS_CLOSE_BUY(s)==false,"Fail!");
s = 0 | 0 | 0 ; assertTrueOrFail(TRADE_SIGNAL_IS_CLOSE_BUY(s)==false,"Fail!");
s = 0 | SIGNAL_CLOSE_BUY_FILTER | 0 ; assertTrueOrFail(TRADE_SIGNAL_IS_CLOSE_BUY(s)==false,"Fail!");
s = 0 | 0 | SIGNAL_CLOSE_TIME_FILTER ; assertTrueOrFail(TRADE_SIGNAL_IS_CLOSE_BUY(s)==false,"Fail!");
s = 0 | SIGNAL_CLOSE_BUY_FILTER | SIGNAL_CLOSE_TIME_FILTER ; assertTrueOrFail(TRADE_SIGNAL_IS_CLOSE_BUY(s)==false,"Fail!");

s = SIGNAL_CLOSE_SELL_MAIN | 0 | 0 ; assertTrueOrFail(TRADE_SIGNAL_IS_CLOSE_SELL(s)==true ,"Fail!");
s = SIGNAL_CLOSE_SELL_MAIN | SIGNAL_CLOSE_SELL_FILTER| 0 ; assertTrueOrFail(TRADE_SIGNAL_IS_CLOSE_SELL(s)==false,"Fail!");
s = SIGNAL_CLOSE_SELL_MAIN | 0 | SIGNAL_CLOSE_TIME_FILTER ; assertTrueOrFail(TRADE_SIGNAL_IS_CLOSE_SELL(s)==false,"Fail!");
s = SIGNAL_CLOSE_SELL_MAIN | SIGNAL_CLOSE_SELL_FILTER | SIGNAL_CLOSE_TIME_FILTER ; assertTrueOrFail(TRADE_SIGNAL_IS_CLOSE_SELL(s)==false,"Fail!");
s = 0 | 0 | 0 ; assertTrueOrFail(TRADE_SIGNAL_IS_CLOSE_SELL(s)==false,"Fail!");
s = 0 | SIGNAL_CLOSE_SELL_FILTER| 0 ; assertTrueOrFail(TRADE_SIGNAL_IS_CLOSE_SELL(s)==false,"Fail!");
s = 0 | 0 | SIGNAL_CLOSE_TIME_FILTER ; assertTrueOrFail(TRADE_SIGNAL_IS_CLOSE_SELL(s)==false,"Fail!");
s = 0 | SIGNAL_CLOSE_SELL_FILTER | SIGNAL_CLOSE_TIME_FILTER ; assertTrueOrFail(TRADE_SIGNAL_IS_CLOSE_SELL(s)==false,"Fail!");


s = SIGNAL_OPEN_BUY_MAIN | 0 | 0 ; assertTrueOrFail(TRADE_SIGNAL_IS_OPEN_BUY(s)==true ,"Fail!");
s = SIGNAL_OPEN_BUY_MAIN | SIGNAL_OPEN_BUY_FILTER | 0 ; assertTrueOrFail(TRADE_SIGNAL_IS_OPEN_BUY(s)==false,"Fail!");
s = SIGNAL_OPEN_BUY_MAIN | 0 | SIGNAL_OPEN_TIME_FILTER ; assertTrueOrFail(TRADE_SIGNAL_IS_OPEN_BUY(s)==false,"Fail!");
s = SIGNAL_OPEN_BUY_MAIN | SIGNAL_OPEN_BUY_FILTER | SIGNAL_OPEN_TIME_FILTER ; assertTrueOrFail(TRADE_SIGNAL_IS_OPEN_BUY(s)==false,"Fail!");
s = 0 | 0 | 0 ; assertTrueOrFail(TRADE_SIGNAL_IS_OPEN_BUY(s)==false,"Fail!");
s = 0 | SIGNAL_OPEN_BUY_FILTER | 0 ; assertTrueOrFail(TRADE_SIGNAL_IS_OPEN_BUY(s)==false,"Fail!");
s = 0 | 0 | SIGNAL_OPEN_TIME_FILTER ; assertTrueOrFail(TRADE_SIGNAL_IS_OPEN_BUY(s)==false,"Fail!");
s = 0 | SIGNAL_OPEN_BUY_FILTER | SIGNAL_OPEN_TIME_FILTER ; assertTrueOrFail(TRADE_SIGNAL_IS_OPEN_BUY(s)==false,"Fail!");

s = SIGNAL_OPEN_SELL_MAIN | 0 | 0 ; assertTrueOrFail(TRADE_SIGNAL_IS_OPEN_SELL(s)==true ,"Fail!");
s = SIGNAL_OPEN_SELL_MAIN | SIGNAL_OPEN_SELL_FILTER | 0 ; assertTrueOrFail(TRADE_SIGNAL_IS_OPEN_SELL(s)==false,"Fail!");
s = SIGNAL_OPEN_SELL_MAIN | 0 | SIGNAL_OPEN_TIME_FILTER ; assertTrueOrFail(TRADE_SIGNAL_IS_OPEN_SELL(s)==false,"Fail!");
s = SIGNAL_OPEN_SELL_MAIN | SIGNAL_OPEN_SELL_FILTER | SIGNAL_OPEN_TIME_FILTER ; assertTrueOrFail(TRADE_SIGNAL_IS_OPEN_SELL(s)==false,"Fail!");
s = 0 | 0 | 0 ; assertTrueOrFail(TRADE_SIGNAL_IS_OPEN_SELL(s)==false,"Fail!");
s = 0 | SIGNAL_OPEN_SELL_FILTER | 0 ; assertTrueOrFail(TRADE_SIGNAL_IS_OPEN_SELL(s)==false,"Fail!");
s = 0 | 0 | SIGNAL_OPEN_TIME_FILTER ; assertTrueOrFail(TRADE_SIGNAL_IS_OPEN_SELL(s)==false,"Fail!");
s = 0 | SIGNAL_OPEN_SELL_FILTER | SIGNAL_OPEN_TIME_FILTER ; assertTrueOrFail(TRADE_SIGNAL_IS_OPEN_SELL(s)==false,"Fail!");
return INIT_SUCCEEDED;
}

/**
* Implements OnInit().
*/
int OnInit() {
return testEnum();
}

0 comments on commit 24ff2f4

Please sign in to comment.