Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: EA31337/EA31337-indicators-other
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: d37bfc58abfa419944f7a7d1949c3342b941ce88
Choose a base ref
...
head repository: EA31337/EA31337-indicators-other
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 74034db84c20be28ee4a24a1de4f009fb5e4c8af
Choose a head ref
Loading
5 changes: 5 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
Language: Cpp
BasedOnStyle: Google
ColumnLimit: 120
IndentPPDirectives: BeforeHash
169 changes: 131 additions & 38 deletions .github/workflows/compile.yml
Original file line number Diff line number Diff line change
@@ -1,77 +1,170 @@
---
name: Compile

# Setting an environment variable with the value of a configuration variable.
env:
ARTIFACT_PREFIX: ${{ inputs.artifact_prefix || 'mt' }}
# yamllint disable-line rule:line-length
CHECKOUT_BRANCH: ${{ inputs.checkout_branch || github.head_ref || github.ref_name }}
INDI_OTHER_WORKDIR: ${{ vars.INDI_OTHER_WORKDIR || 'indicators-other' }}
REPOSITORY: EA31337/EA31337-indicators-other
SKIP_CLEANUP: ${{ inputs.skip_cleanup || false }}

# yamllint disable-line rule:truthy
on:
pull_request:
branches:
- 'master'
- 'dev*'
- '*dev*'
paths-ignore:
- '*.md'
- '.git*'
push:
branches:
- 'master'
- 'dev*'
- '*dev*'
paths-ignore:
- '*.md'
- '.git*'
workflow_call:
inputs:
artifact_prefix:
default: mt
description: Artifact prefix.
required: false
type: string
checkout_branch:
default: ${{ github.head_ref || github.ref_name }}
description: Checkout branch
required: false
type: string
skip_cleanup:
default: false
description: Whether to skip a clean-up job.
required: false
type: boolean

