From 5ac08cf97b8479ccf23d457b1b9b6fa67f0a4550 Mon Sep 17 00:00:00 2001 From: Hadi Khazaee Asl Date: Mon, 17 Mar 2025 23:40:00 +0330 Subject: [PATCH] apply last POI Changes Refctor and Resolve all Side Affect Issues on X121 SMC Expert Projects ... --- Classes/x-saherelm.x-poi.drawer.class.mq5 | 1 + .../x-121.smc.market.cycle.helper.class.mq5 | 4033 +++++++++++++++++ .../BKP}/x-saherelm.xohcl.lib.mq5 | 0 .../BKP}/x-saherelm.xpoi.test.ea.mq5 | 0 Helpers/x-saherelm.x121.helper.mq5 | 615 --- Helpers/x-saherelm.x121.xatr.helper.mq5 | 98 - Helpers/x-saherelm.x121.xdon.helper.mq5 | 173 - Helpers/x-saherelm.x121.xhk.helper.mq5 | 110 - Helpers/x-saherelm.x121.xpv.helper.mq5 | 36 - .../x-saherelm.common.extensions.lib.mq5 | 11 + Libraries/x-saherelm.common.models.lib.mq5 | 368 ++ .../x-121.smc.market.cycle.helper.class.mq5 | 130 +- 12 files changed, 4415 insertions(+), 1160 deletions(-) create mode 100644 Documents/BKP/x-121.smc.market.cycle.helper.class.mq5 rename {Libraries => Documents/BKP}/x-saherelm.xohcl.lib.mq5 (100%) rename {Experts => Documents/BKP}/x-saherelm.xpoi.test.ea.mq5 (100%) diff --git a/Classes/x-saherelm.x-poi.drawer.class.mq5 b/Classes/x-saherelm.x-poi.drawer.class.mq5 index 5513dbfb..b785ea71 100644 --- a/Classes/x-saherelm.x-poi.drawer.class.mq5 +++ b/Classes/x-saherelm.x-poi.drawer.class.mq5 @@ -23,6 +23,7 @@ // Imports ... #include "../Classes/x-saherelm.base.class.mq5" #include "../Classes/x-saherelm.x-cobject.class.mq5" +#include "../Libraries/x-saherelm.x-poi.state.lib.mq5" #include "../Libraries/x-saherelm.x-poi.extensions.lib.mq5" // diff --git a/Documents/BKP/x-121.smc.market.cycle.helper.class.mq5 b/Documents/BKP/x-121.smc.market.cycle.helper.class.mq5 new file mode 100644 index 00000000..3d8f8ed2 --- /dev/null +++ b/Documents/BKP/x-121.smc.market.cycle.helper.class.mq5 @@ -0,0 +1,4033 @@ +/////////////////////////////////////////////////////// +// +// SaherElm IT Center MQL5 Class Library +// -------------------------------------- +// Name: XC121SMCCycleHelper +// Description: provides all based classes for use ... +// +// +// 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.x-bar.analyser.class.mq5" +#include "../../Classes/x-saherelm.x-poi.class.mq5" +#include "../Libraries/x-121.smc.lib.mq5" + +// +// Definitions ... + +// +// Implementations ... + +// +// Cycles Enumeration ... +enum ENUM_X_CYCLES +{ + X_CYCLE_NONE, + X_CYCLE_TRIGGER, + X_CYCLE_DECISION, + X_CYCLE_ANALYSE, + X_CYCLE_VERIFICATION, + X_CYCLE_CONSOLIDATION, + X_CYCLE_VISION, +}; + +// +// String Representation of Cycles Enumeration ... +string ToString(ENUM_X_CYCLES value) +{ + // + string result = EnumToString(value); + + // + StringReplace(result, "X_CYCLE_", ""); + + // + return result; +} + +// +// Validate a Cycle ... +bool IsValid(ENUM_X_CYCLES value) +{ + // + bool result = false; + + // + result = + value != X_CYCLE_NONE; + + // + return result; +} + +// +// Cycle Events Enumeration ... +enum ENUM_X_CYCLE_EVENTS +{ + SAR_CHANGE_DETECTED, + NEW_PEAK_DETECTED, + NEW_VALE_DETECTED, + PIVOT_POINT_DETECTED, + VWAP_ORDER_CHANGE_ETECTED, + VWAP_STATE_CHANGE_DETCTED, + CONSOLIDATION_BREAKED_DETECTED, + PEAK_PIVOT_STARTED, + PEAK_PIVOT_ENDED, + VALE_PIVOT_STARTED, + VALE_PIVOT_ENDED, +}; + +// +// Cycle Helper ... +class XC121SMCCycleHelper : public XCBase +{ + // + public: + // + // Props ... + + // + // X121 ... + XCX121Helper *mX121Helper; + + // + // POI Detector ... + XCPOIDrawer *mPOIDrawer; + XCPOIDetector *mPOIDetector; + + // + // Bar Analyser + XCBarAnalyser *mBarAnalyser; + + // + // Constructor(s) ... + XC121SMCCycleHelper() + { + Default(); + } + + // + // Deconstructor ... + ~XC121SMCCycleHelper() + { + DeInit(); + } + + // + // Getter/Setter(s) ... + + // + // Actions ... + + /** + * Initialize ... + * + * @param symbol: String ... + * @param period: ENUM_TIMEFRAMES member ... + * @param x121Inputs: X121Inputs instance ... + * + * @return ( bool ) + */ + bool Init( + string symbol, + ENUM_TIMEFRAMES period, + X121Inputs &x121Inputs, + int requiredPOIs = 50 // + ) + { + // + bool result = false; + + // + if (requiredPOIs < 0) + { + requiredPOIs = 0; + } + + // + result = IsValid(symbol) && + IsValid(period); + if (!result) + { + return result; + } + + // + mSymbol = symbol; + mPeriod = period; + + // + // X121 ... + mX121Helper = new XCX121Helper(); + result = mX121Helper.Init( + symbol, + period, + x121Inputs // + ); + if (!result) + { + return result; + } + + // + mPOIDetector = new XCPOIDetector( + symbol, + period // + ); + mPOIDetector.MaxRequiredPOIs(requiredPOIs); + + // + int maxLoopbackBars = mPOIDetector.MaxAllowedLoopbackForInit(); + int periodSeconds = PeriodSeconds(period); + if (periodSeconds > PeriodSeconds(PERIOD_M15)) + { + // + int multiplier = periodSeconds / PeriodSeconds(PERIOD_M15); + + // + if (multiplier >= 1) + { + maxLoopbackBars *= 2; + } + } + mPOIDetector.MaxAllowedLoopbackForInit(maxLoopbackBars); + mPOIDetector.Init(); + + // + // Initialize Bar Analyser Class Instance ... + mBarAnalyser = new XCBarAnalyser(); + + // + // Initial and Configure POI Drawer if Required ... + mPOIDrawer = new XCPOIDrawer(); + mPOIDrawer.ChartIdentification(0); + mPOIDrawer.SubWindowIdentification(0); + + // + mPOIDrawer.DemandZoneFill(false); + mPOIDrawer.SupplyZoneFill(false); + mPOIDrawer.BullishFVGFill(false); + mPOIDrawer.BearishFVGFill(false); + mPOIDrawer.SupportZoneFill(false); + mPOIDrawer.ResistanceZoneFill(false); + mPOIDrawer.BullishOrderBlockFill(false); + mPOIDrawer.BearishOrderBlockFill(false); + + // + // Set Chart Style ... + ApplyChartStyle(); + + // + return result; + } + + /** + * Retrieve Symbol ... + * + * @return ( string ) + */ + string GetSymbol() + { + return mSymbol; + } + + /** + * Retrieve TimeFrame (Period) ... + * + * @return ( ENUM_TIMEFRAMES ) + */ + ENUM_TIMEFRAMES GetPeriod() + { + return mPeriod; + } + + /** + * Get Specified Bar ... + * + * @param source: XOHCL instance, Source Bar ... + * @param bar: XOHCL instance, Dest Bar ... + * + * @return ( bool ) + */ + bool GetBar( + XOHCL &source, + XOHCL &bar // + ) + { + // + bool result = false; + + // + bar.Clean(); + + // + string symbol = GetSymbol(); + ENUM_TIMEFRAMES period = GetPeriod(); + + // + result = + IsValid(symbol) && + IsValid(period) && + source.IsValid(); + if (!result) + { + return result; + } + + // + int index = iBarShift( + symbol, + period, + source.time // + ); + result = bar.Init( + symbol, + period, + index // + ); + if (!result) + { + // + bar.Clean(); + return result; + } + + // + return result; + } + + /** + * Retrieve Specified Bar ... + * + * @param bar: XOHCL instance ... + * @param index: Integer ... + * + * @return ( bool ) + */ + bool GetBar( + XOHCL &bar, + int index = 0 // + ) + { + // + bool result = false; + + // + bar.Clean(); + + // + if (index < 0) + { + index = 0; + } + + // + string symbol = GetSymbol(); + ENUM_TIMEFRAMES period = GetPeriod(); + + // + result = bar.Init( + symbol, + period, + index // + ); + + // + return result; + } + + /** + * Retrieve Specified Bar ... + * + * @param bar: XOHCL instance ... + * @param time: Datetime ... + * + * @return ( bool ) + */ + bool GetBar( + XOHCL &bar, + datetime time = NULL // + ) + { + // + bool result = false; + + // + int index = GetBarIndex(time); + result = GetBar(bar, + index // + ); + + // + return result; + } + + /** + * Retrieve Specified Time Bar Index ... + * + * @param time: DateTime ... + * + * @return ( int ) + */ + int GetBarIndex(datetime time = NULL) + { + // + int result = -1; + + // + time = NormalizeTime(time); + + // + string symbol = GetSymbol(); + ENUM_TIMEFRAMES period = GetPeriod(); + + // + result = iBarShift( + symbol, + period, + time // + ); + + // + return result; + } + + /** + * Retrieve Cycle Conditions ... + * + * @param events: ENUM_X_CYCLE_EVENTS member, Array ... + * @param conditions: X121SMCCycleConditions instance ... + * @param barIndex: Integer ... + * @param loopback: Integer ... + * + * @return ( bool ) + */ + bool GetConditions( + ENUM_X_CYCLE_EVENTS &events[], + ENUM_XPOI_EVENTS &poiEvents[], + X121SMCCycleConditions &conditions, + int barIndex = 0, + int loopback = 7 // + ) + { + // + bool result = false; + + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + if (loopback < 5) + { + loopback = 5; + } + + // + Clean(events); + Clean(poiEvents); + conditions.Clean(); + + // + result = mX121Helper.GetConditions( + conditions.x121Conditions, + barIndex, + loopback // + ); + if (!result) + { + // + conditions.Clean(); + return result; + } + + // + mPOIDetector.Update(poiEvents); + mPOIDetector.GetState(conditions.state); + + // + conditions.symbol = GetSymbol(); + conditions.period = GetPeriod(); + conditions.time = TimeCurrent(); + + // + // Update(); + + // + result = conditions.IsValid(); + + // + return result; + } + + // + bool GeneratePVBox( + XBoxZone &box, + int barIndex = 0 // + ) + { + // + bool result = false; + + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + box.Clean(); + box.symbol = GetSymbol(); + box.period = GetPeriod(); + + // + int index = barIndex; + + // + // Peak ... + datetime peaksSameFrom = NULL; + double peak = mX121Helper.xpvHelper.GetPeak(index); + double prevPeak = mX121Helper.xpvHelper.GetPeak(index + 1); + bool startsByPeak = peak == prevPeak; + + // + // Vale ... + datetime valesSameFrom = NULL; + double vale = mX121Helper.xpvHelper.GetVale(index); + double prevVale = mX121Helper.xpvHelper.GetVale(index + 1); + bool startsByVale = + !startsByPeak && + vale == prevVale; + + // + bool canBreak = false; + while (!canBreak) + { + // + index++; + + // + datetime cTime = iTime( + box.symbol, + box.period, + index // + ); + + // + // Peak ... + double iPeak = mX121Helper.xpvHelper.GetPeak(index); + + // + // Vale ... + double iVale = mX121Helper.xpvHelper.GetVale(index); + + // + // Start By Peak or Value ... + bool isSame = false; + if (startsByPeak) + { + // + isSame = iPeak == peak; + bool canSetVale = vale == 0 + ? true + : iVale > vale; + if (canSetVale) + { + vale = iVale; + } + } + else if (startsByVale) + { + // + isSame = iVale == vale; + bool canSetPeak = peak == 0 + ? true + : iPeak < peak; + if (canSetPeak) + { + peak = iPeak; + } + } + + // + if (isSame) + { + // + box.from = cTime; + box.upper = peak; + box.lower = vale; + } + else if (IsValid(box.from)) + { + // + // Complete Box ... + box.to = iTime( + box.symbol, + box.period, + barIndex // + ); + + // + box.type = "XPVBox"; + box.dir = startsByPeak + ? X_DIRECTION_BEARISH + : startsByVale + ? X_DIRECTION_BULLISH + : X_DIRECTION_NONE; + } + + // + canBreak = !isSame; + } + + // + result = box.IsValid(); + if (!result) + { + box.Clean(); + } + + // + return result; + } + + // + int DetectRejections( + XBoxZone &rejections[], + int barIndex = 0, + bool forceBarType = true, + bool forceFiboPressure = true, + bool forceUnUsedRejections = true, + int maxAllowedLoopback = 587 // + ) + { + // + int result = 0; + + // + // Normalize Args ... + Clean(rejections); + + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + int idx = -1; + bool has = false; + for (int i = barIndex + 1; i < barIndex + maxAllowedLoopback; i++) + { + // + // Init Indexed Bar ... + XOHCL iBar; + XOHCL iCBar; + XOHCL iPBar; + has = GetBar(iBar, i); + has = + has && + iBar.GetPreviousBar(iCBar); + has = + has && + iCBar.GetPreviousBar(iPBar); + if (!has) + { + // + iBar.Clean(); + iCBar.Clean(); + iPBar.Clean(); + break; + } + + // + // Check CBar Bullish Fibo Pressure ... + bool cBarHasBullishFiboPressure = + mBarAnalyser + .HasFiboPressure( + iCBar, + X_DIRECTION_BULLISH, + X_FIBO_LEVEL_382 // + ); + + // + // Check CBar Bearish Fibo Pressure ... + bool cBarHasBearishFiboPressure = + mBarAnalyser + .HasFiboPressure( + iCBar, + X_DIRECTION_BEARISH, + X_FIBO_LEVEL_382 // + ); + + // + // Check Bar is Bullish Rejection Swing ... + bool isBullishRejection = + // + iCBar.low < iBar.low && + iCBar.low < iPBar.low && + // + iCBar.low < iCBar.GetDown() && + iCBar.GetLowShadow() > iCBar.GetBody() && + iCBar.GetLowShadow() > iCBar.GetHighShadow() + // + ; + + // + // Check Bar is Bearish Rejection Swing ... + bool isBearishRejection = + // + iCBar.high > iBar.high && + iCBar.high > iPBar.high && + // + iCBar.high > iCBar.GetUp() && + iCBar.GetHighShadow() > iCBar.GetBody() && + iCBar.GetHighShadow() > iCBar.GetLowShadow() + // + ; + + // + // Apply Fibo Pressure ... + if (forceFiboPressure) + { + // + isBullishRejection = + isBullishRejection && + cBarHasBullishFiboPressure; + + // + isBearishRejection = + isBearishRejection && + cBarHasBearishFiboPressure; + } + + // + // Apply Force Bar Type ... + if (forceBarType) + { + // + isBullishRejection = + isBullishRejection && + iCBar.IsBullish(); + + // + isBearishRejection = + isBearishRejection && + iCBar.IsBearish(); + } + + // + // Summarize Result ... + has = isBullishRejection || + isBearishRejection; + if (has) + { + // + XBoxZone iBox; + + // + iBox.to = iBar.time; + iBox.from = iCBar.time; + iBox.period = iBar.period; + iBox.symbol = iBar.symbol; + + // + iBox.dir = + isBullishRejection + ? X_DIRECTION_BULLISH + : X_DIRECTION_BEARISH; + + // + iBox.upper = + isBullishRejection + ? iCBar.GetDown() + : iCBar.high; + + // + iBox.lower = + isBullishRejection + ? iCBar.low + : iCBar.GetUp(); + + // + iBox.type = + isBullishRejection + ? "XSwingLow" + : "XSwingHigh"; + + // + // Validate Box ... + has = iBox.IsValid(); + if (has) + { + // + // Apply Force Unused Rejections ... + if (forceUnUsedRejections) + { + // + has = !IsBoxBreaked( + iBox, + iCBar.Index() + 1, + barIndex // + ); + } + + // + if (has) + { + // + idx = FindIndex( + iBox, + rejections // + ); + has = !IsValidIndex(idx); + if (has) + { + // + AddRef( + iBox, + rejections // + ); + } + } + } + + // + iBox.Clean(); + } + + // + iBar.Clean(); + iCBar.Clean(); + iPBar.Clean(); + } + + // + result = ArraySize(rejections); + + // + return result; + } + + // + // Virtuals ... + + /** + * Set Default Properties Values ... + */ + virtual void Default() + { + } + + // + protected: + // + + // + private: + // + // Props ... + string mSymbol; + ENUM_TIMEFRAMES mPeriod; + + // + // Actions ... + + /** + * Release All Resources ... + */ + void DeInit() + { + // + ZeroMemory(mX121Helper); + ZeroMemory(mPOIDetector); + ZeroMemory(mBarAnalyser); + + // + delete mX121Helper; + delete mPOIDetector; + delete mBarAnalyser; + } + + /** + * Apply Chart Style ... + */ + void ApplyChartStyle() + { + // + // Retrieve Current Chart ID ... + long chartId = ChartID(); + + // + ENUM_CHART_MODE mMode = CHART_CANDLES; // chart's mMode + bool mShowBidLine = true; // show bid line + bool mShowAskLine = true; // show ask line + bool mShowGrid = false; // show grids on chart + bool mShowVolumes = true; // show volumes + bool mShowTradeLevels = true; // Displaying trade levels in the chart (levels of open positions, Stop Loss, Take Profit and pending orders) + bool mAutoScroll = true; // chart autoscroll + bool mQuickNavigation = true; // chart quick navigation state + color mForeGroundColor = clrWhite; // chart's foreground color + color mBackGroundColor = clrBlack; // chart's background color + color mUpColor = clrGreen; // Up Color + color mDownColor = clrRed; // Down Color + color mBullishColor = clrGreen; // Bullish color + color mBearishColor = clrRed; // Bearish color + color mGridColor = clrGray; // grid color + color mBidLineColor = clrGray; // bid line color + color mAskLineColor = clrRed; // ask line color + color mLineColor = clrLime; // line mMode and doji candlestick color + color mStopColor = clrGold; // Color of stop order levels (Stop Loss and Take Profit) + color mVolumesColor = clrGreen; // volumes color + + // + ChartSetInteger(chartId, CHART_SHOW_BID_LINE, mShowBidLine); + ChartSetInteger(chartId, CHART_SHOW_ASK_LINE, mShowAskLine); + ChartSetInteger(chartId, CHART_SHOW_GRID, mShowGrid); + ChartSetInteger(chartId, CHART_SHOW_VOLUMES, mShowVolumes); + ChartSetInteger(chartId, CHART_SHOW_TRADE_LEVELS, mShowTradeLevels); + ChartSetInteger(chartId, CHART_AUTOSCROLL, mAutoScroll); + ChartSetInteger(chartId, CHART_QUICK_NAVIGATION, mQuickNavigation); + ChartSetInteger(chartId, CHART_COLOR_FOREGROUND, mForeGroundColor); + ChartSetInteger(chartId, CHART_COLOR_BACKGROUND, mBackGroundColor); + ChartSetInteger(chartId, CHART_COLOR_GRID, mGridColor); + ChartSetInteger(chartId, CHART_COLOR_BID, mBidLineColor); + ChartSetInteger(chartId, CHART_COLOR_ASK, mAskLineColor); + ChartSetInteger(chartId, CHART_COLOR_STOP_LEVEL, mStopColor); + ChartSetInteger(chartId, CHART_COLOR_VOLUME, mVolumesColor); + + // + // For Enabling XCC ... + // ChartSetInteger(chartId, CHART_MODE, mMode); + // ChartSetInteger(chartId, CHART_COLOR_CHART_UP, mUpColor); + // ChartSetInteger(chartId, CHART_COLOR_CHART_DOWN, mDownColor); + // ChartSetInteger(chartId, CHART_COLOR_CANDLE_BULL, mBullishColor); + // ChartSetInteger(chartId, CHART_COLOR_CANDLE_BEAR, mBearishColor); + // ChartSetInteger(chartId, CHART_COLOR_CHART_LINE, mLineColor); + } + + // +}; + +// +// Signal Provider Data ... +struct X121SMCStrategySignalProviderData +{ + // + // Props ... + + // + // Trigger ... + XPOIState triggerState; + double triggerBullishScore; + double triggerBearishScore; + X121Conditions triggerXConditions; + ENUM_XPOI_EVENTS triggerPoiEvents[]; + XC121SMCCycleHelper *triggerCycleHelper; + ENUM_X_CYCLE_EVENTS triggerCycleEvents[]; + X121SMCCycleConditions triggerConditions; + + // + // Decision ... + XPOIState decisionState; + double decisionBullishScore; + double decisionBearishScore; + X121Conditions decisionXConditions; + ENUM_XPOI_EVENTS decisionPoiEvents[]; + XC121SMCCycleHelper *decisionCycleHelper; + ENUM_X_CYCLE_EVENTS decisionCycleEvents[]; + X121SMCCycleConditions decisionConditions; + + // + // Analyse ... + XPOIState analyseState; + double analyseBullishScore; + double analyseBearishScore; + X121Conditions analyseXConditions; + ENUM_XPOI_EVENTS analysePoiEvents[]; + XC121SMCCycleHelper *analyseCycleHelper; + ENUM_X_CYCLE_EVENTS analyseCycleEvents[]; + X121SMCCycleConditions analyseConditions; + + // + // Verification ... + XPOIState verificationState; + double verificationBullishScore; + double verificationBearishScore; + X121Conditions verificationXConditions; + ENUM_XPOI_EVENTS verificationPoiEvents[]; + XC121SMCCycleHelper *verificationCycleHelper; + ENUM_X_CYCLE_EVENTS verificationCycleEvents[]; + X121SMCCycleConditions verificationConditions; + + // + // Consolidation ... + XPOIState consolidationState; + double consolidationBullishScore; + double consolidationBearishScore; + X121Conditions consolidationXConditions; + ENUM_XPOI_EVENTS consolidationPoiEvents[]; + XC121SMCCycleHelper *consolidationCycleHelper; + ENUM_X_CYCLE_EVENTS consolidationCycleEvents[]; + X121SMCCycleConditions consolidationConditions; + + // + // Vision ... + XPOIState visionState; + double visionBullishScore; + double visionBearishScore; + X121Conditions visionXConditions; + ENUM_XPOI_EVENTS visionPoiEvents[]; + XC121SMCCycleHelper *visionCycleHelper; + ENUM_X_CYCLE_EVENTS visionCycleEvents[]; + X121SMCCycleConditions visionConditions; + + // + // Constructor ... + X121SMCStrategySignalProviderData() + { + Clean(); + } + + // + // Tools ... + + // + // Cleanup ... + void Clean() + { + // + // Trigger ... + triggerState.Clean(); + triggerBullishScore = 0; + triggerBearishScore = 0; + Clean(triggerPoiEvents); + Clean(triggerCycleEvents); + triggerConditions.Clean(); + triggerXConditions.Clean(); + + // + // Decision ... + decisionState.Clean(); + decisionBullishScore = 0; + decisionBearishScore = 0; + Clean(decisionPoiEvents); + Clean(decisionCycleEvents); + decisionConditions.Clean(); + decisionXConditions.Clean(); + + // + // Analyse ... + analyseState.Clean(); + analyseBullishScore = 0; + analyseBearishScore = 0; + Clean(analysePoiEvents); + Clean(analyseCycleEvents); + analyseConditions.Clean(); + analyseXConditions.Clean(); + + // + // Verification ... + verificationState.Clean(); + verificationBullishScore = 0; + verificationBearishScore = 0; + Clean(verificationPoiEvents); + Clean(verificationCycleEvents); + verificationConditions.Clean(); + verificationXConditions.Clean(); + + // + // Consolidation ... + consolidationState.Clean(); + consolidationBullishScore = 0; + consolidationBearishScore = 0; + Clean(consolidationPoiEvents); + Clean(consolidationCycleEvents); + consolidationConditions.Clean(); + consolidationXConditions.Clean(); + + // + // Vision ... + visionState.Clean(); + visionBullishScore = 0; + visionBearishScore = 0; + Clean(visionPoiEvents); + Clean(visionCycleEvents); + visionConditions.Clean(); + visionXConditions.Clean(); + } + + // + void Destroy() + { + // + Clean(); + + // + ZeroMemory(visionCycleHelper); + ZeroMemory(triggerCycleHelper); + ZeroMemory(analyseCycleHelper); + ZeroMemory(decisionCycleHelper); + ZeroMemory(verificationCycleHelper); + ZeroMemory(consolidationCycleHelper); + + // + ZeroMemory(this); + } + + // + bool IsValid() + { + // + bool result = false; + + // + result = + visionCycleHelper != NULL && + triggerCycleHelper != NULL && + analyseCycleHelper != NULL && + decisionCycleHelper != NULL && + verificationCycleHelper != NULL && + consolidationCycleHelper != NULL; + + // + return result; + } + + // + // Initialize ... + bool Init( + XC121SMCCycleHelper *_triggerCycleHelper, + XC121SMCCycleHelper *_decisionCycleHelper, + XC121SMCCycleHelper *_analyseCycleHelper, + XC121SMCCycleHelper *_verificationCycleHelper, + XC121SMCCycleHelper *_consolidationCycleHelper, + XC121SMCCycleHelper *_visionCycleHelper // + ) + { + // + bool result = false; + + // + // Validate Cycle Helpers ... + result = + // + _visionCycleHelper != NULL && + _triggerCycleHelper != NULL && + _analyseCycleHelper != NULL && + _decisionCycleHelper != NULL && + _verificationCycleHelper != NULL && + _consolidationCycleHelper != NULL + // + ; + if (!result) + { + return result; + } + + // + visionCycleHelper = _visionCycleHelper; + triggerCycleHelper = _triggerCycleHelper; + analyseCycleHelper = _analyseCycleHelper; + decisionCycleHelper = _decisionCycleHelper; + verificationCycleHelper = _verificationCycleHelper; + consolidationCycleHelper = _consolidationCycleHelper; + + // + result = IsValid(); + + // + return result; + } + + // + // Prepare all ... + bool Prepare( + int barIndex = 0, + int loopback = 10, + bool trigger = false, + bool decision = true, + bool analyse = true, + bool verification = false, + bool consolidation = true, + bool vision = true // + ) + { + // + bool result = false; + + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + if (loopback < 7) + { + loopback = 7; + } + + // + result = IsValid(); + if (!result) + { + return result; + } + + // + // Trigger ... + if (trigger) + { + // + result = triggerCycleHelper.GetConditions( + triggerCycleEvents, + triggerPoiEvents, + triggerConditions, + barIndex, + loopback // + ); + if (!result) + { + // + Clean(triggerPoiEvents); + Clean(triggerCycleEvents); + + // + triggerConditions.Clean(); + + // + return result; + } + } + + // + // Decision ... + if (decision) + { + // + result = decisionCycleHelper.GetConditions( + decisionCycleEvents, + decisionPoiEvents, + decisionConditions, + barIndex, + loopback // + ); + if (!result) + { + // + Clean(triggerPoiEvents); + Clean(decisionPoiEvents); + Clean(triggerCycleEvents); + triggerConditions.Clean(); + Clean(decisionCycleEvents); + decisionConditions.Clean(); + + // + return result; + } + } + + // + // Analyse ... + if (analyse) + { + // + result = analyseCycleHelper.GetConditions( + analyseCycleEvents, + analysePoiEvents, + analyseConditions, + barIndex, + loopback // + ); + if (!result) + { + // + Clean(triggerPoiEvents); + Clean(analysePoiEvents); + Clean(decisionPoiEvents); + Clean(triggerCycleEvents); + Clean(analyseCycleEvents); + triggerConditions.Clean(); + analyseConditions.Clean(); + Clean(decisionCycleEvents); + decisionConditions.Clean(); + + // + return result; + } + } + + // + // Verification ... + if (verification) + { + // + result = verificationCycleHelper.GetConditions( + verificationCycleEvents, + verificationPoiEvents, + verificationConditions, + barIndex, + loopback // + ); + if (!result) + { + // + Clean(triggerPoiEvents); + Clean(analysePoiEvents); + Clean(decisionPoiEvents); + Clean(triggerCycleEvents); + Clean(analyseCycleEvents); + triggerConditions.Clean(); + analyseConditions.Clean(); + Clean(decisionCycleEvents); + decisionConditions.Clean(); + Clean(verificationPoiEvents); + Clean(verificationCycleEvents); + verificationConditions.Clean(); + + // + return result; + } + } + + // + // Consolidation ... + if (consolidation) + { + // + result = consolidationCycleHelper.GetConditions( + consolidationCycleEvents, + consolidationPoiEvents, + consolidationConditions, + barIndex, + loopback // + ); + if (!result) + { + // + Clean(triggerPoiEvents); + Clean(analysePoiEvents); + Clean(decisionPoiEvents); + Clean(triggerCycleEvents); + Clean(analyseCycleEvents); + triggerConditions.Clean(); + analyseConditions.Clean(); + Clean(decisionCycleEvents); + decisionConditions.Clean(); + Clean(verificationPoiEvents); + Clean(consolidationPoiEvents); + Clean(verificationCycleEvents); + verificationConditions.Clean(); + Clean(consolidationCycleEvents); + consolidationConditions.Clean(); + + // + return result; + } + } + + // + // Vision ... + if (vision) + { + result = visionCycleHelper.GetConditions( + visionCycleEvents, + visionPoiEvents, + visionConditions, + barIndex, + loopback // + ); + if (!result) + { + // + Clean(visionPoiEvents); + Clean(triggerPoiEvents); + Clean(analysePoiEvents); + Clean(visionCycleEvents); + visionConditions.Clean(); + Clean(decisionPoiEvents); + Clean(triggerCycleEvents); + Clean(analyseCycleEvents); + triggerConditions.Clean(); + analyseConditions.Clean(); + Clean(decisionCycleEvents); + decisionConditions.Clean(); + Clean(verificationPoiEvents); + Clean(consolidationPoiEvents); + Clean(verificationCycleEvents); + verificationConditions.Clean(); + Clean(consolidationCycleEvents); + consolidationConditions.Clean(); + + // + return result; + } + } + + // + // Cycles POI States ... + visionState = visionConditions.state; + triggerState = triggerConditions.state; + analyseState = analyseConditions.state; + decisionState = decisionConditions.state; + verificationState = verificationConditions.state; + consolidationState = consolidationConditions.state; + + // + // Cycle X121Conditions ... + visionXConditions = visionConditions.x121Conditions; + triggerXConditions = triggerConditions.x121Conditions; + analyseXConditions = analyseConditions.x121Conditions; + decisionXConditions = decisionConditions.x121Conditions; + verificationXConditions = verificationConditions.x121Conditions; + consolidationXConditions = consolidationConditions.x121Conditions; + + // + // Trigger ... + triggerXConditions.GenerateScore( + triggerBullishScore, + triggerBearishScore // + ); + + // + // Decision ... + decisionXConditions.GenerateScore( + decisionBullishScore, + decisionBearishScore // + ); + + // + // Analyse ... + analyseXConditions.GenerateScore( + analyseBullishScore, + analyseBearishScore // + ); + + // + // Verification ... + verificationXConditions.GenerateScore( + verificationBullishScore, + verificationBearishScore // + ); + + // + // Consolidation ... + consolidationXConditions.GenerateScore( + consolidationBullishScore, + consolidationBearishScore // + ); + + // + // Vision ... + visionXConditions.GenerateScore( + visionBullishScore, + visionBearishScore // + ); + + // + return result; + } + + // + bool SelectCycle( + ENUM_X_CYCLES cycle, + XPOIState &cState, + X121Conditions &cXConditions, + XC121SMCCycleHelper *&cHelper, + X121SMCCycleConditions &cConditions // + ) + { + // + bool result = false; + + // + cState.Clean(); + ZeroMemory(cHelper); + cConditions.Clean(); + cXConditions.Clean(); + + // + result = cycle != X_CYCLE_NONE; + if (!result) + { + return result; + } + + // + if (cycle == X_CYCLE_TRIGGER) + { + // + cState = triggerState; + cHelper = triggerCycleHelper; + cConditions = triggerConditions; + cXConditions = triggerXConditions; + } + else if (cycle == X_CYCLE_DECISION) + { + // + cState = decisionState; + cHelper = decisionCycleHelper; + cConditions = decisionConditions; + cXConditions = decisionXConditions; + } + else if (cycle == X_CYCLE_ANALYSE) + { + // + cState = analyseState; + cHelper = analyseCycleHelper; + cConditions = analyseConditions; + cXConditions = analyseXConditions; + } + else if (cycle == X_CYCLE_VERIFICATION) + { + // + cState = verificationState; + cHelper = verificationCycleHelper; + cConditions = verificationConditions; + cXConditions = verificationXConditions; + } + else if (cycle == X_CYCLE_CONSOLIDATION) + { + // + cState = consolidationState; + cHelper = consolidationCycleHelper; + cConditions = consolidationConditions; + cXConditions = consolidationXConditions; + } + else if (cycle == X_CYCLE_VISION) + { + // + cState = visionState; + cHelper = visionCycleHelper; + cConditions = visionConditions; + cXConditions = visionXConditions; + } + + // + result = cState.IsValid() && + cHelper != NULL; + + // + return result; + } + + // + void MaxRequiredPOIs(int value) + { + // + if (!IsValid()) + { + return; + } + + // + visionCycleHelper.mPOIDetector.MaxRequiredPOIs(value); + analyseCycleHelper.mPOIDetector.MaxRequiredPOIs(value); + decisionCycleHelper.mPOIDetector.MaxRequiredPOIs(value); + consolidationCycleHelper.mPOIDetector.MaxRequiredPOIs(value); + } + + // + void MaxAllowedLoopbackForInit(int value) + { + // + if (!IsValid()) + { + return; + } + + // + visionCycleHelper.mPOIDetector.MaxAllowedLoopbackForInit(value); + analyseCycleHelper.mPOIDetector.MaxAllowedLoopbackForInit(value); + decisionCycleHelper.mPOIDetector.MaxAllowedLoopbackForInit(value); + consolidationCycleHelper.mPOIDetector.MaxAllowedLoopbackForInit(value); + } + + // +}; + +// +// Condition Parser ... +struct X121SMCStrategyConditionParser +{ + // + // Props ... + + // + // XSAR ... + + // + bool isSarBullishOverPeaksGoldenZone; + bool isSarSwitchedToBullishOverPeaksGoldenZone; + bool isSarBearishOverPeaksGoldenZone; + bool isSarSwitchedToBearishOverPeaksGoldenZone; + bool isSarBullishUnderValesGoldenZone; + bool isSarSwitchedToBullishUnderValesGoldenZone; + bool isSarBearishUnderValesGoldenZone; + bool isSarSwitchedToBearishUnderValesGoldenZone; + + // + // XMA ... + + // + bool isX3MaFastUnderValesGoldenZone; + bool isX3MaFastCrossedUnderValesGoldenZone; + bool isX3MaFastOverPeaksGoldenZone; + bool isX3MaFastCrossedOverPeaksGoldenZone; + + // + bool isX3MaInsidePeaksGoldenZone; + bool isX3MaCrossedInsidePeaksGoldenZone; + bool isX3MaInsideValesGoldenZone; + bool isX3MaCrossedInsideValesGoldenZone; + + // + bool isX3MaBullishStateOverPeaksGoldenZone; + bool isX3MaBearishStateOverPeaksGoldenZone; + bool isX3MaSwitchedToBullishStateOverPeaksGoldenZone; + bool isX3MaSwitchedToBearishStateOverPeaksGoldenZone; + + // + bool isX3MaBullishOrderedOverPeaksGoldenZone; + bool isX3MaBearishOrderedOverPeaksGoldenZone; + bool isX3MaSwitchedToBullishOrderedOverPeaksGoldenZone; + bool isX3MaSwitchedToBearishOrderedOverPeaksGoldenZone; + + // + bool isX3MaBullishStateUnderValesGoldenZone; + bool isX3MaBearishStateUnderValesGoldenZone; + bool isX3MaSwitchedToBullishStateUnderValesGoldenZone; + bool isX3MaSwitchedToBearishStateUnderValesGoldenZone; + + // + bool isX3MaBullishOrderedUnderValesGoldenZone; + bool isX3MaBearishOrderedUnderValesGoldenZone; + bool isX3MaSwitchedToBullishOrderedUnderValesGoldenZone; + bool isX3MaSwitchedToBearishOrderedUnderValesGoldenZone; + + // + // XVWAP ... + + // + bool isVWapFastUnderValesGoldenZone; + bool isVWapFastCrossedUnderValesGoldenZone; + bool isVWapFastOverPeaksGoldenZone; + bool isVWapFastCrossedOverPeaksGoldenZone; + + // + bool isVWapInsidePeaksGoldenZone; + bool isVWapCrossedInsidePeaksGoldenZone; + bool isVWapInsideValesGoldenZone; + bool isVWapCrossedInsideValesGoldenZone; + + // + bool isVWapBullishStateOverPeaksGoldenZone; + bool isVWapBearishStateOverPeaksGoldenZone; + bool isVWapSwitchedToBullishStateOverPeaksGoldenZone; + bool isVWapSwitchedToBearishStateOverPeaksGoldenZone; + + // + bool isVWapBullishOrderedOverPeaksGoldenZone; + bool isVWapBearishOrderedOverPeaksGoldenZone; + bool isVWapSwitchedToBullishOrderedOverPeaksGoldenZone; + bool isVWapSwitchedToBearishOrderedOverPeaksGoldenZone; + + // + bool isVWapBullishStateUnderValesGoldenZone; + bool isVWapBearishStateUnderValesGoldenZone; + bool isVWapSwitchedToBullishStateUnderValesGoldenZone; + bool isVWapSwitchedToBearishStateUnderValesGoldenZone; + + // + bool isVWapBullishOrderedUnderValesGoldenZone; + bool isVWapBearishOrderedUnderValesGoldenZone; + bool isVWapSwitchedToBullishOrderedUnderValesGoldenZone; + bool isVWapSwitchedToBearishOrderedUnderValesGoldenZone; + + // + // XHK ... + + // + // XRWHK ... + + // + bool isRawHKBearishOverPeaksGoldenZone; + bool isRawHKSwitchedToBearishOverPeaksGoldenZone; + bool isRawHKBullishUnderValesGoldenZone; + bool isRawHKSwitchedToBullishUnderValesGoldenZone; + + // + // XSMHK ... + + // + bool isSMHKBearishOverPeaksGoldenZone; + bool isSMHKSwitchedToBearishOverPeaksGoldenZone; + bool isSMHKBullishUnderValesGoldenZone; + bool isSMHKSwitchedToBullishUnderValesGoldenZone; + + // + // XATR ... + + // + bool isAtrUpperOverPeaksGoldenZone; + bool isAtrLowerOverPeaksGoldenZone; + bool isAtrOverPeaksGoldenZone; + bool isAtrCrossedOverPeaksGoldenZone; + + // + bool isAtrUpperUnderValesGoldenZone; + bool isAtrLowerUnderValesGoldenZone; + bool isAtrUnderValesGoldenZone; + bool isAtrCrossedUnderValesGoldenZone; + + // + // XSTR ... + + // + bool isStrBullishOverPeaksGoldenZone; + bool isStrBearishOverPeaksGoldenZone; + bool isStrSwitchedToBullishOverPeaksGoldenZone; + bool isStrSwitchedToBearishOverPeaksGoldenZone; + + // + bool isStrBullishUnderValesGoldenZone; + bool isStrBearishUnderValesGoldenZone; + bool isStrSwitchedToBullishUnderValesGoldenZone; + bool isStrSwitchedToBearishUnderValesGoldenZone; + + // + // XCHE ... + + // + bool isCheBullishOverPeaksGoldenZone; + bool isCheBearishOverPeaksGoldenZone; + bool isCheSwitchedBullishOverPeaksGoldenZone; + bool isCheSwitchedBearishOverPeaksGoldenZone; + + // + bool isCheBullishUnderValesGoldenZone; + bool isCheBearishUnderValesGoldenZone; + bool isCheSwitchedBullishUnderValesGoldenZone; + bool isCheSwitchedBearishUnderValesGoldenZone; + + // + // Constructor ... + X121SMCStrategyConditionParser() + { + Clean(); + } + + // + // Tools ... + + // + void Clean() + { + // + // XSAR ... + + // + isSarBullishOverPeaksGoldenZone = false; + isSarSwitchedToBullishOverPeaksGoldenZone = false; + isSarBearishOverPeaksGoldenZone = false; + isSarSwitchedToBearishOverPeaksGoldenZone = false; + isSarBullishUnderValesGoldenZone = false; + isSarSwitchedToBullishUnderValesGoldenZone = false; + isSarBearishUnderValesGoldenZone = false; + isSarSwitchedToBearishUnderValesGoldenZone = false; + + // + // X3MA ... + + // + isX3MaFastUnderValesGoldenZone = false; + isX3MaFastCrossedUnderValesGoldenZone = false; + isX3MaFastOverPeaksGoldenZone = false; + isX3MaFastCrossedOverPeaksGoldenZone = false; + + // + isX3MaInsidePeaksGoldenZone = false; + isX3MaCrossedInsidePeaksGoldenZone = false; + isX3MaInsideValesGoldenZone = false; + isX3MaCrossedInsideValesGoldenZone = false; + + // + isX3MaBullishStateOverPeaksGoldenZone = false; + isX3MaBearishStateOverPeaksGoldenZone = false; + isX3MaSwitchedToBullishStateOverPeaksGoldenZone = false; + isX3MaSwitchedToBearishStateOverPeaksGoldenZone = false; + + // + isX3MaBullishOrderedOverPeaksGoldenZone = false; + isX3MaBearishOrderedOverPeaksGoldenZone = false; + isX3MaSwitchedToBullishOrderedOverPeaksGoldenZone = false; + isX3MaSwitchedToBearishOrderedOverPeaksGoldenZone = false; + + // + isX3MaBullishStateUnderValesGoldenZone = false; + isX3MaBearishStateUnderValesGoldenZone = false; + isX3MaSwitchedToBullishStateUnderValesGoldenZone = false; + isX3MaSwitchedToBearishStateUnderValesGoldenZone = false; + + // + isX3MaBullishOrderedUnderValesGoldenZone = false; + isX3MaBearishOrderedUnderValesGoldenZone = false; + isX3MaSwitchedToBullishOrderedUnderValesGoldenZone = false; + isX3MaSwitchedToBearishOrderedUnderValesGoldenZone = false; + + // + // XVWAP ... + + // + isVWapFastUnderValesGoldenZone = false; + isVWapFastCrossedUnderValesGoldenZone = false; + isVWapFastOverPeaksGoldenZone = false; + isVWapFastCrossedOverPeaksGoldenZone = false; + + // + isVWapInsidePeaksGoldenZone = false; + isVWapCrossedInsidePeaksGoldenZone = false; + isVWapInsideValesGoldenZone = false; + isVWapCrossedInsideValesGoldenZone = false; + + // + isVWapBullishStateOverPeaksGoldenZone = false; + isVWapBearishStateOverPeaksGoldenZone = false; + isVWapSwitchedToBullishStateOverPeaksGoldenZone = false; + isVWapSwitchedToBearishStateOverPeaksGoldenZone = false; + + // + isVWapBullishOrderedOverPeaksGoldenZone = false; + isVWapBearishOrderedOverPeaksGoldenZone = false; + isVWapSwitchedToBullishOrderedOverPeaksGoldenZone = false; + isVWapSwitchedToBearishOrderedOverPeaksGoldenZone = false; + + // + isVWapBullishStateUnderValesGoldenZone = false; + isVWapBearishStateUnderValesGoldenZone = false; + isVWapSwitchedToBullishStateUnderValesGoldenZone = false; + isVWapSwitchedToBearishStateUnderValesGoldenZone = false; + + // + isVWapBullishOrderedUnderValesGoldenZone = false; + isVWapBearishOrderedUnderValesGoldenZone = false; + isVWapSwitchedToBullishOrderedUnderValesGoldenZone = false; + isVWapSwitchedToBearishOrderedUnderValesGoldenZone = false; + + // + // XHK ... + + // + // XRWHK ... + + // + isRawHKBearishOverPeaksGoldenZone = false; + isRawHKSwitchedToBearishOverPeaksGoldenZone = false; + isRawHKBullishUnderValesGoldenZone = false; + isRawHKSwitchedToBullishUnderValesGoldenZone = false; + + // + // XSMHK ... + + // + isSMHKBearishOverPeaksGoldenZone = false; + isSMHKSwitchedToBearishOverPeaksGoldenZone = false; + isSMHKBullishUnderValesGoldenZone = false; + isSMHKSwitchedToBullishUnderValesGoldenZone = false; + + // + // XATR ... + + // + isAtrUpperOverPeaksGoldenZone = false; + isAtrLowerOverPeaksGoldenZone = false; + isAtrOverPeaksGoldenZone = false; + isAtrCrossedOverPeaksGoldenZone = false; + + // + isAtrUpperUnderValesGoldenZone = false; + isAtrLowerUnderValesGoldenZone = false; + isAtrUnderValesGoldenZone = false; + isAtrCrossedUnderValesGoldenZone = false; + + // + // XSTR ... + + // + isStrBullishOverPeaksGoldenZone = false; + isStrBearishOverPeaksGoldenZone = false; + isStrSwitchedToBullishOverPeaksGoldenZone = false; + isStrSwitchedToBearishOverPeaksGoldenZone = false; + + // + isStrBullishUnderValesGoldenZone = false; + isStrBearishUnderValesGoldenZone = false; + isStrSwitchedToBullishUnderValesGoldenZone = false; + isStrSwitchedToBearishUnderValesGoldenZone = false; + + // + // XCHE ... + + // + isCheBullishOverPeaksGoldenZone = false; + isCheBearishOverPeaksGoldenZone = false; + isCheSwitchedBullishOverPeaksGoldenZone = false; + isCheSwitchedBearishOverPeaksGoldenZone = false; + + // + isCheBullishUnderValesGoldenZone = false; + isCheBearishUnderValesGoldenZone = false; + isCheSwitchedBullishUnderValesGoldenZone = false; + isCheSwitchedBearishUnderValesGoldenZone = false; + + // + ZeroMemory(this); + } + + // + void Parse( + X121Conditions &conditions // + ) + { + // + Clean(); + + // + // + int zIDX = 0; + int cIDX = zIDX + 1; + int pIDX = cIDX + 1; + + // + // XSAR ... + + // + isSarBullishOverPeaksGoldenZone = + conditions.isSarBullish && + conditions.sarBuffer[cIDX] > conditions.peaksGoldenBuffer[cIDX]; + + // + isSarSwitchedToBullishOverPeaksGoldenZone = + conditions.isSarSwitchedToBullish && + conditions.sarBuffer[cIDX] > conditions.peaksGoldenBuffer[cIDX]; + + // + isSarBearishOverPeaksGoldenZone = + conditions.isSarBearish && + conditions.sarBuffer[cIDX] > conditions.peaksGoldenBuffer[cIDX]; + + // + isSarSwitchedToBearishOverPeaksGoldenZone = + conditions.isSarSwitchedToBearish && + conditions.sarBuffer[cIDX] > conditions.peaksGoldenBuffer[cIDX]; + + // + isSarBullishUnderValesGoldenZone = + conditions.isSarBullish && + conditions.sarBuffer[cIDX] < conditions.valesGoldenBuffer[cIDX]; + + // + isSarSwitchedToBullishUnderValesGoldenZone = + conditions.isSarSwitchedToBullish && + conditions.sarBuffer[cIDX] < conditions.valesGoldenBuffer[cIDX]; + + // + isSarBearishUnderValesGoldenZone = + conditions.isSarBearish && + conditions.sarBuffer[cIDX] < conditions.valesGoldenBuffer[cIDX]; + + // + isSarSwitchedToBearishUnderValesGoldenZone = + conditions.isSarSwitchedToBearish && + conditions.sarBuffer[cIDX] < conditions.valesGoldenBuffer[cIDX]; + + // + // X3MA ... + + // + isX3MaFastUnderValesGoldenZone = + conditions.x3maFastBuffer[cIDX] < conditions.valesGoldenBuffer[cIDX]; + + // + isX3MaFastCrossedUnderValesGoldenZone = + isX3MaFastUnderValesGoldenZone && + conditions.x3maFastBuffer[pIDX] >= conditions.valesGoldenBuffer[pIDX]; + + // + isX3MaFastOverPeaksGoldenZone = + conditions.x3maFastBuffer[cIDX] > conditions.peaksGoldenBuffer[cIDX]; + + // + isX3MaFastCrossedOverPeaksGoldenZone = + isX3MaFastOverPeaksGoldenZone && + conditions.x3maFastBuffer[pIDX] <= conditions.peaksGoldenBuffer[pIDX]; + + // + isX3MaInsidePeaksGoldenZone = + // + conditions.x3maMin < conditions.peaksBuffer[cIDX] && + conditions.x3maMin > conditions.peaksGoldenBuffer[cIDX] && + // + conditions.x3maMax < conditions.peaksBuffer[cIDX] && + conditions.x3maMax > conditions.peaksGoldenBuffer[cIDX] + // + ; + + // + isX3MaCrossedInsidePeaksGoldenZone = + isX3MaInsidePeaksGoldenZone && + !( + // + conditions.x3maMin < conditions.peaksBuffer[pIDX] && + conditions.x3maMin > conditions.peaksGoldenBuffer[pIDX] && + // + conditions.x3maMax < conditions.peaksBuffer[pIDX] && + conditions.x3maMax > conditions.peaksGoldenBuffer[pIDX] + // + ); + + // + isX3MaInsideValesGoldenZone = + // + conditions.x3maMin > conditions.valesBuffer[cIDX] && + conditions.x3maMin < conditions.valesGoldenBuffer[cIDX] && + // + conditions.x3maMax > conditions.valesBuffer[cIDX] && + conditions.x3maMax < conditions.valesGoldenBuffer[cIDX] + // + ; + + isX3MaCrossedInsideValesGoldenZone = + isX3MaInsideValesGoldenZone && + !( + // + conditions.x3maMin > conditions.valesBuffer[pIDX] && + conditions.x3maMin < conditions.valesGoldenBuffer[pIDX] && + // + conditions.x3maMax > conditions.valesBuffer[pIDX] && + conditions.x3maMax < conditions.valesGoldenBuffer[pIDX] + // + ); + + // + isX3MaBullishStateOverPeaksGoldenZone = + isX3MaInsidePeaksGoldenZone && + conditions.isX3MaBullishState; + + // + isX3MaBearishStateOverPeaksGoldenZone = + isX3MaInsidePeaksGoldenZone && + conditions.isX3MaBearishState; + + // + isX3MaSwitchedToBullishStateOverPeaksGoldenZone = + isX3MaInsidePeaksGoldenZone && + conditions.isX3MaSwitchedToBullishState; + + // + isX3MaSwitchedToBearishStateOverPeaksGoldenZone = + isX3MaInsidePeaksGoldenZone && + conditions.isX3MaSwitchedToBearishState; + + // + isX3MaBullishOrderedOverPeaksGoldenZone = + isX3MaInsidePeaksGoldenZone && + conditions.isX3MaBullishOrdered; + + // + isX3MaBearishOrderedOverPeaksGoldenZone = + isX3MaInsidePeaksGoldenZone && + conditions.isX3MaBearishOrdered; + + // + isX3MaSwitchedToBullishOrderedOverPeaksGoldenZone = + isX3MaInsidePeaksGoldenZone && + conditions.isX3MaSwitchedToBullishOrdered; + + // + isX3MaSwitchedToBearishOrderedOverPeaksGoldenZone = + isX3MaInsidePeaksGoldenZone && + conditions.isX3MaSwitchedToBearishOrdered; + + // + isX3MaBullishStateUnderValesGoldenZone = + isX3MaInsideValesGoldenZone && + conditions.isX3MaBullishState; + + // + isX3MaBearishStateUnderValesGoldenZone = + isX3MaInsideValesGoldenZone && + conditions.isX3MaBearishState; + + // + isX3MaSwitchedToBullishStateUnderValesGoldenZone = + isX3MaInsideValesGoldenZone && + conditions.isX3MaSwitchedToBullishState; + + // + isX3MaSwitchedToBearishStateUnderValesGoldenZone = + isX3MaInsideValesGoldenZone && + conditions.isX3MaSwitchedToBearishState; + + // + isX3MaBullishOrderedUnderValesGoldenZone = + isX3MaInsideValesGoldenZone && + conditions.isX3MaBullishOrdered; + + // + isX3MaBearishOrderedUnderValesGoldenZone = + isX3MaInsideValesGoldenZone && + conditions.isX3MaBearishOrdered; + + // + isX3MaSwitchedToBullishOrderedUnderValesGoldenZone = + isX3MaInsideValesGoldenZone && + conditions.isX3MaSwitchedToBullishOrdered; + + // + isX3MaSwitchedToBearishOrderedUnderValesGoldenZone = + isX3MaInsideValesGoldenZone && + conditions.isX3MaSwitchedToBearishOrdered; + + // + // XVWAP ... + + // + isVWapFastUnderValesGoldenZone = + conditions.vwapFastBuffer[cIDX] < conditions.valesGoldenBuffer[cIDX]; + + // + isVWapFastCrossedUnderValesGoldenZone = + isVWapFastUnderValesGoldenZone && + conditions.vwapFastBuffer[pIDX] >= conditions.valesGoldenBuffer[pIDX]; + + // + isVWapFastOverPeaksGoldenZone = + conditions.vwapFastBuffer[cIDX] > conditions.peaksGoldenBuffer[cIDX]; + + // + isVWapFastCrossedOverPeaksGoldenZone = + isVWapFastOverPeaksGoldenZone && + conditions.vwapFastBuffer[pIDX] <= conditions.peaksGoldenBuffer[pIDX]; + + // + isVWapInsidePeaksGoldenZone = + // + conditions.vwapMin < conditions.peaksBuffer[cIDX] && + conditions.vwapMin > conditions.peaksGoldenBuffer[cIDX] && + // + conditions.vwapMax < conditions.peaksBuffer[cIDX] && + conditions.vwapMax > conditions.peaksGoldenBuffer[cIDX] + // + ; + + // + isVWapCrossedInsidePeaksGoldenZone = + isVWapInsidePeaksGoldenZone && + !( + // + conditions.vwapMin < conditions.peaksBuffer[pIDX] && + conditions.vwapMin > conditions.peaksGoldenBuffer[pIDX] && + // + conditions.vwapMax < conditions.peaksBuffer[pIDX] && + conditions.vwapMax > conditions.peaksGoldenBuffer[pIDX] + // + ); + + // + isVWapInsideValesGoldenZone = + // + conditions.vwapMin > conditions.valesBuffer[cIDX] && + conditions.vwapMin < conditions.valesGoldenBuffer[cIDX] && + // + conditions.vwapMax > conditions.valesBuffer[cIDX] && + conditions.vwapMax < conditions.valesGoldenBuffer[cIDX] + // + ; + + // + isVWapCrossedInsideValesGoldenZone = + isVWapInsideValesGoldenZone && + !( + // + conditions.vwapMin > conditions.valesBuffer[pIDX] && + conditions.vwapMin < conditions.valesGoldenBuffer[pIDX] && + // + conditions.vwapMax > conditions.valesBuffer[pIDX] && + conditions.vwapMax < conditions.valesGoldenBuffer[pIDX] + // + ); + + // + isVWapBullishStateOverPeaksGoldenZone = + isVWapInsidePeaksGoldenZone && + conditions.isVWapBullishState; + + // + isVWapBearishStateOverPeaksGoldenZone = + isVWapInsidePeaksGoldenZone && + conditions.isVWapBearishState; + + // + isVWapSwitchedToBullishStateOverPeaksGoldenZone = + isVWapInsidePeaksGoldenZone && + conditions.isVWapSwitchedToBullishState; + + // + isVWapSwitchedToBearishStateOverPeaksGoldenZone = + isVWapInsidePeaksGoldenZone && + conditions.isVWapSwitchedToBearishState; + + // + isVWapBullishOrderedOverPeaksGoldenZone = + isVWapInsidePeaksGoldenZone && + conditions.isVWapBullishOrdered; + + // + isVWapBearishOrderedOverPeaksGoldenZone = + isVWapInsidePeaksGoldenZone && + conditions.isVWapBearishOrdered; + + // + isVWapSwitchedToBullishOrderedOverPeaksGoldenZone = + isVWapInsidePeaksGoldenZone && + conditions.isVWapSwitchedToBullishOrdered; + + // + isVWapSwitchedToBearishOrderedOverPeaksGoldenZone = + isVWapInsidePeaksGoldenZone && + conditions.isVWapSwitchedToBearishOrdered; + + // + isVWapBullishStateUnderValesGoldenZone = + isVWapInsideValesGoldenZone && + conditions.isVWapBullishState; + + // + isVWapBearishStateUnderValesGoldenZone = + isVWapInsideValesGoldenZone && + conditions.isVWapBearishState; + + // + isVWapSwitchedToBullishStateUnderValesGoldenZone = + isVWapInsideValesGoldenZone && + conditions.isVWapSwitchedToBullishState; + + // + isVWapSwitchedToBearishStateUnderValesGoldenZone = + isVWapInsideValesGoldenZone && + conditions.isVWapSwitchedToBearishState; + + // + isVWapBullishOrderedUnderValesGoldenZone = + isVWapInsideValesGoldenZone && + conditions.isVWapBullishOrdered; + + // + isVWapBearishOrderedUnderValesGoldenZone = + isVWapInsideValesGoldenZone && + conditions.isVWapBearishOrdered; + + // + isVWapSwitchedToBullishOrderedUnderValesGoldenZone = + isVWapInsideValesGoldenZone && + conditions.isVWapSwitchedToBullishOrdered; + + // + isVWapSwitchedToBearishOrderedUnderValesGoldenZone = + isVWapInsideValesGoldenZone && + conditions.isVWapSwitchedToBearishOrdered; + + // + // XHK ... + + // + // XRWHK ... + + // + isRawHKBearishOverPeaksGoldenZone = + conditions.isRawHKBearish && + conditions.xhkRawHighBuffer[cIDX] > conditions.peaksGoldenBuffer[cIDX]; + + // + isRawHKSwitchedToBearishOverPeaksGoldenZone = + conditions.isRawHKSwitchedToBearish && + conditions.xhkRawHighBuffer[cIDX] > conditions.peaksGoldenBuffer[cIDX]; + + // + isRawHKBullishUnderValesGoldenZone = + conditions.isRawHKBullish && + conditions.xhkRawLowBuffer[cIDX] < conditions.valesGoldenBuffer[cIDX]; + + // + isRawHKSwitchedToBullishUnderValesGoldenZone = + conditions.isRawHKSwitchedToBullish && + conditions.xhkRawLowBuffer[cIDX] < conditions.valesGoldenBuffer[cIDX]; + + // + // XSMHK ... + + // + isSMHKBearishOverPeaksGoldenZone = + conditions.isSMHKBearish && + conditions.xhkSMHighBuffer[cIDX] > conditions.peaksGoldenBuffer[cIDX]; + + // + isSMHKSwitchedToBearishOverPeaksGoldenZone = + conditions.isSMHKSwitchedToBearish && + conditions.xhkSMHighBuffer[cIDX] > conditions.peaksGoldenBuffer[cIDX]; + + // + isSMHKBullishUnderValesGoldenZone = + conditions.isSMHKBullish && + conditions.xhkSMLowBuffer[cIDX] < conditions.valesGoldenBuffer[cIDX]; + + // + isSMHKSwitchedToBullishUnderValesGoldenZone = + conditions.isSMHKSwitchedToBullish && + conditions.xhkSMLowBuffer[cIDX] < conditions.valesGoldenBuffer[cIDX]; + + // + // XATR ... + + // + isAtrUpperOverPeaksGoldenZone = + conditions.atrUpperBuffer[cIDX] < conditions.peaksBuffer[cIDX] && + conditions.atrUpperBuffer[cIDX] > conditions.peaksGoldenBuffer[cIDX]; + + // + isAtrLowerOverPeaksGoldenZone = + conditions.atrLowerBuffer[cIDX] < conditions.peaksBuffer[cIDX] && + conditions.atrLowerBuffer[cIDX] > conditions.peaksGoldenBuffer[cIDX]; + + // + isAtrOverPeaksGoldenZone = + isAtrUpperOverPeaksGoldenZone && + isAtrLowerOverPeaksGoldenZone; + + // + isAtrCrossedOverPeaksGoldenZone = + isAtrOverPeaksGoldenZone && + !( + // + conditions.atrUpperBuffer[pIDX] < conditions.peaksBuffer[pIDX] && + conditions.atrUpperBuffer[pIDX] > conditions.peaksGoldenBuffer[pIDX] + // + && + // + conditions.atrLowerBuffer[pIDX] < conditions.peaksBuffer[pIDX] && + conditions.atrLowerBuffer[pIDX] > conditions.peaksGoldenBuffer[pIDX] + // + ); + + // + isAtrUpperUnderValesGoldenZone = + conditions.atrUpperBuffer[cIDX] > conditions.valesBuffer[cIDX] && + conditions.atrUpperBuffer[cIDX] < conditions.valesGoldenBuffer[cIDX]; + + // + isAtrLowerUnderValesGoldenZone = + conditions.atrLowerBuffer[cIDX] > conditions.valesBuffer[cIDX] && + conditions.atrLowerBuffer[cIDX] < conditions.valesGoldenBuffer[cIDX]; + + // + isAtrUnderValesGoldenZone = + isAtrUpperUnderValesGoldenZone && + isAtrLowerUnderValesGoldenZone; + + // + isAtrCrossedUnderValesGoldenZone = + isAtrUnderValesGoldenZone && + !( + // + conditions.atrUpperBuffer[pIDX] > conditions.valesBuffer[pIDX] && + conditions.atrUpperBuffer[pIDX] < conditions.valesGoldenBuffer[pIDX] + // + && + // + conditions.atrLowerBuffer[pIDX] > conditions.valesBuffer[pIDX] && + conditions.atrLowerBuffer[pIDX] < conditions.valesGoldenBuffer[pIDX] + // + ); + + // + // XSTR ... + + // + isStrBullishOverPeaksGoldenZone = + conditions.isStrBullish && + conditions.strBuffer[cIDX] < conditions.peaksBuffer[cIDX] && + conditions.strBuffer[cIDX] > conditions.peaksGoldenBuffer[cIDX]; + + // + isStrBearishOverPeaksGoldenZone = + conditions.isStrBearish && + conditions.strBuffer[cIDX] < conditions.peaksBuffer[cIDX] && + conditions.strBuffer[cIDX] > conditions.peaksGoldenBuffer[cIDX]; + + // + isStrSwitchedToBullishOverPeaksGoldenZone = + conditions.isStrSwitchedToBullish && + conditions.strBuffer[cIDX] < conditions.peaksBuffer[cIDX] && + conditions.strBuffer[cIDX] > conditions.peaksGoldenBuffer[cIDX]; + + // + isStrSwitchedToBearishOverPeaksGoldenZone = + conditions.isStrSwitchedToBearish && + conditions.strBuffer[cIDX] < conditions.peaksBuffer[cIDX] && + conditions.strBuffer[cIDX] > conditions.peaksGoldenBuffer[cIDX]; + + // + isStrBullishUnderValesGoldenZone = + conditions.isStrBullish && + conditions.strBuffer[cIDX] > conditions.valesBuffer[cIDX] && + conditions.strBuffer[cIDX] < conditions.valesGoldenBuffer[cIDX]; + + // + isStrBearishUnderValesGoldenZone = + conditions.isStrBearish && + conditions.strBuffer[cIDX] > conditions.valesBuffer[cIDX] && + conditions.strBuffer[cIDX] < conditions.valesGoldenBuffer[cIDX]; + + // + isStrSwitchedToBullishUnderValesGoldenZone = + conditions.isStrSwitchedToBullish && + conditions.strBuffer[cIDX] > conditions.valesBuffer[cIDX] && + conditions.strBuffer[cIDX] < conditions.valesGoldenBuffer[cIDX]; + + // + isStrSwitchedToBearishUnderValesGoldenZone = + conditions.isStrSwitchedToBearish && + conditions.strBuffer[cIDX] > conditions.valesBuffer[cIDX] && + conditions.strBuffer[cIDX] < conditions.valesGoldenBuffer[cIDX]; + + // + // XCHE ... + + // + isCheBullishOverPeaksGoldenZone = + conditions.isCheBullish && + conditions.le1Buffer[cIDX] < conditions.peaksBuffer[cIDX] && + conditions.le1Buffer[cIDX] > conditions.peaksGoldenBuffer[cIDX] && + conditions.le2Buffer[cIDX] < conditions.peaksBuffer[cIDX] && + conditions.le2Buffer[cIDX] > conditions.peaksGoldenBuffer[cIDX]; + + // + isCheBearishOverPeaksGoldenZone = + conditions.isCheSwitchedToBullish && + conditions.se1Buffer[cIDX] < conditions.peaksBuffer[cIDX] && + conditions.se1Buffer[cIDX] > conditions.peaksGoldenBuffer[cIDX] && + conditions.se2Buffer[cIDX] < conditions.peaksBuffer[cIDX] && + conditions.se2Buffer[cIDX] > conditions.peaksGoldenBuffer[cIDX]; + + // + isCheSwitchedBullishOverPeaksGoldenZone = + conditions.isCheSwitchedToBullish && + conditions.le1Buffer[cIDX] < conditions.peaksBuffer[cIDX] && + conditions.le1Buffer[cIDX] > conditions.peaksGoldenBuffer[cIDX] && + conditions.le2Buffer[cIDX] < conditions.peaksBuffer[cIDX] && + conditions.le2Buffer[cIDX] > conditions.peaksGoldenBuffer[cIDX]; + + // + isCheSwitchedBearishOverPeaksGoldenZone = + conditions.isCheSwitchedToBearish && + conditions.se1Buffer[cIDX] < conditions.peaksBuffer[cIDX] && + conditions.se1Buffer[cIDX] > conditions.peaksGoldenBuffer[cIDX] && + conditions.se2Buffer[cIDX] < conditions.peaksBuffer[cIDX] && + conditions.se2Buffer[cIDX] > conditions.peaksGoldenBuffer[cIDX]; + + // + isCheBullishUnderValesGoldenZone = + conditions.isCheBullish && + conditions.cheMin > conditions.valesBuffer[cIDX] && + conditions.cheMin < conditions.valesGoldenBuffer[cIDX] && + conditions.cheMax > conditions.valesBuffer[cIDX] && + conditions.cheMax < conditions.valesGoldenBuffer[cIDX]; + + // + isCheBearishUnderValesGoldenZone = + conditions.isCheBearish && + conditions.cheMin > conditions.valesBuffer[cIDX] && + conditions.cheMin < conditions.valesGoldenBuffer[cIDX] && + conditions.cheMax > conditions.valesBuffer[cIDX] && + conditions.cheMax < conditions.valesGoldenBuffer[cIDX]; + + // + isCheSwitchedBullishUnderValesGoldenZone = + conditions.isCheSwitchedToBullish && + conditions.cheMin > conditions.valesBuffer[cIDX] && + conditions.cheMin < conditions.valesGoldenBuffer[cIDX] && + conditions.cheMax > conditions.valesBuffer[cIDX] && + conditions.cheMax < conditions.valesGoldenBuffer[cIDX]; + + // + isCheSwitchedBearishUnderValesGoldenZone = + conditions.isCheSwitchedToBearish && + conditions.cheMin > conditions.valesBuffer[cIDX] && + conditions.cheMin < conditions.valesGoldenBuffer[cIDX] && + conditions.cheMax > conditions.valesBuffer[cIDX] && + conditions.cheMax < conditions.valesGoldenBuffer[cIDX]; + } + + // + bool HasSenario1Conditions( + ENUM_X_CYCLES cycle, + XBoxZone &box, + XBoxZone &holderBox, + ENUM_X_DIRECTION &dir, + X121SMCStrategySignalProviderData &provider, + ENUM_X_CYCLES holderCycle = X_CYCLE_NONE, + int barIndex = 0 // + ) + { + // + bool result = false; + + // + // Fil Selected Data ... + XPOIState cState; + X121Conditions cXConditions; + XC121SMCCycleHelper *cHelper; + X121SMCCycleConditions cConditions; + result = provider.SelectCycle( + cycle, + cState, + cXConditions, + cHelper, + cConditions // + ); + if (!result) + { + // + cState.Clean(); + ZeroMemory(cHelper); + cConditions.Clean(); + cXConditions.Clean(); + + // + return result; + } + Parse(cXConditions); + + // + // Fil Selected Data ... + XPOIState chState; + X121Conditions chXConditions; + XC121SMCCycleHelper *chHelper; + X121SMCCycleConditions chConditions; + if (holderCycle != X_CYCLE_NONE) + { + // + result = provider.SelectCycle( + holderCycle, + chState, + chXConditions, + chHelper, + chConditions // + ); + if (!result) + { + // + chState.Clean(); + ZeroMemory(chHelper); + chConditions.Clean(); + chXConditions.Clean(); + + // + return result; + } + + // + Parse(chXConditions); + } + + // + // Normalize Args ... + + // + box.Clean(); + holderBox.Clean(); + dir = X_DIRECTION_NONE; + + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + int idx = -1; + int count = 0; + bool has = false; + + // + int zIDX = barIndex; + int cIDX = zIDX + 1; + int pIDX = cIDX + 1; + + // + bool isBullish = false; + bool isBearish = false; + + // + XOHCL zBar; + XOHCL cBar; + XOHCL pBar; + + // + // Initial Bars ... + result = zBar.Init( + cState.symbol, + cState.period, + barIndex // + ); + result = + result && + zBar.GetPreviousBar(cBar); + result = + result && + cBar.GetPreviousBar(pBar); + if (!result) + { + // + zBar.Clean(); + cBar.Clean(); + pBar.Clean(); + cState.Clean(); + chState.Clean(); + ZeroMemory(cHelper); + cConditions.Clean(); + cXConditions.Clean(); + ZeroMemory(chHelper); + chConditions.Clean(); + chXConditions.Clean(); + + // + return result; + } + + // + // Detecting Signal Conditions ... + + // + // Bullish Conditions ... + isBullish = + // + // Base Condition ... + ( + // + cXConditions.supportsBuffer[cIDX] == cXConditions.valesBuffer[zIDX] + // + // cXConditions.isSarSwitchedToBullish && + // cXConditions.isSMHKSwitchedToBullish && + // cBar.low < cXConditions.masLowerBuffer[cIDX] && + // cBar.low < cXConditions.valesGoldenBuffer[cIDX] && + // zBar.close < cXConditions.valesGoldenBuffer[cIDX] && + // cXConditions.xhkSMCloseBuffer[cIDX] < cXConditions.valesGoldenBuffer[cIDX] + // + ) + // + ; + + // + // Bearish Conditions ... + isBearish = + // + // Base Condition ... + ( + // + false + // + ) + // + ; + + // + // Filling Requirements ... + result = + isBullish || + isBearish; + if (result) + { + // + dir = + isBullish + ? X_DIRECTION_BULLISH + : X_DIRECTION_BEARISH; + + // + box.dir = dir; + box.to = TimeCurrent(); + box.symbol = cXConditions.symbol; + box.period = cXConditions.period; + + // + int fromIDX = -1; + if (isBullish) + { + // + double vale = cXConditions.valesBuffer[cIDX]; + box.lower = vale; + box.upper = cXConditions.valesGoldenBuffer[cIDX]; + + // + int lowerValeIDX = -1; + double lowerVale = cHelper + .mX121Helper + .xpvHelper + .GetLowerVale( + lowerValeIDX, + vale, + cBar.Index() // + ); + + // + int higherValeIDX = -1; + double higherVale = cHelper + .mX121Helper + .xpvHelper + .GetHigherVale( + higherValeIDX, + vale, + cBar.Index() // + ); + + // + if (IsValidIndex(lowerValeIDX) && + IsValidIndex(higherValeIDX)) + { + // + fromIDX = + lowerValeIDX < higherValeIDX + ? lowerValeIDX + : higherValeIDX; + } + else if (IsValidIndex(lowerValeIDX) && + !IsValidIndex(higherValeIDX)) + { + // + fromIDX = lowerValeIDX; + } + else if (!IsValidIndex(lowerValeIDX) && + IsValidIndex(higherValeIDX)) + { + // + fromIDX = higherValeIDX; + } + } + else + { + // + double peak = cXConditions.peaksBuffer[cIDX]; + box.upper = peak; + + // + box.lower = cXConditions.peaksGoldenBuffer[cIDX]; + + // + int lowerPeakIDX = -1; + double lowerPeak = cHelper + .mX121Helper + .xpvHelper + .GetLowerPeak( + lowerPeakIDX, + peak, + cBar.Index() // + ); + + // + int higherPeakIDX = -1; + double higherPeak = cHelper + .mX121Helper + .xpvHelper + .GetHigherPeak( + higherPeakIDX, + peak, + cBar.Index() // + ); + + // + if (IsValidIndex(lowerPeakIDX) && + IsValidIndex(higherPeakIDX)) + { + // + fromIDX = + lowerPeakIDX < higherPeakIDX + ? lowerPeakIDX + : higherPeakIDX; + } + else if (IsValidIndex(lowerPeakIDX) && + !IsValidIndex(higherPeakIDX)) + { + // + fromIDX = lowerPeakIDX; + } + else if (!IsValidIndex(lowerPeakIDX) && + IsValidIndex(higherPeakIDX)) + { + // + fromIDX = higherPeakIDX; + } + } + + // + if (IsValidIndex(fromIDX)) + { + // + box.from = iTime( + zBar.symbol, + zBar.period, + fromIDX // + ); + } + else + { + box.from = pBar.time; + } + + // + // Detect Holder Box ... + XBoxZone tmpBoxes[]; + if (chState.IsValid()) + { + // + if (isBullish) + { + // + // Demand Zones ... + XBoxZone tmp[]; + ToBox( + chState.demandZones, + tmp // + ); + Copy( + tmp, + tmpBoxes, + false // + ); + Clean(tmp); + + // + // Bullish Order Blocks ... + ToBox( + chState.bullishOrderBlocks, + tmp // + ); + Copy( + tmp, + tmpBoxes, + false // + ); + Clean(tmp); + + // + // Bullish Fair Value Gaps ... + ToBox( + chState.bullishFairValueGaps, + tmp // + ); + Copy( + tmp, + tmpBoxes, + false // + ); + Clean(tmp); + } + else + { + // + // Supply Zones ... + XBoxZone tmp[]; + ToBox( + chState.supplyZones, + tmp // + ); + Copy( + tmp, + tmpBoxes, + false // + ); + Clean(tmp); + + // + // Bearish Order Blocks ... + ToBox( + chState.bearishOrderBlocks, + tmp // + ); + Copy( + tmp, + tmpBoxes, + false // + ); + Clean(tmp); + + // + // Bearish Fair Value Gaps ... + ToBox( + chState.bearishFairValueGaps, + tmp // + ); + Copy( + tmp, + tmpBoxes, + false // + ); + Clean(tmp); + } + } + + // + has = HasChild(tmpBoxes); + if (has) + { + // + while (HasChild(tmpBoxes)) + { + // + idx = GetOldest(tmpBoxes); + has = IsValidIndex(idx); + if (!has) + { + break; + } + + // + XBoxZone iBox = tmpBoxes[idx]; + ArrayRemove( + tmpBoxes, + idx, + 1 // + ); + + // + has = IsBoxInside( + box, + iBox // + ); + if (has) + { + // + holderBox = iBox; + holderBox.to = TimeCurrent(); + iBox.Clean(); + break; + } + + // + iBox.Clean(); + } + } + + // + Clean(tmpBoxes); + + // + // Fix Box Upper and Lower based on Strategy ... + + // + double points = GetPoints(box.symbol); + double minPointsDiff = points * 20; + + // + double prefferSL = 0; + + // + // Other SL Conditions ... + if (prefferSL <= 0) + { + // + if (isBullish) + { + // + if (zBar.open < cXConditions.valesGoldenBuffer[cIDX]) + { + prefferSL = cXConditions.valesBuffer[cIDX]; + } + else if (zBar.open > cXConditions.valesGoldenBuffer[cIDX] && + zBar.open < cXConditions.peaksGoldenBuffer[cIDX]) + { + prefferSL = cXConditions.valesGoldenBuffer[cIDX]; + } + else if (zBar.open > cXConditions.peaksGoldenBuffer[cIDX]) + { + // + if (cXConditions.sarBuffer[cIDX] > cXConditions.peaksGoldenBuffer[cIDX]) + { + prefferSL = cXConditions.sarBuffer[cIDX]; + } + else + { + prefferSL = zBar.open > cXConditions.peaksGoldenBuffer[cIDX]; + } + } + } + else + { + // + if (zBar.open > cXConditions.peaksGoldenBuffer[cIDX]) + { + prefferSL = cXConditions.peaksBuffer[cIDX]; + } + else if (zBar.open < cXConditions.peaksGoldenBuffer[cIDX] && + zBar.open > cXConditions.valesGoldenBuffer[cIDX]) + { + prefferSL = cXConditions.peaksGoldenBuffer[cIDX]; + } + else if (zBar.open < cXConditions.valesGoldenBuffer[cIDX]) + { + // + if (cXConditions.sarBuffer[cIDX] < cXConditions.valesGoldenBuffer[cIDX]) + { + prefferSL = cXConditions.sarBuffer[cIDX]; + } + else + { + prefferSL = cXConditions.valesGoldenBuffer[cIDX]; + } + } + } + } + + // + if (prefferSL > 0) + { + // + box.upper = + isBullish + ? zBar.open + : prefferSL; + + // + box.lower = + isBullish + ? prefferSL + : zBar.open; + } + + // + // Validate Conditions to Force Has Holder Box ... + + result = + result && + holderBox.IsValid() && + dir == holderBox.dir; + + // + if (!result) + { + // + isBullish = false; + isBearish = false; + } + } + + // + // Check All Conditions ... + result = + box.IsValid() && + HasDirection(dir) && + (isBullish || + isBearish); + + // + // Cleanup Resources ... + zBar.Clean(); + cBar.Clean(); + pBar.Clean(); + cState.Clean(); + chState.Clean(); + ZeroMemory(cHelper); + cConditions.Clean(); + cXConditions.Clean(); + ZeroMemory(chHelper); + chConditions.Clean(); + chXConditions.Clean(); + + // + return result; + } + + // + bool HasSenario2Conditions( + ENUM_X_CYCLES ttfCycle, + XBoxZone &breakedBoxes[], + XBoxZone &box, + ENUM_X_DIRECTION &dir, + X121SMCStrategySignalProviderData &provider, + int barIndex = 0, + bool forceBarType = false, + bool forceFiboPressure = false // + ) + { + // + bool result = false; + + // + // Validate Args ... + result = + IsValid(ttfCycle) && + HasChild(breakedBoxes); + if (!result) + { + return result; + } + + // + // TODO: Add support for Extracting Trend ... + ENUM_X_DIRECTION trend = X_DIRECTION_NONE; + bool hasBullishTrend = IsBullish(trend); + bool hasBearishTrend = IsBearish(trend); + + // + // TTF Cycle Extract ... + XPOIState ttfState; + X121Conditions ttfXConditions; + XC121SMCCycleHelper *ttfHelper; + X121SMCCycleConditions ttfConditions; + result = provider.SelectCycle( + ttfCycle, + ttfState, + ttfXConditions, + ttfHelper, + ttfConditions // + ); + if (!result) + { + // + ttfState.Clean(); + ZeroMemory(ttfHelper); + ttfConditions.Clean(); + ttfXConditions.Clean(); + + // + return result; + } + Parse(ttfXConditions); + + // + // Normalize Args ... + + // + box.Clean(); + dir = X_DIRECTION_NONE; + + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + // Define Resources ... + + // + int idx = -1; + int count = 0; + bool has = false; + + // + int zIDX = barIndex; + int cIDX = zIDX + 1; + int pIDX = cIDX + 1; + + // + double ask = GetAsk(ttfState.symbol); + double bid = GetBid(ttfState.symbol); + + // + bool isBullish = false; + bool isBearish = false; + + // + XOHCL zBar; + XOHCL cBar; + XOHCL pBar; + + // + // Initial Bars ... + result = zBar.Init( + ttfState.symbol, + ttfState.period, + barIndex // + ); + result = + result && + zBar.GetPreviousBar(cBar); + result = + result && + cBar.GetPreviousBar(pBar); + if (!result) + { + // + zBar.Clean(); + cBar.Clean(); + pBar.Clean(); + ttfState.Clean(); + ZeroMemory(ttfHelper); + ttfConditions.Clean(); + ttfXConditions.Clean(); + + // + return result; + } + + // + // Conditions ... + + // + // First we Have to Detect Inside Box ... + XBoxZone insideBox; + count = ArraySize(breakedBoxes); + for (int i = 0; i < count; i++) + { + // + XBoxZone iBox = breakedBoxes[i]; + + // + bool isInside = + IsInsideBox( + zBar, + iBox // + ); + if (isInside) + { + // + // Since we have to Follow Trend based on Breaked Boxes ... + // we have to use: + // - Breaked Bullish Boxes on Bearish Trend ... + // - Breaked Bearish Boxes on Bullish Trend ... + isInside = + hasBullishTrend + ? iBox.IsBearish() + : hasBearishTrend + ? iBox.IsBullish() + : false; + + // + // Check Inside ... + if (isInside) + { + // + insideBox = iBox; + iBox.Clean(); + + // + break; + } + } + + // + iBox.Clean(); + } + + // + // Check Inside Box is Valid or not ... + result = insideBox.IsValid(); + if (!result) + { + // + zBar.Clean(); + cBar.Clean(); + pBar.Clean(); + ttfState.Clean(); + insideBox.Clean(); + ZeroMemory(ttfHelper); + ttfConditions.Clean(); + ttfXConditions.Clean(); + } + + // + // Update Inside Box From and To ... + // Based on Breaked ... + insideBox.from = insideBox.to; + insideBox.to = TimeCurrent(); + + // + // Detect Breaked Box Direction ... + bool isInsideBoxBullish = insideBox.IsBullish(); + bool isInsideBoxBearish = insideBox.IsBearish(); + + // + // Detect Inside Box Rejection ... + + // + bool isUpperBearishReject = + cBar.high >= insideBox.upper && + cBar.GetUp() < insideBox.upper; + + // + bool isUpperBullishReject = + cBar.low <= insideBox.upper && + cBar.GetDown() > insideBox.upper; + + // + bool isLowerBearishReject = + cBar.high >= insideBox.lower && + cBar.GetUp() < insideBox.lower; + + // + bool isLowerBullishReject = + cBar.low <= insideBox.lower && + cBar.GetDown() > insideBox.lower; + + // + // Apply Force Bar Type ... + if (forceBarType) + { + // + isUpperBearishReject = + isUpperBearishReject && + cBar.IsBearish(); + + // + isUpperBullishReject = + isUpperBullishReject && + cBar.IsBullish(); + + // + isLowerBearishReject = + isLowerBearishReject && + cBar.IsBearish(); + + // + isLowerBullishReject = + isLowerBullishReject && + cBar.IsBullish(); + } + + // + // Apply Force Fibo Pressure ... + if (forceBarType) + { + // + isUpperBearishReject = + isUpperBearishReject && + ttfHelper + .mBarAnalyser + .HasFiboPressure( + cBar, + X_DIRECTION_BEARISH, + X_FIBO_LEVEL_382 // + ); + + // + isUpperBullishReject = + isUpperBullishReject && + ttfHelper + .mBarAnalyser + .HasFiboPressure( + cBar, + X_DIRECTION_BULLISH, + X_FIBO_LEVEL_382 // + ); + + // + isLowerBearishReject = + isLowerBearishReject && + ttfHelper + .mBarAnalyser + .HasFiboPressure( + cBar, + X_DIRECTION_BEARISH, + X_FIBO_LEVEL_382 // + ); + + // + isLowerBullishReject = + isLowerBullishReject && + ttfHelper + .mBarAnalyser + .HasFiboPressure( + cBar, + X_DIRECTION_BULLISH, + X_FIBO_LEVEL_382 // + ); + } + + // + // Bullish Conditions ... + isBullish = ( + // + hasBullishTrend && + isInsideBoxBearish && + isLowerBullishReject + // + ); + + // + // Bearish Conditions ... + isBearish = ( + // + hasBearishTrend && + isInsideBoxBullish && + isUpperBearishReject + // + ); + + // + // Filling Requirements ... + result = + isBullish || + isBearish; + if (result) + { + // + box = insideBox; + + // + dir = + isBullish + ? X_DIRECTION_BULLISH + : X_DIRECTION_BEARISH; + } + + // + // Check All Conditions ... + result = + box.IsValid() && + HasDirection(dir) && + (isBullish || + isBearish // + ); + + // + // Cleanup Resource ... + + // + zBar.Clean(); + cBar.Clean(); + pBar.Clean(); + + // + ttfState.Clean(); + insideBox.Clean(); + ZeroMemory(ttfHelper); + ttfConditions.Clean(); + ttfXConditions.Clean(); + + // + return result; + } + + // + bool HasSenario4Conditions( + ENUM_X_CYCLES cycle, + XBoxZone &box, + XBoxZone &holderBox, + ENUM_X_DIRECTION &dir, + X121SMCStrategySignalProviderData &provider, + ENUM_X_CYCLES holderCycle = X_CYCLE_NONE, + int barIndex = 0 // + ) + { + // + bool result = false; + + // + // Fil Selected Data ... + XPOIState cState; + X121Conditions cXConditions; + XC121SMCCycleHelper *cHelper; + X121SMCCycleConditions cConditions; + result = provider.SelectCycle( + cycle, + cState, + cXConditions, + cHelper, + cConditions // + ); + if (!result) + { + // + cState.Clean(); + ZeroMemory(cHelper); + cConditions.Clean(); + cXConditions.Clean(); + + // + return result; + } + Parse(cXConditions); + + // + // Fil Selected Data ... + XPOIState chState; + X121Conditions chXConditions; + XC121SMCCycleHelper *chHelper; + X121SMCCycleConditions chConditions; + if (holderCycle != X_CYCLE_NONE) + { + // + result = provider.SelectCycle( + holderCycle, + chState, + chXConditions, + chHelper, + chConditions // + ); + if (!result) + { + // + chState.Clean(); + ZeroMemory(chHelper); + chConditions.Clean(); + chXConditions.Clean(); + + // + return result; + } + + // + Parse(chXConditions); + } + + // + // Normalize Args ... + + // + box.Clean(); + holderBox.Clean(); + dir = X_DIRECTION_NONE; + + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + int idx = -1; + int count = 0; + bool has = false; + + // + int zIDX = barIndex; + int cIDX = zIDX + 1; + int pIDX = cIDX + 1; + + // + bool isBullish = false; + bool isBearish = false; + + // + XOHCL zBar; + XOHCL cBar; + XOHCL pBar; + + // + // Initial Bars ... + result = zBar.Init( + cState.symbol, + cState.period, + barIndex // + ); + result = + result && + zBar.GetPreviousBar(cBar); + result = + result && + cBar.GetPreviousBar(pBar); + if (!result) + { + // + zBar.Clean(); + cBar.Clean(); + pBar.Clean(); + cState.Clean(); + chState.Clean(); + ZeroMemory(cHelper); + cConditions.Clean(); + cXConditions.Clean(); + ZeroMemory(chHelper); + chConditions.Clean(); + chXConditions.Clean(); + + // + return result; + } + + // + // Detecting Signal Conditions ... + + // + // Bullish Conditions ... + isBullish = + // + // Base Condition ... + ( + // + cBar.IsBullish() && + zBar.open >= cBar.close && + ( + // + // Regular Reject ... + (pBar.low > cBar.low && + cBar.low < cXConditions.valesGoldenBuffer[cIDX] && + cBar.GetDown() > cXConditions.valesGoldenBuffer[cIDX]) + // + || + // + // Regular Exit ... + (pBar.low < cXConditions.valesGoldenBuffer[cIDX] && + (cBar.low > cXConditions.valesGoldenBuffer[cIDX] || + cBar.GetUp() > cXConditions.valesGoldenBuffer[cIDX])) + // + || + // + IsBarBreak( + cXConditions.valesGoldenBuffer[cIDX], + X_DIRECTION_BULLISH, + cBar // + ) + // + || + // + IsBarReject( + cXConditions.valesGoldenBuffer[cIDX], + X_DIRECTION_BULLISH, + cBar // + ) + // + ) + // + ) + // + && + // + // Checking other Conditions ... + ( + // + // XSAR ... + cXConditions.isSarBullish && + // + // XSTR ... + cXConditions.isStrSwitchedToBullish && + // + // // X3MA ... + // // XVWAP ... + // (cXConditions.isX3MaFastOverMid || + // cXConditions.isVWapFastOverMid) && + // + // XHK ... + cXConditions.isSMHKBullish && + cXConditions.isRawHKBullish && + // + // XCHE ... + cXConditions.isCheBullish && + cXConditions.le1Buffer[cIDX] < cBar.low && + cXConditions.le2Buffer[cIDX] < cBar.low + // + ) + // + ; + + // + // Bearish Conditions ... + isBearish = + // + // Base Condition ... + ( + // + cBar.IsBearish() && + zBar.open <= cBar.close && + ( + // + // Regular Reject ... + (pBar.high < cBar.high && + cBar.high > cXConditions.peaksGoldenBuffer[cIDX] && + cBar.GetUp() < cXConditions.peaksGoldenBuffer[cIDX]) + // + || + // + // Regular Exit ... + (pBar.high > cXConditions.peaksGoldenBuffer[cIDX] && + (cBar.high < cXConditions.peaksGoldenBuffer[cIDX] || + cBar.GetDown() < cXConditions.peaksGoldenBuffer[cIDX])) + // + || + // + IsBarBreak( + cXConditions.peaksGoldenBuffer[cIDX], + X_DIRECTION_BEARISH, + cBar // + ) + // + || + // + IsBarReject( + cXConditions.peaksGoldenBuffer[cIDX], + X_DIRECTION_BEARISH, + cBar // + ) + // + ) + // + ) + // + && + // + // Checking other Conditions ... + ( + // + // XSAR ... + cXConditions.isSarBearish && + // + // XSTR ... + cXConditions.isStrSwitchedToBearish && + // + // // X3MA ... + // // XVWAP ... + // (cXConditions.isX3MaFastUnderMid || + // cXConditions.isVWapFastUnderMid) && + // + // XHK ... + cXConditions.isSMHKBearish && + cXConditions.isRawHKBearish && + // + // XCHE ... + cXConditions.isCheBearish && + cXConditions.se1Buffer[cIDX] > cBar.high && + cXConditions.se2Buffer[cIDX] > cBar.high + // + ) + // + ; + + // + // Filling Requirements ... + result = + isBullish || + isBearish; + if (result) + { + // + dir = + isBullish + ? X_DIRECTION_BULLISH + : X_DIRECTION_BEARISH; + + // + box.dir = dir; + box.to = TimeCurrent(); + box.symbol = cXConditions.symbol; + box.period = cXConditions.period; + + // + int fromIDX = -1; + if (isBullish) + { + // + double vale = cXConditions.valesBuffer[cIDX]; + box.lower = vale; + box.upper = cXConditions.valesGoldenBuffer[cIDX]; + + // + int lowerValeIDX = -1; + double lowerVale = cHelper + .mX121Helper + .xpvHelper + .GetLowerVale( + lowerValeIDX, + vale, + cBar.Index() // + ); + + // + int higherValeIDX = -1; + double higherVale = cHelper + .mX121Helper + .xpvHelper + .GetHigherVale( + higherValeIDX, + vale, + cBar.Index() // + ); + + // + if (IsValidIndex(lowerValeIDX) && + IsValidIndex(higherValeIDX)) + { + // + fromIDX = + lowerValeIDX < higherValeIDX + ? lowerValeIDX + : higherValeIDX; + } + else if (IsValidIndex(lowerValeIDX) && + !IsValidIndex(higherValeIDX)) + { + // + fromIDX = lowerValeIDX; + } + else if (!IsValidIndex(lowerValeIDX) && + IsValidIndex(higherValeIDX)) + { + // + fromIDX = higherValeIDX; + } + } + else + { + // + double peak = cXConditions.peaksBuffer[cIDX]; + box.upper = peak; + + // + box.lower = cXConditions.peaksGoldenBuffer[cIDX]; + + // + int lowerPeakIDX = -1; + double lowerPeak = cHelper + .mX121Helper + .xpvHelper + .GetLowerPeak( + lowerPeakIDX, + peak, + cBar.Index() // + ); + + // + int higherPeakIDX = -1; + double higherPeak = cHelper + .mX121Helper + .xpvHelper + .GetHigherPeak( + higherPeakIDX, + peak, + cBar.Index() // + ); + + // + if (IsValidIndex(lowerPeakIDX) && + IsValidIndex(higherPeakIDX)) + { + // + fromIDX = + lowerPeakIDX < higherPeakIDX + ? lowerPeakIDX + : higherPeakIDX; + } + else if (IsValidIndex(lowerPeakIDX) && + !IsValidIndex(higherPeakIDX)) + { + // + fromIDX = lowerPeakIDX; + } + else if (!IsValidIndex(lowerPeakIDX) && + IsValidIndex(higherPeakIDX)) + { + // + fromIDX = higherPeakIDX; + } + } + + // + if (IsValidIndex(fromIDX)) + { + // + box.from = iTime( + zBar.symbol, + zBar.period, + fromIDX // + ); + } + else + { + box.from = pBar.time; + } + + // + // Detect Holder Box ... + XBoxZone tmpBoxes[]; + if (chState.IsValid()) + { + // + if (isBullish) + { + // + // Demand Zones ... + XBoxZone tmp[]; + ToBox( + chState.demandZones, + tmp // + ); + Copy( + tmp, + tmpBoxes, + false // + ); + Clean(tmp); + + // + // Bullish Order Blocks ... + ToBox( + chState.bullishOrderBlocks, + tmp // + ); + Copy( + tmp, + tmpBoxes, + false // + ); + Clean(tmp); + + // + // Bullish Fair Value Gaps ... + ToBox( + chState.bullishFairValueGaps, + tmp // + ); + Copy( + tmp, + tmpBoxes, + false // + ); + Clean(tmp); + } + else + { + // + // Supply Zones ... + XBoxZone tmp[]; + ToBox( + chState.supplyZones, + tmp // + ); + Copy( + tmp, + tmpBoxes, + false // + ); + Clean(tmp); + + // + // Bearish Order Blocks ... + ToBox( + chState.bearishOrderBlocks, + tmp // + ); + Copy( + tmp, + tmpBoxes, + false // + ); + Clean(tmp); + + // + // Bearish Fair Value Gaps ... + ToBox( + chState.bearishFairValueGaps, + tmp // + ); + Copy( + tmp, + tmpBoxes, + false // + ); + Clean(tmp); + } + } + + // + has = HasChild(tmpBoxes); + if (has) + { + // + while (HasChild(tmpBoxes)) + { + // + idx = GetOldest(tmpBoxes); + has = IsValidIndex(idx); + if (!has) + { + break; + } + + // + XBoxZone iBox = tmpBoxes[idx]; + ArrayRemove( + tmpBoxes, + idx, + 1 // + ); + + // + has = IsBoxInside( + box, + iBox // + ); + if (has) + { + // + holderBox = iBox; + holderBox.to = TimeCurrent(); + iBox.Clean(); + break; + } + + // + iBox.Clean(); + } + } + + // + Clean(tmpBoxes); + + // + // Validate Conditions to Force Has Holder Box ... + result = + result && + holderBox.IsValid(); + if (!result) + { + // + isBullish = false; + isBearish = false; + } + } + + // + // Check All Conditions ... + result = + box.IsValid() && + HasDirection(dir) && + (isBullish || + isBearish); + + // + // Cleanup Resources ... + zBar.Clean(); + cBar.Clean(); + pBar.Clean(); + cState.Clean(); + chState.Clean(); + ZeroMemory(cHelper); + cConditions.Clean(); + cXConditions.Clean(); + ZeroMemory(chHelper); + chConditions.Clean(); + chXConditions.Clean(); + + // + return result; + } + + // +}; diff --git a/Libraries/x-saherelm.xohcl.lib.mq5 b/Documents/BKP/x-saherelm.xohcl.lib.mq5 similarity index 100% rename from Libraries/x-saherelm.xohcl.lib.mq5 rename to Documents/BKP/x-saherelm.xohcl.lib.mq5 diff --git a/Experts/x-saherelm.xpoi.test.ea.mq5 b/Documents/BKP/x-saherelm.xpoi.test.ea.mq5 similarity index 100% rename from Experts/x-saherelm.xpoi.test.ea.mq5 rename to Documents/BKP/x-saherelm.xpoi.test.ea.mq5 diff --git a/Helpers/x-saherelm.x121.helper.mq5 b/Helpers/x-saherelm.x121.helper.mq5 index 167c0205..31b50d39 100644 --- a/Helpers/x-saherelm.x121.helper.mq5 +++ b/Helpers/x-saherelm.x121.helper.mq5 @@ -308,46 +308,6 @@ struct X121Conditions bool isClosedUnderAtrUpper; bool isClosedUnderAtrLower; - // - bool isRejectedUpAtrUpper; - bool isRejectedDownAtrUpper; - - // - bool isRejectedUpAtrLower; - bool isRejectedDownAtrLower; - - // - bool isBreakedUpAtrUpper; - bool isBreakedDownAtrUpper; - - // - bool isBreakedUpAtrLower; - bool isBreakedDownAtrLower; - - // - bool isRejectedDonOpenUpper; - bool isRejectedDonHighUpper; - bool isRejectedDonLowUpper; - bool isRejectedDonCloseUpper; - - // - bool isRejectedDonOpenLower; - bool isRejectedDonHighLower; - bool isRejectedDonLowLower; - bool isRejectedDonCloseLower; - - // - bool isBreakedDonOpenUpper; - bool isBreakedDonHighUpper; - bool isBreakedDonLowUpper; - bool isBreakedDonCloseUpper; - - // - bool isBreakedDonOpenLower; - bool isBreakedDonHighLower; - bool isBreakedDonLowLower; - bool isBreakedDonCloseLower; - // bool isSarBullish; bool isSarBearish; @@ -358,15 +318,11 @@ struct X121Conditions bool isNewPeak; bool isNewPeakOverLast; bool isNewPeakUnderLast; - bool isRejectedPrevPeak; - bool isBreakedUpPrevPeak; // bool isNewVale; bool isNewValeOverLast; bool isNewValeUnderLast; - bool isRejectedPrevVale; - bool isBreakedDownPrevVale; // bool isStrBullish; @@ -447,22 +403,12 @@ struct X121Conditions bool isRawHKBullish; bool isSMHKBearish; bool isRawHKBearish; - bool isBreakedUpSMHK; - bool isBreakedUpRawHK; - bool isRejectedUpSMHK; bool isClosedOverSMHK; - bool isRejectedUpRawHK; - bool isBreakedDownSMHK; bool isClosedUnderSMHK; bool isClosedOverRawHK; bool isClosedUnderRawHK; - bool isBreakedDownRawHK; - bool isRejectedDownSMHK; - bool isRejectedDownRawHK; - bool isRawHKBreakedUpSMHK; bool isRawHKClosedOverSMHK; bool isRawHKClosedUnderSMHK; - bool isRawHKBreakedDownSMHK; bool isSMHKSwitchedToBullish; bool isSMHKSwitchedToBearish; bool isRawHKSwitchedToBearish; @@ -487,18 +433,12 @@ struct X121Conditions bool isSarEqualsToVale; bool isStrEqualsToPeak; bool isStrEqualsToVale; - bool isX3MaMinBreakedUp; - bool isX3MaMaxBreakedUp; bool isX3MaFatsUnderMid; bool isX3MaFatsOverSlow; bool isAtrUpperOverPeak; bool isPeakOverAtrUpper; bool isStrUpperOverPeak; bool isStrLowerOverVale; - bool isBreakedUpPrevSar; - bool isBreakedUpPrevStr; - bool isVWapMinBreakedUp; - bool isVWapMaxBreakedUp; bool isClosedOverCheMin; bool isClosedOverCheMax; bool isX3MaFatsUnderSlow; @@ -512,28 +452,16 @@ struct X121Conditions bool isClosedUnderCheMax; bool isClosedOverVWapMin; bool isClosedOverVWapMax; - bool isX3MaMinBreakedDown; - bool isX3MaMaxBreakedDown; bool isClosedUnderX3MaMin; bool isClosedUnderX3MaMax; - bool isBreakedDownPrevSar; - bool isBreakedDownPrevStr; bool isStrCrossedOverVale; bool isSarCrossedOverVale; bool isClosedUnderVWapMin; bool isClosedUnderVWapMax; - bool isVWapMinBreakedDown; - bool isVWapMaxBreakedDown; bool isX3MaFatsOverMidPrev; bool isSarCrossedUnderPeak; bool isStrCrossedUnderPeak; bool isNewPeakOverAtrUpper; - bool isBreakedUpPrevCheMin; - bool isBreakedUpPrevCheMax; - bool isBreakedUpPrevCheLE1; - bool isBreakedUpPrevCheLE2; - bool isBreakedUpPrevCheSE1; - bool isBreakedUpPrevCheSE2; bool isX3MaFatsUnderMidPrev; bool isX3MaFatsOverSlowPrev; bool isAtrUpperEqualsToPeak; @@ -546,17 +474,7 @@ struct X121Conditions bool isStrUpperUnderAtrUpper; bool isStrLowerUnderAtrLower; bool isX3MaFatsUnderSlowPrev; - bool isBreakedUpPrevAtrUpper; - bool isBreakedUpPrevAtrLower; - bool isBreakedDownPrevCheMin; - bool isBreakedDownPrevCheMax; - bool isBreakedDownPrevCheLE1; - bool isBreakedDownPrevCheLE2; - bool isBreakedDownPrevCheSE1; - bool isBreakedDownPrevCheSE2; bool isX3MaFastCrossedOverMid; - bool isRejectedUpPrevAtrUpper; - bool isRejectedUpPrevAtrLower; bool isVWapFastCrossedOverMid; bool isX3MaFastCrossedUnderMid; bool isX3MaFastCrossedOverSlow; @@ -564,8 +482,6 @@ struct X121Conditions bool isAtrLowerCrossedDownVale; bool isStrLowerOverDonLowLower; bool isVWapFastCrossedUnderMid; - bool isBreakedDownPrevAtrUpper; - bool isBreakedDownPrevAtrLower; bool isStrUpperCrossedOverPeak; bool isStrLowerCrossedOverVale; bool isDonLowLowerEqualsToVale; @@ -577,8 +493,6 @@ struct X121Conditions bool isStrUpperCrossedUnderPeak; bool isStrLowerCrossedUnderVale; bool isDonHighUpperEqualsToPeak; - bool isRejectedDownPrevAtrUpper; - bool isRejectedDownPrevAtrLower; bool isStrUpperUnderDonHighUpper; bool isStrUpperCrossedOverAtrUpper; bool isStrLowerCrossedOverAtrLower; @@ -833,40 +747,14 @@ struct X121Conditions // ATR ... // - isBreakedUpAtrUpper = false; - isBreakedUpAtrLower = false; isClosedOverAtrUpper = false; isClosedOverAtrLower = false; - isRejectedUpAtrUpper = false; - isRejectedUpAtrLower = false; isClosedUnderAtrUpper = false; isClosedUnderAtrLower = false; - isBreakedDownAtrUpper = false; - isBreakedDownAtrLower = false; - isRejectedDownAtrUpper = false; - isRejectedDownAtrLower = false; // // DON ... - // - isRejectedDonOpenUpper = false; - isRejectedDonHighUpper = false; - isRejectedDonLowUpper = false; - isRejectedDonCloseUpper = false; - isRejectedDonOpenLower = false; - isRejectedDonHighLower = false; - isRejectedDonLowLower = false; - isRejectedDonCloseLower = false; - isBreakedDonOpenUpper = false; - isBreakedDonHighUpper = false; - isBreakedDonLowUpper = false; - isBreakedDonCloseUpper = false; - isBreakedDonOpenLower = false; - isBreakedDonHighLower = false; - isBreakedDonLowLower = false; - isBreakedDonCloseLower = false; - // // SAR ... @@ -883,15 +771,11 @@ struct X121Conditions isNewPeak = false; isNewPeakOverLast = false; isNewPeakUnderLast = false; - isRejectedPrevPeak = false; - isBreakedUpPrevPeak = false; // isNewVale = false; isNewValeOverLast = false; isNewValeUnderLast = false; - isRejectedPrevVale = false; - isBreakedDownPrevVale = false; // // STR ... @@ -981,24 +865,14 @@ struct X121Conditions isRawHKBullish = false; isSMHKBearish = false; isRawHKBearish = false; - isBreakedUpSMHK = false; - isBreakedUpRawHK = false; - isRejectedUpSMHK = false; isClosedOverSMHK = false; - isRejectedUpRawHK = false; - isBreakedDownSMHK = false; isClosedUnderSMHK = false; isClosedOverRawHK = false; isClosedUnderRawHK = false; - isBreakedDownRawHK = false; - isRejectedDownSMHK = false; - isRejectedDownRawHK = false; - isRawHKBreakedUpSMHK = false; isRawHKClosedOverSMHK = false; isSMHKSwitchedToBearish = false; isRawHKSwitchedToBearish = false; isRawHKClosedUnderSMHK = false; - isRawHKBreakedDownSMHK = false; isSMHKSwitchedToBullish = false; isRawHKSwitchedToBullish = false; @@ -1013,18 +887,12 @@ struct X121Conditions isSarEqualsToVale = false; isStrEqualsToPeak = false; isStrEqualsToVale = false; - isX3MaMinBreakedUp = false; - isX3MaMaxBreakedUp = false; isX3MaFatsUnderMid = false; isX3MaFatsOverSlow = false; isAtrUpperOverPeak = false; isPeakOverAtrUpper = false; isStrUpperOverPeak = false; isStrLowerOverVale = false; - isBreakedUpPrevSar = false; - isBreakedUpPrevStr = false; - isVWapMinBreakedUp = false; - isVWapMaxBreakedUp = false; isClosedOverCheMin = false; isClosedOverCheMax = false; isX3MaFatsUnderSlow = false; @@ -1038,28 +906,16 @@ struct X121Conditions isClosedUnderCheMax = false; isClosedOverVWapMin = false; isClosedOverVWapMax = false; - isX3MaMinBreakedDown = false; - isX3MaMaxBreakedDown = false; isClosedUnderX3MaMin = false; isClosedUnderX3MaMax = false; - isBreakedDownPrevSar = false; - isBreakedDownPrevStr = false; isStrCrossedOverVale = false; isSarCrossedOverVale = false; isClosedUnderVWapMin = false; isClosedUnderVWapMax = false; - isVWapMinBreakedDown = false; - isVWapMaxBreakedDown = false; isX3MaFatsOverMidPrev = false; isSarCrossedUnderPeak = false; isStrCrossedUnderPeak = false; isNewPeakOverAtrUpper = false; - isBreakedUpPrevCheMin = false; - isBreakedUpPrevCheMax = false; - isBreakedUpPrevCheLE1 = false; - isBreakedUpPrevCheLE2 = false; - isBreakedUpPrevCheSE1 = false; - isBreakedUpPrevCheSE2 = false; isX3MaFatsUnderMidPrev = false; isX3MaFatsOverSlowPrev = false; isAtrUpperEqualsToPeak = false; @@ -1072,17 +928,7 @@ struct X121Conditions isStrUpperUnderAtrUpper = false; isStrLowerUnderAtrLower = false; isX3MaFatsUnderSlowPrev = false; - isBreakedUpPrevAtrUpper = false; - isBreakedUpPrevAtrLower = false; - isBreakedDownPrevCheMin = false; - isBreakedDownPrevCheMax = false; - isBreakedDownPrevCheLE1 = false; - isBreakedDownPrevCheLE2 = false; - isBreakedDownPrevCheSE1 = false; - isBreakedDownPrevCheSE2 = false; isX3MaFastCrossedOverMid = false; - isRejectedUpPrevAtrUpper = false; - isRejectedUpPrevAtrLower = false; isVWapFastCrossedOverMid = false; isX3MaFastCrossedUnderMid = false; isX3MaFastCrossedOverSlow = false; @@ -1090,8 +936,6 @@ struct X121Conditions isAtrLowerCrossedDownVale = false; isStrLowerOverDonLowLower = false; isVWapFastCrossedUnderMid = false; - isBreakedDownPrevAtrUpper = false; - isBreakedDownPrevAtrLower = false; isStrUpperCrossedOverPeak = false; isStrLowerCrossedOverVale = false; isDonLowLowerEqualsToVale = false; @@ -1103,8 +947,6 @@ struct X121Conditions isStrUpperCrossedUnderPeak = false; isStrLowerCrossedUnderVale = false; isDonHighUpperEqualsToPeak = false; - isRejectedDownPrevAtrUpper = false; - isRejectedDownPrevAtrLower = false; isStrUpperUnderDonHighUpper = false; isStrUpperCrossedOverAtrUpper = false; isStrLowerCrossedOverAtrLower = false; @@ -1598,10 +1440,6 @@ struct X121Conditions { bullishScore += minScore; } - if (isBreakedUpPrevSar) - { - bullishScore += minScore; - } if (isSarCrossedOverVale) { bullishScore += score; @@ -1640,22 +1478,6 @@ struct X121Conditions { bullishScore += score; } - if (isBreakedUpPrevAtrLower) - { - bullishScore += minScore; - } - if (isBreakedUpPrevAtrUpper) - { - bullishScore += minScore; - } - if (isRejectedUpPrevAtrUpper) - { - bullishScore += minScore; - } - if (isRejectedUpPrevAtrLower) - { - bullishScore += minScore; - } if (isStrLowerCrossedOverAtrLower) { bullishScore += score; @@ -1666,10 +1488,6 @@ struct X121Conditions } // - if (isBreakedUpPrevStr) - { - bullishScore += minScore; - } if (isStrEqualsToVale) { bullishScore += minScore; @@ -1708,14 +1526,6 @@ struct X121Conditions } // - if (isVWapMinBreakedUp) - { - bullishScore += minScore; - } - if (isVWapMaxBreakedUp) - { - bullishScore += minScore; - } if (isClosedOverVWapMin) { bullishScore += minScore; @@ -1734,14 +1544,6 @@ struct X121Conditions } // - if (isX3MaMinBreakedUp) - { - bullishScore += minScore; - } - if (isX3MaMaxBreakedUp) - { - bullishScore += minScore; - } if (isClosedOverX3MaMin) { bullishScore += minScore; @@ -1768,30 +1570,6 @@ struct X121Conditions { bullishScore += minScore; } - if (isBreakedUpPrevCheMin) - { - bullishScore += minScore; - } - if (isBreakedUpPrevCheMax) - { - bullishScore += minScore; - } - if (isBreakedUpPrevCheLE1) - { - bullishScore += minScore; - } - if (isBreakedUpPrevCheLE2) - { - bullishScore += minScore; - } - if (isBreakedUpPrevCheSE1) - { - bullishScore += minScore; - } - if (isBreakedUpPrevCheSE2) - { - bullishScore += minScore; - } if (isDonLowLowerEqualsToVale) { bullishScore += minScore; @@ -1810,10 +1588,6 @@ struct X121Conditions { bearishScore += minScore; } - if (isBreakedDownPrevSar) - { - bearishScore += minScore; - } if (isSarCrossedUnderPeak) { bearishScore += score; @@ -1852,22 +1626,6 @@ struct X121Conditions { bearishScore += score; } - if (isBreakedDownPrevAtrUpper) - { - bearishScore += minScore; - } - if (isBreakedDownPrevAtrLower) - { - bearishScore += minScore; - } - if (isRejectedDownPrevAtrUpper) - { - bearishScore += minScore; - } - if (isRejectedDownPrevAtrLower) - { - bearishScore += minScore; - } if (isStrLowerCrossedUnderAtrLower) { bearishScore += score; @@ -1890,10 +1648,6 @@ struct X121Conditions { bearishScore += minScore; } - if (isBreakedDownPrevStr) - { - bearishScore += minScore; - } if (isStrCrossedUnderPeak) { bearishScore += score; @@ -1936,14 +1690,6 @@ struct X121Conditions { bearishScore += minScore; } - if (isVWapMinBreakedDown) - { - bearishScore += minScore; - } - if (isVWapMaxBreakedDown) - { - bearishScore += minScore; - } if (isVWapFastCrossedUnderMid) { bearishScore += score; @@ -1954,14 +1700,6 @@ struct X121Conditions } // - if (isX3MaMinBreakedDown) - { - bearishScore += minScore; - } - if (isX3MaMaxBreakedDown) - { - bearishScore += minScore; - } if (isClosedUnderX3MaMin) { bearishScore += minScore; @@ -1988,30 +1726,6 @@ struct X121Conditions { bearishScore += minScore; } - if (isBreakedDownPrevCheMin) - { - bearishScore += minScore; - } - if (isBreakedDownPrevCheMax) - { - bearishScore += minScore; - } - if (isBreakedDownPrevCheLE1) - { - bearishScore += minScore; - } - if (isBreakedDownPrevCheLE2) - { - bearishScore += minScore; - } - if (isBreakedDownPrevCheSE1) - { - bearishScore += minScore; - } - if (isBreakedDownPrevCheSE2) - { - bearishScore += minScore; - } if (isDonHighUpperEqualsToPeak) { bearishScore += minScore; @@ -2103,13 +1817,9 @@ struct X121Conditions ToString("isNewPeak", isNewPeak, ignoreFalseConditions, separator) + ToString("isNewPeakOverLast", isNewPeakOverLast, ignoreFalseConditions, separator) + ToString("isNewPeakUnderLast", isNewPeakUnderLast, ignoreFalseConditions, separator) + - ToString("isRejectedPrevPeak", isRejectedPrevPeak, ignoreFalseConditions, separator) + - ToString("isBreakedUpPrevPeak", isBreakedUpPrevPeak, ignoreFalseConditions, separator) + ToString("isNewVale", isNewVale, ignoreFalseConditions, separator) + ToString("isNewValeOverLast", isNewValeOverLast, ignoreFalseConditions, separator) + ToString("isNewValeUnderLast", isNewValeUnderLast, ignoreFalseConditions, separator) + - ToString("isRejectedPrevVale", isRejectedPrevVale, ignoreFalseConditions, separator) + - ToString("isBreakedDownPrevVale", isBreakedDownPrevVale, ignoreFalseConditions, separator) + // "-----------------------" + separator + "> RSI ..." + separator + @@ -2128,34 +1838,10 @@ struct X121Conditions ToString("isClosedOverAtrLower", isClosedOverAtrLower, ignoreFalseConditions, separator) + ToString("isClosedUnderAtrUpper", isClosedUnderAtrUpper, ignoreFalseConditions, separator) + ToString("isClosedUnderAtrLower", isClosedUnderAtrLower, ignoreFalseConditions, separator) + - ToString("isRejectedUpAtrUpper", isRejectedUpAtrUpper, ignoreFalseConditions, separator) + - ToString("isRejectedDownAtrUpper", isRejectedDownAtrUpper, ignoreFalseConditions, separator) + - ToString("isRejectedUpAtrLower", isRejectedUpAtrLower, ignoreFalseConditions, separator) + - ToString("isRejectedDownAtrLower", isRejectedDownAtrLower, ignoreFalseConditions, separator) + - ToString("isBreakedUpAtrUpper", isBreakedUpAtrUpper, ignoreFalseConditions, separator) + - ToString("isBreakedDownAtrUpper", isBreakedDownAtrUpper, ignoreFalseConditions, separator) + - ToString("isBreakedUpAtrLower", isBreakedUpAtrLower, ignoreFalseConditions, separator) + // "-----------------------" + separator + "DON ..." + separator + "-----------------------" + separator + - ToString("isBreakedDownAtrLower", isBreakedDownAtrLower, ignoreFalseConditions, separator) + - ToString("isRejectedDonOpenUpper", isRejectedDonOpenUpper, ignoreFalseConditions, separator) + - ToString("isRejectedDonHighUpper", isRejectedDonHighUpper, ignoreFalseConditions, separator) + - ToString("isRejectedDonLowUpper", isRejectedDonLowUpper, ignoreFalseConditions, separator) + - ToString("isRejectedDonCloseUpper", isRejectedDonCloseUpper, ignoreFalseConditions, separator) + - ToString("isRejectedDonOpenLower", isRejectedDonOpenLower, ignoreFalseConditions, separator) + - ToString("isRejectedDonHighLower", isRejectedDonHighLower, ignoreFalseConditions, separator) + - ToString("isRejectedDonLowLower", isRejectedDonLowLower, ignoreFalseConditions, separator) + - ToString("isRejectedDonCloseLower", isRejectedDonCloseLower, ignoreFalseConditions, separator) + - ToString("isBreakedDonOpenUpper", isBreakedDonOpenUpper, ignoreFalseConditions, separator) + - ToString("isBreakedDonHighUpper", isBreakedDonHighUpper, ignoreFalseConditions, separator) + - ToString("isBreakedDonLowUpper", isBreakedDonLowUpper, ignoreFalseConditions, separator) + - ToString("isBreakedDonCloseUpper", isBreakedDonCloseUpper, ignoreFalseConditions, separator) + - ToString("isBreakedDonOpenLower", isBreakedDonOpenLower, ignoreFalseConditions, separator) + - ToString("isBreakedDonHighLower", isBreakedDonHighLower, ignoreFalseConditions, separator) + - ToString("isBreakedDonLowLower", isBreakedDonLowLower, ignoreFalseConditions, separator) + - ToString("isBreakedDonCloseLower", isBreakedDonCloseLower, ignoreFalseConditions, separator) + // "-----------------------" + separator + "VWAP ..." + separator + @@ -2238,24 +1924,14 @@ struct X121Conditions ToString("isRawHKBullish", isRawHKBullish, ignoreFalseConditions, separator) + ToString("isSMHKBearish", isSMHKBearish, ignoreFalseConditions, separator) + ToString("isRawHKBearish", isRawHKBearish, ignoreFalseConditions, separator) + - ToString("isBreakedUpSMHK", isBreakedUpSMHK, ignoreFalseConditions, separator) + - ToString("isBreakedUpRawHK", isBreakedUpRawHK, ignoreFalseConditions, separator) + - ToString("isRejectedUpSMHK", isRejectedUpSMHK, ignoreFalseConditions, separator) + ToString("isClosedOverSMHK", isClosedOverSMHK, ignoreFalseConditions, separator) + - ToString("isRejectedUpRawHK", isRejectedUpRawHK, ignoreFalseConditions, separator) + - ToString("isBreakedDownSMHK", isBreakedDownSMHK, ignoreFalseConditions, separator) + ToString("isClosedUnderSMHK", isClosedUnderSMHK, ignoreFalseConditions, separator) + ToString("isClosedOverRawHK", isClosedOverRawHK, ignoreFalseConditions, separator) + ToString("isClosedUnderRawHK", isClosedUnderRawHK, ignoreFalseConditions, separator) + - ToString("isBreakedDownRawHK", isBreakedDownRawHK, ignoreFalseConditions, separator) + - ToString("isRejectedDownSMHK", isRejectedDownSMHK, ignoreFalseConditions, separator) + - ToString("isRejectedDownRawHK", isRejectedDownRawHK, ignoreFalseConditions, separator) + - ToString("isRawHKBreakedUpSMHK", isRawHKBreakedUpSMHK, ignoreFalseConditions, separator) + ToString("isRawHKClosedOverSMHK", isRawHKClosedOverSMHK, ignoreFalseConditions, separator) + ToString("isSMHKSwitchedToBearish", isSMHKSwitchedToBearish, ignoreFalseConditions, separator) + ToString("isRawHKSwitchedToBearish", isRawHKSwitchedToBearish, ignoreFalseConditions, separator) + ToString("isRawHKClosedUnderSMHK", isRawHKClosedUnderSMHK, ignoreFalseConditions, separator) + - ToString("isRawHKBreakedDownSMHK", isRawHKBreakedDownSMHK, ignoreFalseConditions, separator) + ToString("isSMHKSwitchedToBullish", isSMHKSwitchedToBullish, ignoreFalseConditions, separator) + ToString("isRawHKSwitchedToBullish", isRawHKSwitchedToBullish, ignoreFalseConditions, separator) + // @@ -2287,10 +1963,6 @@ struct X121Conditions ToString("isStrEqualsToPeak", isStrEqualsToPeak, ignoreFalseConditions, separator) + ToString("isStrEqualsToVale", isStrEqualsToVale, ignoreFalseConditions, separator) + ToString("isPeakOverAtrUpper", isPeakOverAtrUpper, ignoreFalseConditions, separator) + - ToString("isBreakedUpPrevSar", isBreakedUpPrevSar, ignoreFalseConditions, separator) + - ToString("isBreakedUpPrevStr", isBreakedUpPrevStr, ignoreFalseConditions, separator) + - ToString("isVWapMinBreakedUp", isVWapMinBreakedUp, ignoreFalseConditions, separator) + - ToString("isVWapMaxBreakedUp", isVWapMaxBreakedUp, ignoreFalseConditions, separator) + ToString("isStrUpperOverPeak", isStrUpperOverPeak, ignoreFalseConditions, separator) + ToString("isStrLowerOverVale", isStrLowerOverVale, ignoreFalseConditions, separator) + ToString("isAtrUpperOverPeak", isAtrUpperOverPeak, ignoreFalseConditions, separator) + @@ -2300,55 +1972,31 @@ struct X121Conditions ToString("isStrUpperUnderPeak", isStrUpperUnderPeak, ignoreFalseConditions, separator) + ToString("isValeUnderAtrLower", isValeUnderAtrLower, ignoreFalseConditions, separator) + ToString("isStrLowerUnderVale", isStrLowerUnderVale, ignoreFalseConditions, separator) + - ToString("isVWapMinBreakedDown", isVWapMinBreakedDown, ignoreFalseConditions, separator) + - ToString("isVWapMaxBreakedDown", isVWapMaxBreakedDown, ignoreFalseConditions, separator) + ToString("isClosedUnderVWapMin", isClosedUnderVWapMin, ignoreFalseConditions, separator) + ToString("isClosedUnderVWapMax", isClosedUnderVWapMax, ignoreFalseConditions, separator) + - ToString("isBreakedDownPrevSar", isBreakedDownPrevSar, ignoreFalseConditions, separator) + - ToString("isBreakedDownPrevStr", isBreakedDownPrevStr, ignoreFalseConditions, separator) + ToString("isSarCrossedOverVale", isSarCrossedOverVale, ignoreFalseConditions, separator) + ToString("isStrCrossedOverVale", isStrCrossedOverVale, ignoreFalseConditions, separator) + - ToString("isBreakedUpPrevCheLE1", isBreakedUpPrevCheLE1, ignoreFalseConditions, separator) + - ToString("isBreakedUpPrevCheLE2", isBreakedUpPrevCheLE2, ignoreFalseConditions, separator) + - ToString("isBreakedUpPrevCheSE1", isBreakedUpPrevCheSE1, ignoreFalseConditions, separator) + - ToString("isBreakedUpPrevCheSE2", isBreakedUpPrevCheSE2, ignoreFalseConditions, separator) + ToString("isSarCrossedUnderPeak", isSarCrossedUnderPeak, ignoreFalseConditions, separator) + ToString("isStrCrossedUnderPeak", isStrCrossedUnderPeak, ignoreFalseConditions, separator) + ToString("isNewPeakOverAtrUpper", isNewPeakOverAtrUpper, ignoreFalseConditions, separator) + - ToString("isBreakedUpPrevCheMin", isBreakedUpPrevCheMin, ignoreFalseConditions, separator) + - ToString("isBreakedUpPrevCheMax", isBreakedUpPrevCheMax, ignoreFalseConditions, separator) + ToString("isNewValeUnderAtrLower", isNewValeUnderAtrLower, ignoreFalseConditions, separator) + ToString("isStrUpperOverAtrUpper", isStrUpperOverAtrUpper, ignoreFalseConditions, separator) + ToString("isStrLowerOverAtrLower", isStrLowerOverAtrLower, ignoreFalseConditions, separator) + ToString("isAtrUpperEqualsToPeak", isAtrUpperEqualsToPeak, ignoreFalseConditions, separator) + ToString("isAtrLowerEqualsToVale", isAtrLowerEqualsToVale, ignoreFalseConditions, separator) + - ToString("isBreakedDownPrevCheMin", isBreakedDownPrevCheMin, ignoreFalseConditions, separator) + - ToString("isBreakedDownPrevCheMax", isBreakedDownPrevCheMax, ignoreFalseConditions, separator) + - ToString("isBreakedDownPrevCheLE1", isBreakedDownPrevCheLE1, ignoreFalseConditions, separator) + - ToString("isBreakedDownPrevCheLE2", isBreakedDownPrevCheLE2, ignoreFalseConditions, separator) + - ToString("isBreakedDownPrevCheSE1", isBreakedDownPrevCheSE1, ignoreFalseConditions, separator) + - ToString("isBreakedDownPrevCheSE2", isBreakedDownPrevCheSE2, ignoreFalseConditions, separator) + ToString("isAtrUpperCrossedUpPeak", isAtrUpperCrossedUpPeak, ignoreFalseConditions, separator) + ToString("isAtrLowerCrossedUpVale", isAtrLowerCrossedUpVale, ignoreFalseConditions, separator) + ToString("isStrUpperUnderAtrUpper", isStrUpperUnderAtrUpper, ignoreFalseConditions, separator) + ToString("isStrLowerUnderAtrLower", isStrLowerUnderAtrLower, ignoreFalseConditions, separator) + - ToString("isBreakedUpPrevAtrUpper", isBreakedUpPrevAtrUpper, ignoreFalseConditions, separator) + - ToString("isBreakedUpPrevAtrLower", isBreakedUpPrevAtrLower, ignoreFalseConditions, separator) + ToString("isVWapFastCrossedOverMid", isVWapFastCrossedOverMid, ignoreFalseConditions, separator) + - ToString("isRejectedUpPrevAtrUpper", isRejectedUpPrevAtrUpper, ignoreFalseConditions, separator) + - ToString("isRejectedUpPrevAtrLower", isRejectedUpPrevAtrLower, ignoreFalseConditions, separator) + ToString("isAtrUpperCrossedDownPeak", isAtrUpperCrossedDownPeak, ignoreFalseConditions, separator) + ToString("isAtrLowerCrossedDownVale", isAtrLowerCrossedDownVale, ignoreFalseConditions, separator) + - ToString("isBreakedDownPrevAtrUpper", isBreakedDownPrevAtrUpper, ignoreFalseConditions, separator) + - ToString("isBreakedDownPrevAtrLower", isBreakedDownPrevAtrLower, ignoreFalseConditions, separator) + ToString("isVWapFastCrossedUnderMid", isVWapFastCrossedUnderMid, ignoreFalseConditions, separator) + ToString("isVWapFastCrossedOverSlow", isVWapFastCrossedOverSlow, ignoreFalseConditions, separator) + ToString("isStrUpperCrossedOverPeak", isStrUpperCrossedOverPeak, ignoreFalseConditions, separator) + ToString("isStrLowerOverDonLowLower", isStrLowerOverDonLowLower, ignoreFalseConditions, separator) + ToString("isStrLowerCrossedOverVale", isStrLowerCrossedOverVale, ignoreFalseConditions, separator) + ToString("isDonLowLowerEqualsToVale", isDonLowLowerEqualsToVale, ignoreFalseConditions, separator) + - ToString("isRejectedDownPrevAtrUpper", isRejectedDownPrevAtrUpper, ignoreFalseConditions, separator) + - ToString("isRejectedDownPrevAtrLower", isRejectedDownPrevAtrLower, ignoreFalseConditions, separator) + ToString("isVWapFastCrossedUnderSlow", isVWapFastCrossedUnderSlow, ignoreFalseConditions, separator) + ToString("isStrUpperCrossedUnderPeak", isStrUpperCrossedUnderPeak, ignoreFalseConditions, separator) + ToString("isStrLowerCrossedUnderVale", isStrLowerCrossedUnderVale, ignoreFalseConditions, separator) + @@ -3249,10 +2897,6 @@ class XCX121Helper : public XCBase conditions.isNewValeOverLast = xpvConditions.isNewValeOverLast; conditions.isNewPeakUnderLast = xpvConditions.isNewPeakUnderLast; conditions.isNewValeUnderLast = xpvConditions.isNewValeUnderLast; - conditions.isRejectedPrevVale = xpvConditions.isRejectedPrevVale; - conditions.isRejectedPrevPeak = xpvConditions.isRejectedPrevPeak; - conditions.isBreakedUpPrevPeak = xpvConditions.isBreakedUpPrevPeak; - conditions.isBreakedDownPrevVale = xpvConditions.isBreakedDownPrevVale; conditions.isSarSwitchedToBullish = xpvConditions.isSarSwitchedToBullish; conditions.isSarSwitchedToBearish = xpvConditions.isSarSwitchedToBearish; @@ -3316,24 +2960,14 @@ class XCX121Helper : public XCBase conditions.isRawHKBullish = xhkConditions.isRawHKBullish; conditions.isSMHKBearish = xhkConditions.isSMHKBearish; conditions.isRawHKBearish = xhkConditions.isRawHKBearish; - conditions.isBreakedUpSMHK = xhkConditions.isBreakedUpSMHK; - conditions.isBreakedUpRawHK = xhkConditions.isBreakedUpRawHK; - conditions.isRejectedUpSMHK = xhkConditions.isRejectedUpSMHK; conditions.isClosedOverSMHK = xhkConditions.isClosedOverSMHK; - conditions.isRejectedUpRawHK = xhkConditions.isRejectedUpRawHK; - conditions.isBreakedDownSMHK = xhkConditions.isBreakedDownSMHK; conditions.isClosedUnderSMHK = xhkConditions.isClosedUnderSMHK; conditions.isClosedOverRawHK = xhkConditions.isClosedOverRawHK; conditions.isClosedUnderRawHK = xhkConditions.isClosedUnderRawHK; - conditions.isBreakedDownRawHK = xhkConditions.isBreakedDownRawHK; - conditions.isRejectedDownSMHK = xhkConditions.isRejectedDownSMHK; - conditions.isRejectedDownRawHK = xhkConditions.isRejectedDownRawHK; - conditions.isRawHKBreakedUpSMHK = xhkConditions.isRawHKBreakedUpSMHK; conditions.isRawHKClosedOverSMHK = xhkConditions.isRawHKClosedOverSMHK; conditions.isSMHKSwitchedToBearish = xhkConditions.isSMHKSwitchedToBearish; conditions.isRawHKSwitchedToBearish = xhkConditions.isRawHKSwitchedToBearish; conditions.isRawHKClosedUnderSMHK = xhkConditions.isRawHKClosedUnderSMHK; - conditions.isRawHKBreakedDownSMHK = xhkConditions.isRawHKBreakedDownSMHK; conditions.isSMHKSwitchedToBullish = xhkConditions.isSMHKSwitchedToBullish; conditions.isRawHKSwitchedToBullish = xhkConditions.isRawHKSwitchedToBullish; @@ -3409,18 +3043,10 @@ class XCX121Helper : public XCBase // conditions.isRsiOverSold = xatrConditions.isRsiOverSold; conditions.isRsiOverBought = xatrConditions.isRsiOverBought; - conditions.isBreakedUpAtrUpper = xatrConditions.isBreakedUpAtrUpper; - conditions.isBreakedUpAtrLower = xatrConditions.isBreakedUpAtrLower; conditions.isClosedOverAtrUpper = xatrConditions.isClosedOverAtrUpper; - conditions.isRejectedUpAtrUpper = xatrConditions.isRejectedUpAtrUpper; - conditions.isRejectedUpAtrLower = xatrConditions.isRejectedUpAtrLower; conditions.isClosedOverAtrLower = xatrConditions.isClosedOverAtrLower; - conditions.isBreakedDownAtrUpper = xatrConditions.isBreakedDownAtrUpper; - conditions.isBreakedDownAtrLower = xatrConditions.isBreakedDownAtrLower; conditions.isClosedUnderAtrUpper = xatrConditions.isClosedUnderAtrUpper; conditions.isClosedUnderAtrLower = xatrConditions.isClosedUnderAtrLower; - conditions.isRejectedDownAtrUpper = xatrConditions.isRejectedDownAtrUpper; - conditions.isRejectedDownAtrLower = xatrConditions.isRejectedDownAtrLower; conditions.isRsiCrossedOverOverSold = xatrConditions.isRsiCrossedOverOverSold; conditions.isRsiCrossedUnderOverSold = xatrConditions.isRsiCrossedUnderOverSold; conditions.isRsiCrossedOverOverBought = xatrConditions.isRsiCrossedOverOverBought; @@ -3602,24 +3228,6 @@ class XCX121Helper : public XCBase // // Conditions ... - // - conditions.isBreakedDonLowUpper = xdonConditions.isBreakedDonLowUpper; - conditions.isBreakedDonLowLower = xdonConditions.isBreakedDonLowLower; - conditions.isRejectedDonLowUpper = xdonConditions.isRejectedDonLowUpper; - conditions.isRejectedDonLowLower = xdonConditions.isRejectedDonLowLower; - conditions.isBreakedDonOpenUpper = xdonConditions.isBreakedDonOpenUpper; - conditions.isBreakedDonHighUpper = xdonConditions.isBreakedDonHighUpper; - conditions.isBreakedDonOpenLower = xdonConditions.isBreakedDonOpenLower; - conditions.isBreakedDonHighLower = xdonConditions.isBreakedDonHighLower; - conditions.isRejectedDonOpenUpper = xdonConditions.isRejectedDonOpenUpper; - conditions.isRejectedDonHighUpper = xdonConditions.isRejectedDonHighUpper; - conditions.isRejectedDonOpenLower = xdonConditions.isRejectedDonOpenLower; - conditions.isRejectedDonHighLower = xdonConditions.isRejectedDonHighLower; - conditions.isBreakedDonCloseUpper = xdonConditions.isBreakedDonCloseUpper; - conditions.isBreakedDonCloseLower = xdonConditions.isBreakedDonCloseLower; - conditions.isRejectedDonCloseUpper = xdonConditions.isRejectedDonCloseUpper; - conditions.isRejectedDonCloseLower = xdonConditions.isRejectedDonCloseLower; - // // X3MA ... @@ -3844,30 +3452,6 @@ class XCX121Helper : public XCBase double x3maMin = GetMin(x3mas); double x3maMax = GetMax(x3mas); - // - bool isX3MaMinBreakedUp = IsBarBreak( - x3maMin, - X_DIRECTION_BULLISH, - cBar // - ); - bool isX3MaMinBreakedDown = IsBarBreak( - x3maMin, - X_DIRECTION_BEARISH, - cBar // - ); - - // - bool isX3MaMaxBreakedUp = IsBarBreak( - x3maMax, - X_DIRECTION_BULLISH, - cBar // - ); - bool isX3MaMaxBreakedDown = IsBarBreak( - x3maMax, - X_DIRECTION_BEARISH, - cBar // - ); - // bool isX3MaFatsOverMid = conditions.x3maFastBuffer[cIDX] > conditions.x3maMidBuffer[cIDX]; bool isX3MaFatsOverMidPrev = conditions.x3maFastBuffer[pIDX] > conditions.x3maMidBuffer[pIDX]; @@ -3924,30 +3508,6 @@ class XCX121Helper : public XCBase double vwapMin = GetMin(vwaps); double vwapMax = GetMax(vwaps); - // - bool isVWapMinBreakedUp = IsBarBreak( - vwapMin, - X_DIRECTION_BULLISH, - cBar // - ); - bool isVWapMinBreakedDown = IsBarBreak( - vwapMin, - X_DIRECTION_BEARISH, - cBar // - ); - - // - bool isVWapMaxBreakedUp = IsBarBreak( - vwapMax, - X_DIRECTION_BULLISH, - cBar // - ); - bool isVWapMaxBreakedDown = IsBarBreak( - vwapMax, - X_DIRECTION_BEARISH, - cBar // - ); - // bool isVWapFatsOverMid = conditions.vwapFastBuffer[cIDX] > conditions.vwapMidBuffer[cIDX]; bool isVWapFatsOverMidPrev = conditions.vwapFastBuffer[pIDX] > conditions.vwapMidBuffer[pIDX]; @@ -4043,149 +3603,6 @@ class XCX121Helper : public XCBase double cheMin = GetMin(ches); double cheMax = GetMax(ches); - // - bool isBreakedUpPrevSar = IsBarBreak( - prevSar, - X_DIRECTION_BULLISH, - cBar // - ); - bool isBreakedDownPrevSar = IsBarBreak( - prevSar, - X_DIRECTION_BEARISH, - cBar // - ); - - // - bool isBreakedUpPrevStr = IsBarBreak( - prevStr, - X_DIRECTION_BULLISH, - cBar // - ); - bool isBreakedDownPrevStr = IsBarBreak( - prevStr, - X_DIRECTION_BEARISH, - cBar // - ); - - // - bool isRejectedUpPrevAtrUpper = IsBarReject( - prevAtrUpper, - X_DIRECTION_BULLISH, - cBar // - ); - - // - bool isRejectedDownPrevAtrUpper = IsBarReject( - prevAtrUpper, - X_DIRECTION_BEARISH, - cBar // - ); - - // - bool isRejectedUpPrevAtrLower = IsBarReject( - prevAtrLower, - X_DIRECTION_BULLISH, - cBar // - ); - - // - bool isRejectedDownPrevAtrLower = IsBarReject( - prevAtrLower, - X_DIRECTION_BEARISH, - cBar // - ); - - // - bool isBreakedUpPrevAtrUpper = IsBarBreak( - prevAtrUpper, - X_DIRECTION_BULLISH, - cBar // - ); - bool isBreakedDownPrevAtrUpper = IsBarBreak( - prevAtrUpper, - X_DIRECTION_BEARISH, - cBar // - ); - - // - bool isBreakedUpPrevAtrLower = IsBarBreak( - prevAtrLower, - X_DIRECTION_BULLISH, - cBar // - ); - bool isBreakedDownPrevAtrLower = IsBarBreak( - prevAtrLower, - X_DIRECTION_BEARISH, - cBar // - ); - - // - bool isBreakedUpPrevCheLE1 = IsBarBreak( - prevCheLE1, - X_DIRECTION_BULLISH, - cBar // - ); - bool isBreakedUpPrevCheLE2 = IsBarBreak( - prevCheLE2, - X_DIRECTION_BULLISH, - cBar // - ); - bool isBreakedUpPrevCheSE1 = IsBarBreak( - prevCheSE1, - X_DIRECTION_BULLISH, - cBar // - ); - bool isBreakedUpPrevCheSE2 = IsBarBreak( - prevCheSE2, - X_DIRECTION_BULLISH, - cBar // - ); - - // - bool isBreakedDownPrevCheLE1 = IsBarBreak( - prevCheLE1, - X_DIRECTION_BEARISH, - cBar // - ); - bool isBreakedDownPrevCheLE2 = IsBarBreak( - prevCheLE2, - X_DIRECTION_BEARISH, - cBar // - ); - bool isBreakedDownPrevCheSE1 = IsBarBreak( - prevCheSE1, - X_DIRECTION_BEARISH, - cBar // - ); - bool isBreakedDownPrevCheSE2 = IsBarBreak( - prevCheSE2, - X_DIRECTION_BEARISH, - cBar // - ); - - // - bool isBreakedUpPrevCheMin = IsBarBreak( - cheMin, - X_DIRECTION_BULLISH, - cBar // - ); - bool isBreakedDownPrevCheMin = IsBarBreak( - cheMin, - X_DIRECTION_BEARISH, - cBar // - ); - - // - bool isBreakedUpPrevCheMax = IsBarBreak( - cheMax, - X_DIRECTION_BULLISH, - cBar // - ); - bool isBreakedDownPrevCheMax = IsBarBreak( - cheMax, - X_DIRECTION_BEARISH, - cBar // - ); // bool isSarCrossedUnderPeak = @@ -4365,17 +3782,11 @@ class XCX121Helper : public XCBase conditions.isStrEqualsToPeak = isStrEqualsToPeak; conditions.isStrEqualsToVale = isStrEqualsToVale; conditions.isX3MaFatsOverMid = isX3MaFatsOverMid; - conditions.isX3MaMinBreakedUp = isX3MaMinBreakedUp; - conditions.isX3MaMaxBreakedUp = isX3MaMaxBreakedUp; conditions.isX3MaFatsUnderMid = isX3MaFatsUnderMid; conditions.isX3MaFatsOverSlow = isX3MaFatsOverSlow; conditions.isStrUpperOverPeak = isStrUpperOverPeak; conditions.isPeakOverAtrUpper = isPeakOverAtrUpper; conditions.isStrLowerOverVale = isStrLowerOverVale; - conditions.isVWapMinBreakedUp = isVWapMinBreakedUp; - conditions.isVWapMaxBreakedUp = isVWapMaxBreakedUp; - conditions.isBreakedUpPrevSar = isBreakedUpPrevSar; - conditions.isBreakedUpPrevStr = isBreakedUpPrevStr; conditions.isAtrUpperOverPeak = isAtrUpperOverPeak; conditions.isClosedOverX3MaMin = isClosedOverX3MaMin; conditions.isClosedOverX3MaMax = isClosedOverX3MaMax; @@ -4388,26 +3799,14 @@ class XCX121Helper : public XCBase conditions.isClosedOverVWapMax = isClosedOverVWapMax; conditions.isClosedUnderX3MaMin = isClosedUnderX3MaMin; conditions.isClosedUnderX3MaMax = isClosedUnderX3MaMax; - conditions.isX3MaMinBreakedDown = isX3MaMinBreakedDown; - conditions.isX3MaMaxBreakedDown = isX3MaMaxBreakedDown; conditions.isClosedUnderVWapMin = isClosedUnderVWapMin; conditions.isClosedUnderVWapMax = isClosedUnderVWapMax; - conditions.isVWapMinBreakedDown = isVWapMinBreakedDown; - conditions.isVWapMaxBreakedDown = isVWapMaxBreakedDown; conditions.isSarCrossedOverVale = isSarCrossedOverVale; conditions.isStrCrossedOverVale = isStrCrossedOverVale; - conditions.isBreakedDownPrevStr = isBreakedDownPrevStr; - conditions.isBreakedDownPrevSar = isBreakedDownPrevSar; conditions.isX3MaFatsOverMidPrev = isX3MaFatsOverMidPrev; conditions.isSarCrossedUnderPeak = isSarCrossedUnderPeak; conditions.isStrCrossedUnderPeak = isStrCrossedUnderPeak; conditions.isNewPeakOverAtrUpper = isNewPeakOverAtrUpper; - conditions.isBreakedUpPrevCheLE1 = isBreakedUpPrevCheLE1; - conditions.isBreakedUpPrevCheLE2 = isBreakedUpPrevCheLE2; - conditions.isBreakedUpPrevCheSE1 = isBreakedUpPrevCheSE1; - conditions.isBreakedUpPrevCheSE2 = isBreakedUpPrevCheSE2; - conditions.isBreakedUpPrevCheMin = isBreakedUpPrevCheMin; - conditions.isBreakedUpPrevCheMax = isBreakedUpPrevCheMax; conditions.isX3MaFatsUnderMidPrev = isX3MaFatsUnderMidPrev; conditions.isX3MaFatsOverSlowPrev = isX3MaFatsOverSlowPrev; conditions.isAtrUpperEqualsToPeak = isAtrUpperEqualsToPeak; @@ -4416,28 +3815,16 @@ class XCX121Helper : public XCBase conditions.isStrUpperOverAtrUpper = isStrUpperOverAtrUpper; conditions.isStrLowerOverAtrLower = isStrLowerOverAtrLower; conditions.isX3MaFatsUnderSlowPrev = isX3MaFatsUnderSlowPrev; - conditions.isBreakedDownPrevCheMin = isBreakedDownPrevCheMin; - conditions.isBreakedDownPrevCheMax = isBreakedDownPrevCheMax; - conditions.isBreakedDownPrevCheLE1 = isBreakedDownPrevCheLE1; - conditions.isBreakedDownPrevCheLE2 = isBreakedDownPrevCheLE2; - conditions.isBreakedDownPrevCheSE1 = isBreakedDownPrevCheSE1; - conditions.isBreakedDownPrevCheSE2 = isBreakedDownPrevCheSE2; conditions.isStrUpperUnderAtrUpper = isStrUpperUnderAtrUpper; conditions.isStrLowerUnderAtrLower = isStrLowerUnderAtrLower; - conditions.isBreakedUpPrevAtrUpper = isBreakedUpPrevAtrUpper; - conditions.isBreakedUpPrevAtrLower = isBreakedUpPrevAtrLower; conditions.isAtrUpperCrossedUpPeak = isAtrUpperCrossedUpPeak; conditions.isAtrLowerCrossedUpVale = isAtrLowerCrossedUpVale; conditions.isX3MaFastCrossedOverMid = isX3MaFastCrossedOverMid; conditions.isVWapFastCrossedOverMid = isVWapFastCrossedOverMid; - conditions.isRejectedUpPrevAtrUpper = isRejectedUpPrevAtrUpper; - conditions.isRejectedUpPrevAtrLower = isRejectedUpPrevAtrLower; conditions.isX3MaFastCrossedUnderMid = isX3MaFastCrossedUnderMid; conditions.isX3MaFastCrossedOverSlow = isX3MaFastCrossedOverSlow; conditions.isAtrUpperCrossedDownPeak = isAtrUpperCrossedDownPeak; conditions.isAtrLowerCrossedDownVale = isAtrLowerCrossedDownVale; - conditions.isBreakedDownPrevAtrUpper = isBreakedDownPrevAtrUpper; - conditions.isBreakedDownPrevAtrLower = isBreakedDownPrevAtrLower; conditions.isVWapFastCrossedUnderMid = isVWapFastCrossedUnderMid; conditions.isDonLowLowerEqualsToVale = isDonLowLowerEqualsToVale; conditions.isStrUpperCrossedOverPeak = isStrUpperCrossedOverPeak; @@ -4445,8 +3832,6 @@ class XCX121Helper : public XCBase conditions.isStrLowerOverDonLowLower = isStrLowerOverDonLowLower; conditions.isVWapFastCrossedOverSlow = isVWapFastCrossedOverSlow; conditions.isX3MaFastCrossedUnderSlow = isX3MaFastCrossedUnderSlow; - conditions.isRejectedDownPrevAtrUpper = isRejectedDownPrevAtrUpper; - conditions.isRejectedDownPrevAtrLower = isRejectedDownPrevAtrLower; conditions.isVWapFastCrossedUnderSlow = isVWapFastCrossedUnderSlow; conditions.isStrUpperOverDonHighUpper = isStrUpperOverDonHighUpper; conditions.isStrLowerUnderDonLowLower = isStrLowerUnderDonLowLower; diff --git a/Helpers/x-saherelm.x121.xatr.helper.mq5 b/Helpers/x-saherelm.x121.xatr.helper.mq5 index 2c7b5c4e..8c0a6d2c 100644 --- a/Helpers/x-saherelm.x121.xatr.helper.mq5 +++ b/Helpers/x-saherelm.x121.xatr.helper.mq5 @@ -220,22 +220,6 @@ struct X121XATRConditions bool isClosedUnderAtrUpper; bool isClosedUnderAtrLower; - // - bool isRejectedUpAtrUpper; - bool isRejectedDownAtrUpper; - - // - bool isRejectedUpAtrLower; - bool isRejectedDownAtrLower; - - // - bool isBreakedUpAtrUpper; - bool isBreakedDownAtrUpper; - - // - bool isBreakedUpAtrLower; - bool isBreakedDownAtrLower; - // // bool isCloseLower @@ -306,22 +290,6 @@ struct X121XATRConditions isClosedUnderAtrUpper = false; isClosedUnderAtrLower = false; - // - isRejectedUpAtrUpper = false; - isRejectedDownAtrUpper = false; - - // - isRejectedUpAtrLower = false; - isRejectedDownAtrLower = false; - - // - isBreakedUpAtrUpper = false; - isBreakedDownAtrUpper = false; - - // - isBreakedUpAtrLower = false; - isBreakedDownAtrLower = false; - // ZeroMemory(this); } @@ -409,14 +377,6 @@ struct X121XATRConditions ToString("isClosedOverAtrLower", isClosedOverAtrLower, ignoreFalseConditions, separator) + ToString("isClosedUnderAtrUpper", isClosedUnderAtrUpper, ignoreFalseConditions, separator) + ToString("isClosedUnderAtrLower", isClosedUnderAtrLower, ignoreFalseConditions, separator) + - ToString("isRejectedUpAtrUpper", isRejectedUpAtrUpper, ignoreFalseConditions, separator) + - ToString("isRejectedDownAtrUpper", isRejectedDownAtrUpper, ignoreFalseConditions, separator) + - ToString("isRejectedUpAtrLower", isRejectedUpAtrLower, ignoreFalseConditions, separator) + - ToString("isRejectedDownAtrLower", isRejectedDownAtrLower, ignoreFalseConditions, separator) + - ToString("isBreakedUpAtrUpper", isBreakedUpAtrUpper, ignoreFalseConditions, separator) + - ToString("isBreakedDownAtrUpper", isBreakedDownAtrUpper, ignoreFalseConditions, separator) + - ToString("isBreakedUpAtrLower", isBreakedUpAtrLower, ignoreFalseConditions, separator) + - ToString("isBreakedDownAtrLower", isBreakedDownAtrLower, ignoreFalseConditions, separator) + // "" // @@ -1048,69 +1008,11 @@ class XCX121XATRHelper : public XCBaseHelper bool isClosedUnderAtrUpper = cBar.close < conditions.atrUpperBuffer[cIDX]; bool isClosedUnderAtrLower = cBar.close < conditions.atrLowerBuffer[cIDX]; - // - bool isRejectedUpAtrUpper = IsBarReject( - atrUpperBuffer[cIDX], - X_DIRECTION_BULLISH, - cBar // - ); - bool isRejectedDownAtrUpper = IsBarReject( - atrUpperBuffer[cIDX], - X_DIRECTION_BEARISH, - cBar // - ); - - // - bool isRejectedUpAtrLower = IsBarReject( - atrLowerBuffer[cIDX], - X_DIRECTION_BULLISH, - cBar // - ); - ; - bool isRejectedDownAtrLower = IsBarReject( - atrLowerBuffer[cIDX], - X_DIRECTION_BEARISH, - cBar // - ); - ; - - // - bool isBreakedUpAtrUpper = IsBarBreak( - atrUpperBuffer[cIDX], - X_DIRECTION_BULLISH, - cBar // - ); - bool isBreakedDownAtrUpper = IsBarBreak( - atrUpperBuffer[cIDX], - X_DIRECTION_BEARISH, - cBar // - ); - - // - bool isBreakedUpAtrLower = IsBarBreak( - atrLowerBuffer[cIDX], - X_DIRECTION_BULLISH, - cBar // - ); - bool isBreakedDownAtrLower = IsBarBreak( - atrLowerBuffer[cIDX], - X_DIRECTION_BEARISH, - cBar // - ); - // conditions.isRsiOverSold = isRsiOverSold; conditions.isRsiOverBought = isRsiOverBought; - conditions.isRejectedUpAtrUpper = isRejectedUpAtrUpper; - conditions.isRejectedUpAtrLower = isRejectedUpAtrLower; - conditions.isBreakedUpAtrUpper = isBreakedUpAtrUpper; - conditions.isBreakedUpAtrLower = isBreakedUpAtrLower; - conditions.isRejectedDownAtrUpper = isRejectedDownAtrUpper; - conditions.isRejectedDownAtrLower = isRejectedDownAtrLower; conditions.isClosedOverAtrUpper = isClosedOverAtrUpper; conditions.isClosedOverAtrLower = isClosedOverAtrLower; - conditions.isBreakedDownAtrUpper = isBreakedDownAtrUpper; - conditions.isBreakedDownAtrLower = isBreakedDownAtrLower; conditions.isClosedUnderAtrUpper = isClosedUnderAtrUpper; conditions.isClosedUnderAtrLower = isClosedUnderAtrLower; conditions.isRsiCrossedOverOverSold = isRsiCrossedOverOverSold; diff --git a/Helpers/x-saherelm.x121.xdon.helper.mq5 b/Helpers/x-saherelm.x121.xdon.helper.mq5 index 639df23f..c731e1f4 100644 --- a/Helpers/x-saherelm.x121.xdon.helper.mq5 +++ b/Helpers/x-saherelm.x121.xdon.helper.mq5 @@ -178,30 +178,6 @@ struct X121XDONConditions // // Conditions ... - // - bool isRejectedDonOpenUpper; - bool isRejectedDonHighUpper; - bool isRejectedDonLowUpper; - bool isRejectedDonCloseUpper; - - // - bool isRejectedDonOpenLower; - bool isRejectedDonHighLower; - bool isRejectedDonLowLower; - bool isRejectedDonCloseLower; - - // - bool isBreakedDonOpenUpper; - bool isBreakedDonHighUpper; - bool isBreakedDonLowUpper; - bool isBreakedDonCloseUpper; - - // - bool isBreakedDonOpenLower; - bool isBreakedDonHighLower; - bool isBreakedDonLowLower; - bool isBreakedDonCloseLower; - // // Constructor ... X121XDONConditions() @@ -249,30 +225,6 @@ struct X121XDONConditions // // Conditions ... - // - isRejectedDonOpenUpper = false; - isRejectedDonHighUpper = false; - isRejectedDonLowUpper = false; - isRejectedDonCloseUpper = false; - - // - isRejectedDonOpenLower = false; - isRejectedDonHighLower = false; - isRejectedDonLowLower = false; - isRejectedDonCloseLower = false; - - // - isBreakedDonOpenUpper = false; - isBreakedDonHighUpper = false; - isBreakedDonLowUpper = false; - isBreakedDonCloseUpper = false; - - // - isBreakedDonOpenLower = false; - isBreakedDonHighLower = false; - isBreakedDonLowLower = false; - isBreakedDonCloseLower = false; - // ZeroMemory(this); } @@ -347,25 +299,6 @@ struct X121XDONConditions // string conditionsStr = // - ToString("isRejectedDonOpenUpper", isRejectedDonOpenUpper, ignoreFalseConditions, separator) + - ToString("isRejectedDonHighUpper", isRejectedDonHighUpper, ignoreFalseConditions, separator) + - ToString("isRejectedDonLowUpper", isRejectedDonLowUpper, ignoreFalseConditions, separator) + - ToString("isRejectedDonCloseUpper", isRejectedDonCloseUpper, ignoreFalseConditions, separator) + - // - ToString("isRejectedDonOpenLower", isRejectedDonOpenLower, ignoreFalseConditions, separator) + - ToString("isRejectedDonHighLower", isRejectedDonHighLower, ignoreFalseConditions, separator) + - ToString("isRejectedDonLowLower", isRejectedDonLowLower, ignoreFalseConditions, separator) + - ToString("isRejectedDonCloseLower", isRejectedDonCloseLower, ignoreFalseConditions, separator) + - // - ToString("isBreakedDonOpenUpper", isBreakedDonOpenUpper, ignoreFalseConditions, separator) + - ToString("isBreakedDonHighUpper", isBreakedDonHighUpper, ignoreFalseConditions, separator) + - ToString("isBreakedDonLowUpper", isBreakedDonLowUpper, ignoreFalseConditions, separator) + - ToString("isBreakedDonCloseUpper", isBreakedDonCloseUpper, ignoreFalseConditions, separator) + - // - ToString("isBreakedDonOpenLower", isBreakedDonOpenLower, ignoreFalseConditions, separator) + - ToString("isBreakedDonHighLower", isBreakedDonHighLower, ignoreFalseConditions, separator) + - ToString("isBreakedDonLowLower", isBreakedDonLowLower, ignoreFalseConditions, separator) + - ToString("isBreakedDonCloseLower", isBreakedDonCloseLower, ignoreFalseConditions, separator) + // "" // @@ -1102,112 +1035,6 @@ class XCX121XDONHelper : public XCBaseHelper // int cIDX = 1; int pIDX = cIDX + 1; - - // - bool isRejectedDonOpenUpper = IsBarReject( - donOpenUpperBuffer[cIDX], - X_DIRECTION_BEARISH, - cBar // - ); - bool isRejectedDonHighUpper = IsBarReject( - donHighUpperBuffer[cIDX], - X_DIRECTION_BEARISH, - cBar // - ); - bool isRejectedDonLowUpper = IsBarReject( - donLowUpperBuffer[cIDX], - X_DIRECTION_BEARISH, - cBar // - ); - bool isRejectedDonCloseUpper = IsBarReject( - donCloseUpperBuffer[cIDX], - X_DIRECTION_BEARISH, - cBar // - ); - - // - bool isRejectedDonOpenLower = IsBarReject( - donOpenLowerBuffer[cIDX], - X_DIRECTION_BULLISH, - cBar // - ); - bool isRejectedDonHighLower = IsBarReject( - donHighLowerBuffer[cIDX], - X_DIRECTION_BULLISH, - cBar // - ); - bool isRejectedDonLowLower = IsBarReject( - donLowLowerBuffer[cIDX], - X_DIRECTION_BULLISH, - cBar // - ); - bool isRejectedDonCloseLower = IsBarReject( - donCloseLowerBuffer[cIDX], - X_DIRECTION_BULLISH, - cBar // - ); - - // - bool isBreakedDonOpenUpper = IsBarBreak( - donOpenUpperBuffer[cIDX], - X_DIRECTION_BEARISH, - cBar // - ); - bool isBreakedDonHighUpper = IsBarBreak( - donHighUpperBuffer[cIDX], - X_DIRECTION_BEARISH, - cBar // - ); - bool isBreakedDonLowUpper = IsBarBreak( - donLowUpperBuffer[cIDX], - X_DIRECTION_BEARISH, - cBar // - ); - bool isBreakedDonCloseUpper = IsBarBreak( - donCloseUpperBuffer[cIDX], - X_DIRECTION_BEARISH, - cBar // - ); - - // - bool isBreakedDonOpenLower = IsBarBreak( - donOpenLowerBuffer[cIDX], - X_DIRECTION_BULLISH, - cBar // - ); - bool isBreakedDonHighLower = IsBarBreak( - donHighLowerBuffer[cIDX], - X_DIRECTION_BULLISH, - cBar // - ); - bool isBreakedDonLowLower = IsBarBreak( - donLowLowerBuffer[cIDX], - X_DIRECTION_BULLISH, - cBar // - ); - bool isBreakedDonCloseLower = IsBarBreak( - donCloseLowerBuffer[cIDX], - X_DIRECTION_BULLISH, - cBar // - ); - - // - conditions.isBreakedDonLowUpper = isBreakedDonLowUpper; - conditions.isBreakedDonLowLower = isBreakedDonLowLower; - conditions.isRejectedDonLowUpper = isRejectedDonLowUpper; - conditions.isRejectedDonLowLower = isRejectedDonLowLower; - conditions.isBreakedDonOpenUpper = isBreakedDonOpenUpper; - conditions.isBreakedDonHighUpper = isBreakedDonHighUpper; - conditions.isBreakedDonOpenLower = isBreakedDonOpenLower; - conditions.isBreakedDonHighLower = isBreakedDonHighLower; - conditions.isRejectedDonOpenUpper = isRejectedDonOpenUpper; - conditions.isRejectedDonOpenLower = isRejectedDonOpenLower; - conditions.isRejectedDonHighUpper = isRejectedDonHighUpper; - conditions.isRejectedDonHighLower = isRejectedDonHighLower; - conditions.isBreakedDonCloseUpper = isBreakedDonCloseUpper; - conditions.isBreakedDonCloseLower = isBreakedDonCloseLower; - conditions.isRejectedDonCloseUpper = isRejectedDonCloseUpper; - conditions.isRejectedDonCloseLower = isRejectedDonCloseLower; // Cleanup(); diff --git a/Helpers/x-saherelm.x121.xhk.helper.mq5 b/Helpers/x-saherelm.x121.xhk.helper.mq5 index 0a4e89a8..03cdf424 100644 --- a/Helpers/x-saherelm.x121.xhk.helper.mq5 +++ b/Helpers/x-saherelm.x121.xhk.helper.mq5 @@ -179,20 +179,6 @@ struct X121XHKConditions bool isRawHKClosedOverSMHK; bool isRawHKClosedUnderSMHK; - // - bool isBreakedUpSMHK; - bool isBreakedUpRawHK; - bool isRejectedUpSMHK; - bool isRejectedUpRawHK; - bool isRawHKBreakedUpSMHK; - - // - bool isBreakedDownSMHK; - bool isBreakedDownRawHK; - bool isRejectedDownSMHK; - bool isRejectedDownRawHK; - bool isRawHKBreakedDownSMHK; - // // Constructor ... X121XHKConditions() @@ -262,20 +248,6 @@ struct X121XHKConditions isRawHKClosedOverSMHK = false; isRawHKClosedUnderSMHK = false; - // - isBreakedUpSMHK = false; - isBreakedUpRawHK = false; - isRejectedUpSMHK = false; - isRejectedUpRawHK = false; - isRawHKBreakedUpSMHK = false; - - // - isBreakedDownSMHK = false; - isBreakedDownRawHK = false; - isRejectedDownSMHK = false; - isRejectedDownRawHK = false; - isRawHKBreakedDownSMHK = false; - // ZeroMemory(this); } @@ -364,16 +336,6 @@ struct X121XHKConditions ToString("isClosedUnderRawHK", isClosedUnderRawHK, ignoreFalseConditions, separator) + ToString("isRawHKClosedOverSMHK", isRawHKClosedOverSMHK, ignoreFalseConditions, separator) + ToString("isRawHKClosedUnderSMHK", isRawHKClosedUnderSMHK, ignoreFalseConditions, separator) + - ToString("isBreakedUpSMHK", isBreakedUpSMHK, ignoreFalseConditions, separator) + - ToString("isBreakedUpRawHK", isBreakedUpRawHK, ignoreFalseConditions, separator) + - ToString("isRejectedUpSMHK", isRejectedUpSMHK, ignoreFalseConditions, separator) + - ToString("isRejectedUpRawHK", isRejectedUpRawHK, ignoreFalseConditions, separator) + - ToString("isRawHKBreakedUpSMHK", isRawHKBreakedUpSMHK, ignoreFalseConditions, separator) + - ToString("isBreakedDownSMHK", isBreakedDownSMHK, ignoreFalseConditions, separator) + - ToString("isBreakedDownRawHK", isBreakedDownRawHK, ignoreFalseConditions, separator) + - ToString("isRejectedDownSMHK", isRejectedDownSMHK, ignoreFalseConditions, separator) + - ToString("isRejectedDownRawHK", isRejectedDownRawHK, ignoreFalseConditions, separator) + - ToString("isRawHKBreakedDownSMHK", isRawHKBreakedDownSMHK, ignoreFalseConditions, separator) + // "" // @@ -1240,68 +1202,6 @@ class XCX121XHKHelper : public XCBaseHelper bool isRawHKClosedOverSMHK = rawHKClose > smHKUp; bool isRawHKClosedUnderSMHK = rawHKClose < smHKDown; - // - bool isBreakedUpSMHK = IsBarBreak( - smHKUp, - X_DIRECTION_BULLISH, - cBar // - ); - bool isBreakedUpRawHK = IsBarBreak( - rawHKUp, - X_DIRECTION_BULLISH, - cBar // - ); - bool isRejectedUpSMHK = IsBarReject( - smHKUp, - X_DIRECTION_BULLISH, - cBar // - ); - bool isRejectedUpRawHK = IsBarReject( - rawHKUp, - X_DIRECTION_BULLISH, - cBar // - ); - - // - bool isRawHKBreakedUpSMHK = - hasRawHKBar && - IsBarBreak( - smHKUp, - X_DIRECTION_BULLISH, - rawHKCBar // - ); - - // - bool isBreakedDownSMHK = IsBarBreak( - smHKDown, - X_DIRECTION_BEARISH, - cBar // - ); - bool isBreakedDownRawHK = IsBarBreak( - rawHKDown, - X_DIRECTION_BEARISH, - cBar // - ); - bool isRejectedDownSMHK = IsBarReject( - smHKDown, - X_DIRECTION_BEARISH, - cBar // - ); - bool isRejectedDownRawHK = IsBarReject( - rawHKDown, - X_DIRECTION_BEARISH, - cBar // - ); - - // - bool isRawHKBreakedDownSMHK = - hasRawHKBar && - IsBarBreak( - smHKDown, - X_DIRECTION_BEARISH, - rawHKCBar // - ); - // conditions.isSMHKBullish = isSMHKBullish; conditions.isRawHKBullish = isRawHKBullish; @@ -1317,16 +1217,6 @@ class XCX121XHKHelper : public XCBaseHelper conditions.isClosedUnderRawHK = isClosedUnderRawHK; conditions.isRawHKClosedOverSMHK = isRawHKClosedOverSMHK; conditions.isRawHKClosedUnderSMHK = isRawHKClosedUnderSMHK; - conditions.isBreakedUpSMHK = isBreakedUpSMHK; - conditions.isBreakedUpRawHK = isBreakedUpRawHK; - conditions.isRejectedUpSMHK = isRejectedUpSMHK; - conditions.isRejectedUpRawHK = isRejectedUpRawHK; - conditions.isRawHKBreakedUpSMHK = isRawHKBreakedUpSMHK; - conditions.isBreakedDownSMHK = isBreakedDownSMHK; - conditions.isBreakedDownRawHK = isBreakedDownRawHK; - conditions.isRejectedDownSMHK = isRejectedDownSMHK; - conditions.isRejectedDownRawHK = isRejectedDownRawHK; - conditions.isRawHKBreakedDownSMHK = isRawHKBreakedDownSMHK; // Cleanup(); diff --git a/Helpers/x-saherelm.x121.xpv.helper.mq5 b/Helpers/x-saherelm.x121.xpv.helper.mq5 index b694a71f..2d9f42b7 100644 --- a/Helpers/x-saherelm.x121.xpv.helper.mq5 +++ b/Helpers/x-saherelm.x121.xpv.helper.mq5 @@ -324,15 +324,11 @@ struct X121XPVConditions bool isNewPeak; bool isNewPeakOverLast; bool isNewPeakUnderLast; - bool isRejectedPrevPeak; - bool isBreakedUpPrevPeak; // bool isNewVale; bool isNewValeOverLast; bool isNewValeUnderLast; - bool isRejectedPrevVale; - bool isBreakedDownPrevVale; // // Constructor ... @@ -419,15 +415,11 @@ struct X121XPVConditions isNewPeak = false; isNewPeakOverLast = false; isNewPeakUnderLast = false; - isRejectedPrevPeak = false; - isBreakedUpPrevPeak = false; // isNewVale = false; isNewValeOverLast = false; isNewValeUnderLast = false; - isRejectedPrevVale = false; - isBreakedDownPrevVale = false; // ZeroMemory(this); @@ -510,13 +502,9 @@ struct X121XPVConditions ToString("isNewPeak", isNewPeak, ignoreFalseConditions, separator) + ToString("isNewPeakOverLast", isNewPeakOverLast, ignoreFalseConditions, separator) + ToString("isNewPeakUnderLast", isNewPeakUnderLast, ignoreFalseConditions, separator) + - ToString("isRejectedPrevPeak", isRejectedPrevPeak, ignoreFalseConditions, separator) + - ToString("isBreakedUpPrevPeak", isBreakedUpPrevPeak, ignoreFalseConditions, separator) + ToString("isNewVale", isNewVale, ignoreFalseConditions, separator) + ToString("isNewValeOverLast", isNewValeOverLast, ignoreFalseConditions, separator) + ToString("isNewValeUnderLast", isNewValeUnderLast, ignoreFalseConditions, separator) + - ToString("isRejectedPrevVale", isRejectedPrevVale, ignoreFalseConditions, separator) + - ToString("isBreakedDownPrevVale", isBreakedDownPrevVale, ignoreFalseConditions, separator) + // "" // @@ -2447,16 +2435,6 @@ class XCX121XPVHelper : public XCBaseHelper conditions.peaksBuffer[cIDX] > conditions.peaksBuffer[pIDX]; bool isNewPeakUnderLast = isNewPeak && conditions.peaksBuffer[cIDX] < conditions.peaksBuffer[pIDX]; - bool isRejectedPrevPeak = IsBarReject( - conditions.peaksBuffer[pIDX], - X_DIRECTION_BEARISH, - cBar // - ); - bool isBreakedUpPrevPeak = IsBarBreak( - conditions.peaksBuffer[pIDX], - X_DIRECTION_BULLISH, - cBar // - ); // bool isNewVale = conditions.valesBuffer[cIDX] != conditions.valesBuffer[pIDX]; @@ -2464,16 +2442,6 @@ class XCX121XPVHelper : public XCBaseHelper conditions.valesBuffer[cIDX] > conditions.valesBuffer[pIDX]; bool isNewValeUnderLast = isNewVale && conditions.valesBuffer[cIDX] < conditions.valesBuffer[pIDX]; - bool isRejectedPrevVale = IsBarReject( - conditions.valesBuffer[pIDX], - X_DIRECTION_BULLISH, - cBar // - ); - bool isBreakedDownPrevVale = IsBarBreak( - conditions.valesBuffer[pIDX], - X_DIRECTION_BEARISH, - cBar // - ); // conditions.isSarBullish = isSarBullish; @@ -2483,13 +2451,9 @@ class XCX121XPVHelper : public XCBaseHelper conditions.isNewPeak = isNewPeak; conditions.isNewPeakOverLast = isNewPeakOverLast; conditions.isNewPeakUnderLast = isNewPeakUnderLast; - conditions.isRejectedPrevPeak = isRejectedPrevPeak; - conditions.isBreakedUpPrevPeak = isBreakedUpPrevPeak; conditions.isNewVale = isNewVale; conditions.isNewValeOverLast = isNewValeOverLast; conditions.isNewValeUnderLast = isNewValeUnderLast; - conditions.isRejectedPrevVale = isRejectedPrevVale; - conditions.isBreakedDownPrevVale = isBreakedDownPrevVale; // Cleanup(); diff --git a/Libraries/x-saherelm.common.extensions.lib.mq5 b/Libraries/x-saherelm.common.extensions.lib.mq5 index b0925f11..9dada94a 100644 --- a/Libraries/x-saherelm.common.extensions.lib.mq5 +++ b/Libraries/x-saherelm.common.extensions.lib.mq5 @@ -1003,6 +1003,17 @@ double GetExit( return result; } +/** + * Retrieve Current Tick ... + */ +bool GetTick( + string mSymbol, + MqlTick &tick // +) +{ + return SymbolInfoTick(mSymbol, tick); +} + // // END Position ... // diff --git a/Libraries/x-saherelm.common.models.lib.mq5 b/Libraries/x-saherelm.common.models.lib.mq5 index 4cd05ace..c8e3186d 100644 --- a/Libraries/x-saherelm.common.models.lib.mq5 +++ b/Libraries/x-saherelm.common.models.lib.mq5 @@ -22,3 +22,371 @@ // #include "../Libraries/x-saherelm.common.extensions.lib.mq5" +// +// Use To Parse Symbols for +// Ignore Brokers Additional Suffixes ... +struct XSymbolParser +{ + // + string version; // Temp ... + + // + // Symbol Parsing ... + + // + // Forext ... + + // + bool IsEURUSD(string symbol) + { + // + string symbolIdentifiers[] = { + "EUR", + "USD" // + }; + + // + bool result = Contains( + symbolIdentifiers, + symbol // + ); + + // + return result; + } + + // + bool IsUSDJPY(string symbol) + { + // + string symbolIdentifiers[] = { + "USD", + "JPY" // + }; + + // + bool result = Contains( + symbolIdentifiers, + symbol // + ); + + // + return result; + } + + // + bool IsEURJPY(string symbol) + { + // + string symbolIdentifiers[] = { + "EUR", + "JPY" // + }; + + // + bool result = Contains( + symbolIdentifiers, + symbol // + ); + + // + return result; + } + + // + bool IsUSDCHF(string symbol) + { + // + string symbolIdentifiers[] = { + "USD", + "CHF" // + }; + + // + bool result = Contains( + symbolIdentifiers, + symbol // + ); + + // + return result; + } + + // + bool IsEURCHF(string symbol) + { + // + string symbolIdentifiers[] = { + "EUR", + "CHF" // + }; + + // + bool result = Contains( + symbolIdentifiers, + symbol // + ); + + // + return result; + } + + // + bool IsGBPUSD(string symbol) + { + // + string symbolIdentifiers[] = { + "GBP", + "USD" // + }; + + // + bool result = Contains( + symbolIdentifiers, + symbol // + ); + + // + return result; + } + + // + bool IsEURGBP(string symbol) + { + // + string symbolIdentifiers[] = { + "EUR", + "GBP" // + }; + + // + bool result = Contains( + symbolIdentifiers, + symbol // + ); + + // + return result; + } + + // + bool IsAUDUSD(string symbol) + { + // + string symbolIdentifiers[] = { + "AUD", + "USD" // + }; + + // + bool result = Contains( + symbolIdentifiers, + symbol // + ); + + // + return result; + } + + // + bool IsEURAUD(string symbol) + { + // + string symbolIdentifiers[] = { + "EUR", + "AUD" // + }; + + // + bool result = Contains( + symbolIdentifiers, + symbol // + ); + + // + return result; + } + + // + bool IsUSDCAD(string symbol) + { + // + string symbolIdentifiers[] = { + "USD", + "CAD" // + }; + + // + bool result = Contains( + symbolIdentifiers, + symbol // + ); + + // + return result; + } + + // + bool IsEURCAD(string symbol) + { + // + string symbolIdentifiers[] = { + "EUR", + "CAD" // + }; + + // + bool result = Contains( + symbolIdentifiers, + symbol // + ); + + // + return result; + } + + // + bool IsNZDUSD(string symbol) + { + // + string symbolIdentifiers[] = { + "NZD", + "USD" // + }; + + // + bool result = Contains( + symbolIdentifiers, + symbol // + ); + + // + return result; + } + + // + bool IsEURNZD(string symbol) + { + // + string symbolIdentifiers[] = { + "EUR", + "NZD" // + }; + + // + bool result = Contains( + symbolIdentifiers, + symbol // + ); + + // + return result; + } + + // + // Metals ... + + // + bool IsXAUUSD(string symbol) + { + // + string symbolIdentifiers[] = { + "XAU", + "USD" // + }; + + // + bool result = Contains( + symbolIdentifiers, + symbol // + ); + + // + return result; + } + + // + bool IsXAGUSD(string symbol) + { + // + string symbolIdentifiers[] = { + "XAG", + "USD" // + }; + + // + bool result = Contains( + symbolIdentifiers, + symbol // + ); + + // + return result; + } + + // + // Indexes ... + + // + bool IsDowJones(string symbol) + { + // + bool result = Contains( + "DowJones30", + symbol // + ); + + // + return result; + } + + // + // Oil ... + + // + bool IsBrent(string symbol) + { + // + bool result = Contains( + "BRENT", + symbol // + ); + + // + return result; + } + + // + // Symbol Finder ... + string GetEURUSDSymbol() + { + // + string result = NULL; + + // + string symbols[]; + int symbolsCount = GetAllSymbols( + symbols // + ); + if (!IsValidSize(symbolsCount)) + { + return result; + } + + // + for (int i = 0; i < symbolsCount; i++) + { + // + string iSymbol = symbols[i]; + if (IsEURUSD(iSymbol)) + { + // + result = iSymbol; + break; + } + } + + // + return result; + } +}; diff --git a/X121SMCEA/Classes/x-121.smc.market.cycle.helper.class.mq5 b/X121SMCEA/Classes/x-121.smc.market.cycle.helper.class.mq5 index 3d8f8ed2..1ee34e13 100644 --- a/X121SMCEA/Classes/x-121.smc.market.cycle.helper.class.mq5 +++ b/X121SMCEA/Classes/x-121.smc.market.cycle.helper.class.mq5 @@ -3571,70 +3571,7 @@ struct X121SMCStrategyConditionParser isBullish = // // Base Condition ... - ( - // - cBar.IsBullish() && - zBar.open >= cBar.close && - ( - // - // Regular Reject ... - (pBar.low > cBar.low && - cBar.low < cXConditions.valesGoldenBuffer[cIDX] && - cBar.GetDown() > cXConditions.valesGoldenBuffer[cIDX]) - // - || - // - // Regular Exit ... - (pBar.low < cXConditions.valesGoldenBuffer[cIDX] && - (cBar.low > cXConditions.valesGoldenBuffer[cIDX] || - cBar.GetUp() > cXConditions.valesGoldenBuffer[cIDX])) - // - || - // - IsBarBreak( - cXConditions.valesGoldenBuffer[cIDX], - X_DIRECTION_BULLISH, - cBar // - ) - // - || - // - IsBarReject( - cXConditions.valesGoldenBuffer[cIDX], - X_DIRECTION_BULLISH, - cBar // - ) - // - ) - // - ) - // - && - // - // Checking other Conditions ... - ( - // - // XSAR ... - cXConditions.isSarBullish && - // - // XSTR ... - cXConditions.isStrSwitchedToBullish && - // - // // X3MA ... - // // XVWAP ... - // (cXConditions.isX3MaFastOverMid || - // cXConditions.isVWapFastOverMid) && - // - // XHK ... - cXConditions.isSMHKBullish && - cXConditions.isRawHKBullish && - // - // XCHE ... - cXConditions.isCheBullish && - cXConditions.le1Buffer[cIDX] < cBar.low && - cXConditions.le2Buffer[cIDX] < cBar.low - // - ) + false // ; @@ -3643,70 +3580,7 @@ struct X121SMCStrategyConditionParser isBearish = // // Base Condition ... - ( - // - cBar.IsBearish() && - zBar.open <= cBar.close && - ( - // - // Regular Reject ... - (pBar.high < cBar.high && - cBar.high > cXConditions.peaksGoldenBuffer[cIDX] && - cBar.GetUp() < cXConditions.peaksGoldenBuffer[cIDX]) - // - || - // - // Regular Exit ... - (pBar.high > cXConditions.peaksGoldenBuffer[cIDX] && - (cBar.high < cXConditions.peaksGoldenBuffer[cIDX] || - cBar.GetDown() < cXConditions.peaksGoldenBuffer[cIDX])) - // - || - // - IsBarBreak( - cXConditions.peaksGoldenBuffer[cIDX], - X_DIRECTION_BEARISH, - cBar // - ) - // - || - // - IsBarReject( - cXConditions.peaksGoldenBuffer[cIDX], - X_DIRECTION_BEARISH, - cBar // - ) - // - ) - // - ) - // - && - // - // Checking other Conditions ... - ( - // - // XSAR ... - cXConditions.isSarBearish && - // - // XSTR ... - cXConditions.isStrSwitchedToBearish && - // - // // X3MA ... - // // XVWAP ... - // (cXConditions.isX3MaFastUnderMid || - // cXConditions.isVWapFastUnderMid) && - // - // XHK ... - cXConditions.isSMHKBearish && - cXConditions.isRawHKBearish && - // - // XCHE ... - cXConditions.isCheBearish && - cXConditions.se1Buffer[cIDX] > cBar.high && - cXConditions.se2Buffer[cIDX] > cBar.high - // - ) + false // ;