From 7bae4c6723a865db6d98903d9cacc32503e42cdf Mon Sep 17 00:00:00 2001 From: Hadi Khazaee Asl Date: Wed, 19 Jun 2024 11:40:05 +0330 Subject: [PATCH] add support for XPV inside Market Cycles ... --- Classes/x-saherelm.x121.setup.class.mq5 | 474 ++++++- Classes/x-saherelm.xrange.class.mq5 | 55 + ...lass.mq5 => x-saherelm.xsctrend.class.mq5} | 59 +- ...class.mq5 => x-saherelm.xsczone.class.mq5} | 0 Helpers/x-saherelm.xpv.helper.mq5 | 1160 +++++++++++++++++ Libraries/x-saherelm.xtrade.lib.mq5 | 4 +- 6 files changed, 1721 insertions(+), 31 deletions(-) create mode 100644 Classes/x-saherelm.xrange.class.mq5 rename Classes/{x-saherelm.xtrend.class.mq5 => x-saherelm.xsctrend.class.mq5} (88%) rename Classes/{x-saherelm.xczone.class.mq5 => x-saherelm.xsczone.class.mq5} (100%) diff --git a/Classes/x-saherelm.x121.setup.class.mq5 b/Classes/x-saherelm.x121.setup.class.mq5 index e09f9b0e..ff6809e5 100644 --- a/Classes/x-saherelm.x121.setup.class.mq5 +++ b/Classes/x-saherelm.x121.setup.class.mq5 @@ -26,9 +26,11 @@ // #include "../Libraries/x-saherelm.xtrade.lib.mq5" #include "../Classes/x-saherelm.xalert.class.mq5" -#include "../Classes/x-saherelm.xczone.class.mq5" +#include "../Classes/x-saherelm.xsczone.class.mq5" +#include "../Classes/x-saherelm.xsctrend.class.mq5" // +#include "../Helpers/x-saherelm.xpv.helper.mq5" #include "../Helpers/x-saherelm.xtd.helper.mq5" #include "../Helpers/x-saherelm.xhk.helper.mq5" #include "../Helpers/x-saherelm.xstr.helper.mq5" @@ -204,6 +206,7 @@ struct X121SetupInputs // // Helpers Inputs ... + XPVInputs pvInputs; // XPV Inputs XTDInputs tdInputs; // XTD Inputs XHKInputs hkInputs; // XHK Inputs XCHEInputs cheInputs; // XCHE Inputs @@ -240,6 +243,7 @@ struct X121SetupInputs bool Init( string _symbol, // Symbol ENUM_TIMEFRAMES _period, // Time Frame + XPVInputs &_pvInputs, // XPV Inputs XTDInputs &_tdInputs, // XTD Inputs XHKInputs &_hkInputs, // XHK Inputs XCHEInputs &_cheInputs, // XCHE Inputs @@ -261,6 +265,7 @@ struct X121SetupInputs // // Helpers Inputs ... + this.pvInputs = _pvInputs; this.tdInputs = _tdInputs; this.hkInputs = _hkInputs; this.cheInputs = _cheInputs; @@ -294,6 +299,7 @@ struct X121SetupInputs period = NULL; // + pvInputs.Clean(); tdInputs.Clean(); hkInputs.Clean(); cheInputs.Clean(); @@ -314,6 +320,7 @@ struct X121SetupInputs void Default() { // + pvInputs.Default(); tdInputs.Default(); hkInputs.Default(); cheInputs.Default(); @@ -355,6 +362,13 @@ struct X121SetupInputs return result; } + // + result = pvInputs.IsValid(); + if (!result) + { + return result; + } + // result = hkInputs.IsValid(); if (!result) @@ -456,6 +470,7 @@ struct X121SetupConditions // // Conditions ... + XPVConditions pvConditions; XTDConditions tdConditions; XHKConditions hkConditions; XCHEConditions cheConditions; @@ -531,6 +546,14 @@ struct X121SetupConditions bullishScore += tempBullishScore; bearishScore += tempBearishScore; + // + pvConditions.GenerateScore( + tempBullishScore, + tempBearishScore // + ); + bullishScore += tempBullishScore; + bearishScore += tempBearishScore; + // adxtdConditions.GenerateScore( tempBullishScore, @@ -659,6 +682,7 @@ struct X121SetupConditions ); // + string pvSummary = pvConditions.GenerateSummary(false, true, false, ignoreFalseConditions); string tdSummary = tdConditions.GenerateSummary(false, true, false, ignoreFalseConditions); string hkSummary = hkConditions.GenerateSummary(false, true, false, ignoreFalseConditions); string strSummary = strConditions.GenerateSummary(false, true, false, ignoreFalseConditions); @@ -675,6 +699,7 @@ struct X121SetupConditions // string conditionsStr = // + pvSummary + separator + tdSummary + separator + hkSummary + separator + ichSummary + separator + @@ -2259,7 +2284,7 @@ struct X121SignalGenerator // bool IsConditionsValidForLong( X121SetupConditions &conditions, // Conditions - int verifications = 4 // Number of Verifications + int verifications = 4 // Number of Verifications ) { // @@ -2515,7 +2540,7 @@ struct X121SignalGenerator // bool IsConditionsValidForShort( X121SetupConditions &conditions, // Conditions - int verifications = 4 // Number of Verifications + int verifications = 4 // Number of Verifications ) { // @@ -2755,6 +2780,22 @@ struct X121SignalGenerator signal.zones = zones; } + // + // Calculate Trend ... + XSCTrend *trend = new XSCTrend( + signal.symbol, + signal.period // + ); + + // + XSCTrendInput tInputs; + tInputs.Default(); + bool canUseTrend = trend.Init(tInputs); + if (canUseTrend) + { + signal.trend = trend; + } + // // Generate Support Signals ... if (_useSupport) @@ -2787,6 +2828,27 @@ struct X121SignalGenerator // bool canUseZones = signal.zones != NULL; + bool canUseTrend = signal.trend != NULL && + signal.trend.IsValid(); + + // + XSignal rSignal; // Recovery Signal ... + + // + double rSL = 0; // Recovery Stop Loss ... + double rTP = 0; // Recovery Take Profit ... + double rEntry = 0; // Recovery Entry Point ... + double rVolume = signal.volume * 2; // Recovery Volume ... + ENUM_POSITION_TYPE rType; // Recovery Signal Type ... + ENUM_X_ORDER_MODES rMode; // Recovery Signal Mode ... + bool isSignalPrepared = false; // Check Signal Preparation Succeed ... + + // + double exitPrice = GetExit(signal.symbol, signal.type); + double entryPrice = GetEntry(signal.symbol, signal.type); + + // + double onePointValue = PointToPrice(1, signal.symbol); // // Check Signal Has TP and SL ... @@ -2821,21 +2883,6 @@ struct X121SignalGenerator // Try to Find a Hot Level based on Signal Direction // as Resistance ... - // - XSignal rSignal; // Recovery Signal ... - - // - double rSL = 0; // Recovery Stop Loss ... - double rTP = 0; // Recovery Take Profit ... - double rEntry = 0; // Recovery Entry Point ... - double rVolume = signal.volume * 2; // Recovery Volume ... - ENUM_POSITION_TYPE rType; // Recovery Signal Type ... - ENUM_X_ORDER_MODES rMode; // Recovery Signal Mode ... - bool isSignalPrepared = false; // Check Signal Preparation Succeed ... - - // - double onePointValue = PointToPrice(1, signal.symbol); - // for (int i = 0; i < signal.zones.CountZones(); i++) { @@ -2878,10 +2925,10 @@ struct X121SignalGenerator // Opposit Support on Resistance Upper ... // - rTP = signal.sl <= 0 - ? iZone.high - (onePointValue * 15) - : signal.sl; - rSL = signal.entry; + // rTP = signal.sl <= 0 + // ? iZone.high - (onePointValue * 15) + // : signal.sl; + // rSL = signal.entry; rType = POSITION_TYPE_BUY; rEntry = iZone.high + (onePointValue * 2); rMode = X_ORDER_MODE_STOP; @@ -2920,10 +2967,10 @@ struct X121SignalGenerator // Support Directional on Resistance Lower ... // - rTP = signal.entry; - rSL = signal.sl <= 0 - ? signal.entry - (onePointValue * 15) - : signal.sl; + // rTP = signal.entry; + // rSL = signal.sl <= 0 + // ? signal.entry - (onePointValue * 15) + // : signal.sl; rEntry = iZone.low - (onePointValue * 2); rVolume = signal.volume * 3; rType = POSITION_TYPE_SELL; @@ -2969,6 +3016,355 @@ struct X121SignalGenerator } } } + + // + if (canUseTrend) + { + // + // Check Ask and Bid Price ... + + // + XOHCL fHighBar = signal.trend.GetFirstSwingHighBar(); + XOHCL sHighBar = signal.trend.GetSecondSwingHighBar(); + + // + XOHCL fLowBar = signal.trend.GetFirstSwingLowBar(); + XOHCL sLowBar = signal.trend.GetSecondSwingLowBar(); + + // + double twoPoint = onePointValue * 2; + double fiftyPoint = onePointValue * 15; + + // + // add resistance ... + bool canAdd = + isLong && + entryPrice < (sHighBar.high - fiftyPoint); + if (canAdd) + { + // + rSignal.Clean(); + + // + rEntry = sHighBar.high - fiftyPoint; + rType = POSITION_TYPE_BUY; + rMode = X_ORDER_MODE_STOP; + rVolume = signal.volume * 2; + + // + isSignalPrepared = rSignal.Prepare( + signal.symbol, + signal.provider, + signal.period, + rType, + rMode, + rEntry, + rVolume, + rSL, + rTP // + ); + if (isSignalPrepared) + { + // + AddRef( + rSignal, + signal.supports // + ); + + // + rSignal.Clean(); + + // + rSL = 0; + rTP = 0; + rEntry = 0; + isSignalPrepared = false; + } + + // + rEntry = sHighBar.high - fiftyPoint; + rType = POSITION_TYPE_SELL; + rMode = X_ORDER_MODE_LIMIT; + rVolume = signal.volume * 3; + + // + isSignalPrepared = rSignal.Prepare( + signal.symbol, + signal.provider, + signal.period, + rType, + rMode, + rEntry, + rVolume, + rSL, + rTP // + ); + if (isSignalPrepared) + { + // + AddRef( + rSignal, + signal.supports // + ); + + // + rSignal.Clean(); + + // + rSL = 0; + rTP = 0; + rEntry = 0; + isSignalPrepared = false; + } + } + + // + canAdd = + isLong && + entryPrice > (sLowBar.low + fiftyPoint); + if (canAdd) + { + // + rSignal.Clean(); + + // + rEntry = (sLowBar.low + fiftyPoint); + rType = POSITION_TYPE_SELL; + rMode = X_ORDER_MODE_STOP; + rVolume = signal.volume * 2; + + // + isSignalPrepared = rSignal.Prepare( + signal.symbol, + signal.provider, + signal.period, + rType, + rMode, + rEntry, + rVolume, + rSL, + rTP // + ); + if (isSignalPrepared) + { + // + AddRef( + rSignal, + signal.supports // + ); + + // + rSignal.Clean(); + + // + rSL = 0; + rTP = 0; + rEntry = 0; + isSignalPrepared = false; + } + + // + rEntry = (sLowBar.low - fiftyPoint); + rType = POSITION_TYPE_BUY; + rMode = X_ORDER_MODE_LIMIT; + rVolume = signal.volume * 3; + + // + isSignalPrepared = rSignal.Prepare( + signal.symbol, + signal.provider, + signal.period, + rType, + rMode, + rEntry, + rVolume, + rSL, + rTP // + ); + if (isSignalPrepared) + { + // + AddRef( + rSignal, + signal.supports // + ); + + // + rSignal.Clean(); + + // + rSL = 0; + rTP = 0; + rEntry = 0; + isSignalPrepared = false; + } + } + + // + // add support ... + canAdd = + !isLong && + entryPrice > (sLowBar.low + fiftyPoint); + if (canAdd) + { + // + rSignal.Clean(); + + // + rEntry = sLowBar.low + fiftyPoint; + rType = POSITION_TYPE_SELL; + rMode = X_ORDER_MODE_STOP; + rVolume = signal.volume * 2; + + // + isSignalPrepared = rSignal.Prepare( + signal.symbol, + signal.provider, + signal.period, + rType, + rMode, + rEntry, + rVolume, + rSL, + rTP // + ); + if (isSignalPrepared) + { + // + AddRef( + rSignal, + signal.supports // + ); + + // + rSignal.Clean(); + + // + rSL = 0; + rTP = 0; + rEntry = 0; + isSignalPrepared = false; + } + + // + rEntry = sLowBar.low + fiftyPoint; + rType = POSITION_TYPE_BUY; + rMode = X_ORDER_MODE_LIMIT; + rVolume = signal.volume * 3; + + // + isSignalPrepared = rSignal.Prepare( + signal.symbol, + signal.provider, + signal.period, + rType, + rMode, + rEntry, + rVolume, + rSL, + rTP // + ); + if (isSignalPrepared) + { + // + AddRef( + rSignal, + signal.supports // + ); + + // + rSignal.Clean(); + + // + rSL = 0; + rTP = 0; + rEntry = 0; + isSignalPrepared = false; + } + } + + // + canAdd = + !isLong && + entryPrice < (sHighBar.high - fiftyPoint); + if (canAdd) + { + // + rSignal.Clean(); + + // + rEntry = (sHighBar.high - fiftyPoint); + rType = POSITION_TYPE_BUY; + rMode = X_ORDER_MODE_STOP; + rVolume = signal.volume * 2; + + // + isSignalPrepared = rSignal.Prepare( + signal.symbol, + signal.provider, + signal.period, + rType, + rMode, + rEntry, + rVolume, + rSL, + rTP // + ); + if (isSignalPrepared) + { + // + AddRef( + rSignal, + signal.supports // + ); + + // + rSignal.Clean(); + + // + rSL = 0; + rTP = 0; + rEntry = 0; + isSignalPrepared = false; + } + + // + rEntry = (sHighBar.high - fiftyPoint); + rType = POSITION_TYPE_SELL; + rMode = X_ORDER_MODE_LIMIT; + rVolume = signal.volume * 3; + + // + isSignalPrepared = rSignal.Prepare( + signal.symbol, + signal.provider, + signal.period, + rType, + rMode, + rEntry, + rVolume, + rSL, + rTP // + ); + if (isSignalPrepared) + { + // + AddRef( + rSignal, + signal.supports // + ); + + // + rSignal.Clean(); + + // + rSL = 0; + rTP = 0; + rEntry = 0; + isSignalPrepared = false; + } + } + } } // @@ -2987,6 +3383,7 @@ class XSCX121Setup : public XSCBaseAlert public: // // Props ... + XSCXPVHelper *pvHelper; XSCXTDHelper *tdHelper; XSCXHKHelper *hkHelper; XSCXCHEHelper *cheHelper; @@ -3010,6 +3407,7 @@ public: void ~XSCX121Setup() { // + delete pvHelper; delete tdHelper; delete hkHelper; delete cheHelper; @@ -3064,6 +3462,19 @@ public: // // Initialize Helpers ... + // + // XPV ... + pvHelper = new XSCXPVHelper(); + result = pvHelper.Init( + inputs.symbol, + inputs.period, + inputs.pvInputs // + ); + if (!result) + { + return result; + } + // // XTD ... tdHelper = new XSCXTDHelper(); @@ -3271,6 +3682,17 @@ public: conditions.period = GetPeriod(); conditions.time = TimeCurrent(); + // + result = pvHelper.GetConditions( + conditions.pvConditions, + barIndex, + loopback // + ); + if (!result) + { + return result; + } + // result = tdHelper.GetConditions( conditions.tdConditions, diff --git a/Classes/x-saherelm.xrange.class.mq5 b/Classes/x-saherelm.xrange.class.mq5 new file mode 100644 index 00000000..c0efb069 --- /dev/null +++ b/Classes/x-saherelm.xrange.class.mq5 @@ -0,0 +1,55 @@ +/////////////////////////////////////////////////////// +// +// SaherElm IT Center MQL5 Class Library +// ---------------------------------------------- +// Name: XSCRange +// Description: provides all Range requirements ... +// +// +// Maintainer: +// ------------ +// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com) +// +////////////////////////////////////////////////////// +// +// Global Properties ... +#property library +#property copyright "Copyright 2023, SaherElm IT Center" +#property link "https://www.saherelm.ir" +#property version "1.00" +#property strict + +// +// Imports ... +#include "../Classes/x-saherelm.base.class.mq5" +#include "../Libraries/x-saherelm.xtrade.lib.mq5" +#include "../Classes/x-saherelm.xaccount.class.mq5" + +// +// Definitions ... + +// +enum ENUM_XSCRANGE_CALCULATION_MODE { + // + XSCRANGE_CALCULATE_MANUALLY = 0, + XSCRANGE_CALCULATE_DAILY = 1, + XSCRANGE_CALCULATE_HALFDAY = 2, + XSCRANGE_CALCULATE_4H = 3, +}; + +// +struct XSCRangeInput +{ + // + // Props ... + + // + datetime startTime; // Range Start Time + datetime endTime; // Range End Time + + // + int lifetime; // Range Live Time (Secconds) + + // + +}; \ No newline at end of file diff --git a/Classes/x-saherelm.xtrend.class.mq5 b/Classes/x-saherelm.xsctrend.class.mq5 similarity index 88% rename from Classes/x-saherelm.xtrend.class.mq5 rename to Classes/x-saherelm.xsctrend.class.mq5 index b9cc56aa..74124907 100644 --- a/Classes/x-saherelm.xtrend.class.mq5 +++ b/Classes/x-saherelm.xsctrend.class.mq5 @@ -321,7 +321,7 @@ public: // result = mSymbol + "_" + - ToString(mPeriod) + + ToString(mPeriod) + "_" + ToFormatString(zBar.time); // @@ -422,7 +422,10 @@ public: // double support = secondSwingLowBar.low; - datetime supportTime = secondSwingLowBar.time; + datetime supportTime = + secondSwingLowBar.time > secondSwingHighBar.time + ? secondSwingHighBar.time + : secondSwingLowBar.time; string supportName = // identifier + @@ -436,7 +439,11 @@ public: // double resistance = secondSwingHighBar.high; - datetime resistanceTime = secondSwingLowBar.time; + datetime resistanceTime = + secondSwingLowBar.time > secondSwingHighBar.time + ? secondSwingHighBar.time + : secondSwingLowBar.time; + string resistanceName = // identifier + @@ -479,7 +486,7 @@ public: (IsSpecifiedValid(prefix) ? "_" + prefix + "_" : "") + - "_" + lowsPrefix + "_" + + "_" + highsPrefix + "_" + "" // ; @@ -528,6 +535,50 @@ public: return result; } + // + // Draw Highs ... + result = DrawTrendLine( + chartId, + highsName, + subWindow, + oldHighTime, + oldHigh, + newHighTime, + newHigh, + mInputs.clrHighs, + STYLE_SOLID, + 2, + false, + false, + true // Ray Right ... + ); + if (!result) + { + return result; + } + + // + // Draw Lows ... + result = DrawTrendLine( + chartId, + lowsName, + subWindow, + oldLowTime, + oldLow, + newLowTime, + newLow, + mInputs.clrLows, + STYLE_SOLID, + 2, + false, + false, + true // Ray Right ... + ); + if (!result) + { + return result; + } + // return result; } diff --git a/Classes/x-saherelm.xczone.class.mq5 b/Classes/x-saherelm.xsczone.class.mq5 similarity index 100% rename from Classes/x-saherelm.xczone.class.mq5 rename to Classes/x-saherelm.xsczone.class.mq5 diff --git a/Helpers/x-saherelm.xpv.helper.mq5 b/Helpers/x-saherelm.xpv.helper.mq5 index b78b1831..b0f91e6a 100644 --- a/Helpers/x-saherelm.xpv.helper.mq5 +++ b/Helpers/x-saherelm.xpv.helper.mq5 @@ -268,6 +268,612 @@ struct XPVInputs } }; +// +// Conditions ... +struct XPVConditions +{ + // + // Common ... + string symbol; + ENUM_TIMEFRAMES period; + datetime time; + + // + // Buffers ... + double peaks[]; + double vales[]; + double resistances[]; + double supports[]; + double fib1s[]; + double fib2s[]; + double fib3s[]; + double fib4s[]; + double fib5s[]; + double sCHHs[]; + double sCLLs[]; + double mCHHs[]; + double mCLLs[]; + double lCHHs[]; + double lCLLs[]; + double hCHHs[]; + double hCLLs[]; + + // + // Conditions ... + + // + bool isNewPeak; + bool isNewPeakOverLast; + bool isNewPeakUnderLast; + + // + bool isNewVale; + bool isNewValeOverLast; + bool isNewValeUnderLast; + + // + bool isFiboIncreased; + bool isFiboDecreased; + bool isFiboSectionChanged; + + // + // SC ... + + // + bool isSCBullish; + bool isSCHHBullish; + bool isSCLLBullish; + bool isSCSwitchedToBullish; + bool isSCHHSwitchedToBullish; + bool isSCLLSwitchedToBullish; + + // + bool isSCBearish; + bool isSCHHBearish; + bool isSCLLBearish; + bool isSCSwitchedToBearish; + bool isSCHHSwitchedToBearish; + bool isSCLLSwitchedToBeraish; + + // + // MC ... + + // + bool isMCBullish; + bool isMCHHBullish; + bool isMCLLBullish; + bool isMCSwitchedToBullish; + bool isMCHHSwitchedToBullish; + bool isMCLLSwitchedToBullish; + + // + bool isMCBearish; + bool isMCHHBearish; + bool isMCLLBearish; + bool isMCSwitchedToBearish; + bool isMCHHSwitchedToBearish; + bool isMCLLSwitchedToBeraish; + + // + // LC ... + + // + bool isLCBullish; + bool isLCHHBullish; + bool isLCLLBullish; + bool isLCSwitchedToBullish; + bool isLCHHSwitchedToBullish; + bool isLCLLSwitchedToBullish; + // + bool isLCBearish; + bool isLCHHBearish; + bool isLCLLBearish; + bool isLCSwitchedToBearish; + bool isLCHHSwitchedToBearish; + bool isLCLLSwitchedToBeraish; + + // + // HC ... + + // + bool isHCBullish; + bool isHCHHBullish; + bool isHCLLBullish; + bool isHCSwitchedToBullish; + bool isHCHHSwitchedToBullish; + bool isHCLLSwitchedToBullish; + + // + bool isHCBearish; + bool isHCHHBearish; + bool isHCLLBearish; + bool isHCSwitchedToBearish; + bool isHCHHSwitchedToBearish; + bool isHCLLSwitchedToBeraish; + + // + void Clean() + { + // + Clean(peaks); + Clean(vales); + Clean(resistances); + Clean(supports); + Clean(fib1s); + Clean(fib2s); + Clean(fib3s); + Clean(fib4s); + Clean(fib5s); + Clean(sCHHs); + Clean(sCLLs); + Clean(mCHHs); + Clean(mCLLs); + Clean(lCHHs); + Clean(lCLLs); + Clean(hCHHs); + Clean(hCLLs); + + // + ArraySetAsSeries(peaks, true); + ArraySetAsSeries(vales, true); + ArraySetAsSeries(resistances, true); + ArraySetAsSeries(supports, true); + ArraySetAsSeries(fib1s, true); + ArraySetAsSeries(fib2s, true); + ArraySetAsSeries(fib3s, true); + ArraySetAsSeries(fib4s, true); + ArraySetAsSeries(fib5s, true); + ArraySetAsSeries(sCHHs, true); + ArraySetAsSeries(sCLLs, true); + ArraySetAsSeries(mCHHs, true); + ArraySetAsSeries(mCLLs, true); + ArraySetAsSeries(lCHHs, true); + ArraySetAsSeries(lCLLs, true); + ArraySetAsSeries(hCHHs, true); + ArraySetAsSeries(hCLLs, true); + + // + isNewPeak = false; + isNewPeakOverLast = false; + isNewPeakUnderLast = false; + isNewVale = false; + isNewValeOverLast = false; + isNewValeUnderLast = false; + isFiboIncreased = false; + isFiboDecreased = false; + isFiboSectionChanged = false; + isSCBullish = false; + isSCHHBullish = false; + isSCLLBullish = false; + isSCSwitchedToBullish = false; + isSCHHSwitchedToBullish = false; + isSCLLSwitchedToBullish = false; + isSCBearish = false; + isSCHHBearish = false; + isSCLLBearish = false; + isSCSwitchedToBearish = false; + isSCHHSwitchedToBearish = false; + isSCLLSwitchedToBeraish = false; + isMCBullish = false; + isMCHHBullish = false; + isMCLLBullish = false; + isMCSwitchedToBullish = false; + isMCHHSwitchedToBullish = false; + isMCLLSwitchedToBullish = false; + isMCBearish = false; + isMCHHBearish = false; + isMCLLBearish = false; + isMCSwitchedToBearish = false; + isMCHHSwitchedToBearish = false; + isMCLLSwitchedToBeraish = false; + isLCBullish = false; + isLCHHBullish = false; + isLCLLBullish = false; + isLCSwitchedToBullish = false; + isLCHHSwitchedToBullish = false; + isLCLLSwitchedToBullish = false; + isLCBearish = false; + isLCHHBearish = false; + isLCLLBearish = false; + isLCSwitchedToBearish = false; + isLCHHSwitchedToBearish = false; + isLCLLSwitchedToBeraish = false; + isHCBullish = false; + isHCHHBullish = false; + isHCLLBullish = false; + isHCSwitchedToBullish = false; + isHCHHSwitchedToBullish = false; + isHCLLSwitchedToBullish = false; + isHCBearish = false; + isHCHHBearish = false; + isHCLLBearish = false; + isHCSwitchedToBearish = false; + isHCHHSwitchedToBearish = false; + isHCLLSwitchedToBeraish = false; + } + + // + void GenerateScore( + double &bullishScore, + double &bearishScore // + ) + { + // + bullishScore = 0; + bearishScore = 0; + + // + if (isNewPeak) + { + } + if (isNewPeakOverLast) + { + } + if (isNewPeakUnderLast) + { + } + + // + if (isNewVale) + { + } + if (isNewValeOverLast) + { + } + if (isNewValeUnderLast) + { + } + + // + if (isFiboIncreased) + { + } + if (isFiboDecreased) + { + } + if (isFiboSectionChanged) + { + } + + // + if (isSCBullish) + { + bullishScore++; + } + if (isSCHHBullish) + { + bullishScore++; + } + if (isSCLLBullish) + { + bullishScore++; + } + if (isSCSwitchedToBullish) + { + bullishScore++; + } + if (isSCHHSwitchedToBullish) + { + bullishScore++; + } + if (isSCLLSwitchedToBullish) + { + bullishScore++; + } + + // + if (isSCBearish) + { + bearishScore++; + } + if (isSCHHBearish) + { + bearishScore++; + } + if (isSCLLBearish) + { + bearishScore++; + } + if (isSCSwitchedToBearish) + { + bearishScore++; + } + if (isSCHHSwitchedToBearish) + { + bearishScore++; + } + if (isSCLLSwitchedToBeraish) + { + bearishScore++; + } + + // + if (isMCBullish) + { + bullishScore++; + } + if (isMCHHBullish) + { + bullishScore++; + } + if (isMCLLBullish) + { + bullishScore++; + } + if (isMCSwitchedToBullish) + { + bullishScore++; + } + if (isMCHHSwitchedToBullish) + { + bullishScore++; + } + if (isMCLLSwitchedToBullish) + { + bullishScore++; + } + + // + if (isMCBearish) + { + bearishScore++; + } + if (isMCHHBearish) + { + bearishScore++; + } + if (isMCLLBearish) + { + bearishScore++; + } + if (isMCSwitchedToBearish) + { + bearishScore++; + } + if (isMCHHSwitchedToBearish) + { + bearishScore++; + } + if (isMCLLSwitchedToBeraish) + { + bearishScore++; + } + + // + if (isLCBullish) + { + bullishScore++; + } + if (isLCHHBullish) + { + bullishScore++; + } + if (isLCLLBullish) + { + bullishScore++; + } + if (isLCSwitchedToBullish) + { + bullishScore++; + } + if (isLCHHSwitchedToBullish) + { + bullishScore++; + } + if (isLCLLSwitchedToBullish) + { + bullishScore++; + } + + // + if (isLCBearish) + { + bearishScore++; + } + if (isLCHHBearish) + { + bearishScore++; + } + if (isLCLLBearish) + { + bearishScore++; + } + if (isLCSwitchedToBearish) + { + bearishScore++; + } + if (isLCHHSwitchedToBearish) + { + bearishScore++; + } + if (isLCLLSwitchedToBeraish) + { + bearishScore++; + } + + if (isHCBullish) + { + bullishScore++; + } + if (isHCHHBullish) + { + bullishScore++; + } + if (isHCLLBullish) + { + bullishScore++; + } + if (isHCSwitchedToBullish) + { + bullishScore++; + } + if (isHCHHSwitchedToBullish) + { + bullishScore++; + } + if (isHCLLSwitchedToBullish) + { + bullishScore++; + } + + // + if (isHCBearish) + { + bearishScore++; + } + if (isHCHHBearish) + { + bearishScore++; + } + if (isHCLLBearish) + { + bearishScore++; + } + if (isHCSwitchedToBearish) + { + bearishScore++; + } + if (isHCHHSwitchedToBearish) + { + bearishScore++; + } + if (isHCLLSwitchedToBeraish) + { + bearishScore++; + } + } + + // + string GenerateSummary( + bool onlyCommons = false, + bool onlyConditions = false, + bool includeScores = true, + bool ignoreFalseConditions = true, + string separator = "\n" // + ) + { + // + string result = NULL; + + // + double bullishScore = 0; + double bearishScore = 0; + GenerateScore( + bullishScore, + bearishScore // + ); + + // + string scoresStr = + // + "Scores: " + separator + + "---------------" + separator + + "Bullish: " + ToString(bullishScore) + separator + + "Bearish: " + ToString(bearishScore) + separator + + "" + // + ; + + // + string commonStr = GenerateSpecifiedCommonSummary( + this, + separator, + includeScores // + ); + + // + string conditionsStr = + // + ToString("isNewPeak", isNewPeak, ignoreFalseConditions, separator) + + ToString("isNewPeakOverLast", isNewPeakOverLast, ignoreFalseConditions, separator) + + ToString("isNewPeakUnderLast", isNewPeakUnderLast, ignoreFalseConditions, separator) + + ToString("isNewVale", isNewVale, ignoreFalseConditions, separator) + + ToString("isNewValeOverLast", isNewValeOverLast, ignoreFalseConditions, separator) + + ToString("isNewValeUnderLast", isNewValeUnderLast, ignoreFalseConditions, separator) + + ToString("isFiboIncreased", isFiboIncreased, ignoreFalseConditions, separator) + + ToString("isFiboDecreased", isFiboDecreased, ignoreFalseConditions, separator) + + ToString("isFiboSectionChanged", isFiboSectionChanged, ignoreFalseConditions, separator) + + ToString("isSCBullish", isSCBullish, ignoreFalseConditions, separator) + + ToString("isSCHHBullish", isSCHHBullish, ignoreFalseConditions, separator) + + ToString("isSCLLBullish", isSCLLBullish, ignoreFalseConditions, separator) + + ToString("isSCSwitchedToBullish", isSCSwitchedToBullish, ignoreFalseConditions, separator) + + ToString("isSCHHSwitchedToBullish", isSCHHSwitchedToBullish, ignoreFalseConditions, separator) + + ToString("isSCLLSwitchedToBullish", isSCLLSwitchedToBullish, ignoreFalseConditions, separator) + + ToString("isSCBearish", isSCBearish, ignoreFalseConditions, separator) + + ToString("isSCHHBearish", isSCHHBearish, ignoreFalseConditions, separator) + + ToString("isSCLLBearish", isSCLLBearish, ignoreFalseConditions, separator) + + ToString("isSCSwitchedToBearish", isSCSwitchedToBearish, ignoreFalseConditions, separator) + + ToString("isSCHHSwitchedToBearish", isSCHHSwitchedToBearish, ignoreFalseConditions, separator) + + ToString("isSCLLSwitchedToBeraish", isSCLLSwitchedToBeraish, ignoreFalseConditions, separator) + + ToString("isMCBullish", isMCBullish, ignoreFalseConditions, separator) + + ToString("isMCHHBullish", isMCHHBullish, ignoreFalseConditions, separator) + + ToString("isMCLLBullish", isMCLLBullish, ignoreFalseConditions, separator) + + ToString("isMCSwitchedToBullish", isMCSwitchedToBullish, ignoreFalseConditions, separator) + + ToString("isMCHHSwitchedToBullish", isMCHHSwitchedToBullish, ignoreFalseConditions, separator) + + ToString("isMCLLSwitchedToBullish", isMCLLSwitchedToBullish, ignoreFalseConditions, separator) + + ToString("isMCBearish", isMCBearish, ignoreFalseConditions, separator) + + ToString("isMCHHBearish", isMCHHBearish, ignoreFalseConditions, separator) + + ToString("isMCLLBearish", isMCLLBearish, ignoreFalseConditions, separator) + + ToString("isMCSwitchedToBearish", isMCSwitchedToBearish, ignoreFalseConditions, separator) + + ToString("isMCHHSwitchedToBearish", isMCHHSwitchedToBearish, ignoreFalseConditions, separator) + + ToString("isMCLLSwitchedToBeraish", isMCLLSwitchedToBeraish, ignoreFalseConditions, separator) + + ToString("isLCBullish", isLCBullish, ignoreFalseConditions, separator) + + ToString("isLCHHBullish", isLCHHBullish, ignoreFalseConditions, separator) + + ToString("isLCLLBullish", isLCLLBullish, ignoreFalseConditions, separator) + + ToString("isLCSwitchedToBullish", isLCSwitchedToBullish, ignoreFalseConditions, separator) + + ToString("isLCHHSwitchedToBullish", isLCHHSwitchedToBullish, ignoreFalseConditions, separator) + + ToString("isLCLLSwitchedToBullish", isLCLLSwitchedToBullish, ignoreFalseConditions, separator) + + ToString("isLCBearish", isLCBearish, ignoreFalseConditions, separator) + + ToString("isLCHHBearish", isLCHHBearish, ignoreFalseConditions, separator) + + ToString("isLCLLBearish", isLCLLBearish, ignoreFalseConditions, separator) + + ToString("isLCSwitchedToBearish", isLCSwitchedToBearish, ignoreFalseConditions, separator) + + ToString("isLCHHSwitchedToBearish", isLCHHSwitchedToBearish, ignoreFalseConditions, separator) + + ToString("isLCLLSwitchedToBeraish", isLCLLSwitchedToBeraish, ignoreFalseConditions, separator) + + ToString("isHCBullish", isHCBullish, ignoreFalseConditions, separator) + + ToString("isHCHHBullish", isHCHHBullish, ignoreFalseConditions, separator) + + ToString("isHCLLBullish", isHCLLBullish, ignoreFalseConditions, separator) + + ToString("isHCSwitchedToBullish", isHCSwitchedToBullish, ignoreFalseConditions, separator) + + ToString("isHCHHSwitchedToBullish", isHCHHSwitchedToBullish, ignoreFalseConditions, separator) + + ToString("isHCLLSwitchedToBullish", isHCLLSwitchedToBullish, ignoreFalseConditions, separator) + + ToString("isHCBearish", isHCBearish, ignoreFalseConditions, separator) + + ToString("isHCHHBearish", isHCHHBearish, ignoreFalseConditions, separator) + + ToString("isHCLLBearish", isHCLLBearish, ignoreFalseConditions, separator) + + ToString("isHCSwitchedToBearish", isHCSwitchedToBearish, ignoreFalseConditions, separator) + + ToString("isHCHHSwitchedToBearish", isHCHHSwitchedToBearish, ignoreFalseConditions, separator) + + ToString("isHCLLSwitchedToBeraish", isHCLLSwitchedToBeraish, ignoreFalseConditions, separator) + + "" + // + ; + + // + result = + // + "[" + GetTag() + "]" + separator + + (onlyConditions + ? "" + : commonStr) + + (!includeScores + ? "" + : scoresStr) + + " " + separator + + (onlyCommons + ? "" + : conditionsStr) + + "" + // + ; + + // + return result; + } + + // + string GetTag() + { + return "XPV"; + } +}; + // // Class ... class XSCXPVHelper : public XSCBaseHelper @@ -1613,6 +2219,560 @@ public: ); } + // + bool GetConditions( + XPVConditions &conditions, // + int barIndex = 0, // + int loopback = 3 // + ) + { + // + bool result = true; + + // + if (loopback < 3) + { + loopback = 3; + } + + // + conditions.Clean(); + + // + conditions.symbol = mSymbol; + conditions.period = mPeriod; + conditions.time = TimeCurrent(); + + // + int zIndex = barIndex; + int cIndex = zIndex + 1; + int pIndex = cIndex + 1; + int ppIndex = pIndex + 1; + + // + // Buffers ... + + // + CopyPeak( + zIndex, + loopback, + conditions.peaks // + ); + + // + CopyVale( + zIndex, + loopback, + conditions.vales // + ); + + // + CopySupport( + zIndex, + loopback, + conditions.supports // + ); + + // + CopyResistance( + zIndex, + loopback, + conditions.resistances // + ); + + // + CopyFib1( + zIndex, + loopback, + conditions.fib1s // + ); + + // + CopyFib2( + zIndex, + loopback, + conditions.fib2s // + ); + + // + CopyFib3( + zIndex, + loopback, + conditions.fib3s // + ); + + // + CopyFib4( + zIndex, + loopback, + conditions.fib4s // + ); + + // + CopyFib5( + zIndex, + loopback, + conditions.fib5s // + ); + + // + CopySCHH( + zIndex, + loopback, + conditions.sCHHs // + ); + + // + CopySCLL( + zIndex, + loopback, + conditions.sCLLs // + ); + + // + CopyMCHH( + zIndex, + loopback, + conditions.mCHHs // + ); + + // + CopyMCLL( + zIndex, + loopback, + conditions.mCLLs // + ); + + // + CopyLCHH( + zIndex, + loopback, + conditions.lCHHs // + ); + + // + CopyLCLL( + zIndex, + loopback, + conditions.lCLLs // + ); + + // + CopyHCHH( + zIndex, + loopback, + conditions.hCHHs // + ); + + // + CopyHCLL( + zIndex, + loopback, + conditions.hCLLs // + ); + + // + // Conditions ... + + // + bool isNewPeak = conditions.peaks[cIndex] != conditions.peaks[pIndex]; + bool isNewPeakOverLast = isNewPeak && + conditions.peaks[cIndex] > conditions.peaks[pIndex]; + bool isNewPeakUnderLast = isNewPeak && + conditions.peaks[cIndex] < conditions.peaks[pIndex]; + + // + bool isNewVale = conditions.vales[cIndex] != conditions.vales[pIndex]; + bool isNewValeOverLast = isNewVale && + conditions.vales[cIndex] > conditions.vales[pIndex]; + bool isNewValeUnderLast = isNewVale && + conditions.vales[cIndex] < conditions.vales[pIndex]; + + // + bool isFiboIncreased = + // + conditions.fib1s[cIndex] > conditions.fib1s[pIndex] && + conditions.fib2s[cIndex] > conditions.fib2s[pIndex] && + conditions.fib3s[cIndex] > conditions.fib3s[pIndex] && + conditions.fib4s[cIndex] > conditions.fib4s[pIndex] && + conditions.fib5s[cIndex] > conditions.fib5s[pIndex] + // + ; + bool isFiboDecreased = + // + conditions.fib1s[cIndex] < conditions.fib1s[pIndex] && + conditions.fib2s[cIndex] < conditions.fib2s[pIndex] && + conditions.fib3s[cIndex] < conditions.fib3s[pIndex] && + conditions.fib4s[cIndex] < conditions.fib4s[pIndex] && + conditions.fib5s[cIndex] < conditions.fib5s[pIndex] + // + ; + bool isFiboSectionChanged = + // + (isFiboDecreased && + isNewPeakUnderLast) + // + || + // + (isFiboIncreased && + isNewValeOverLast) + // + ; + + // + // SC ... + + // + bool isSCHHBullish = conditions.sCHHs[cIndex] > conditions.sCHHs[pIndex]; + bool isSCLLBullish = conditions.sCLLs[cIndex] > conditions.sCLLs[pIndex]; + + // + bool isSCHHBullishPrev = conditions.sCHHs[pIndex] > conditions.sCHHs[ppIndex]; + bool isSCLLBullishPrev = conditions.sCLLs[pIndex] > conditions.sCLLs[ppIndex]; + + // + bool isSCBullish = isSCHHBullish && + isSCLLBullish; + + // + bool isSCBullishPrev = isSCHHBullishPrev && + isSCLLBullishPrev; + + // + bool isSCHHSwitchedToBullish = isSCHHBullish && + !isSCHHBullishPrev; + bool isSCLLSwitchedToBullish = isSCLLBullish && + !isSCLLBullishPrev; + + // + bool isSCHHBearish = conditions.sCHHs[cIndex] < conditions.sCHHs[pIndex]; + bool isSCLLBearish = conditions.sCLLs[cIndex] < conditions.sCLLs[pIndex]; + + // + bool isSCHHBearishPrev = conditions.sCHHs[pIndex] < conditions.sCHHs[ppIndex]; + bool isSCLLBearishPrev = conditions.sCLLs[pIndex] < conditions.sCLLs[ppIndex]; + + // + bool isSCBearish = isSCHHBearish && + isSCLLBearish; + + // + bool isSCBearishPrev = isSCHHBearishPrev && + isSCLLBearishPrev; + + // + bool isSCHHSwitchedToBearish = isSCHHBearish && + !isSCHHBearishPrev; + bool isSCLLSwitchedToBeraish = isSCLLBearish && + !isSCLLBearishPrev; + + // + bool isSCSwitchedToBullish = + // + (isSCHHSwitchedToBullish && + !isSCLLBearish) + // + || + // + (isSCLLSwitchedToBullish && + !isSCHHBearish) + // + ; + + // + bool isSCSwitchedToBearish = + // + (isSCHHSwitchedToBearish && + !isSCLLBullish) + // + || + // + (isSCLLSwitchedToBeraish && + !isSCHHBullish) + // + ; + + // + // MC ... + + // + bool isMCHHBullish = conditions.mCHHs[cIndex] > conditions.mCHHs[pIndex]; + bool isMCLLBullish = conditions.mCLLs[cIndex] > conditions.mCLLs[pIndex]; + + // + bool isMCHHBullishPrev = conditions.mCHHs[pIndex] > conditions.mCHHs[ppIndex]; + bool isMCLLBullishPrev = conditions.mCLLs[pIndex] > conditions.mCLLs[ppIndex]; + + // + bool isMCBullish = isMCHHBullish && + isMCLLBullish; + + // + bool isMCBullishPrev = isMCHHBullishPrev && + isMCLLBullishPrev; + + // + bool isMCHHSwitchedToBullish = isMCHHBullish && + !isMCHHBullishPrev; + bool isMCLLSwitchedToBullish = isMCLLBullish && + !isMCLLBullishPrev; + + // + bool isMCHHBearish = conditions.mCHHs[cIndex] < conditions.mCHHs[pIndex]; + bool isMCLLBearish = conditions.mCLLs[cIndex] < conditions.mCLLs[pIndex]; + + // + bool isMCHHBearishPrev = conditions.mCHHs[pIndex] < conditions.mCHHs[ppIndex]; + bool isMCLLBearishPrev = conditions.mCLLs[pIndex] < conditions.mCLLs[ppIndex]; + + // + bool isMCBearish = isMCHHBearish && + isMCLLBearish; + + // + bool isMCBearishPrev = isMCHHBearishPrev && + isMCLLBearishPrev; + + // + bool isMCHHSwitchedToBearish = isMCHHBearish && + !isMCHHBearishPrev; + bool isMCLLSwitchedToBeraish = isMCLLBearish && + !isMCLLBearishPrev; + + // + bool isMCSwitchedToBullish = + // + (isMCHHSwitchedToBullish && + !isMCLLBearish) + // + || + // + (isMCLLSwitchedToBullish && + !isMCHHBearish) + // + ; + + // + bool isMCSwitchedToBearish = + // + (isMCHHSwitchedToBearish && + !isMCLLBullish) + // + || + // + (isMCLLSwitchedToBeraish && + !isMCHHBullish) + // + ; + + // + // LC ... + + // + bool isLCHHBullish = conditions.lCHHs[cIndex] > conditions.lCHHs[pIndex]; + bool isLCLLBullish = conditions.lCLLs[cIndex] > conditions.lCLLs[pIndex]; + + // + bool isLCHHBullishPrev = conditions.lCHHs[pIndex] > conditions.lCHHs[ppIndex]; + bool isLCLLBullishPrev = conditions.lCLLs[pIndex] > conditions.lCLLs[ppIndex]; + + // + bool isLCBullish = isLCHHBullish && + isLCLLBullish; + + // + bool isLCBullishPrev = isLCHHBullishPrev && + isLCLLBullishPrev; + + // + bool isLCHHSwitchedToBullish = isLCHHBullish && + !isLCHHBullishPrev; + bool isLCLLSwitchedToBullish = isLCLLBullish && + !isLCLLBullishPrev; + + // + bool isLCHHBearish = conditions.lCHHs[cIndex] < conditions.lCHHs[pIndex]; + bool isLCLLBearish = conditions.lCLLs[cIndex] < conditions.lCLLs[pIndex]; + + // + bool isLCHHBearishPrev = conditions.lCHHs[pIndex] < conditions.lCHHs[ppIndex]; + bool isLCLLBearishPrev = conditions.lCLLs[pIndex] < conditions.lCLLs[ppIndex]; + + // + bool isLCBearish = isLCHHBearish && + isLCLLBearish; + + // + bool isLCBearishPrev = isLCHHBearishPrev && + isLCLLBearishPrev; + + // + bool isLCHHSwitchedToBearish = isLCHHBearish && + !isLCHHBearishPrev; + bool isLCLLSwitchedToBeraish = isLCLLBearish && + !isLCLLBearishPrev; + + // + bool isLCSwitchedToBullish = + // + (isLCHHSwitchedToBullish && + !isLCLLBearish) + // + || + // + (isLCLLSwitchedToBullish && + !isLCHHBearish) + // + ; + + // + bool isLCSwitchedToBearish = + // + (isLCHHSwitchedToBearish && + !isLCLLBullish) + // + || + // + (isLCLLSwitchedToBeraish && + !isLCHHBullish) + // + ; + + // + // HC ... + + // + bool isHCHHBullish = conditions.hCHHs[cIndex] > conditions.hCHHs[pIndex]; + bool isHCLLBullish = conditions.hCLLs[cIndex] > conditions.hCLLs[pIndex]; + + // + bool isHCHHBullishPrev = conditions.hCHHs[pIndex] > conditions.hCHHs[ppIndex]; + bool isHCLLBullishPrev = conditions.hCLLs[pIndex] > conditions.hCLLs[ppIndex]; + + // + bool isHCBullish = isHCHHBullish && + isHCLLBullish; + + // + bool isHCBullishPrev = isHCHHBullishPrev && + isHCLLBullishPrev; + + // + bool isHCHHSwitchedToBullish = isHCHHBullish && + !isHCHHBullishPrev; + bool isHCLLSwitchedToBullish = isHCLLBullish && + !isHCLLBullishPrev; + + // + bool isHCHHBearish = conditions.hCHHs[cIndex] < conditions.hCHHs[pIndex]; + bool isHCLLBearish = conditions.hCLLs[cIndex] < conditions.hCLLs[pIndex]; + + // + bool isHCHHBearishPrev = conditions.hCHHs[pIndex] < conditions.hCHHs[ppIndex]; + bool isHCLLBearishPrev = conditions.hCLLs[pIndex] < conditions.hCLLs[ppIndex]; + + // + bool isHCBearish = isHCHHBearish && + isHCLLBearish; + + // + bool isHCBearishPrev = isHCHHBearishPrev && + isHCLLBearishPrev; + + // + bool isHCHHSwitchedToBearish = isHCHHBearish && + !isHCHHBearishPrev; + bool isHCLLSwitchedToBeraish = isHCLLBearish && + !isHCLLBearishPrev; + + // + bool isHCSwitchedToBullish = + // + (isHCHHSwitchedToBullish && + !isHCLLBearish) + // + || + // + (isHCLLSwitchedToBullish && + !isHCHHBearish) + // + ; + + // + bool isHCSwitchedToBearish = + // + (isHCHHSwitchedToBearish && + !isHCLLBullish) + // + || + // + (isHCLLSwitchedToBeraish && + !isHCHHBullish) + // + ; + + // + conditions.isNewPeak = isNewPeak; + conditions.isNewPeakOverLast = isNewPeakOverLast; + conditions.isNewPeakUnderLast = isNewPeakUnderLast; + conditions.isNewVale = isNewVale; + conditions.isNewValeOverLast = isNewValeOverLast; + conditions.isNewValeUnderLast = isNewValeUnderLast; + conditions.isFiboIncreased = isFiboIncreased; + conditions.isFiboDecreased = isFiboDecreased; + conditions.isFiboSectionChanged = isFiboSectionChanged; + conditions.isSCBullish = isSCBullish; + conditions.isSCHHBullish = isSCHHBullish; + conditions.isSCLLBullish = isSCLLBullish; + conditions.isSCSwitchedToBullish = isSCSwitchedToBullish; + conditions.isSCHHSwitchedToBullish = isSCHHSwitchedToBullish; + conditions.isSCLLSwitchedToBullish = isSCLLSwitchedToBullish; + conditions.isSCBearish = isSCBearish; + conditions.isSCHHBearish = isSCHHBearish; + conditions.isSCLLBearish = isSCLLBearish; + conditions.isSCSwitchedToBearish = isSCSwitchedToBearish; + conditions.isSCHHSwitchedToBearish = isSCHHSwitchedToBearish; + conditions.isSCLLSwitchedToBeraish = isSCLLSwitchedToBeraish; + conditions.isMCBullish = isMCBullish; + conditions.isMCHHBullish = isMCHHBullish; + conditions.isMCLLBullish = isMCLLBullish; + conditions.isMCSwitchedToBullish = isMCSwitchedToBullish; + conditions.isMCHHSwitchedToBullish = isMCHHSwitchedToBullish; + conditions.isMCLLSwitchedToBullish = isMCLLSwitchedToBullish; + conditions.isMCBearish = isMCBearish; + conditions.isMCHHBearish = isMCHHBearish; + conditions.isMCLLBearish = isMCLLBearish; + conditions.isMCSwitchedToBearish = isMCSwitchedToBearish; + conditions.isMCHHSwitchedToBearish = isMCHHSwitchedToBearish; + conditions.isMCLLSwitchedToBeraish = isMCLLSwitchedToBeraish; + conditions.isLCBullish = isLCBullish; + conditions.isLCHHBullish = isLCHHBullish; + conditions.isLCLLBullish = isLCLLBullish; + conditions.isLCSwitchedToBullish = isLCSwitchedToBullish; + conditions.isLCHHSwitchedToBullish = isLCHHSwitchedToBullish; + conditions.isLCLLSwitchedToBullish = isLCLLSwitchedToBullish; + conditions.isLCBearish = isLCBearish; + conditions.isLCHHBearish = isLCHHBearish; + conditions.isLCLLBearish = isLCLLBearish; + conditions.isLCSwitchedToBearish = isLCSwitchedToBearish; + conditions.isLCHHSwitchedToBearish = isLCHHSwitchedToBearish; + conditions.isLCLLSwitchedToBeraish = isLCLLSwitchedToBeraish; + conditions.isHCBullish = isHCBullish; + conditions.isHCHHBullish = isHCHHBullish; + conditions.isHCLLBullish = isHCLLBullish; + conditions.isHCSwitchedToBullish = isHCSwitchedToBullish; + conditions.isHCHHSwitchedToBullish = isHCHHSwitchedToBullish; + conditions.isHCLLSwitchedToBullish = isHCLLSwitchedToBullish; + conditions.isHCBearish = isHCBearish; + conditions.isHCHHBearish = isHCHHBearish; + conditions.isHCLLBearish = isHCLLBearish; + conditions.isHCSwitchedToBearish = isHCSwitchedToBearish; + conditions.isHCHHSwitchedToBearish = isHCHHSwitchedToBearish; + conditions.isHCLLSwitchedToBeraish = isHCLLSwitchedToBeraish; + // + return result; + } + // // Protected ... protected: diff --git a/Libraries/x-saherelm.xtrade.lib.mq5 b/Libraries/x-saherelm.xtrade.lib.mq5 index 6380e9d6..3999f1f1 100644 --- a/Libraries/x-saherelm.xtrade.lib.mq5 +++ b/Libraries/x-saherelm.xtrade.lib.mq5 @@ -23,8 +23,9 @@ // Imports ... #include #include "../Libraries/x-saherelm.draw.lib.mq5" -#include "../Classes/x-saherelm.xczone.class.mq5" #include "../Libraries/x-saherelm.common.lib.mq5" +#include "../Classes/x-saherelm.xsczone.class.mq5" +#include "../Classes/x-saherelm.xsctrend.class.mq5" // // Definitions ... @@ -731,6 +732,7 @@ struct XSignal // // Zones for Signal ... XSCZones *zones; + XSCTrend *trend; // // Constructor ...