jobs:
GetList:
outputs:
filelist: ${{ steps.get-files.outputs.filelist }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set output with list of files
id: get-files
run: |
import glob, json, os
files = glob.glob("**/*.mq?")
print("::set-output name=filelist::{}".format(json.dumps(files)))
shell: python
- name: Display output
run: echo ${{ steps.get-files.outputs.filelist }}
Compile:
mt4:
name: Installs platform (4)
uses: EA31337/EA-Tester/.github/workflows/platform-linux.yml@dev
with:
artifact_name: ${{ inputs.artifact_prefix || 'mt' }}4
artifact_overwrite: true
skip_cleanup: true
version: 4

mt5:
name: Installs platform (5)
uses: EA31337/EA-Tester/.github/workflows/platform-linux.yml@dev
with:
artifact_name: ${{ inputs.artifact_prefix || 'mt' }}5
artifact_overwrite: true
skip_cleanup: true
version: 5

compile-platform-indicators:
defaults:
run:
shell: powershell
needs: [GetList]
name: Compile platform indicators
needs: [mt4, mt5]
runs-on: windows-latest
strategy:
matrix:
file: ${{ fromJson(needs.GetList.outputs.filelist) }}
version: [4, 5]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v3
- uses: actions/download-artifact@v4
with:
path: Include/EA31337-classes
ref: v2.012.1
repository: EA31337/EA31337-classes
- name: Compile (build 2361)
uses: fx31337/mql-compile-action@master
name: ${{ env.ARTIFACT_PREFIX }}${{ matrix.version }}
path: .${{ env.ARTIFACT_PREFIX }}${{ matrix.version }}
- name: Compile MQL
uses: fx31337/mql-compile-action@dev
with:
include: .
init-platform: true
mt-version: 5.0.0.2361
path: ${{ matrix.file }}
mt-path: .${{ env.ARTIFACT_PREFIX }}${{ matrix.version }}
# yamllint disable-line rule:line-length
path: .${{ env.ARTIFACT_PREFIX }}${{ matrix.version }}/**/MQL?/Indicators
verbose: true
- name: Compile (build 2515)
if: endsWith(matrix.file, '.mq5')
- name: Copy MQL to the current location
run: >-
Copy-Item
-Path ".${{ env.ARTIFACT_PREFIX }}*\*\*\MQL?"
-Destination .
-Recurse
-Verbose
- name: List all source code files
run: '(Get-ChildItem -Recurse -Path "MQL?" -Include *.mq[45]).fullname'
- name: List compiled files
run: '(Get-ChildItem -Recurse -Path "MQL?" -Include *.ex[45]).fullname'
- name: Upload platform indicators
uses: actions/upload-artifact@v4
with:
if-no-files-found: error
name: ${{ env.ARTIFACT_PREFIX }}-indicators-ex${{ matrix.version }}
path: MQL?/**/*.[me][qx][45h]
- if: ${{ failure() }}
uses: mxschmitt/action-tmate@v3
timeout-minutes: 20

compile-indicators:
defaults:
run:
shell: powershell
name: Compile Indicators
needs: [compile-platform-indicators]
runs-on: windows-latest
strategy:
matrix:
version: [4, 5]
steps:
- uses: actions/checkout@v4
with:
path: ${{ env.INDI_OTHER_WORKDIR }}
ref: ${{ env.CHECKOUT_BRANCH }}
repository: EA31337/EA31337-indicators-other
- uses: actions/checkout@v4
with:
path: MQL${{ matrix.version}}/Include/EA31337-classes
ref: v3.000.2
repository: EA31337/EA31337-classes
- uses: actions/download-artifact@v4
with:
name: ${{ env.ARTIFACT_PREFIX }}${{ matrix.version }}
path: .${{ env.ARTIFACT_PREFIX }}${{ matrix.version }}
- uses: actions/download-artifact@v4
with:
merge-multiple: true
pattern: ${{ env.ARTIFACT_PREFIX }}-indicators-ex?
- name: List all source code files
run: '(Get-ChildItem -Recurse -Path . -Include *.mq[45]).fullname'
- name: List compiled files
run: '(Get-ChildItem -Recurse -Path . -Include *.ex[45]).fullname'
- name: Compile
uses: fx31337/mql-compile-action@master
with:
include: .
init-platform: true
mt-version: 5.0.0.2515
path: ${{ matrix.file }}
include: MQL${{ matrix.version }}
mt-path: .${{ env.ARTIFACT_PREFIX }}${{ matrix.version }}
path: ${{ env.INDI_OTHER_WORKDIR }}/**/*.mq${{ matrix.version }}
verbose: true
- name: List compiled files
run: '(Get-ChildItem -Recurse -Path . -Include *.ex[45]).fullname'
- run: Get-Location
- name: Upload indicator artifacts
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
# yamllint disable-line rule:line-length
name: ${{ env.ARTIFACT_PREFIX }}-indicators-other-ex${{ matrix.version }}
path: ${{ env.INDI_OTHER_WORKDIR }}/**/*.ex[45]
timeout-minutes: 30

cleanup:
if: inputs.skip_cleanup != true
name: Clean-up
needs: [compile-indicators]
runs-on: ubuntu-latest
steps:
- uses: geekyeggo/delete-artifact@v5
with:
name: Indicators-other
path: '**/*.ex?'
name: ${{ env.ARTIFACT_PREFIX }}?
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -5,5 +5,11 @@
*.swp
*~

# Ignores test results in HTML format.
*.htm

# Ignores test result logs.
*.log

# Ignores Finder metadata files on Mac
.DS_Store
36 changes: 36 additions & 0 deletions Misc/ATR_MA_Trend.mq4.todo
Original file line number Diff line number Diff line change
@@ -3,5 +3,41 @@
* Implements strategy's indicator.
*/

#include <EA31337-classes/IndicatorLegacy.h>

#property indicator_chart_window
#property indicator_buffers 4
#property indicator_plots 4
//+----------------------------------------------+
//| Bullish indicator rendering options |
//+----------------------------------------------+
#property indicator_type1 DRAW_LINE
#property indicator_color1 Blue
#property indicator_style1 STYLE_DASHDOTDOT
#property indicator_width1 2
#property indicator_label1 "Upper TrendValue"
//+----------------------------------------------+
//| Bearish indicator rendering options |
//+----------------------------------------------+
#property indicator_type2 DRAW_LINE
#property indicator_color2 MediumVioletRed
#property indicator_style2 STYLE_DASHDOTDOT
#property indicator_width2 2
#property indicator_label2 "Lower TrendValue"
//+----------------------------------------------+
//| Bullish indicator rendering options |
//+----------------------------------------------+
#property indicator_type3 DRAW_ARROW
#property indicator_color3 DeepSkyBlue
#property indicator_width3 4
#property indicator_label3 "Buy TrendValue"
//+----------------------------------------------+
//| Bearish indicator rendering options |
//+----------------------------------------------+
#property indicator_type4 DRAW_ARROW
#property indicator_color4 Red
#property indicator_width4 4
#property indicator_label4 "Sell TrendValue"

// Includes the main file.
#include "ATR_MA_Trend.mq5"
87 changes: 87 additions & 0 deletions Oscillators/Arrows/ATR_MA_Slope.mq4
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
#property indicator_buffers 4
#property indicator_separate_window

extern int NumberOfBars = 100;
extern double SlopeThreshold = 2.0;
extern int SlopeMAPeriod = 7;
extern int SlopeATRPeriod = 50;

extern color SlopeColor = Gray;
extern color LongColor = Lime;
extern color ShortColor = Red;

double Slope[];
double Long[];
double Short[];
double Flat[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init() {
IndicatorShortName(WindowExpertName());

SetIndexBuffer(0, Slope);
SetIndexBuffer(1, Long);
SetIndexBuffer(2, Short);
SetIndexBuffer(3, Flat);

SetIndexStyle(0, DRAW_LINE, STYLE_SOLID, 1, SlopeColor);
SetIndexLabel(0, "Slope");
SetIndexStyle(1, DRAW_ARROW, STYLE_SOLID, 1, LongColor);
SetIndexLabel(1, "Long");
SetIndexArrow(1, 159);
SetIndexStyle(2, DRAW_ARROW, STYLE_SOLID, 1, ShortColor);
SetIndexLabel(2, "Short");
SetIndexArrow(2, 159);
SetIndexStyle(3, DRAW_ARROW, STYLE_SOLID, 1, SlopeColor);
SetIndexLabel(3, "Flat");
SetIndexArrow(3, 159);

#ifdef __MQL4__
SetLevelStyle(STYLE_SOLID, 1, SlopeColor);
SetLevelValue(0, SlopeThreshold * 0.5);
SetLevelValue(1, -SlopeThreshold * 0.5);
#endif

return (INIT_SUCCEEDED);
}

int start() {
int prev_calculated = IndicatorCounted();
int rates_total = Bars;
int limit = MathMin(NumberOfBars, rates_total - prev_calculated);
if (limit == rates_total)
limit--;

for (int shift = limit; shift >= 0; shift--) {
Slope[shift] = 0;

double dblTma, dblPrev;
double atr = iATR(NULL, PERIOD_CURRENT, SlopeATRPeriod, shift + 10) / 10;

if (atr != 0) {
dblTma = iMA(NULL, PERIOD_CURRENT, SlopeMAPeriod, 0, MODE_LWMA,
PRICE_CLOSE, shift);
dblPrev = (iMA(NULL, PERIOD_CURRENT, SlopeMAPeriod, 0, MODE_LWMA,
PRICE_CLOSE, shift + 1) *
231 +
iClose(NULL, (int)PERIOD_CURRENT, shift) * 20) /
251;
Slope[shift] = (dblTma - dblPrev) / atr;
}

Long[shift] = EMPTY_VALUE;
Short[shift] = EMPTY_VALUE;
Flat[shift] = EMPTY_VALUE;

if (Slope[shift] > SlopeThreshold * 0.5)
Long[shift] = Slope[shift];
else if (Slope[shift] < -SlopeThreshold * 0.5)
Short[shift] = Slope[shift];
else
Flat[shift] = Slope[shift];
}

return (0);
}
Loading