Skip to content

Commit

Permalink
Merge pull request #5 from EA31337/dev
Browse files Browse the repository at this point in the history
Final release updates
  • Loading branch information
kenorb authored Feb 22, 2021
2 parents 97e791d + 73e0ee6 commit 2cfd016
Show file tree
Hide file tree
Showing 20 changed files with 591 additions and 187 deletions.
6 changes: 3 additions & 3 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---
Language: Cpp
BasedOnStyle: Google
ColumnLimit: 120
Language: Cpp
BasedOnStyle: Google
ColumnLimit: 120
75 changes: 75 additions & 0 deletions .github/workflows/backtest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
---
name: Backtest

# yamllint disable-line rule:truthy
on:
push:
branches:
- 'v*-backtest'
release:
types:
- published

jobs:

Compile:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: List MQL files
run: '(Get-ChildItem -Recurse -Path . -Include *.mq[45]).fullname'
shell: powershell
- name: Compiles EA (MQL4)
uses: fx31337/mql-compile-action@master
with:
path: src\EA31337-Libre.mq4
verbose: true

- name: Compiles EA (MQL5)
uses: fx31337/mql-compile-action@master
with:
path: src\EA31337-Libre.mq5
verbose: true
- name: List compiled files
run: '(Get-ChildItem -Recurse -Path . -Include *.ex[45]).fullname'

- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: EA
path: 'src/*.ex?'

Backtest:

defaults:
run:
shell: bash

needs: Compile
runs-on: ubuntu-latest

strategy:
matrix:
deposit: [10000, 100000]
spread: [1, 10]
year: [2019]

steps:

- uses: actions/download-artifact@v2
with:
name: EA

- name: Test ${{ matrix.year }}.${{ matrix.month }}
uses: fx31337/mql-tester-action@master
with:
BtDeposit: ${{ matrix.deposit }}
BtDigits: 5
BtMonths: 1-12
BtSpread: ${{ matrix.spread }}
BtYears: ${{ matrix.year }}
RunOnWarning: 'show_logs && parse_results $@'
TestExpert: EA31337-Libre
TestPeriod: M1
32 changes: 17 additions & 15 deletions .github/workflows/compile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,41 +4,43 @@ name: Compile
# yamllint disable-line rule:truthy
on:
pull_request:
paths:
- '**.mq?'
- '.github/workflows/compile.yml'
- 'src/include/**'
paths-ignore:
- '**.md'
push:
paths:
- '**.mq?'
- '.github/workflows/compile.yml'
- 'src/include/**'
paths-ignore:
- '**.md'

jobs:
Compile:
defaults:
run:
shell: bash
shell: powershell
working-directory: src
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v2
with:
submodules: recursive
- name: List MQL files
run: '(Get-ChildItem -Recurse -Path . -Include *.mq[45]).fullname'
shell: powershell
- name: Compile for MQL4
- name: Compiles EA (MQL4)
uses: fx31337/mql-compile-action@master
with:
path: src\EA31337-Libre.mq4
include: src
mt-version: 5.0.0.2361
verbose: true
- name: Compile for MQL5

- name: Compiles EA (MQL5)
uses: fx31337/mql-compile-action@master
with:
path: src\EA31337-Libre.mq5
include: src
mt-version: 5.0.0.2515
verbose: true
- name: List compiled files
run: '(Get-ChildItem -Recurse -Path . -Include *.ex[45]).fullname'

- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: EA31337-${{ matrix.mode }}
path: 'src/*.ex?'
137 changes: 137 additions & 0 deletions .github/workflows/optimize-strats.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
---
name: Optimize Strategies

# yamllint disable-line rule:truthy
on:
push:
branches:
- 'optimize-strats'

