From e0ba0f914fc59538830929b0d6ae7bf5fd398829 Mon Sep 17 00:00:00 2001 From: kenorb Date: Sat, 26 Aug 2023 20:35:58 +0100 Subject: [PATCH 01/30] Adds README for multi-value indicators --- Oscillators/Multi/README.md | 26 +++++++++++++++++++ Oscillators/{ => Multi}/TDI-RT-Clone.mq4 | 0 Oscillators/{ => Multi}/TDI-RT-Clone.mq5 | 0 .../{ => Multi}/Traders Dynamic Index.mq4 | 0 .../{ => Multi}/Traders Dynamic Index.mq5 | 0 Oscillators/README.md | 8 ------ 6 files changed, 26 insertions(+), 8 deletions(-) create mode 100644 Oscillators/Multi/README.md rename Oscillators/{ => Multi}/TDI-RT-Clone.mq4 (100%) rename Oscillators/{ => Multi}/TDI-RT-Clone.mq5 (100%) rename Oscillators/{ => Multi}/Traders Dynamic Index.mq4 (100%) rename Oscillators/{ => Multi}/Traders Dynamic Index.mq5 (100%) diff --git a/Oscillators/Multi/README.md b/Oscillators/Multi/README.md new file mode 100644 index 0000000..0205560 --- /dev/null +++ b/Oscillators/Multi/README.md @@ -0,0 +1,26 @@ +# Oscillator multi-value indicators + +Multi-value oscillators, often referred to as "multi-line" or "multi-buffer" +oscillators, are a variation of traditional oscillators used in technical +analysis. While traditional oscillators like the RSI or Stochastic oscillator +generate a single line that oscillates within a specific range, +multi-value oscillators plot multiple lines +or buffers on a histogram-like chart. + +These additional lines on the histogram provide traders and analysts with +more information and insights into the price movement and momentum of an +asset. Each line represents a different aspect of price behavior, allowing +for a more comprehensive analysis of market conditions. + +The interaction and relationship between these multiple lines can offer +valuable signals and indications of potential market trends, reversals, or +momentum shifts. Traders often look for crossovers, divergences, and +patterns among the lines to make more informed trading decisions. + +## TDI (Traders Dynamic Index) + +The Traders Dynamic Index (TDI) is a versatile trading indicator designed to +aid traders in analyzing market conditions related to trend direction, market +strength, and volatility. It combines RSI, Moving Averages, and volatility +bands to offer insights into trend direction, market strength, and volatility +which gives comprehensive overview of the market's behavior. diff --git a/Oscillators/TDI-RT-Clone.mq4 b/Oscillators/Multi/TDI-RT-Clone.mq4 similarity index 100% rename from Oscillators/TDI-RT-Clone.mq4 rename to Oscillators/Multi/TDI-RT-Clone.mq4 diff --git a/Oscillators/TDI-RT-Clone.mq5 b/Oscillators/Multi/TDI-RT-Clone.mq5 similarity index 100% rename from Oscillators/TDI-RT-Clone.mq5 rename to Oscillators/Multi/TDI-RT-Clone.mq5 diff --git a/Oscillators/Traders Dynamic Index.mq4 b/Oscillators/Multi/Traders Dynamic Index.mq4 similarity index 100% rename from Oscillators/Traders Dynamic Index.mq4 rename to Oscillators/Multi/Traders Dynamic Index.mq4 diff --git a/Oscillators/Traders Dynamic Index.mq5 b/Oscillators/Multi/Traders Dynamic Index.mq5 similarity index 100% rename from Oscillators/Traders Dynamic Index.mq5 rename to Oscillators/Multi/Traders Dynamic Index.mq5 diff --git a/Oscillators/README.md b/Oscillators/README.md index b56bfad..13a7437 100644 --- a/Oscillators/README.md +++ b/Oscillators/README.md @@ -28,11 +28,3 @@ In summary, oscillators are a type of indicator used in technical analysis that measure price momentum and provide insights into overbought or oversold conditions. They are considered a subset of indicators due to their specific function and characteristics. - -## TDI (Traders Dynamic Index) - -The Traders Dynamic Index (TDI) is a versatile trading indicator designed to -aid traders in analyzing market conditions related to trend direction, market -strength, and volatility. It combines RSI, Moving Averages, and volatility -bands to offer insights into trend direction, market strength, and volatility -which gives comprehensive overview of the market's behavior. From 4ab6544263b7396905cb011eba97135be19d9e6e Mon Sep 17 00:00:00 2001 From: kenorb Date: Sat, 26 Aug 2023 20:39:12 +0100 Subject: [PATCH 02/30] Renames some oscillators to multi-value sub-category --- .../{ => Multi}/Elliott_Wave_Oscillator2.mq4 | 0 .../{ => Multi}/Elliott_Wave_Oscillator2.mq5 | 0 Oscillators/{ => Multi}/SVE_Bollinger_Bands.mq4 | 0 Oscillators/{ => Multi}/SVE_Bollinger_Bands.mq5 | 0 Oscillators/{ => Multi}/SuperSlope.mq4 | 0 Oscillators/{ => Multi}/SuperSlope.mq5.fixme | 0 enum.h | 14 +++++++------- 7 files changed, 7 insertions(+), 7 deletions(-) rename Oscillators/{ => Multi}/Elliott_Wave_Oscillator2.mq4 (100%) rename Oscillators/{ => Multi}/Elliott_Wave_Oscillator2.mq5 (100%) rename Oscillators/{ => Multi}/SVE_Bollinger_Bands.mq4 (100%) rename Oscillators/{ => Multi}/SVE_Bollinger_Bands.mq5 (100%) rename Oscillators/{ => Multi}/SuperSlope.mq4 (100%) rename Oscillators/{ => Multi}/SuperSlope.mq5.fixme (100%) diff --git a/Oscillators/Elliott_Wave_Oscillator2.mq4 b/Oscillators/Multi/Elliott_Wave_Oscillator2.mq4 similarity index 100% rename from Oscillators/Elliott_Wave_Oscillator2.mq4 rename to Oscillators/Multi/Elliott_Wave_Oscillator2.mq4 diff --git a/Oscillators/Elliott_Wave_Oscillator2.mq5 b/Oscillators/Multi/Elliott_Wave_Oscillator2.mq5 similarity index 100% rename from Oscillators/Elliott_Wave_Oscillator2.mq5 rename to Oscillators/Multi/Elliott_Wave_Oscillator2.mq5 diff --git a/Oscillators/SVE_Bollinger_Bands.mq4 b/Oscillators/Multi/SVE_Bollinger_Bands.mq4 similarity index 100% rename from Oscillators/SVE_Bollinger_Bands.mq4 rename to Oscillators/Multi/SVE_Bollinger_Bands.mq4 diff --git a/Oscillators/SVE_Bollinger_Bands.mq5 b/Oscillators/Multi/SVE_Bollinger_Bands.mq5 similarity index 100% rename from Oscillators/SVE_Bollinger_Bands.mq5 rename to Oscillators/Multi/SVE_Bollinger_Bands.mq5 diff --git a/Oscillators/SuperSlope.mq4 b/Oscillators/Multi/SuperSlope.mq4 similarity index 100% rename from Oscillators/SuperSlope.mq4 rename to Oscillators/Multi/SuperSlope.mq4 diff --git a/Oscillators/SuperSlope.mq5.fixme b/Oscillators/Multi/SuperSlope.mq5.fixme similarity index 100% rename from Oscillators/SuperSlope.mq5.fixme rename to Oscillators/Multi/SuperSlope.mq5.fixme diff --git a/enum.h b/enum.h index ff73a76..0488ff6 100644 --- a/enum.h +++ b/enum.h @@ -22,13 +22,13 @@ #ifndef ENUM_INDICATOR_OTHER_DEFINED // Defines enum with supported indicator list. enum ENUM_INDICATOR_OTHER { - INDI_OTHER_0_NONE = 0, // (None) - INDI_OTHER_MISC_ATR_MA_TREND, // Misc: ATR MA Trend - INDI_OTHER_OSC_SUPERSLOPE, // Oscillator: Super Slope - INDI_OTHER_OSC_TDI, // Oscillator: TDI (Traders Dynamic Index) - INDI_OTHER_OSC_TDI_RT_CLONE, // Oscillator: TDI-RT-Clone - INDI_OTHER_OSC_TMA_CG, // Oscillator: TMA CG - INDI_OTHER_PRICE_EWO2, // Oscillator: Elliott Wave Oscillator 2 + INDI_OTHER_0_NONE = 0, // (None) + INDI_OTHER_MISC_ATR_MA_TREND, // Misc: ATR MA Trend + INDI_OTHER_OSC_SUPERSLOPE, // Oscillator: Super Slope + INDI_OTHER_OSC_MULTI_EWO2, // Oscillator: Elliott Wave Oscillator 2 + INDI_OTHER_OSC_MULTI_TDI, // Oscillator: TDI (Traders Dynamic Index) + INDI_OTHER_OSC_MULTI_TDI_RT_CLONE, // Oscillator: TDI-RT-Clone + INDI_OTHER_OSC_MULTI_TMA_CG, // Oscillator: TMA CG INDI_OTHER_PRICE_MULTI_OHLC_HA_SMOOTHED, // Price/Range: SVE Bollinger Bands INDI_OTHER_PRICE_RANGE_SVE_BB, // Price/Range: SVE Bollinger Bands }; From 76f02848b7a5a180a11645fb346044cfcc0a2614 Mon Sep 17 00:00:00 2001 From: kenorb Date: Sat, 26 Aug 2023 21:48:11 +0100 Subject: [PATCH 03/30] Renames TDI int shorter name to fit as resource name --- Oscillators/Multi/{Traders Dynamic Index.mq4 => TDI.mq4} | 0 Oscillators/Multi/{Traders Dynamic Index.mq5 => TDI.mq5} | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename Oscillators/Multi/{Traders Dynamic Index.mq4 => TDI.mq4} (100%) rename Oscillators/Multi/{Traders Dynamic Index.mq5 => TDI.mq5} (97%) diff --git a/Oscillators/Multi/Traders Dynamic Index.mq4 b/Oscillators/Multi/TDI.mq4 similarity index 100% rename from Oscillators/Multi/Traders Dynamic Index.mq4 rename to Oscillators/Multi/TDI.mq4 diff --git a/Oscillators/Multi/Traders Dynamic Index.mq5 b/Oscillators/Multi/TDI.mq5 similarity index 97% rename from Oscillators/Multi/Traders Dynamic Index.mq5 rename to Oscillators/Multi/TDI.mq5 index 45ad00a..68a7fc3 100644 --- a/Oscillators/Multi/Traders Dynamic Index.mq5 +++ b/Oscillators/Multi/TDI.mq5 @@ -35,7 +35,7 @@ #define TimeDayOfWeek (DateTime::DateOfWeek()) // Includes the main file. -#include "Traders Dynamic Index.mq4" +#include "TDI.mq4" // Custom indicator initialization function. void OnInit() { From bf4882764352e84f6b157bb8dbcccfba4fefb7b5 Mon Sep 17 00:00:00 2001 From: kenorb Date: Wed, 13 Sep 2023 00:53:24 +0100 Subject: [PATCH 04/30] GHA: Adds workflow_call Refs: https://docs.github.com/en/actions/using-workflows/reusing-workflows --- .github/workflows/compile.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/compile.yml b/.github/workflows/compile.yml index ca47653..a736754 100644 --- a/.github/workflows/compile.yml +++ b/.github/workflows/compile.yml @@ -17,6 +17,7 @@ on: paths-ignore: - '*.md' - '.git*' + workflow_call: jobs: GetList: From 703730c48bfc00865d2537ac5ffd9c31f371d8d5 Mon Sep 17 00:00:00 2001 From: kenorb Date: Wed, 4 Oct 2023 21:39:12 +0100 Subject: [PATCH 05/30] SuperTrend: Adds properties for MQL4 --- Price/SuperTrend.mq4 | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Price/SuperTrend.mq4 b/Price/SuperTrend.mq4 index b43dee1..b247d7e 100644 --- a/Price/SuperTrend.mq4 +++ b/Price/SuperTrend.mq4 @@ -5,6 +5,17 @@ * @fixme */ +#property indicator_chart_window +#property indicator_buffers 4 +#property indicator_plots 1 +#property indicator_label1 "SuperTrend" +#property indicator_type1 DRAW_LINE +#property indicator_color1 clrGreen +#property indicator_color2 clrRed +#property indicator_color3 clrDarkGray +#property indicator_style1 STYLE_SOLID +#property indicator_width1 2 + // Includes EA31337 framework. //#include From 0a54c867d284841fbf15c27ed80d1e8e8055f505 Mon Sep 17 00:00:00 2001 From: kenorb Date: Wed, 4 Oct 2023 21:59:18 +0100 Subject: [PATCH 06/30] SuperTrend: Adds OnCalculate() --- Price/SuperTrend.mq4 | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/Price/SuperTrend.mq4 b/Price/SuperTrend.mq4 index b247d7e..f0a7b56 100644 --- a/Price/SuperTrend.mq4 +++ b/Price/SuperTrend.mq4 @@ -7,22 +7,33 @@ #property indicator_chart_window #property indicator_buffers 4 -#property indicator_plots 1 -#property indicator_label1 "SuperTrend" -#property indicator_type1 DRAW_LINE -#property indicator_color1 clrGreen -#property indicator_color2 clrRed -#property indicator_color3 clrDarkGray -#property indicator_style1 STYLE_SOLID -#property indicator_width1 2 +#property indicator_plots 1 +#property indicator_label1 "SuperTrend" +#property indicator_type1 DRAW_LINE +#property indicator_color1 clrGreen +#property indicator_color2 clrRed +#property indicator_color3 clrDarkGray +#property indicator_style1 STYLE_SOLID +#property indicator_width1 2 // Includes EA31337 framework. -//#include +// #include // Includes. -//#include "SuperTrend.mq5" +// #include "SuperTrend.mq5" // Custom indicator initialization function. void OnInit() { // @fixme } + +// Custom indicator iteration function. +int OnCalculate(const int rates_total, const int prev_calculated, const datetime &time[], const double &open[], + const double &high[], const double &low[], const double &close[], const long &tick_volume[], + const long &volume[], const int &spread[]) { + int start = rates_total - prev_calculated; + + // @todo: Call OnCalculate() in .mq5 file. + + return (rates_total); +} \ No newline at end of file From 4b1434792d6d2c6744e4653095942d5064fa7212 Mon Sep 17 00:00:00 2001 From: kenorb Date: Tue, 24 Oct 2023 23:02:00 +0100 Subject: [PATCH 07/30] GHA: Compile: Clarify repository when calling workflow externally --- .github/workflows/compile.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/compile.yml b/.github/workflows/compile.yml index a736754..264b931 100644 --- a/.github/workflows/compile.yml +++ b/.github/workflows/compile.yml @@ -26,6 +26,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 + with: + repository: EA31337/EA31337-indicators-other - name: Set output with list of files id: get-files run: | @@ -49,6 +51,8 @@ jobs: file: ${{ fromJson(needs.GetList.outputs.filelist) }} steps: - uses: actions/checkout@v3 + with: + repository: EA31337/EA31337-indicators-other - uses: actions/checkout@v3 with: path: Include/EA31337-classes From dc15c77a83ffdec0d185c334d6c19512e5331dbb Mon Sep 17 00:00:00 2001 From: kenorb Date: Tue, 24 Oct 2023 23:06:41 +0100 Subject: [PATCH 08/30] Fixes newline at end of file --- Price/SuperTrend.mq4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Price/SuperTrend.mq4 b/Price/SuperTrend.mq4 index f0a7b56..c1181b8 100644 --- a/Price/SuperTrend.mq4 +++ b/Price/SuperTrend.mq4 @@ -36,4 +36,4 @@ int OnCalculate(const int rates_total, const int prev_calculated, const datetime // @todo: Call OnCalculate() in .mq5 file. return (rates_total); -} \ No newline at end of file +} From 5c3ce59aa1ef0a92dfbb3cd9ea29a99ae79d50c5 Mon Sep 17 00:00:00 2001 From: kenorb Date: Wed, 25 Oct 2023 16:21:45 +0100 Subject: [PATCH 09/30] GHA: Specifies the current branch --- .github/workflows/compile.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/compile.yml b/.github/workflows/compile.yml index 264b931..3f83d80 100644 --- a/.github/workflows/compile.yml +++ b/.github/workflows/compile.yml @@ -52,6 +52,7 @@ jobs: steps: - uses: actions/checkout@v3 with: + ref: ${{ github.head_ref || github.ref_name }} repository: EA31337/EA31337-indicators-other - uses: actions/checkout@v3 with: From 8f8b7ce94c8b4552f0ec98256c29396cfacbd776 Mon Sep 17 00:00:00 2001 From: kenorb Date: Wed, 25 Oct 2023 18:18:04 +0100 Subject: [PATCH 10/30] GHA: Uploads .ex[45] files only --- .github/workflows/compile.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/compile.yml b/.github/workflows/compile.yml index 3f83d80..3b31e69 100644 --- a/.github/workflows/compile.yml +++ b/.github/workflows/compile.yml @@ -82,5 +82,5 @@ jobs: - name: Upload indicator artifacts uses: actions/upload-artifact@v3 with: - name: Indicators-other - path: '**/*.ex?' + name: indicators-other + path: '**/*.ex[45]' From 7fe060076cc886fde4ff00a41c0a6a4f69091d5c Mon Sep 17 00:00:00 2001 From: kenorb Date: Thu, 26 Oct 2023 01:14:36 +0100 Subject: [PATCH 11/30] Improves Compile workflow without matrix --- .github/workflows/compile.yml | 35 +++++++---------------------------- 1 file changed, 7 insertions(+), 28 deletions(-) diff --git a/.github/workflows/compile.yml b/.github/workflows/compile.yml index 3b31e69..3027123 100644 --- a/.github/workflows/compile.yml +++ b/.github/workflows/compile.yml @@ -19,39 +19,19 @@ on: - '.git*' workflow_call: +env: + INDI_WORK_DIR: indicators-other + jobs: - GetList: - outputs: - filelist: ${{ steps.get-files.outputs.filelist }} - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - repository: EA31337/EA31337-indicators-other - - name: Set output with list of files - id: get-files - run: | - import glob, json, os - fghout = os.environ["GITHUB_OUTPUT"] - files = glob.glob("**/*.mq?", recursive=True) - filelist = "filelist={}".format(json.dumps(files)) - with open(fghout, "a") as fd: - fd.write(filelist) - shell: python - - name: Display outputs - run: echo "${{ toJson(steps.get-files.outputs) }}" Compile: defaults: run: shell: powershell - needs: [GetList] runs-on: windows-latest - strategy: - matrix: - file: ${{ fromJson(needs.GetList.outputs.filelist) }} steps: - uses: actions/checkout@v3 with: + path: "$INDI_WORK_DIR" ref: ${{ github.head_ref || github.ref_name }} repository: EA31337/EA31337-indicators-other - uses: actions/checkout@v3 @@ -65,16 +45,15 @@ jobs: include: . init-platform: true mt-version: 5.0.0.2361 - path: ${{ matrix.file }} + path: "$INDI_WORK_DIR/**/*.mq?" verbose: true - name: Compile (build 2515) - if: endsWith(matrix.file, '.mq5') uses: fx31337/mql-compile-action@master with: include: . init-platform: true mt-version: 5.0.0.2515 - path: ${{ matrix.file }} + path: "$INDI_WORK_DIR/**/*.mq5" verbose: true - name: List compiled files run: '(Get-ChildItem -Recurse -Path . -Include *.ex[45]).fullname' @@ -83,4 +62,4 @@ jobs: uses: actions/upload-artifact@v3 with: name: indicators-other - path: '**/*.ex[45]' + path: "$INDI_WORK_DIR/**/*.ex[45]" From bdf822904db5a5bbb7b41345468a5d2aaf9dd043 Mon Sep 17 00:00:00 2001 From: kenorb Date: Thu, 26 Oct 2023 01:22:42 +0100 Subject: [PATCH 12/30] GHA: Compile: Uses env.INDI_OTHER_WORKDIR syntax --- .github/workflows/compile.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/compile.yml b/.github/workflows/compile.yml index 3027123..ec291a3 100644 --- a/.github/workflows/compile.yml +++ b/.github/workflows/compile.yml @@ -20,7 +20,7 @@ on: workflow_call: env: - INDI_WORK_DIR: indicators-other + INDI_OTHER_WORKDIR: indicators-other jobs: Compile: @@ -31,7 +31,7 @@ jobs: steps: - uses: actions/checkout@v3 with: - path: "$INDI_WORK_DIR" + path: ${{ env.INDI_OTHER_WORKDIR }} ref: ${{ github.head_ref || github.ref_name }} repository: EA31337/EA31337-indicators-other - uses: actions/checkout@v3 @@ -45,7 +45,7 @@ jobs: include: . init-platform: true mt-version: 5.0.0.2361 - path: "$INDI_WORK_DIR/**/*.mq?" + path: ${{ env.INDI_OTHER_WORKDIR }}/**/*.mq? verbose: true - name: Compile (build 2515) uses: fx31337/mql-compile-action@master @@ -53,7 +53,7 @@ jobs: include: . init-platform: true mt-version: 5.0.0.2515 - path: "$INDI_WORK_DIR/**/*.mq5" + path: ${{ env.INDI_OTHER_WORKDIR }}/**/*.mq5 verbose: true - name: List compiled files run: '(Get-ChildItem -Recurse -Path . -Include *.ex[45]).fullname' @@ -62,4 +62,4 @@ jobs: uses: actions/upload-artifact@v3 with: name: indicators-other - path: "$INDI_WORK_DIR/**/*.ex[45]" + path: ${{ env.INDI_OTHER_WORKDIR }}/**/*.ex[45] From f704b05ff99489d4a036ef9fdafbafa90abfd6e0 Mon Sep 17 00:00:00 2001 From: kenorb Date: Fri, 27 Oct 2023 21:06:39 +0100 Subject: [PATCH 13/30] GHA: Improvements for INDI_OTHER_WORKDIR --- .github/workflows/compile.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/compile.yml b/.github/workflows/compile.yml index ec291a3..72361fc 100644 --- a/.github/workflows/compile.yml +++ b/.github/workflows/compile.yml @@ -20,7 +20,8 @@ on: workflow_call: env: - INDI_OTHER_WORKDIR: indicators-other + # Setting an environment variable with the value of a configuration variable. + INDI_OTHER_WORKDIR: ${{ vars.INDI_OTHER_WORKDIR || 'indicators-other' }} jobs: Compile: From ccd5ed1c65e4252635668c2dfffa130fc686c87e Mon Sep 17 00:00:00 2001 From: Adrian Kierzkowski Date: Thu, 4 Jan 2024 23:27:06 +0100 Subject: [PATCH 14/30] Refs EA31337/Strategy-TDI#1. WIP. Fixes zero divide in MT4 code. Added MT5 wrapper. Still don't output two signal lines' buffers. --- Oscillators/Multi/Traders Dynamic Index.mq4 | 8 ++-- Oscillators/Multi/Traders Dynamic Index.mq5 | 44 +++++++++++++-------- 2 files changed, 32 insertions(+), 20 deletions(-) diff --git a/Oscillators/Multi/Traders Dynamic Index.mq4 b/Oscillators/Multi/Traders Dynamic Index.mq4 index 7900b8f..5bc9e9d 100644 --- a/Oscillators/Multi/Traders Dynamic Index.mq4 +++ b/Oscillators/Multi/Traders Dynamic Index.mq4 @@ -92,12 +92,12 @@ #property indicator_separate_window extern int RSI_Period = 13; //8-25 -extern int RSI_Price = 0; //0-6 +extern ENUM_APPLIED_PRICE RSI_Price = PRICE_CLOSE; extern int Volatility_Band = 34; //20-40 extern int RSI_Price_Line = 2; -extern int RSI_Price_Type = 0; //0-3 +extern ENUM_MA_METHOD RSI_Price_Type = MODE_SMA; extern int Trade_Signal_Line = 7; -extern int Trade_Signal_Type = 0; //0-3 +extern ENUM_MA_METHOD Trade_Signal_Type = MODE_SMA; double RSIBuf[],UpZone[],MdZone[],DnZone[],MaBuf[],MbBuf[]; @@ -141,7 +141,7 @@ int start() ArrayResize(RSI,Volatility_Band); int counted_bars=IndicatorCounted(); int i; - int limit = Bars-counted_bars-1; + int limit = MathMax(0, Bars - counted_bars - Volatility_Band); for(i=limit; i>=0; i--) { RSIBuf[i] = (iRSI(NULL,0,RSI_Period,RSI_Price,i)); diff --git a/Oscillators/Multi/Traders Dynamic Index.mq5 b/Oscillators/Multi/Traders Dynamic Index.mq5 index 45ad00a..bf7bf2d 100644 --- a/Oscillators/Multi/Traders Dynamic Index.mq5 +++ b/Oscillators/Multi/Traders Dynamic Index.mq5 @@ -28,9 +28,15 @@ #include #include +int BarsShrinked() { + static int _initial_bars = MathMax(0, ChartStatic::iBars(_Symbol, _Period) - 1000); + int _result = ChartStatic::iBars(_Symbol, _Period) - _initial_bars; + return _result; +} + // Defines macros. #define extern input -#define Bars fmin(10000, (ChartStatic::iBars(_Symbol, _Period))) +#define Bars BarsShrinked() #define Bid (SymbolInfoStatic::GetBid(_Symbol)) #define TimeDayOfWeek (DateTime::DateOfWeek()) @@ -38,22 +44,28 @@ #include "Traders Dynamic Index.mq4" // Custom indicator initialization function. -void OnInit() { - init(); - if (!ArrayGetAsSeries(RSIBuf)) { - ArraySetAsSeries(RSIBuf, true); - ArraySetAsSeries(UpZone, true); - ArraySetAsSeries(MdZone, true); - ArraySetAsSeries(DnZone, true); - ArraySetAsSeries(MaBuf, true); - ArraySetAsSeries(MbBuf, true); - } -} +void OnInit() { init(); } // Custom indicator iteration function. -int OnCalculate(const int rates_total, const int prev_calculated, - const int begin, const double &price[]) { - IndicatorCounted(fmin(prev_calculated, Bars)); +int OnCalculate(const int rates_total, const int prev_calculated, const int begin, const double &price[]) { ResetLastError(); - return start() >= 0 ? rates_total : 0; + + ArraySetAsSeries(RSIBuf, true); + ArraySetAsSeries(UpZone, true); + ArraySetAsSeries(MdZone, true); + ArraySetAsSeries(DnZone, true); + ArraySetAsSeries(MaBuf, true); + ArraySetAsSeries(MbBuf, true); + + int _result = start() >= 0 ? rates_total : 0; + + ArraySetAsSeries(RSIBuf, false); + ArraySetAsSeries(UpZone, false); + ArraySetAsSeries(MdZone, false); + ArraySetAsSeries(DnZone, false); + ArraySetAsSeries(MaBuf, false); + ArraySetAsSeries(MbBuf, false); + + IndicatorCounted(fmin(rates_total, Bars)); + return _result; } From e6b75b6aceba08277155940807c53a833f667863 Mon Sep 17 00:00:00 2001 From: kenorb Date: Sun, 11 Feb 2024 17:47:11 +0000 Subject: [PATCH 15/30] GHA: Implements new method of compilation workflow --- .github/workflows/compile.yml | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/.github/workflows/compile.yml b/.github/workflows/compile.yml index 72361fc..87c5028 100644 --- a/.github/workflows/compile.yml +++ b/.github/workflows/compile.yml @@ -24,12 +24,24 @@ env: INDI_OTHER_WORKDIR: ${{ vars.INDI_OTHER_WORKDIR || 'indicators-other' }} jobs: + Install-MT4-Linux: + uses: EA31337/ansible-role-metatrader/.github/workflows/platform.yml@dev + Compile: defaults: run: shell: powershell + needs: [Install-MT4-Linux] runs-on: windows-latest steps: + - uses: actions/download-artifact@v4 + with: + name: platform4 + path: .mt4 + - uses: actions/download-artifact@v4 + with: + name: platform5 + path: .mt5 - uses: actions/checkout@v3 with: path: ${{ env.INDI_OTHER_WORKDIR }} @@ -40,20 +52,20 @@ jobs: path: Include/EA31337-classes ref: v3.000.1 repository: EA31337/EA31337-classes - - name: Compile (build 2361) + - name: Compile MQL4 uses: fx31337/mql-compile-action@master with: include: . init-platform: true - mt-version: 5.0.0.2361 + mt-path: .mt4 path: ${{ env.INDI_OTHER_WORKDIR }}/**/*.mq? verbose: true - - name: Compile (build 2515) + - name: Compile MQL5 uses: fx31337/mql-compile-action@master with: include: . init-platform: true - mt-version: 5.0.0.2515 + mt-path: .mt5 path: ${{ env.INDI_OTHER_WORKDIR }}/**/*.mq5 verbose: true - name: List compiled files From 930935128ab7569d3dd67a4c4e74fba5a423ce11 Mon Sep 17 00:00:00 2001 From: kenorb Date: Sun, 11 Feb 2024 18:10:25 +0000 Subject: [PATCH 16/30] GHA: Compile: Adds with.workdir --- .github/workflows/compile.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/compile.yml b/.github/workflows/compile.yml index 87c5028..0ddb45e 100644 --- a/.github/workflows/compile.yml +++ b/.github/workflows/compile.yml @@ -26,6 +26,8 @@ env: jobs: Install-MT4-Linux: uses: EA31337/ansible-role-metatrader/.github/workflows/platform.yml@dev + with: + workdir: ${{ github.workspace }} Compile: defaults: From ac29b3d96c10a4773efa0365d4e752f0ca37d047 Mon Sep 17 00:00:00 2001 From: kenorb Date: Sun, 11 Feb 2024 20:41:59 +0000 Subject: [PATCH 17/30] Revert "GHA: Compile: Adds with.workdir" This reverts commit 930935128ab7569d3dd67a4c4e74fba5a423ce11. --- .github/workflows/compile.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/compile.yml b/.github/workflows/compile.yml index 0ddb45e..87c5028 100644 --- a/.github/workflows/compile.yml +++ b/.github/workflows/compile.yml @@ -26,8 +26,6 @@ env: jobs: Install-MT4-Linux: uses: EA31337/ansible-role-metatrader/.github/workflows/platform.yml@dev - with: - workdir: ${{ github.workspace }} Compile: defaults: From 0c4ee92bc2ab27c112c081c2ff098469f835a7cd Mon Sep 17 00:00:00 2001 From: kenorb Date: Sun, 11 Feb 2024 21:10:21 +0000 Subject: [PATCH 18/30] Adds with variables --- .github/workflows/compile.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/compile.yml b/.github/workflows/compile.yml index 87c5028..4416e33 100644 --- a/.github/workflows/compile.yml +++ b/.github/workflows/compile.yml @@ -24,23 +24,26 @@ env: INDI_OTHER_WORKDIR: ${{ vars.INDI_OTHER_WORKDIR || 'indicators-other' }} jobs: - Install-MT4-Linux: + Platform: uses: EA31337/ansible-role-metatrader/.github/workflows/platform.yml@dev + with: + artifact: mt4 + version: 4 Compile: defaults: run: shell: powershell - needs: [Install-MT4-Linux] + needs: [Platform] runs-on: windows-latest steps: - uses: actions/download-artifact@v4 with: - name: platform4 + name: mt4 path: .mt4 - uses: actions/download-artifact@v4 with: - name: platform5 + name: mt5 path: .mt5 - uses: actions/checkout@v3 with: From 1599c3c611e55faebe5aa72e8cf68baa47920998 Mon Sep 17 00:00:00 2001 From: kenorb Date: Sun, 11 Feb 2024 22:26:42 +0000 Subject: [PATCH 19/30] GHA: Uses workflow from EA-Tester repo instead Splits compile job --- .github/workflows/compile.yml | 63 +++++++++++++++++++++++++++-------- 1 file changed, 49 insertions(+), 14 deletions(-) diff --git a/.github/workflows/compile.yml b/.github/workflows/compile.yml index 4416e33..ecb69fb 100644 --- a/.github/workflows/compile.yml +++ b/.github/workflows/compile.yml @@ -24,27 +24,27 @@ env: INDI_OTHER_WORKDIR: ${{ vars.INDI_OTHER_WORKDIR || 'indicators-other' }} jobs: - Platform: - uses: EA31337/ansible-role-metatrader/.github/workflows/platform.yml@dev + mt4: + name: Installs platform (4) + uses: EA31337/EA-Tester/.github/workflows/platform-linux.yml@dev with: artifact: mt4 version: 4 + mt5: + name: Installs platform (5) + uses: EA31337/EA-Tester/.github/workflows/platform-linux.yml@dev + with: + artifact: mt5 + version: 5 - Compile: + compile-mq4: defaults: run: shell: powershell - needs: [Platform] + name: Compile MQL4 + needs: [mt4] runs-on: windows-latest steps: - - uses: actions/download-artifact@v4 - with: - name: mt4 - path: .mt4 - - uses: actions/download-artifact@v4 - with: - name: mt5 - path: .mt5 - uses: actions/checkout@v3 with: path: ${{ env.INDI_OTHER_WORKDIR }} @@ -55,20 +55,55 @@ jobs: path: Include/EA31337-classes ref: v3.000.1 repository: EA31337/EA31337-classes + - uses: actions/download-artifact@v4 + with: + name: mt4 + path: .platform - name: Compile MQL4 uses: fx31337/mql-compile-action@master with: include: . init-platform: true - mt-path: .mt4 + mt-path: .platform path: ${{ env.INDI_OTHER_WORKDIR }}/**/*.mq? 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@v3 + with: + name: indicators-other + path: ${{ env.INDI_OTHER_WORKDIR }}/**/*.ex[45] + + compile-mq5: + defaults: + run: + shell: powershell + name: Compile MQL5 + needs: [mt5] + runs-on: windows-latest + steps: + - uses: actions/checkout@v3 + with: + path: ${{ env.INDI_OTHER_WORKDIR }} + ref: ${{ github.head_ref || github.ref_name }} + repository: EA31337/EA31337-indicators-other + - uses: actions/checkout@v3 + with: + path: Include/EA31337-classes + ref: v3.000.1 + repository: EA31337/EA31337-classes + - uses: actions/download-artifact@v4 + with: + name: mt5 + path: .platform - name: Compile MQL5 uses: fx31337/mql-compile-action@master with: include: . init-platform: true - mt-path: .mt5 + mt-path: .platform path: ${{ env.INDI_OTHER_WORKDIR }}/**/*.mq5 verbose: true - name: List compiled files From cff9ad82b5aab47c68824fb59ddd9d1f3fb89de1 Mon Sep 17 00:00:00 2001 From: kenorb Date: Mon, 12 Feb 2024 00:00:31 +0000 Subject: [PATCH 20/30] GHA: Adds clean-up job --- .github/workflows/compile.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/compile.yml b/.github/workflows/compile.yml index ecb69fb..df5b4ca 100644 --- a/.github/workflows/compile.yml +++ b/.github/workflows/compile.yml @@ -65,7 +65,7 @@ jobs: include: . init-platform: true mt-path: .platform - path: ${{ env.INDI_OTHER_WORKDIR }}/**/*.mq? + path: ${{ env.INDI_OTHER_WORKDIR }}/**/*.mq4 verbose: true - name: List compiled files run: '(Get-ChildItem -Recurse -Path . -Include *.ex[45]).fullname' @@ -114,3 +114,12 @@ jobs: with: name: indicators-other path: ${{ env.INDI_OTHER_WORKDIR }}/**/*.ex[45] + + cleanup: + name: Clean-up + needs: [compile-mq4, compile-mq5] + runs-on: ubuntu-latest + steps: + - uses: geekyeggo/delete-artifact@v4 + with: + name: mt? From 1177e07237c3b37892b28537439493099050ca59 Mon Sep 17 00:00:00 2001 From: kenorb Date: Mon, 12 Feb 2024 00:07:01 +0000 Subject: [PATCH 21/30] GHA: Updates actions/checkout and actions/upload-artifact to v4 --- .github/workflows/compile.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/compile.yml b/.github/workflows/compile.yml index df5b4ca..37b4967 100644 --- a/.github/workflows/compile.yml +++ b/.github/workflows/compile.yml @@ -45,12 +45,12 @@ jobs: needs: [mt4] runs-on: windows-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: path: ${{ env.INDI_OTHER_WORKDIR }} ref: ${{ github.head_ref || github.ref_name }} repository: EA31337/EA31337-indicators-other - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: path: Include/EA31337-classes ref: v3.000.1 @@ -71,7 +71,7 @@ jobs: run: '(Get-ChildItem -Recurse -Path . -Include *.ex[45]).fullname' - run: Get-Location - name: Upload indicator artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: indicators-other path: ${{ env.INDI_OTHER_WORKDIR }}/**/*.ex[45] @@ -84,12 +84,12 @@ jobs: needs: [mt5] runs-on: windows-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: path: ${{ env.INDI_OTHER_WORKDIR }} ref: ${{ github.head_ref || github.ref_name }} repository: EA31337/EA31337-indicators-other - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: path: Include/EA31337-classes ref: v3.000.1 @@ -110,7 +110,7 @@ jobs: run: '(Get-ChildItem -Recurse -Path . -Include *.ex[45]).fullname' - run: Get-Location - name: Upload indicator artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: indicators-other path: ${{ env.INDI_OTHER_WORKDIR }}/**/*.ex[45] From a77dcc872ef6efb9bd0c6823c164adcd75f1bdd2 Mon Sep 17 00:00:00 2001 From: kenorb Date: Sat, 17 Feb 2024 16:35:18 +0000 Subject: [PATCH 22/30] Upload files to different artifacts Refs: https://github.com/actions/upload-artifact/issues/480 --- .github/workflows/compile.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/compile.yml b/.github/workflows/compile.yml index 37b4967..7b71475 100644 --- a/.github/workflows/compile.yml +++ b/.github/workflows/compile.yml @@ -73,7 +73,7 @@ jobs: - name: Upload indicator artifacts uses: actions/upload-artifact@v4 with: - name: indicators-other + name: indicators-other-ex4 path: ${{ env.INDI_OTHER_WORKDIR }}/**/*.ex[45] compile-mq5: @@ -112,7 +112,7 @@ jobs: - name: Upload indicator artifacts uses: actions/upload-artifact@v4 with: - name: indicators-other + name: indicators-other-ex5 path: ${{ env.INDI_OTHER_WORKDIR }}/**/*.ex[45] cleanup: From 9d1ff39621fc42af9166a5da79fe4f25cecd5698 Mon Sep 17 00:00:00 2001 From: kenorb Date: Sat, 17 Feb 2024 16:36:32 +0000 Subject: [PATCH 23/30] Runs cleanup on failure --- .github/workflows/compile.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/compile.yml b/.github/workflows/compile.yml index 7b71475..5e86609 100644 --- a/.github/workflows/compile.yml +++ b/.github/workflows/compile.yml @@ -116,6 +116,7 @@ jobs: path: ${{ env.INDI_OTHER_WORKDIR }}/**/*.ex[45] cleanup: + if: always() name: Clean-up needs: [compile-mq4, compile-mq5] runs-on: ubuntu-latest From 2cfc57c41956eddf9875566143b963dba28054ef Mon Sep 17 00:00:00 2001 From: kenorb Date: Sat, 17 Feb 2024 21:09:49 +0000 Subject: [PATCH 24/30] Adds artifact_prefix workflow input --- .github/workflows/compile.yml | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/.github/workflows/compile.yml b/.github/workflows/compile.yml index 5e86609..8364c7e 100644 --- a/.github/workflows/compile.yml +++ b/.github/workflows/compile.yml @@ -1,6 +1,11 @@ --- name: Compile +env: + ARTIFACT_PREFIX: ${{ inputs.artifact_prefix || 'mt' }} + # Setting an environment variable with the value of a configuration variable. + INDI_OTHER_WORKDIR: ${{ vars.INDI_OTHER_WORKDIR || 'indicators-other' }} + # yamllint disable-line rule:truthy on: pull_request: @@ -18,23 +23,25 @@ on: - '*.md' - '.git*' workflow_call: - -env: - # Setting an environment variable with the value of a configuration variable. - INDI_OTHER_WORKDIR: ${{ vars.INDI_OTHER_WORKDIR || 'indicators-other' }} + inputs: + artifact_prefix: + default: mt + description: Artifact name + required: false + type: string jobs: mt4: name: Installs platform (4) uses: EA31337/EA-Tester/.github/workflows/platform-linux.yml@dev with: - artifact: mt4 + artifact: ${{ env.ARTIFACT_PREFIX }}4 version: 4 mt5: name: Installs platform (5) uses: EA31337/EA-Tester/.github/workflows/platform-linux.yml@dev with: - artifact: mt5 + artifact: ${{ env.ARTIFACT_PREFIX }}5 version: 5 compile-mq4: From 0d8e327914675268a4d657580125da37ad1d10a7 Mon Sep 17 00:00:00 2001 From: kenorb Date: Sat, 17 Feb 2024 21:43:10 +0000 Subject: [PATCH 25/30] Revert "Adds artifact_prefix workflow input" This reverts commit 2cfc57c41956eddf9875566143b963dba28054ef. --- .github/workflows/compile.yml | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/.github/workflows/compile.yml b/.github/workflows/compile.yml index 8364c7e..5e86609 100644 --- a/.github/workflows/compile.yml +++ b/.github/workflows/compile.yml @@ -1,11 +1,6 @@ --- name: Compile -env: - ARTIFACT_PREFIX: ${{ inputs.artifact_prefix || 'mt' }} - # Setting an environment variable with the value of a configuration variable. - INDI_OTHER_WORKDIR: ${{ vars.INDI_OTHER_WORKDIR || 'indicators-other' }} - # yamllint disable-line rule:truthy on: pull_request: @@ -23,25 +18,23 @@ on: - '*.md' - '.git*' workflow_call: - inputs: - artifact_prefix: - default: mt - description: Artifact name - required: false - type: string + +env: + # Setting an environment variable with the value of a configuration variable. + INDI_OTHER_WORKDIR: ${{ vars.INDI_OTHER_WORKDIR || 'indicators-other' }} jobs: mt4: name: Installs platform (4) uses: EA31337/EA-Tester/.github/workflows/platform-linux.yml@dev with: - artifact: ${{ env.ARTIFACT_PREFIX }}4 + artifact: mt4 version: 4 mt5: name: Installs platform (5) uses: EA31337/EA-Tester/.github/workflows/platform-linux.yml@dev with: - artifact: ${{ env.ARTIFACT_PREFIX }}5 + artifact: mt5 version: 5 compile-mq4: From 20ed9e03d4ee0e910a551fd2f6afa54a8aef3f64 Mon Sep 17 00:00:00 2001 From: kenorb Date: Sat, 17 Feb 2024 21:55:34 +0000 Subject: [PATCH 26/30] GHA: Compile: Sets artifact_overwrite to true --- .github/workflows/compile.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/compile.yml b/.github/workflows/compile.yml index 5e86609..74554ba 100644 --- a/.github/workflows/compile.yml +++ b/.github/workflows/compile.yml @@ -28,13 +28,15 @@ jobs: name: Installs platform (4) uses: EA31337/EA-Tester/.github/workflows/platform-linux.yml@dev with: - artifact: mt4 + artifact_name: mt4 + artifact_overwrite: true version: 4 mt5: name: Installs platform (5) uses: EA31337/EA-Tester/.github/workflows/platform-linux.yml@dev with: - artifact: mt5 + artifact_name: mt5 + artifact_overwrite: true version: 5 compile-mq4: From 92320a7e93426fa030e3fc476bfc1933fc0758ac Mon Sep 17 00:00:00 2001 From: kenorb Date: Sun, 5 May 2024 23:49:45 +0100 Subject: [PATCH 27/30] GHA: Compile: Improves Compile workflow --- .github/workflows/compile.yml | 53 ++++++++++++++++++++++++----------- 1 file changed, 36 insertions(+), 17 deletions(-) diff --git a/.github/workflows/compile.yml b/.github/workflows/compile.yml index 74554ba..bc614de 100644 --- a/.github/workflows/compile.yml +++ b/.github/workflows/compile.yml @@ -1,42 +1,59 @@ --- name: Compile +# Setting an environment variable with the value of a configuration variable. +env: + ARTIFACT_PREFIX: ${{ inputs.artifact_prefix || 'mt' }} + INDI_OTHER_WORKDIR: ${{ vars.INDI_OTHER_WORKDIR || 'indicators-other' }} + REPOSITORY: EA31337/EA31337-indicators-common + 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: - -env: - # Setting an environment variable with the value of a configuration variable. - INDI_OTHER_WORKDIR: ${{ vars.INDI_OTHER_WORKDIR || 'indicators-other' }} + inputs: + artifact_prefix: + default: mt + description: Artifact prefix. + required: false + type: string + skip_cleanup: + default: false + description: Whether to skip a clean-up job. + required: false + type: boolean jobs: mt4: name: Installs platform (4) uses: EA31337/EA-Tester/.github/workflows/platform-linux.yml@dev with: - artifact_name: mt4 + 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: mt5 + artifact_name: ${{ inputs.artifact_prefix || 'mt' }}5 artifact_overwrite: true + skip_cleanup: true version: 5 compile-mq4: @@ -59,14 +76,14 @@ jobs: repository: EA31337/EA31337-classes - uses: actions/download-artifact@v4 with: - name: mt4 - path: .platform + name: ${{ env.ARTIFACT_PREFIX }}4 + path: .${{ env.ARTIFACT_PREFIX }}4 - name: Compile MQL4 uses: fx31337/mql-compile-action@master with: include: . init-platform: true - mt-path: .platform + mt-path: .${{ env.ARTIFACT_PREFIX }}4 path: ${{ env.INDI_OTHER_WORKDIR }}/**/*.mq4 verbose: true - name: List compiled files @@ -75,8 +92,10 @@ jobs: - name: Upload indicator artifacts uses: actions/upload-artifact@v4 with: + if-no-files-found: error name: indicators-other-ex4 path: ${{ env.INDI_OTHER_WORKDIR }}/**/*.ex[45] + timeout-minutes: 20 compile-mq5: defaults: @@ -98,14 +117,14 @@ jobs: repository: EA31337/EA31337-classes - uses: actions/download-artifact@v4 with: - name: mt5 - path: .platform + name: ${{ env.ARTIFACT_PREFIX }}5 + path: .${{ env.ARTIFACT_PREFIX }}5 - name: Compile MQL5 uses: fx31337/mql-compile-action@master with: include: . init-platform: true - mt-path: .platform + mt-path: .${{ env.ARTIFACT_PREFIX }}5 path: ${{ env.INDI_OTHER_WORKDIR }}/**/*.mq5 verbose: true - name: List compiled files @@ -118,11 +137,11 @@ jobs: path: ${{ env.INDI_OTHER_WORKDIR }}/**/*.ex[45] cleanup: - if: always() + if: inputs.skip_cleanup != true name: Clean-up needs: [compile-mq4, compile-mq5] runs-on: ubuntu-latest steps: - - uses: geekyeggo/delete-artifact@v4 + - uses: geekyeggo/delete-artifact@v5 with: - name: mt? + name: ${{ env.ARTIFACT_PREFIX }}* From 45610f8cba4d019f6e469471d2f9741dab2c2710 Mon Sep 17 00:00:00 2001 From: kenorb Date: Tue, 20 Aug 2024 14:29:15 +0100 Subject: [PATCH 28/30] GHA: Fixes for Compile workflow --- .github/workflows/compile.yml | 91 ++++++++++++++++++++--------------- 1 file changed, 53 insertions(+), 38 deletions(-) diff --git a/.github/workflows/compile.yml b/.github/workflows/compile.yml index bc614de..9c8b6fd 100644 --- a/.github/workflows/compile.yml +++ b/.github/workflows/compile.yml @@ -5,7 +5,7 @@ name: Compile env: ARTIFACT_PREFIX: ${{ inputs.artifact_prefix || 'mt' }} INDI_OTHER_WORKDIR: ${{ vars.INDI_OTHER_WORKDIR || 'indicators-other' }} - REPOSITORY: EA31337/EA31337-indicators-common + REPOSITORY: EA31337/EA31337-indicators-other SKIP_CLEANUP: ${{ inputs.skip_cleanup || false }} # yamllint disable-line rule:truthy @@ -56,54 +56,61 @@ jobs: skip_cleanup: true version: 5 - compile-mq4: + compile-platform-indicators: defaults: run: shell: powershell - name: Compile MQL4 - needs: [mt4] + name: Compile platform indicators + needs: [mt4, mt5] runs-on: windows-latest + strategy: + matrix: + version: [4, 5] steps: - - uses: actions/checkout@v4 - with: - path: ${{ env.INDI_OTHER_WORKDIR }} - ref: ${{ github.head_ref || github.ref_name }} - repository: EA31337/EA31337-indicators-other - - uses: actions/checkout@v4 - with: - path: Include/EA31337-classes - ref: v3.000.1 - repository: EA31337/EA31337-classes - uses: actions/download-artifact@v4 with: - name: ${{ env.ARTIFACT_PREFIX }}4 - path: .${{ env.ARTIFACT_PREFIX }}4 - - name: Compile MQL4 - 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-path: .${{ env.ARTIFACT_PREFIX }}4 - path: ${{ env.INDI_OTHER_WORKDIR }}/**/*.mq4 + mt-path: .${{ env.ARTIFACT_PREFIX }}${{ matrix.version }} + # yamllint disable-line rule:line-length + path: .${{ env.ARTIFACT_PREFIX }}${{ matrix.version }}/**/MQL?/Indicators verbose: true + - 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 . -Include *.ex[45]).fullname' - - run: Get-Location - - name: Upload indicator artifacts + 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: indicators-other-ex4 - path: ${{ env.INDI_OTHER_WORKDIR }}/**/*.ex[45] + name: platform-indicators-ex${{ matrix.version }} + path: MQL?/**/*.[me][qx][45h] + - if: ${{ failure() }} + uses: mxschmitt/action-tmate@v3 timeout-minutes: 20 - compile-mq5: + compile-indicators: defaults: run: shell: powershell - name: Compile MQL5 - needs: [mt5] + name: Compile Indicators Other + needs: [compile-platform-indicators] runs-on: windows-latest + strategy: + matrix: + version: [4, 5] steps: - uses: actions/checkout@v4 with: @@ -112,20 +119,27 @@ jobs: repository: EA31337/EA31337-indicators-other - uses: actions/checkout@v4 with: - path: Include/EA31337-classes + path: MQL${{ matrix.version}}/Include/EA31337-classes ref: v3.000.1 repository: EA31337/EA31337-classes - uses: actions/download-artifact@v4 with: - name: ${{ env.ARTIFACT_PREFIX }}5 - path: .${{ env.ARTIFACT_PREFIX }}5 - - name: Compile MQL5 + name: ${{ env.ARTIFACT_PREFIX }}${{ matrix.version }} + path: .${{ env.ARTIFACT_PREFIX }}${{ matrix.version }} + - uses: actions/download-artifact@v4 + with: + merge-multiple: true + pattern: platform-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-path: .${{ env.ARTIFACT_PREFIX }}5 - path: ${{ env.INDI_OTHER_WORKDIR }}/**/*.mq5 + 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' @@ -133,13 +147,14 @@ jobs: - name: Upload indicator artifacts uses: actions/upload-artifact@v4 with: - name: indicators-other-ex5 + name: 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-mq4, compile-mq5] + needs: [compile-indicators] runs-on: ubuntu-latest steps: - uses: geekyeggo/delete-artifact@v5 From d28c94f706eb6092014e7110092d3a58d921452a Mon Sep 17 00:00:00 2001 From: kenorb Date: Tue, 20 Aug 2024 15:45:43 +0100 Subject: [PATCH 29/30] GHA: Compile: Adds prefix to artifact --- .github/workflows/compile.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/compile.yml b/.github/workflows/compile.yml index 9c8b6fd..1ae1187 100644 --- a/.github/workflows/compile.yml +++ b/.github/workflows/compile.yml @@ -95,7 +95,7 @@ jobs: uses: actions/upload-artifact@v4 with: if-no-files-found: error - name: platform-indicators-ex${{ matrix.version }} + name: ${{ env.ARTIFACT_PREFIX }}-indicators-ex${{ matrix.version }} path: MQL?/**/*.[me][qx][45h] - if: ${{ failure() }} uses: mxschmitt/action-tmate@v3 @@ -129,7 +129,7 @@ jobs: - uses: actions/download-artifact@v4 with: merge-multiple: true - pattern: platform-indicators-ex? + 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 @@ -147,7 +147,8 @@ jobs: - name: Upload indicator artifacts uses: actions/upload-artifact@v4 with: - name: indicators-other-ex${{ matrix.version }} + # 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 From c86369ad985fdc668ee92640521984d8ae09b2eb Mon Sep 17 00:00:00 2001 From: kenorb Date: Tue, 20 Aug 2024 22:33:22 +0100 Subject: [PATCH 30/30] GHA: Compile: Adds checkout_branch input --- .github/workflows/compile.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/compile.yml b/.github/workflows/compile.yml index 1ae1187..23eca8e 100644 --- a/.github/workflows/compile.yml +++ b/.github/workflows/compile.yml @@ -4,6 +4,8 @@ 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 }} @@ -31,6 +33,11 @@ on: 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. @@ -105,7 +112,7 @@ jobs: defaults: run: shell: powershell - name: Compile Indicators Other + name: Compile Indicators needs: [compile-platform-indicators] runs-on: windows-latest strategy: @@ -115,7 +122,7 @@ jobs: - uses: actions/checkout@v4 with: path: ${{ env.INDI_OTHER_WORKDIR }} - ref: ${{ github.head_ref || github.ref_name }} + ref: ${{ env.CHECKOUT_BRANCH }} repository: EA31337/EA31337-indicators-other - uses: actions/checkout@v4 with: