From 18ec2462d0b80aa7c45f8a76dd2f30ad739de55d Mon Sep 17 00:00:00 2001 From: Hadi Khazaee Asl Date: Thu, 14 Mar 2024 01:59:03 +0330 Subject: [PATCH] Resolve XUSPY5 XTAM All Guard Attacks in GrowthNext ... --- .../Indicators/x-saherelm.x3m.indicator.mq5 | 387 ++++++++++++++++++ ...aherelm.xuspy5.provider.indicators.lib.mq5 | 233 ++++++++++- Documents/Templates/Brokers List.txt | 4 +- .../Indicators/x-saherelm.x3m.indicator.mq5 | 387 ++++++++++++++++++ ...aherelm.xuspy5.provider.indicators.lib.mq5 | 233 ++++++++++- ...aherelm.xuspy5.provider.indicators.lib.mq5 | 233 ++++++++++- 6 files changed, 1457 insertions(+), 20 deletions(-) create mode 100644 BKP/Main/Indicators/x-saherelm.x3m.indicator.mq5 create mode 100644 Projects/XUSPY5/Indicators/x-saherelm.x3m.indicator.mq5 diff --git a/BKP/Main/Indicators/x-saherelm.x3m.indicator.mq5 b/BKP/Main/Indicators/x-saherelm.x3m.indicator.mq5 new file mode 100644 index 00000000..b8738050 --- /dev/null +++ b/BKP/Main/Indicators/x-saherelm.x3m.indicator.mq5 @@ -0,0 +1,387 @@ +/////////////////////////////////////////////////////// +// +// SaherElm IT Center MQL5 X3M Indicator +// --------------------------------------------- +// Name: X3M +// Description: Tripple MA Indicator ... +// +// +// Maintainer: +// ------------ +// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com) +// +////////////////////////////////////////////////////// +// +// Global Properties ... +#property copyright "Copyright 2023, SaherElm IT Center" +#property link "https://saherelm.ir" +#property version "1.00" +#property description "SaherElm X3M Indicator" +#property strict + +// +// START Constants ... +// +#define ShortName "X3M" +// +// END Constants ... +// + +// +// START Inputs ... +// +input int maFastPeriod = 9; // Fast Period +input int maSlowPeriod = 18; // Slow Period +input int maSignalPeriod = 50; // Signal Period +input int maShift = 0; // Shift +input ENUM_MA_METHOD maMethod = MODE_EMA; // Method +input ENUM_APPLIED_PRICE maAppliedTo = PRICE_CLOSE; // Applied To +// +// END Inputs ... +// + +// +// Includes Logging Library ... +#include "../Libraries/x-saherelm.log.lib.mq5" + +// +// Includes Common Library ... +#include "../Libraries/x-saherelm.common.lib.mq5" + +// +// START Buffers ... +// +#property indicator_chart_window + +// +#property indicator_buffers 3 +#property indicator_plots 3 + +// +// maBuffer ... +#define maFastBufferIndex 0 +#define maSlowBufferIndex 1 +#define maSignalBufferIndex 2 + +double maFastBuffer[]; +double maSlowBuffer[]; +double maSignalBuffer[]; + +#property indicator_label1 "XFast" +#property indicator_type1 DRAW_LINE +#property indicator_color1 clrLime +#property indicator_style1 STYLE_SOLID +#property indicator_width1 1 + +#property indicator_label2 "XSlow" +#property indicator_type2 DRAW_LINE +#property indicator_color2 clrAqua +#property indicator_style2 STYLE_SOLID +#property indicator_width2 1 + +#property indicator_label3 "XSignal" +#property indicator_type3 DRAW_LINE +#property indicator_color3 clrBlueViolet +#property indicator_style3 STYLE_SOLID +#property indicator_width3 1 +// +// END Buffers ... +// + +// +// START Global Definitions: Variables, Properties and etc ... +// +int maFastHandler = INVALID_HANDLE; +int maSlowHandler = INVALID_HANDLE; +int maSignalHandler = INVALID_HANDLE; +// +// END Global Definitions: Variables, Properties and etc ... +// + +// +// START Event Handlers ... +// +// +// Initialization ... +int OnInit() +{ + // + // Validate Inputs ... + if (!ValidateInputs()) + { + return INIT_PARAMETERS_INCORRECT; + } + + // + logTag = ShortName; + + // + // Initializing MA Handler ... + // FAST ... + maFastHandler = iMA( + _Symbol, + _Period, + maFastPeriod, + maShift, + maMethod, + maAppliedTo); + if (maFastHandler == INVALID_HANDLE) + { + // + string message = "Error Initializing Ma Fast Handler ..."; + LogMessage(message); + + // + return INIT_FAILED; + } + // + // SLOW ... + maSlowHandler = iMA( + _Symbol, + _Period, + maSlowPeriod, + maShift, + maMethod, + maAppliedTo); + if (maSlowHandler == INVALID_HANDLE) + { + // + string message = "Error Initializing Ma Slow Handler ..."; + LogMessage(message); + + // + return INIT_FAILED; + } + // + // SIGNAL ... + maSignalHandler = iMA( + _Symbol, + _Period, + maSignalPeriod, + maShift, + maMethod, + maAppliedTo); + if (maSignalHandler == INVALID_HANDLE) + { + // + string message = "Error Initializing Ma Signal Handler ..."; + LogMessage(message); + + // + return INIT_FAILED; + } + + // + // Define Index Buffers ... + DefineBuffers(); + + // + // Set Indicator ShortName ... + SetIndicatorName(); + + // + // Init Succeed ... + return INIT_SUCCEEDED; +} + +// +// DeInitialization ... +void OnDeinit(const int reason) +{ + // + // REASON_PROGRAM 0 The EA has stopped working calling the ExpertRemove() function + // REASON_REMOVE 1 Program removed from a chart + // REASON_RECOMPILE 2 Program recompiled + // REASON_CHARTCHANGE 3 A symbol or a chart period is changed + // REASON_CHARTCLOSE 4 Chart closed + // REASON_PARAMETERS 5 Inputs changed by a user + // REASON_ACCOUNT 6 Another account has been activated or reconnection to the trade server has occurred due to changes in the account settings + // REASON_TEMPLATE 7 Another chart template applied + // REASON_INITFAILED 8 The OnInit() handler returned a non-zero value + // REASON_CLOSE 9 Terminal closed + + // + // Here we can handle De Initialization Reasons ... + IndicatorRelease(maFastHandler); + IndicatorRelease(maSlowHandler); + IndicatorRelease(maSignalHandler); +} + +// +// Calculations ... +// +// Calculating what we want ... +int OnCalculate( + // + // total Candles on chart ... + const int rates_total, + // + // total calculated Candles on charts ... + const int prev_calculated, + // + // history of Candles Open Time ... + const datetime &time[], + // + // history of Candles Open Price ... + const double &open[], + // + // history of Candles High Price ... + const double &high[], + // + // history of Candles Low Price ... + const double &low[], + // + // history of Candles Close Price ... + const double &close[], + // + // history of Tick Volumes on Candle ... + const long &tick_volume[], + // + // history of Trade Volumes ... + const long &volume[], + // + // history of Candles Spread Price ... + const int &spread[]) +{ + // + // Prepare Buffers ... + ArraySetAsSeries(time, true); + ArraySetAsSeries(open, true); + ArraySetAsSeries(high, true); + ArraySetAsSeries(low, true); + ArraySetAsSeries(close, true); + ArraySetAsSeries(tick_volume, true); + ArraySetAsSeries(volume, true); + ArraySetAsSeries(spread, true); + + // + // this counts Available Bars ... + int limit; + + // + // because in some cases we may have more than one input for + // calculation and we must prevent any calculation + // untill we pass the biggest input length, here we get max Input length + // and then wait until pass it ... + int maxLength = MathMax(maFastPeriod, maSlowPeriod); + maxLength = MathMax(maxLength, maSignalPeriod); + + // + // Check Calculated Bars ... + int maFastCalculatedBars = BarsCalculated(maFastHandler); + int maSlowCalculatedBars = BarsCalculated(maSlowHandler); + int maSignalCalculatedBars = BarsCalculated(maSignalHandler); + if (maFastCalculatedBars < maxLength || + maSlowCalculatedBars < maxLength || + maSignalCalculatedBars < maxLength) + { + return prev_calculated; + } + + // + limit = (prev_calculated > rates_total || prev_calculated <= 0) ? rates_total : (rates_total - prev_calculated) + 1; + + // + // Buffers Copy ... + int copiedMaFasts = CopyBuffer(maFastHandler, 0, 0, limit, maFastBuffer); + int copiedMaSlows = CopyBuffer(maSlowHandler, 0, 0, limit, maSlowBuffer); + int copiedMaSignals = CopyBuffer(maSignalHandler, 0, 0, limit, maSignalBuffer); + if (copiedMaFasts <= 0 || + copiedMaSlows <= 0 || + copiedMaSignals <= 0) + { + return prev_calculated; + } + + // + // Main Loop ... + for (int i = limit - 1; i >= 0 && !IsStopped(); i--) + { + // + // Do Buffers Calculation ... + CalculateBuffers(i); + } + + // + return rates_total; +} +// +// END Event Handlers ... +// + +// +// START Functions ... +// +// +// Validate Input Args for Initialization ... +bool ValidateInputs() +{ + // + bool result = false; + + // + // Validate Args ... + if (maFastPeriod >= 2 || + maSlowPeriod > maFastPeriod || + maSignalPeriod > maSignalPeriod) + { + result = true; + } + + // + return result; +} + +// +// Define Indexes and Styles ... +void DefineBuffers() +{ + // + string maFastBufferLabel = "XFast " + "(" + (string)maFastPeriod + ")"; + + // + // Ma Fast Buffer ... + ArraySetAsSeries(maFastBuffer, true); + SetIndexBuffer(maFastBufferIndex, maFastBuffer, INDICATOR_DATA); + PlotIndexSetString(maFastBufferIndex, PLOT_LABEL, maFastBufferLabel); + + // + string maSlowBufferLabel = "XSlow " + "(" + (string)maSlowPeriod + ")"; + + // + // Ma Slow Buffer ... + ArraySetAsSeries(maSlowBuffer, true); + SetIndexBuffer(maSlowBufferIndex, maSlowBuffer, INDICATOR_DATA); + PlotIndexSetString(maSlowBufferIndex, PLOT_LABEL, maSlowBufferLabel); + + // + string maSignalBufferLabel = "XSignal " + "(" + (string)maSignalPeriod + ")"; + + // + // Ma Signal Buffer ... + ArraySetAsSeries(maSignalBuffer, true); + SetIndexBuffer(maSignalBufferIndex, maSignalBuffer, INDICATOR_DATA); + PlotIndexSetString(maSignalBufferIndex, PLOT_LABEL, maSignalBufferLabel); +} + +// +// Set Indicator Short Name and also we can define Buffers Labels ... +void SetIndicatorName() +{ + // + string indicatorShortName = ""; + StringConcatenate(indicatorShortName, ShortName, " ", "(", maSignalPeriod, ")"); + + // + IndicatorSetString(INDICATOR_SHORTNAME, indicatorShortName); +} + +// +// Calculate Buffers ... +void CalculateBuffers(int bar_index) +{ +} + +// +// END Functions ... +// diff --git a/BKP/Main/Providers/x-saherelm.xuspy5.provider.indicators.lib.mq5 b/BKP/Main/Providers/x-saherelm.xuspy5.provider.indicators.lib.mq5 index d82aaea6..5fef946d 100644 --- a/BKP/Main/Providers/x-saherelm.xuspy5.provider.indicators.lib.mq5 +++ b/BKP/Main/Providers/x-saherelm.xuspy5.provider.indicators.lib.mq5 @@ -22224,15 +22224,88 @@ bool XUSPY5XSIHasShortSignal() (mConditions.isXCHMASCTrendsUp && ( // - (mConditions.isXTSCurrentOverFarest && + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && ( // ((mConditions.isXCHMASCPeak && mConditions.isXCHMALCVale) && ( // - (mConditions.isXTMNeutural && - mConditions.isXAMANeutural) + ((mConditions.isXTSCurrentMin && + mConditions.isXCHLHSCMCHHSame) && + ( + // + mConditions.isXTSCurrentCrossedUnderNearest + // + || + // + (mConditions.isXCHMAMCPeak && + mConditions.isXLHHHIncreased) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentOverFarest && + ( + // + (mConditions.isXCHMASCPeak && + ( + // + (mConditions.isXCHMALCVale && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + ) + // + ) + // + || + // + ((mConditions.isXTSCurrentMax && + mConditions.isXCHLHMCLCLLSame) && + ( + // + (mConditions.isXTMBullish && + mConditions.isXAMANeutural) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXCHMAMCPeak && + ( + // + ((mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHLHMCLCLLSame) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMABullish) + // + ) + // + ) // ) // @@ -22261,7 +22334,17 @@ bool XUSPY5XSIHasShortSignal() ( // (mConditions.isXCHLHSCMCHHSame && - mConditions.isXCHLHMCLCLLSame) + ( + // + mConditions.isXCHLHMCLCLLSame + // + || + // + mConditions.isXTSCurrentOverMediest + // + ) + // + ) // ) // @@ -23081,7 +23164,50 @@ bool XUSPY5XSIHasShortSignal() mConditions.isXCHMASCFastCrossedOverSlow) && ( // - false + ((mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear) && + ( + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + (mConditions.isXCHMASCTrendsUp && + ( + // + (mConditions.isXTSCurrentOverFarest && + ( + // + (mConditions.isXCHMASCPeak && + mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCVale && + mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXCHLHSCMCHHSame) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) // ) // @@ -23311,7 +23437,102 @@ bool XUSPY5XSIHasShortSignal() mConditions.isXCHMASCFastCrossedOverSlow) && ( // - false + ((mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear) && + ( + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + (mConditions.isXCHMASCTrendsUp && + ( + // + (mConditions.isXTSCurrentOverNearest && + ( + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXCHMASCPeak && + mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCVale && + mConditions.isXCHLHSCMCHHSame) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentOverFarest && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + (mConditions.isXCHMASCPeak && + mConditions.isXCHMALCVale && + mConditions.isXTMBullish && + mConditions.isXAMABullish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + (mConditions.isXTSCurrentOverFarest && + ( + // + (mConditions.isXCHMAMCFastCrossedOverSlow && + ( + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXCHMASCPeak && + mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCVale && + mConditions.isXCHLHSCMCHHSame) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) // ) // diff --git a/Documents/Templates/Brokers List.txt b/Documents/Templates/Brokers List.txt index 3e126206..fa2f65ef 100644 --- a/Documents/Templates/Brokers List.txt +++ b/Documents/Templates/Brokers List.txt @@ -23,14 +23,14 @@ XTAM ----- Resolve XUSPY5 XTAM All Stopouts in All Markets ... Resolve XUSPY5 XTAM All Critical Guard Attacks in All Markets ... -Resolve XUSPY5 XTAM All Guard Attacks in All Markets ... +Resolve XUSPY5 XTAM All Guard Attacks in GrowthNext ... XSI ---- Resolve XUSPY5 XSI All Stopouts in All Markets ... Resolve XUSPY5 XSI All Critical Guard Attacks in All Markets ... -Resolve XUSPY5 XSI Long Guard Attacks in All Markets ... +Resolve XUSPY5 XSI Shorts Guard Attacks in All Markets ... XTSFI diff --git a/Projects/XUSPY5/Indicators/x-saherelm.x3m.indicator.mq5 b/Projects/XUSPY5/Indicators/x-saherelm.x3m.indicator.mq5 new file mode 100644 index 00000000..b8738050 --- /dev/null +++ b/Projects/XUSPY5/Indicators/x-saherelm.x3m.indicator.mq5 @@ -0,0 +1,387 @@ +/////////////////////////////////////////////////////// +// +// SaherElm IT Center MQL5 X3M Indicator +// --------------------------------------------- +// Name: X3M +// Description: Tripple MA Indicator ... +// +// +// Maintainer: +// ------------ +// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com) +// +////////////////////////////////////////////////////// +// +// Global Properties ... +#property copyright "Copyright 2023, SaherElm IT Center" +#property link "https://saherelm.ir" +#property version "1.00" +#property description "SaherElm X3M Indicator" +#property strict + +// +// START Constants ... +// +#define ShortName "X3M" +// +// END Constants ... +// + +// +// START Inputs ... +// +input int maFastPeriod = 9; // Fast Period +input int maSlowPeriod = 18; // Slow Period +input int maSignalPeriod = 50; // Signal Period +input int maShift = 0; // Shift +input ENUM_MA_METHOD maMethod = MODE_EMA; // Method +input ENUM_APPLIED_PRICE maAppliedTo = PRICE_CLOSE; // Applied To +// +// END Inputs ... +// + +// +// Includes Logging Library ... +#include "../Libraries/x-saherelm.log.lib.mq5" + +// +// Includes Common Library ... +#include "../Libraries/x-saherelm.common.lib.mq5" + +// +// START Buffers ... +// +#property indicator_chart_window + +// +#property indicator_buffers 3 +#property indicator_plots 3 + +// +// maBuffer ... +#define maFastBufferIndex 0 +#define maSlowBufferIndex 1 +#define maSignalBufferIndex 2 + +double maFastBuffer[]; +double maSlowBuffer[]; +double maSignalBuffer[]; + +#property indicator_label1 "XFast" +#property indicator_type1 DRAW_LINE +#property indicator_color1 clrLime +#property indicator_style1 STYLE_SOLID +#property indicator_width1 1 + +#property indicator_label2 "XSlow" +#property indicator_type2 DRAW_LINE +#property indicator_color2 clrAqua +#property indicator_style2 STYLE_SOLID +#property indicator_width2 1 + +#property indicator_label3 "XSignal" +#property indicator_type3 DRAW_LINE +#property indicator_color3 clrBlueViolet +#property indicator_style3 STYLE_SOLID +#property indicator_width3 1 +// +// END Buffers ... +// + +// +// START Global Definitions: Variables, Properties and etc ... +// +int maFastHandler = INVALID_HANDLE; +int maSlowHandler = INVALID_HANDLE; +int maSignalHandler = INVALID_HANDLE; +// +// END Global Definitions: Variables, Properties and etc ... +// + +// +// START Event Handlers ... +// +// +// Initialization ... +int OnInit() +{ + // + // Validate Inputs ... + if (!ValidateInputs()) + { + return INIT_PARAMETERS_INCORRECT; + } + + // + logTag = ShortName; + + // + // Initializing MA Handler ... + // FAST ... + maFastHandler = iMA( + _Symbol, + _Period, + maFastPeriod, + maShift, + maMethod, + maAppliedTo); + if (maFastHandler == INVALID_HANDLE) + { + // + string message = "Error Initializing Ma Fast Handler ..."; + LogMessage(message); + + // + return INIT_FAILED; + } + // + // SLOW ... + maSlowHandler = iMA( + _Symbol, + _Period, + maSlowPeriod, + maShift, + maMethod, + maAppliedTo); + if (maSlowHandler == INVALID_HANDLE) + { + // + string message = "Error Initializing Ma Slow Handler ..."; + LogMessage(message); + + // + return INIT_FAILED; + } + // + // SIGNAL ... + maSignalHandler = iMA( + _Symbol, + _Period, + maSignalPeriod, + maShift, + maMethod, + maAppliedTo); + if (maSignalHandler == INVALID_HANDLE) + { + // + string message = "Error Initializing Ma Signal Handler ..."; + LogMessage(message); + + // + return INIT_FAILED; + } + + // + // Define Index Buffers ... + DefineBuffers(); + + // + // Set Indicator ShortName ... + SetIndicatorName(); + + // + // Init Succeed ... + return INIT_SUCCEEDED; +} + +// +// DeInitialization ... +void OnDeinit(const int reason) +{ + // + // REASON_PROGRAM 0 The EA has stopped working calling the ExpertRemove() function + // REASON_REMOVE 1 Program removed from a chart + // REASON_RECOMPILE 2 Program recompiled + // REASON_CHARTCHANGE 3 A symbol or a chart period is changed + // REASON_CHARTCLOSE 4 Chart closed + // REASON_PARAMETERS 5 Inputs changed by a user + // REASON_ACCOUNT 6 Another account has been activated or reconnection to the trade server has occurred due to changes in the account settings + // REASON_TEMPLATE 7 Another chart template applied + // REASON_INITFAILED 8 The OnInit() handler returned a non-zero value + // REASON_CLOSE 9 Terminal closed + + // + // Here we can handle De Initialization Reasons ... + IndicatorRelease(maFastHandler); + IndicatorRelease(maSlowHandler); + IndicatorRelease(maSignalHandler); +} + +// +// Calculations ... +// +// Calculating what we want ... +int OnCalculate( + // + // total Candles on chart ... + const int rates_total, + // + // total calculated Candles on charts ... + const int prev_calculated, + // + // history of Candles Open Time ... + const datetime &time[], + // + // history of Candles Open Price ... + const double &open[], + // + // history of Candles High Price ... + const double &high[], + // + // history of Candles Low Price ... + const double &low[], + // + // history of Candles Close Price ... + const double &close[], + // + // history of Tick Volumes on Candle ... + const long &tick_volume[], + // + // history of Trade Volumes ... + const long &volume[], + // + // history of Candles Spread Price ... + const int &spread[]) +{ + // + // Prepare Buffers ... + ArraySetAsSeries(time, true); + ArraySetAsSeries(open, true); + ArraySetAsSeries(high, true); + ArraySetAsSeries(low, true); + ArraySetAsSeries(close, true); + ArraySetAsSeries(tick_volume, true); + ArraySetAsSeries(volume, true); + ArraySetAsSeries(spread, true); + + // + // this counts Available Bars ... + int limit; + + // + // because in some cases we may have more than one input for + // calculation and we must prevent any calculation + // untill we pass the biggest input length, here we get max Input length + // and then wait until pass it ... + int maxLength = MathMax(maFastPeriod, maSlowPeriod); + maxLength = MathMax(maxLength, maSignalPeriod); + + // + // Check Calculated Bars ... + int maFastCalculatedBars = BarsCalculated(maFastHandler); + int maSlowCalculatedBars = BarsCalculated(maSlowHandler); + int maSignalCalculatedBars = BarsCalculated(maSignalHandler); + if (maFastCalculatedBars < maxLength || + maSlowCalculatedBars < maxLength || + maSignalCalculatedBars < maxLength) + { + return prev_calculated; + } + + // + limit = (prev_calculated > rates_total || prev_calculated <= 0) ? rates_total : (rates_total - prev_calculated) + 1; + + // + // Buffers Copy ... + int copiedMaFasts = CopyBuffer(maFastHandler, 0, 0, limit, maFastBuffer); + int copiedMaSlows = CopyBuffer(maSlowHandler, 0, 0, limit, maSlowBuffer); + int copiedMaSignals = CopyBuffer(maSignalHandler, 0, 0, limit, maSignalBuffer); + if (copiedMaFasts <= 0 || + copiedMaSlows <= 0 || + copiedMaSignals <= 0) + { + return prev_calculated; + } + + // + // Main Loop ... + for (int i = limit - 1; i >= 0 && !IsStopped(); i--) + { + // + // Do Buffers Calculation ... + CalculateBuffers(i); + } + + // + return rates_total; +} +// +// END Event Handlers ... +// + +// +// START Functions ... +// +// +// Validate Input Args for Initialization ... +bool ValidateInputs() +{ + // + bool result = false; + + // + // Validate Args ... + if (maFastPeriod >= 2 || + maSlowPeriod > maFastPeriod || + maSignalPeriod > maSignalPeriod) + { + result = true; + } + + // + return result; +} + +// +// Define Indexes and Styles ... +void DefineBuffers() +{ + // + string maFastBufferLabel = "XFast " + "(" + (string)maFastPeriod + ")"; + + // + // Ma Fast Buffer ... + ArraySetAsSeries(maFastBuffer, true); + SetIndexBuffer(maFastBufferIndex, maFastBuffer, INDICATOR_DATA); + PlotIndexSetString(maFastBufferIndex, PLOT_LABEL, maFastBufferLabel); + + // + string maSlowBufferLabel = "XSlow " + "(" + (string)maSlowPeriod + ")"; + + // + // Ma Slow Buffer ... + ArraySetAsSeries(maSlowBuffer, true); + SetIndexBuffer(maSlowBufferIndex, maSlowBuffer, INDICATOR_DATA); + PlotIndexSetString(maSlowBufferIndex, PLOT_LABEL, maSlowBufferLabel); + + // + string maSignalBufferLabel = "XSignal " + "(" + (string)maSignalPeriod + ")"; + + // + // Ma Signal Buffer ... + ArraySetAsSeries(maSignalBuffer, true); + SetIndexBuffer(maSignalBufferIndex, maSignalBuffer, INDICATOR_DATA); + PlotIndexSetString(maSignalBufferIndex, PLOT_LABEL, maSignalBufferLabel); +} + +// +// Set Indicator Short Name and also we can define Buffers Labels ... +void SetIndicatorName() +{ + // + string indicatorShortName = ""; + StringConcatenate(indicatorShortName, ShortName, " ", "(", maSignalPeriod, ")"); + + // + IndicatorSetString(INDICATOR_SHORTNAME, indicatorShortName); +} + +// +// Calculate Buffers ... +void CalculateBuffers(int bar_index) +{ +} + +// +// END Functions ... +// diff --git a/Projects/XUSPY5/Providers/x-saherelm.xuspy5.provider.indicators.lib.mq5 b/Projects/XUSPY5/Providers/x-saherelm.xuspy5.provider.indicators.lib.mq5 index d82aaea6..5fef946d 100644 --- a/Projects/XUSPY5/Providers/x-saherelm.xuspy5.provider.indicators.lib.mq5 +++ b/Projects/XUSPY5/Providers/x-saherelm.xuspy5.provider.indicators.lib.mq5 @@ -22224,15 +22224,88 @@ bool XUSPY5XSIHasShortSignal() (mConditions.isXCHMASCTrendsUp && ( // - (mConditions.isXTSCurrentOverFarest && + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && ( // ((mConditions.isXCHMASCPeak && mConditions.isXCHMALCVale) && ( // - (mConditions.isXTMNeutural && - mConditions.isXAMANeutural) + ((mConditions.isXTSCurrentMin && + mConditions.isXCHLHSCMCHHSame) && + ( + // + mConditions.isXTSCurrentCrossedUnderNearest + // + || + // + (mConditions.isXCHMAMCPeak && + mConditions.isXLHHHIncreased) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentOverFarest && + ( + // + (mConditions.isXCHMASCPeak && + ( + // + (mConditions.isXCHMALCVale && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + ) + // + ) + // + || + // + ((mConditions.isXTSCurrentMax && + mConditions.isXCHLHMCLCLLSame) && + ( + // + (mConditions.isXTMBullish && + mConditions.isXAMANeutural) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXCHMAMCPeak && + ( + // + ((mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHLHMCLCLLSame) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMABullish) + // + ) + // + ) // ) // @@ -22261,7 +22334,17 @@ bool XUSPY5XSIHasShortSignal() ( // (mConditions.isXCHLHSCMCHHSame && - mConditions.isXCHLHMCLCLLSame) + ( + // + mConditions.isXCHLHMCLCLLSame + // + || + // + mConditions.isXTSCurrentOverMediest + // + ) + // + ) // ) // @@ -23081,7 +23164,50 @@ bool XUSPY5XSIHasShortSignal() mConditions.isXCHMASCFastCrossedOverSlow) && ( // - false + ((mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear) && + ( + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + (mConditions.isXCHMASCTrendsUp && + ( + // + (mConditions.isXTSCurrentOverFarest && + ( + // + (mConditions.isXCHMASCPeak && + mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCVale && + mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXCHLHSCMCHHSame) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) // ) // @@ -23311,7 +23437,102 @@ bool XUSPY5XSIHasShortSignal() mConditions.isXCHMASCFastCrossedOverSlow) && ( // - false + ((mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear) && + ( + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + (mConditions.isXCHMASCTrendsUp && + ( + // + (mConditions.isXTSCurrentOverNearest && + ( + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXCHMASCPeak && + mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCVale && + mConditions.isXCHLHSCMCHHSame) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentOverFarest && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + (mConditions.isXCHMASCPeak && + mConditions.isXCHMALCVale && + mConditions.isXTMBullish && + mConditions.isXAMABullish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + (mConditions.isXTSCurrentOverFarest && + ( + // + (mConditions.isXCHMAMCFastCrossedOverSlow && + ( + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXCHMASCPeak && + mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCVale && + mConditions.isXCHLHSCMCHHSame) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) // ) // diff --git a/Providers/x-saherelm.xuspy5.provider.indicators.lib.mq5 b/Providers/x-saherelm.xuspy5.provider.indicators.lib.mq5 index d82aaea6..5fef946d 100644 --- a/Providers/x-saherelm.xuspy5.provider.indicators.lib.mq5 +++ b/Providers/x-saherelm.xuspy5.provider.indicators.lib.mq5 @@ -22224,15 +22224,88 @@ bool XUSPY5XSIHasShortSignal() (mConditions.isXCHMASCTrendsUp && ( // - (mConditions.isXTSCurrentOverFarest && + ((mConditions.isXTMBullish && + mConditions.isXAMABullish) && ( // ((mConditions.isXCHMASCPeak && mConditions.isXCHMALCVale) && ( // - (mConditions.isXTMNeutural && - mConditions.isXAMANeutural) + ((mConditions.isXTSCurrentMin && + mConditions.isXCHLHSCMCHHSame) && + ( + // + mConditions.isXTSCurrentCrossedUnderNearest + // + || + // + (mConditions.isXCHMAMCPeak && + mConditions.isXLHHHIncreased) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentOverFarest && + ( + // + (mConditions.isXCHMASCPeak && + ( + // + (mConditions.isXCHMALCVale && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMANeutural) + // + ) + // + ) + // + || + // + ((mConditions.isXTSCurrentMax && + mConditions.isXCHLHMCLCLLSame) && + ( + // + (mConditions.isXTMBullish && + mConditions.isXAMANeutural) + // + ) + // + ) + // + ) + // + ) + // + || + // + (mConditions.isXCHMAMCPeak && + ( + // + ((mConditions.isXCHMASCOverMax && + mConditions.isXCHLHSCMCHHSame && + mConditions.isXCHLHMCLCLLSame) && + ( + // + (mConditions.isXTMNeutural && + mConditions.isXAMABullish) + // + ) + // + ) // ) // @@ -22261,7 +22334,17 @@ bool XUSPY5XSIHasShortSignal() ( // (mConditions.isXCHLHSCMCHHSame && - mConditions.isXCHLHMCLCLLSame) + ( + // + mConditions.isXCHLHMCLCLLSame + // + || + // + mConditions.isXTSCurrentOverMediest + // + ) + // + ) // ) // @@ -23081,7 +23164,50 @@ bool XUSPY5XSIHasShortSignal() mConditions.isXCHMASCFastCrossedOverSlow) && ( // - false + ((mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear) && + ( + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + (mConditions.isXCHMASCTrendsUp && + ( + // + (mConditions.isXTSCurrentOverFarest && + ( + // + (mConditions.isXCHMASCPeak && + mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCVale && + mConditions.isXTMNeutural && + mConditions.isXAMANeutural && + mConditions.isXCHLHSCMCHHSame) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) // ) // @@ -23311,7 +23437,102 @@ bool XUSPY5XSIHasShortSignal() mConditions.isXCHMASCFastCrossedOverSlow) && ( // - false + ((mConditions.isXTDBullOverBear && + mConditions.isXTDSignalOverBear) && + ( + // + ((mConditions.isXCHMAMCTrendsDown && + mConditions.isXCHMAMCFastUnderSlow) && + ( + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + (mConditions.isXCHMASCTrendsUp && + ( + // + (mConditions.isXTSCurrentOverNearest && + ( + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXCHMASCPeak && + mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCVale && + mConditions.isXCHLHSCMCHHSame) + // + ) + // + ) + // + || + // + (mConditions.isXTSCurrentOverFarest && + ( + // + (mConditions.isXTSCurrentOverMediest && + ( + // + (mConditions.isXCHMASCPeak && + mConditions.isXCHMALCVale && + mConditions.isXTMBullish && + mConditions.isXAMABullish) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + || + // + ((mConditions.isXCHMALCTrendsDown && + mConditions.isXCHMALCFastUnderSlow) && + ( + // + (mConditions.isXTSCurrentOverFarest && + ( + // + (mConditions.isXCHMAMCFastCrossedOverSlow && + ( + // + (mConditions.isXTMBullish && + mConditions.isXAMABullish && + mConditions.isXCHMASCPeak && + mConditions.isXCHMAMCPeak && + mConditions.isXCHMALCVale && + mConditions.isXCHLHSCMCHHSame) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) + // + ) // ) //