jobs:
Compile:
defaults:
run:
shell: powershell
working-directory: src
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v2
with:
submodules: recursive
- name: List MQL files
run: '(Get-ChildItem -Recurse -Path . -Include *.mq[45]).fullname'
shell: powershell
- name: Compile for MQL4
uses: fx31337/mql-compile-action@master
with:
path: src\EA31337-Libre.mq4
include: src
mt-version: 4.0.0.1320
verbose: true
- name: Compile for MQL5
uses: fx31337/mql-compile-action@master
with:
path: src\EA31337-Libre.mq5
include: src
mt-version: 5.0.0.2766
verbose: true
- name: List compiled files
run: '(Get-ChildItem -Recurse -Path . -Include *.ex[45]).fullname'
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: EA
path: 'src/*.ex?'
Process:
env:
SETS_DIR: sets/optimize/strategies
outputs:
sets-list: ${{ steps.get-sets.outputs.sets }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set output with list of sets
id: get-sets
run: |
import glob, json, os
os.chdir(os.getenv('SETS_DIR'))
files = glob.glob("*.set")
print("::set-output name=sets::{}".format(json.dumps(files)))
shell: python
- name: Display output
run: echo ${{ steps.get-sets.outputs.sets }}
- name: Upload sets
uses: actions/upload-artifact@v2
with:
name: sets
path: ${{ env.SETS_DIR }}
Optimize:
needs: [Compile, Process]
runs-on: ubuntu-latest
strategy:
matrix:
setfile: ${{ fromJson(needs.Process.outputs.sets-list) }}
steps:
- uses: actions/download-artifact@v2
with:
path: .
- name: Display SET file
run: cat sets/${{ matrix.setfile }}
- uses: ea31337/mql-tester-action@master
with:
BtDeposit: 100000
BtDest: ${{ github.workspace }}/_results
BtMonths: 11-12
BtPair: EURUSD
BtYears: 2019
OptFormatBrief: true
OptFormatJson: true
OptOptimize: true
OptVerbose: true
SetFile: ${{ github.workspace }}/sets/${{ matrix.setfile }}
SetParams: ${{ steps.data.outputs.param }}
TestExpert: "EA31337-Libre"
TestPeriod: M1
TestReportName: Report
- name: Upload result files
uses: actions/upload-artifact@v2
with:
name: results
path: ./_results/*.*
- name: Process results
run: |
pwd
ls
jq --version
jq . _results/*.json
jq -r '(."Result params"/";")[0]' _results/*.json
jq -r '((."Result params"/";")[0]/"=")[0]'
jq -r '(."Result params"/";")[0]' _results/*.json \
>> $GITHUB_ENV
jq -r '"pname="+((."Result params"/";")[0]/"=")[0]' \
_results/*.json >> $GITHUB_ENV
Results:
needs: Optimize
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
persist-credentials: false
# Otherwise, you will failed to push refs to dest repo.
fetch-depth: 0
- uses: actions/download-artifact@v2
with:
name: results
path: .results
- name: Parse results
run: |
cat << EOF >> $GITHUB_ENV
RES_DD=$(jq -rs '.[0]|."Drawdown %"' .results/*.json)
RES_PF=$(jq -rs '.[0]|."Profit factor"' .results/*.json)
RES_TT=$(jq -rs '.[0]|."Total trades"' .results/*.json)
EOF
shell: bash -ex {0}
- name: Check differences
id: git-details
run: echo "::set-output name=changed::$(git diff | wc -l)"
88 changes: 88 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
---
name: Test

# yamllint disable-line rule:truthy
on:
pull_request:
paths:
- '**.h'
- '**.mq?'
- .github/workflows/test.yml
- src/*.mq?
- src/*.mq[45h]
- src/include/**
push:
paths:
- '**.h'
- '**.mq?'
- .github/workflows/test.yml
- src/*.mq?
- src/*.mq[45h]
- src/include/**

jobs:

Compile:
defaults:
run:
shell: powershell
working-directory: src
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v2
with:
submodules: recursive
- name: List MQL files
run: '(Get-ChildItem -Recurse -Path . -Include *.mq[45]).fullname'
shell: powershell
- name: Compiles EA (MQL4)
uses: fx31337/mql-compile-action@master
with:
path: src\EA31337-Libre.mq4
verbose: true

- name: Compiles EA (MQL5)
uses: fx31337/mql-compile-action@master
with:
path: src\EA31337-Libre.mq5
verbose: true
- name: List compiled files
run: '(Get-ChildItem -Recurse -Path . -Include *.ex[45]).fullname'

- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: EA
path: 'src/*.ex?'

Test:

defaults:
run:
shell: bash

needs: Compile
runs-on: ubuntu-latest

strategy:
matrix:
month: [1, 2]
year: [2019]

steps:

- uses: actions/download-artifact@v2
with:
name: EA

- name: Test ${{ matrix.year }}.${{ matrix.month }}
uses: fx31337/mql-tester-action@master
with:
BtDeposit: 10000
BtDigits: 5
BtMonths: ${{ matrix.month }}
BtYears: ${{ matrix.year }}
RunOnWarning: 'show_logs && parse_results $@'
TestExpert: EA31337-Libre
TestPeriod: M1
8 changes: 4 additions & 4 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[submodule "EA31337-classes"]
path = src/include/EA31337-classes
[submodule "classes"]
path = src/include/classes
url = https://github.com/EA31337/EA31337-classes
[submodule "EA31337-strategies"]
path = src/include/EA31337-strategies
[submodule "strategies"]
path = src/include/strategies
url = https://github.com/EA31337/EA31337-strategies
Loading

0 comments on commit 2cfd016

Please sign in to comment.