/////////////////////////////////////////////////////// // // SaherElm IT Center MQL5 Seriallize Library // --------------------------------------- // Name: XPOILib // Description: All models related to POIs ... // // // Maintainer: // ------------ // Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com) // ////////////////////////////////////////////////////// // // Global Properties ... #property library #property copyright "Copyright `023, SaherElm IT Center" #property link "https://www.saherelm.ir" #property version "1.00" #property strict // // Imports ... #include "../Libraries/x-saherelm.x-poi.extensions.lib.mq5" #include "../Libraries/x-saherelm.x-poi.lib.mq5" // enum ENUM_X_OBFVG_FVG_FILTERS { X_OBFVG_FVG_FILTER_NONE, X_OBFVG_FVG_FILTER_INSIDE_OR, X_OBFVG_FVG_FILTER_ABOVE_BELOW, }; // enum ENUM_X_OBFVG_FVG_SELECTION { X_OBFVG_FVG_SELECT_NONE, X_OBFVG_FVG_SELECT_OLDEST, X_OBFVG_FVG_SELECT_LOWEST, X_OBFVG_FVG_SELECT_HIGHEST, X_OBFVG_FVG_SELECT_YOUNGEST, X_OBFVG_FVG_SELECT_HIGHEST_LOWEST, X_OBFVG_FVG_SELECT_LOWEST_HIGHEST, }; // struct XOBFVGPivot { // // Props ... double value; datetime at; // // Constructor ... XOBFVGPivot() { Clean(); } // // Tools ... // void Clean() { // value = 0; at = NULL; // ZeroMemory(this); } // bool IsValid() { // bool result = false; // result = value > 0 && IsValid(at); // return result; } }; // struct XOBFVG { // // Props ... XCFVG *fvgs[]; XCOrderBlock *ob; // // Constructor ... XOBFVG() { Clean(); } // // Tools ... // void Clean() { // Clean(fvgs); ZeroMemory(ob); // ZeroMemory(this); } // bool IsValid() { // bool result = false; // result = HasOB() && HasFVGs(); if (!result) { return result; } // XOHCL passedBar; bool isBodyOut; bool isOBStarted = ob.IsStarted( ob.GetDirection(), passedBar, isBodyOut // ); // int idx = GetOldest(fvgs); result = IsValidIndex(idx); if (!result) { // passedBar.Clean(); return result; } // bool isFVGStarted = fvgs[idx].IsStarted( ob.GetDirection(), passedBar, isBodyOut // ); // result = isOBStarted && isFVGStarted; // passedBar.Clean(); // return result; } // bool HasOB() { return ob != NULL && ob.IsValid(); } // bool HasFVGs() { return HasChild(fvgs); } // int CountFVGs() { return ArraySize(fvgs); } // ENUM_X_DIRECTION GetDirection() { // ENUM_X_DIRECTION result = X_DIRECTION_NONE; // bool isValid = IsValid(); if (!isValid) { return result; } // result = ob.GetDirection(); // return result; } // bool IsBullish() { return IsBullish(GetDirection()); } // bool IsBearish() { return IsBearish(GetDirection()); } // int GetSwings( XOBFVGPivot &pivots[] // ) { // int result = 0; // Clean(pivots); // if (!IsValid()) { return result; } // ENUM_X_DIRECTION forDir = GetDirection(); bool isBullish = IsBullish(forDir); // XOHCL passedBar; XOBFVGPivot iPivot; bool isPassed = false; double appliedPrice = 0; bool isBodyState = false; // // Start ... isPassed = ob.IsStarted( forDir, passedBar, isBodyState // ); if (isPassed) { // appliedPrice = isBullish ? passedBar.low : passedBar.high; // iPivot.Clean(); iPivot.value = appliedPrice; iPivot.at = passedBar.time; // AddRef( iPivot, pivots // ); // iPivot.Clean(); } // // Activation ... isPassed = ob.IsActivated( forDir, passedBar, isBodyState // ); if (isPassed) { // appliedPrice = isBullish ? passedBar.low : passedBar.high; // iPivot.Clean(); iPivot.value = appliedPrice; iPivot.at = passedBar.time; // AddRef( iPivot, pivots // ); // iPivot.Clean(); } // // Worked ... isPassed = ob.IsWorked( forDir, passedBar, isBodyState // ); if (isPassed) { // appliedPrice = isBullish ? passedBar.low : passedBar.high; // iPivot.Clean(); iPivot.value = appliedPrice; iPivot.at = passedBar.time; // AddRef( iPivot, pivots // ); // iPivot.Clean(); } // passedBar.Clean(); // result = ArraySize(pivots); // return result; } // bool GetMainFVG( XCFVG *&fvg // ) { // bool result = false; // fvg = NULL; // result = IsValid(); if (!result) { return result; } // int idx = GetOldest(fvgs); result = IsValidIndex(idx); if (!result) { // ZeroMemory(fvg); return result; } // fvg = fvgs[idx]; result = fvg != NULL && fvg.IsValid(); // return result; } // bool IsValidZone( int barIndex = 0 // ) { // bool result = false; // if (barIndex < 0) { barIndex = 0; } // result = IsValid(); if (!result) { return result; } // XCFVG *tmpFVGs[]; Copy( fvgs, tmpFVGs // ); int count = CountFVGs(); for (int i = 0; i < count; i++) { // XCFVG *iFVG = tmpFVGs[i]; // XOHCL startedBar; bool isBodyOut = false; result = iFVG.IsStarted( iFVG.GetDirection(), startedBar, isBodyOut // ); if (!result) { // ZeroMemory(iFVG); startedBar.Clean(); ArrayRemove( fvgs, i, 1 // ); // continue; } // XOHCL bar; bool isBullish = iFVG.IsBullish(); datetime fromTime = startedBar.NextAt(); // int fromIndex = iBarShift( iFVG.GetSymbol(), iFVG.GetPeriod(), fromTime // ); result = IsValidIndex(fromIndex); if (!result) { // bar.Clean(); ZeroMemory(iFVG); startedBar.Clean(); ArrayRemove( fvgs, i, 1 // ); // continue; } // bool isInited = false; bool isValidFVG = false; for (int j = barIndex; j < fromIndex; j++) { // isInited = bar.Init( iFVG.GetSymbol(), iFVG.GetPeriod(), j // ); if (!isInited) { // bar.Clean(); continue; } // // bool isBarAbove = // bar.low > iFVG.Upper(); // bool isBarBelow = // bar.high < iFVG.Lower(); // bool isBarAbove = bar.GetDown() > iFVG.Upper(); bool isBarBelow = bar.GetUp() < iFVG.Lower(); // isValidFVG = isBullish ? isBarAbove : isBarBelow; if (!isValidFVG) { // bar.Clean(); // break; } // bar.Clean(); } // if (!isValidFVG) { // ArrayRemove( fvgs, i, 1 // ); } // bar.Clean(); ZeroMemory(iFVG); startedBar.Clean(); } // Clean(tmpFVGs); // result = HasFVGs(); // return result; } // bool ToZone(XBoxZone &box) { // bool result = false; // result = ToZoneBox( box, this // ); // return result; } // void AddFVG(XCFVG *fvg) { // int idx = -1; bool has = false; // has = HasOB() && fvg != NULL && fvg.IsValid() && ob.GetDirection() == fvg.GetDirection(); if (!has) { return; } // idx = FindIndex( fvg, fvgs // ); has = !IsValidIndex(idx); if (!has) { return; } // Add( fvg, fvgs // ); } // bool IsSameAs(XOBFVG &item) { // bool result = false; // result = IsValid() && IsSame(ob, item.ob); // return result; } // void UpdateTo(datetime value = NULL) { // value = NormalizeTime(value); // int count = 0; bool has = false; // has = HasOB(); if (has) { ob.To(value); } // has = HasFVGs(); if (has) { // count = CountFVGs(); for (int i = 0; i < count; i++) { fvgs[i].To(value); } } } }; // // Model State Parsing ... struct XPOIStateEvents { // // Props ... // // Swings ... bool hasNewSwing; bool hasNewSwingLow; bool hasNewSwingHigh; // // Momentums ... bool hasNewMomentum; bool hasNewBullishMomentum; bool hasNewBearishMomentum; // // Rejections ... bool hasNewRejection; bool hasNewBullishRejection; bool hasNewBearishRejection; // // Pullbacks ... bool hasNewPullback; bool hasNewBullishPullback; bool hasNewBearishPullback; // // Support/Resistance (s) ... bool hasNewSupportZone; bool hasNewResistanceZone; // // Supply/Demand (s) ... bool hasNewSupplyZone; bool hasNewDemandZone; // // Fair Value Gaps ... bool hasNewFairValueGap; bool hasNewBullishFairValueGap; bool hasNewBearishFairValueGap; // // Order Blocks ... bool hasNewOrderBlock; bool hasNewBullishOrderBlock; bool hasNewBearishOrderBlock; // // Spikes ... bool hasNewSpike; bool hasNewBullishSpike; bool hasNewBearishSpike; // // Sharps ... bool hasNewSharp; bool hasNewBullishSharp; bool hasNewBearishSharp; // // Consolidation Zones ... bool hasNewConsolidationZone; bool hasNewBullishConsolidationZone; bool hasNewBearishConsolidationZone; // // Constructor ... XPOIStateEvents() { Clean(); } // // Tools ... /** * Cleanup Model ... */ void Clean() { // hasNewSwing = false; hasNewSwingLow = false; hasNewSwingHigh = false; // hasNewMomentum = false; hasNewBullishMomentum = false; hasNewBearishMomentum = false; // hasNewRejection = false; hasNewBullishRejection = false; hasNewBearishRejection = false; // hasNewSupportZone = false; hasNewResistanceZone = false; // hasNewSupplyZone = false; hasNewDemandZone = false; // hasNewFairValueGap = false; hasNewBullishFairValueGap = false; hasNewBearishFairValueGap = false; // hasNewOrderBlock = false; hasNewBullishOrderBlock = false; hasNewBearishOrderBlock = false; // hasNewSpike = false; hasNewBullishSpike = false; hasNewBearishSpike = false; // hasNewSharp = false; hasNewBullishSharp = false; hasNewBearishSharp = false; // hasNewConsolidationZone = false; hasNewBullishConsolidationZone = false; hasNewBearishConsolidationZone = false; // ZeroMemory(this); } /** * Initialize Event Parser Model ... * * @param events: ENUM_XPOI_EVENTS members Collection Reference ... */ void Init(ENUM_XPOI_EVENTS &events[]) { // hasNewSwing = HasNewSwing(events); hasNewSwingLow = HasNewSwingLow(events); hasNewSwingHigh = HasNewSwingHigh(events); // hasNewMomentum = HasNewMomentum(events); hasNewBullishMomentum = HasNewBullishMomentum(events); hasNewBearishMomentum = HasNewBearishMomentum(events); // hasNewRejection = HasNewRejection(events); hasNewBullishRejection = HasNewBullishRejection(events); hasNewBearishRejection = HasNewBearishRejection(events); // hasNewPullback = HasNewPullback(events); hasNewBullishPullback = HasNewBullishPullback(events); hasNewBearishPullback = HasNewBearishPullback(events); // hasNewSupportZone = HasNewSupportZone(events); hasNewResistanceZone = HasNewResistanceZone(events); // hasNewSupplyZone = HasNewSupplyZone(events); hasNewDemandZone = HasNewDemandZone(events); // hasNewFairValueGap = HasNewFairValueGap(events); hasNewBullishFairValueGap = HasNewBullishFairValueGap(events); hasNewBearishFairValueGap = HasNewBearishFairValueGap(events); // hasNewOrderBlock = HasNewOrderBlock(events); hasNewBullishOrderBlock = HasNewBullishOrderBlock(events); hasNewBearishOrderBlock = HasNewBearishOrderBlock(events); // hasNewSpike = HasNewSpike(events); hasNewBullishSpike = HasNewBullishSpike(events); hasNewBearishSpike = HasNewBearishSpike(events); // hasNewSharp = HasNewSharp(events); hasNewBullishSharp = HasNewBullishSharp(events); hasNewBearishSharp = HasNewBearishSharp(events); // hasNewConsolidationZone = HasNewConsolidationZone(events); hasNewBullishConsolidationZone = HasNewBullishConsolidationZone(events); hasNewBearishConsolidationZone = HasNewBearishConsolidationZone(events); } // }; // // Model Exists Founded POIs ... struct XPOIState { // string symbol; ENUM_TIMEFRAMES period; datetime time; // XCSwing *swings[]; // Holds Founded Swing ... XCSwing *swingLows[]; // Holds Founded Swing Lows ... XCSwing *swingHighs[]; // Holds Founded Swing Highs ... // XCMomentumBar *momentums[]; // Holds Founded Momentum Bars ... XCMomentumBar *bullishMomentums[]; // Holds Founded Bullish Momentum Bars ... XCMomentumBar *bearishMomentums[]; // Holds Founded Bearish Momentum Bars ... // XCRejectionBar *rejections[]; // Holds Founded Rejection Bars ... XCRejectionBar *bullishRejections[]; // Holds Founded Bullish Rejection Bars ... XCRejectionBar *bearishRejections[]; // Holds Founded Bearish Rejection Bars ... // XCSupportZone *supportZones[]; // Holds Founded Support Zones ... XCResistanceZone *resistanceZones[]; // Holds Founded Resistance Zones ... // XCSupplyZone *supplyZones[]; // Holds Founded Supply Zones ... XCDemandZone *demandZones[]; // Holds Founded Demand Zones ... // XCOrderBlock *orderBlocks[]; // Holds Founded Order Blocks ... XCOrderBlock *bullishOrderBlocks[]; // Holds Founded Bullish Order Blocks ... XCOrderBlock *bearishOrderBlocks[]; // Holds Founded Bearish Order Blocks ... // XCFVG *fairValueGaps[]; // Holds Founded Fair Value Gaps ... XCFVG *bullishFairValueGaps[]; // Holds Founded Bullish Fair Value Gaps ... XCFVG *bearishFairValueGaps[]; // Holds Founded Bearish Fair Value Gaps ... // XConsolidationZone consolidationZones[]; // Holds Founded Consolidation Zones ... XConsolidationZone bullishConsolidationZones[]; // Holds Founded Bullish Consolidation Zones ... XConsolidationZone bearishConsolidationZones[]; // Holds Founded Bearih Consolidation Zones ... // XBoxZone spikes[]; // Holds Founded Spikes ... XBoxZone bullishSpikes[]; // Holds Founded Bullish Spikes ... XBoxZone bearishSpikes[]; // Holds Founded Bearih Spikes ... // XBoxZone sharps[]; // Holds Founded Sharps ... XBoxZone bullishSharps[]; // Holds Founded Bullish Sharps ... XBoxZone bearishSharps[]; // Holds Founded Bearih Sharps ... // XBoxZone pullbacks[]; // Holds Founded Pullbacks ... XBoxZone bullishPullbacks[]; // Holds Founded Bullish Pullbacks ... XBoxZone bearishPullbacks[]; // Holds Founded Bearish Pullbacks ... // // Constructor ... void XPOIState() { Clean(); } // // Actions ... /** * Cleanup all props ... */ void Clean() { // time = NULL; symbol = NULL; period = NULL; // // Swings ... Clean(swings); Clean(swingLows); Clean(swingHighs); // // Momentums ... Clean(momentums); Clean(bullishMomentums); Clean(bearishMomentums); // // Rejections ... Clean(rejections); Clean(bullishRejections); Clean(bearishRejections); // // Support / Resistance Zones ... Clean(supportZones); Clean(resistanceZones); // // Supply / Demand Zones ... Clean(supplyZones); Clean(demandZones); // // Fair Value Gaps ... Clean(fairValueGaps); Clean(bullishFairValueGaps); Clean(bearishFairValueGaps); // // Order Blocks ... Clean(orderBlocks); Clean(bullishOrderBlocks); Clean(bearishOrderBlocks); // // Spikes ... Clean(spikes); Clean(bullishSpikes); Clean(bearishSpikes); // // Sharps ... Clean(sharps); Clean(bullishSharps); Clean(bearishSharps); // // Pullbaks ... Clean(pullbacks); Clean(bullishPullbacks); Clean(bearishPullbacks); // // Consolidation Zones ... Clean(consolidationZones); Clean(bullishConsolidationZones); Clean(bearishConsolidationZones); // ZeroMemory(this); } /** * Validate ... * * @return ( bool ) */ bool IsValid() { // bool result = false; // result = IsSpecifiedValid(symbol) && IsSpecifiedValid(period) && IsSpecifiedValid(time); // return result; } /** * Check State has Childs or not ... * * @return ( bool ) */ bool HasChild() { // bool result = false; // result = // // Swings ... HasSwings() || HasSwingLows() || HasSwingHighs() || // // Momentums ... HasMomentums() || HasBullishMomentums() || HasBearishMomentums() || // // Rejections ... HasRejections() || HasBullishRejections() || HasBearishRejections() || // // Pullbacks ... HasPullbacks() || HasBullishPullbacks() || HasBearishPullbacks() || // // Support / Resistance Zones ... HasSupportZones() || HasResistanceZones() || // // Supply / Demand Zones ... HasSupplyZones() || HasDemandZones() || // // Fair Value Gaps ... HasFairValueGaps() || HasBullishFairValueGaps() || HasBearishFairValueGaps() || // // Order Blocks ... HasOrderBlocks() || HasBullishOrderBlocks() || HasBearishOrderBlocks() || // // Spikes ... HasSpikes() || HasBullishSpikes() || HasBearishSpikes() || // // Sharps ... HasSharps() || HasBullishSharps() || HasBearishSharps() || // // Consolidation Zones ... HasConsolidationZones() || HasBullishConsolidationZones() || HasBearishConsolidationZones() // ; // return result; } // // Checkers ... // // Swings ... // // Has ... // bool HasSwings() { return HasChild(swings); } // bool HasSwingLows() { return HasChild(swingLows); } // bool HasSwingHighs() { return HasChild(swingHighs); } // // Count ... // int CountSwings() { return ArraySize(swings); } // int CountSwingLows() { return ArraySize(swingLows); } // int CountSwingHighs() { return ArraySize(swingHighs); } // // Momentums ... // // Has ... // bool HasMomentums() { return HasChild(momentums); } // bool HasBullishMomentums() { return HasChild(bullishMomentums); } // bool HasBearishMomentums() { return HasChild(bearishMomentums); } // // Count ... // int CountMomentums() { return ArraySize(momentums); } // int CountBullishMomentums() { return ArraySize(bullishMomentums); } // int CountBearishMomentums() { return ArraySize(bearishMomentums); } // // Rejections ... // // Has ... // bool HasRejections() { return HasChild(rejections); } // bool HasBullishRejections() { return HasChild(bullishRejections); } // bool HasBearishRejections() { return HasChild(bearishRejections); } // // Count ... // int CountRejections() { return ArraySize(rejections); } // int CountBullishRejections() { return ArraySize(bullishRejections); } // int CountBearishRejections() { return ArraySize(bearishRejections); } // // Pullbacks ... // // Has ... // bool HasPullbacks() { return HasChild(pullbacks); } // bool HasBullishPullbacks() { return HasChild(bullishPullbacks); } // bool HasBearishPullbacks() { return HasChild(bearishPullbacks); } // // Count ... // int CountPullbacks() { return ArraySize(pullbacks); } // int CountBullishPullbacks() { return ArraySize(bullishPullbacks); } // int CountBearishPullbacks() { return ArraySize(bearishPullbacks); } // // Support / Resistance Zones ... // // Has ... // bool HasSupportZones() { return HasChild(supportZones); } // bool HasResistanceZones() { return HasChild(resistanceZones); } // // Count ... // int CountSupportZones() { return ArraySize(supportZones); } // int CountResistanceZones() { return ArraySize(resistanceZones); } // // Supply / Demand Zones ... // // Has ... // bool HasSupplyZones() { return HasChild(supplyZones); } // bool HasDemandZones() { return HasChild(demandZones); } // // Count ... // int CountSupplyZones() { return ArraySize(supplyZones); } // int CountDemandZones() { return ArraySize(demandZones); } // // Fair Value Gaps ... // // Has ... // bool HasFairValueGaps() { return HasChild(fairValueGaps); } // bool HasBullishFairValueGaps() { return HasChild(bullishFairValueGaps); } // bool HasBearishFairValueGaps() { return HasChild(bearishFairValueGaps); } // // Count ... // int CountFairValueGaps() { return ArraySize(fairValueGaps); } // int CountBullishFairValueGaps() { return ArraySize(bullishFairValueGaps); } // int CountBearishFairValueGaps() { return ArraySize(bearishFairValueGaps); } // // Order Blocks ... // // Has ... // bool HasOrderBlocks() { return HasChild(orderBlocks); } // bool HasBullishOrderBlocks() { return HasChild(bullishOrderBlocks); } // bool HasBearishOrderBlocks() { return HasChild(bearishOrderBlocks); } // // Count ... // int CountOrderBlocks() { return ArraySize(orderBlocks); } // int CountBullishOrderBlocks() { return ArraySize(bullishOrderBlocks); } // int CountBearishOrderBlocks() { return ArraySize(bearishOrderBlocks); } // // Spikes ... // // Has ... // bool HasSpikes() { return HasChild(spikes); } // bool HasBullishSpikes() { return HasChild(bullishSpikes); } // bool HasBearishSpikes() { return HasChild(bearishSpikes); } // // Count ... // int CountSpikes() { return ArraySize(spikes); } // int CountBullishSpikes() { return ArraySize(bullishSpikes); } // int CountBearishSpikes() { return ArraySize(bearishSpikes); } // // Sharps ... // // Has ... // bool HasSharps() { return HasChild(sharps); } // bool HasBullishSharps() { return HasChild(bullishSharps); } // bool HasBearishSharps() { return HasChild(bearishSharps); } // // Count ... // int CountSharps() { return ArraySize(sharps); } // int CountBullishSharps() { return ArraySize(bullishSharps); } // int CountBearishSharps() { return ArraySize(bearishSharps); } // // Consolidation Zone ... // // Has ... // bool HasConsolidationZones() { return HasChild(consolidationZones); } // bool HasBullishConsolidationZones() { return HasChild(bullishConsolidationZones); } // bool HasBearishConsolidationZones() { return HasChild(bearishConsolidationZones); } // // Count ... // int CountConsolidationZones() { return ArraySize(consolidationZones); } // int CountBullishConsolidationZones() { return ArraySize(bullishConsolidationZones); } // int CountBearishConsolidationZones() { return ArraySize(bearishConsolidationZones); } // // Tools ... // void UpdateTo(datetime value = NULL) { // value = NormalizeTime(value); // int count = 0; bool has = false; // has = HasMomentums(); if (has) { // count = CountMomentums(); for (int i = 0; i < count; i++) { momentums[i].To(value); } } // has = HasBullishMomentums(); if (has) { // count = CountBullishMomentums(); for (int i = 0; i < count; i++) { bullishMomentums[i].To(value); } } // has = HasBearishMomentums(); if (has) { // count = CountBearishMomentums(); for (int i = 0; i < count; i++) { bearishMomentums[i].To(value); } } // has = HasRejections(); if (has) { // count = CountRejections(); for (int i = 0; i < count; i++) { rejections[i].To(value); } } // has = HasBullishRejections(); if (has) { // count = CountBullishRejections(); for (int i = 0; i < count; i++) { bullishRejections[i].To(value); } } // has = HasBearishRejections(); if (has) { // count = CountBearishRejections(); for (int i = 0; i < count; i++) { bearishRejections[i].To(value); } } // has = HasSupportZones(); if (has) { // count = CountSupportZones(); for (int i = 0; i < count; i++) { supportZones[i].To(value); } } // has = HasResistanceZones(); if (has) { // count = CountResistanceZones(); for (int i = 0; i < count; i++) { resistanceZones[i].To(value); } } // has = HasSupplyZones(); if (has) { // count = CountSupplyZones(); for (int i = 0; i < count; i++) { supplyZones[i].To(value); } } // has = HasDemandZones(); if (has) { // count = CountDemandZones(); for (int i = 0; i < count; i++) { demandZones[i].To(value); } } // has = HasOrderBlocks(); if (has) { // count = CountOrderBlocks(); for (int i = 0; i < count; i++) { orderBlocks[i].To(value); } } // has = HasBullishOrderBlocks(); if (has) { // count = CountBullishOrderBlocks(); for (int i = 0; i < count; i++) { bullishOrderBlocks[i].To(value); } } // has = HasBearishOrderBlocks(); if (has) { // count = CountBearishOrderBlocks(); for (int i = 0; i < count; i++) { bearishOrderBlocks[i].To(value); } } // has = HasFairValueGaps(); if (has) { // count = CountFairValueGaps(); for (int i = 0; i < count; i++) { fairValueGaps[i].To(value); } } // has = HasBullishFairValueGaps(); if (has) { // count = CountBullishFairValueGaps(); for (int i = 0; i < count; i++) { bullishFairValueGaps[i].To(value); } } // has = HasBearishFairValueGaps(); if (has) { // count = CountBearishFairValueGaps(); for (int i = 0; i < count; i++) { bearishFairValueGaps[i].To(value); } } // has = HasConsolidationZones(); if (has) { // count = CountConsolidationZones(); for (int i = 0; i < count; i++) { consolidationZones[i].to = value; } } // has = HasBullishConsolidationZones(); if (has) { // count = CountBullishConsolidationZones(); for (int i = 0; i < count; i++) { bullishConsolidationZones[i].to = value; } } // has = HasBearishConsolidationZones(); if (has) { // count = CountBearishConsolidationZones(); for (int i = 0; i < count; i++) { bearishConsolidationZones[i].to = value; } } // has = HasSpikes(); if (has) { // count = CountSpikes(); for (int i = 0; i < count; i++) { spikes[i].to = value; } } // has = HasBullishSpikes(); if (has) { // count = CountBullishSpikes(); for (int i = 0; i < count; i++) { bullishSpikes[i].to = value; } } // has = HasBearishSpikes(); if (has) { // count = CountBearishSpikes(); for (int i = 0; i < count; i++) { bearishSpikes[i].to = value; } } // has = HasSharps(); if (has) { // count = CountSharps(); for (int i = 0; i < count; i++) { sharps[i].to = value; } } // has = HasBullishSharps(); if (has) { // count = CountBullishSharps(); for (int i = 0; i < count; i++) { bullishSharps[i].to = value; } } // has = HasBearishSharps(); if (has) { // count = CountBearishSharps(); for (int i = 0; i < count; i++) { bearishSharps[i].to = value; } } } // // Filter Zones ... // // Support ... int FilterSupportZones( XCSupportZone *&dest[], ENUM_TIMEFRAMES forPeriod = NULL, // // Start ... ENUM_XZONE_STATE startState = XZONE_STATE_PASSED, bool forceStartedBodyOut = false, // // Activation ... ENUM_XZONE_STATE activeState = XZONE_STATE_FAILED, bool forceActivatedBodyIn = false, // // Breaktion ... ENUM_XZONE_STATE breakState = XZONE_STATE_FAILED, bool forceBreakedBodyOut = false, // // Works ... ENUM_XZONE_STATE workState = XZONE_STATE_FAILED, bool forceWorkedBodyOut = false // ) { // int result = 0; // int idx = -1; int count = 0; bool has = false; // Clean(dest); // if (!IsValid(forPeriod)) { forPeriod = period; } // has = IsValid() && HasSupportZones(); if (!has) { return result; } // XOHCL passedBar; ENUM_X_DIRECTION passedDir = X_DIRECTION_NONE; passedDir = X_DIRECTION_BULLISH; count = CountSupportZones(); for (int i = 0; i < count; i++) { // XCSupportZone *iZone = supportZones[i]; // // Check Started State ... if (startState == XZONE_STATE_PASSED || startState == XZONE_STATE_FAILED) { // bool isBodyOut = false; bool isStarted = iZone.IsStarted( passedDir, passedBar, isBodyOut, forPeriod // ); // bool isPassed = startState == XZONE_STATE_FAILED ? !isStarted : !forceStartedBodyOut ? isStarted : isStarted && isBodyOut; // passedBar.Clean(); if (!isPassed) { continue; } } // // Check Activation State ... if (activeState == XZONE_STATE_PASSED || activeState == XZONE_STATE_FAILED) { // bool isBodyIn = false; bool isActivated = iZone.IsActivated( passedDir, passedBar, isBodyIn, forceStartedBodyOut, forPeriod // ); // bool isPassed = activeState == XZONE_STATE_FAILED ? !isActivated : !forceActivatedBodyIn ? isActivated : isActivated && isBodyIn; // passedBar.Clean(); if (!isPassed) { continue; } } // // Check Break State ... if (breakState == XZONE_STATE_PASSED || breakState == XZONE_STATE_FAILED) { // bool isBodyOut = false; bool isBreaked = iZone.IsBreaked( passedDir, passedBar, isBodyOut, forceStartedBodyOut, forPeriod // ); // bool isPassed = breakState == XZONE_STATE_FAILED ? !isBreaked : !forceBreakedBodyOut ? isBreaked : isBreaked && isBodyOut; // passedBar.Clean(); if (!isPassed) { continue; } } // // Check Work State ... if (workState == XZONE_STATE_PASSED || workState == XZONE_STATE_FAILED) { // bool ignoreActivation = activeState != XZONE_STATE_PASSED; // bool isBodyOut = false; bool isWorked = iZone.IsWorked( passedDir, passedBar, isBodyOut, ignoreActivation, forceStartedBodyOut, forceActivatedBodyIn, forPeriod // ); // bool isPassed = workState == XZONE_STATE_FAILED ? !isWorked : !forceWorkedBodyOut ? isWorked : isWorked && isBodyOut; // passedBar.Clean(); if (!isPassed) { continue; } } // // Check Filtered Zone Doesn't Exists ... has = FindIndex( idx, iZone, dest // ); if (has) { // passedBar.Clean(); continue; } // Add( iZone, dest // ); // // End For ... } // result = ArraySize(dest); // return result; } // // Resistance ... int FilterResistanceZones( XCResistanceZone *&dest[], ENUM_TIMEFRAMES forPeriod = NULL, // // Start ... ENUM_XZONE_STATE startState = XZONE_STATE_PASSED, bool forceStartedBodyOut = false, // // Activation ... ENUM_XZONE_STATE activeState = XZONE_STATE_FAILED, bool forceActivatedBodyIn = false, // // Breaktion ... ENUM_XZONE_STATE breakState = XZONE_STATE_FAILED, bool forceBreakedBodyOut = false, // // Works ... ENUM_XZONE_STATE workState = XZONE_STATE_FAILED, bool forceWorkedBodyOut = false // ) { // int result = 0; // int idx = -1; int count = 0; bool has = false; // Clean(dest); // if (!IsValid(forPeriod)) { forPeriod = period; } // has = IsValid() && HasResistanceZones(); if (!has) { return result; } // XOHCL passedBar; ENUM_X_DIRECTION passedDir = X_DIRECTION_NONE; passedDir = X_DIRECTION_BEARISH; count = CountResistanceZones(); for (int i = 0; i < count; i++) { // XCResistanceZone *iZone = resistanceZones[i]; // // Check Started State ... if (startState == XZONE_STATE_PASSED || startState == XZONE_STATE_FAILED) { // bool isBodyOut = false; bool isStarted = iZone.IsStarted( passedDir, passedBar, isBodyOut, forPeriod // ); // bool isPassed = startState == XZONE_STATE_FAILED ? !isStarted : !forceStartedBodyOut ? isStarted : isStarted && isBodyOut; // passedBar.Clean(); if (!isPassed) { continue; } } // // Check Activation State ... if (activeState == XZONE_STATE_PASSED || activeState == XZONE_STATE_FAILED) { // bool isBodyIn = false; bool isActivated = iZone.IsActivated( passedDir, passedBar, isBodyIn, forceStartedBodyOut, forPeriod // ); // bool isPassed = activeState == XZONE_STATE_FAILED ? !isActivated : !forceActivatedBodyIn ? isActivated : isActivated && isBodyIn; // passedBar.Clean(); if (!isPassed) { continue; } } // // Check Break State ... if (breakState == XZONE_STATE_PASSED || breakState == XZONE_STATE_FAILED) { // bool isBodyOut = false; bool isBreaked = iZone.IsBreaked( passedDir, passedBar, isBodyOut, forceStartedBodyOut, forPeriod // ); // bool isPassed = breakState == XZONE_STATE_FAILED ? !isBreaked : !forceBreakedBodyOut ? isBreaked : isBreaked && isBodyOut; // passedBar.Clean(); if (!isPassed) { continue; } } // // Check Work State ... if (workState == XZONE_STATE_PASSED || workState == XZONE_STATE_FAILED) { // bool ignoreActivation = activeState != XZONE_STATE_PASSED; // bool isBodyOut = false; bool isWorked = iZone.IsWorked( passedDir, passedBar, isBodyOut, ignoreActivation, forceStartedBodyOut, forceActivatedBodyIn, forPeriod // ); // bool isPassed = workState == XZONE_STATE_FAILED ? !isWorked : !forceWorkedBodyOut ? isWorked : isWorked && isBodyOut; // passedBar.Clean(); if (!isPassed) { continue; } } // // Check Filtered Zone Doesn't Exists ... has = FindIndex( idx, iZone, dest // ); if (has) { // passedBar.Clean(); continue; } // Add( iZone, dest // ); // // End For ... } // result = ArraySize(dest); // return result; } // // Supply ... int FilterSupplyZones( XCSupplyZone *&dest[], ENUM_TIMEFRAMES forPeriod = NULL, // // Start ... ENUM_XZONE_STATE startState = XZONE_STATE_PASSED, bool forceStartedBodyOut = false, // // Activation ... ENUM_XZONE_STATE activeState = XZONE_STATE_FAILED, bool forceActivatedBodyIn = false, // // Breaktion ... ENUM_XZONE_STATE breakState = XZONE_STATE_FAILED, bool forceBreakedBodyOut = false, // // Works ... ENUM_XZONE_STATE workState = XZONE_STATE_FAILED, bool forceWorkedBodyOut = false // ) { // int result = 0; // int idx = -1; int count = 0; bool has = false; // Clean(dest); // if (!IsValid(forPeriod)) { forPeriod = period; } // has = IsValid() && HasSupplyZones(); if (!has) { return result; } // XOHCL passedBar; ENUM_X_DIRECTION passedDir = X_DIRECTION_NONE; passedDir = X_DIRECTION_BEARISH; count = CountSupplyZones(); for (int i = 0; i < count; i++) { // XCSupplyZone *iZone = supplyZones[i]; // // Check Started State ... if (startState == XZONE_STATE_PASSED || startState == XZONE_STATE_FAILED) { // bool isBodyOut = false; bool isStarted = iZone.IsStarted( passedDir, passedBar, isBodyOut, forPeriod // ); // bool isPassed = startState == XZONE_STATE_FAILED ? !isStarted : !forceStartedBodyOut ? isStarted : isStarted && isBodyOut; // passedBar.Clean(); if (!isPassed) { continue; } } // // Check Activation State ... if (activeState == XZONE_STATE_PASSED || activeState == XZONE_STATE_FAILED) { // bool isBodyIn = false; bool isActivated = iZone.IsActivated( passedDir, passedBar, isBodyIn, forceStartedBodyOut, forPeriod // ); // bool isPassed = activeState == XZONE_STATE_FAILED ? !isActivated : !forceActivatedBodyIn ? isActivated : isActivated && isBodyIn; // passedBar.Clean(); if (!isPassed) { continue; } } // // Check Break State ... if (breakState == XZONE_STATE_PASSED || breakState == XZONE_STATE_FAILED) { // bool isBodyOut = false; bool isBreaked = iZone.IsBreaked( passedDir, passedBar, isBodyOut, forceStartedBodyOut, forPeriod // ); // bool isPassed = breakState == XZONE_STATE_FAILED ? !isBreaked : !forceBreakedBodyOut ? isBreaked : isBreaked && isBodyOut; // passedBar.Clean(); if (!isPassed) { continue; } } // // Check Work State ... if (workState == XZONE_STATE_PASSED || workState == XZONE_STATE_FAILED) { // bool ignoreActivation = activeState != XZONE_STATE_PASSED; // bool isBodyOut = false; bool isWorked = iZone.IsWorked( passedDir, passedBar, isBodyOut, ignoreActivation, forceStartedBodyOut, forceActivatedBodyIn, forPeriod // ); // bool isPassed = workState == XZONE_STATE_FAILED ? !isWorked : !forceWorkedBodyOut ? isWorked : isWorked && isBodyOut; // passedBar.Clean(); if (!isPassed) { continue; } } // // Check Filtered Zone Doesn't Exists ... has = FindIndex( idx, iZone, dest // ); if (has) { // passedBar.Clean(); continue; } // Add( iZone, dest // ); // // End For ... } // result = ArraySize(dest); // return result; } // // Demand ... int FilterDemandZones( XCDemandZone *&dest[], ENUM_TIMEFRAMES forPeriod = NULL, // // Start ... ENUM_XZONE_STATE startState = XZONE_STATE_PASSED, bool forceStartedBodyOut = false, // // Activation ... ENUM_XZONE_STATE activeState = XZONE_STATE_FAILED, bool forceActivatedBodyIn = false, // // Breaktion ... ENUM_XZONE_STATE breakState = XZONE_STATE_FAILED, bool forceBreakedBodyOut = false, // // Works ... ENUM_XZONE_STATE workState = XZONE_STATE_FAILED, bool forceWorkedBodyOut = false // ) { // int result = 0; // int idx = -1; int count = 0; bool has = false; // Clean(dest); // if (!IsValid(forPeriod)) { forPeriod = period; } // has = IsValid() && HasDemandZones(); if (!has) { return result; } // XOHCL passedBar; ENUM_X_DIRECTION passedDir = X_DIRECTION_NONE; passedDir = X_DIRECTION_BULLISH; count = CountDemandZones(); for (int i = 0; i < count; i++) { // XCDemandZone *iZone = demandZones[i]; // // Check Started State ... if (startState == XZONE_STATE_PASSED || startState == XZONE_STATE_FAILED) { // bool isBodyOut = false; bool isStarted = iZone.IsStarted( passedDir, passedBar, isBodyOut, forPeriod // ); // bool isPassed = startState == XZONE_STATE_FAILED ? !isStarted : !forceStartedBodyOut ? isStarted : isStarted && isBodyOut; // passedBar.Clean(); if (!isPassed) { continue; } } // // Check Activation State ... if (activeState == XZONE_STATE_PASSED || activeState == XZONE_STATE_FAILED) { // bool isBodyIn = false; bool isActivated = iZone.IsActivated( passedDir, passedBar, isBodyIn, forceStartedBodyOut, forPeriod // ); // bool isPassed = activeState == XZONE_STATE_FAILED ? !isActivated : !forceActivatedBodyIn ? isActivated : isActivated && isBodyIn; // passedBar.Clean(); if (!isPassed) { continue; } } // // Check Break State ... if (breakState == XZONE_STATE_PASSED || breakState == XZONE_STATE_FAILED) { // bool isBodyOut = false; bool isBreaked = iZone.IsBreaked( passedDir, passedBar, isBodyOut, forceStartedBodyOut, forPeriod // ); // bool isPassed = breakState == XZONE_STATE_FAILED ? !isBreaked : !forceBreakedBodyOut ? isBreaked : isBreaked && isBodyOut; // passedBar.Clean(); if (!isPassed) { continue; } } // // Check Work State ... if (workState == XZONE_STATE_PASSED || workState == XZONE_STATE_FAILED) { // bool ignoreActivation = activeState != XZONE_STATE_PASSED; // bool isBodyOut = false; bool isWorked = iZone.IsWorked( passedDir, passedBar, isBodyOut, ignoreActivation, forceStartedBodyOut, forceActivatedBodyIn, forPeriod // ); // bool isPassed = workState == XZONE_STATE_FAILED ? !isWorked : !forceWorkedBodyOut ? isWorked : isWorked && isBodyOut; // passedBar.Clean(); if (!isPassed) { continue; } } // // Check Filtered Zone Doesn't Exists ... has = FindIndex( idx, iZone, dest // ); if (has) { // passedBar.Clean(); continue; } // Add( iZone, dest // ); // // End For ... } // result = ArraySize(dest); // return result; } // // OrderBlock ... int FilterOrderBlocks( XCOrderBlock *&dest[], ENUM_TIMEFRAMES forPeriod = NULL, // // Start ... ENUM_XZONE_STATE startState = XZONE_STATE_PASSED, bool forceStartedBodyOut = false, // // Activation ... ENUM_XZONE_STATE activeState = XZONE_STATE_FAILED, bool forceActivatedBodyIn = false, // // Breaktion ... ENUM_XZONE_STATE breakState = XZONE_STATE_FAILED, bool forceBreakedBodyOut = false, // // Works ... ENUM_XZONE_STATE workState = XZONE_STATE_FAILED, bool forceWorkedBodyOut = false // ) { // int result = 0; // int idx = -1; int count = 0; bool has = false; // Clean(dest); // if (!IsValid(forPeriod)) { forPeriod = period; } // has = IsValid() && HasOrderBlocks(); if (!has) { return result; } // XOHCL passedBar; ENUM_X_DIRECTION passedDir = X_DIRECTION_NONE; count = CountOrderBlocks(); for (int i = 0; i < count; i++) { // XCOrderBlock *iZone = orderBlocks[i]; passedDir = iZone.GetDirection(); // // Check Started State ... if (startState == XZONE_STATE_PASSED || startState == XZONE_STATE_FAILED) { // bool isBodyOut = false; bool isStarted = iZone.IsStarted( passedDir, passedBar, isBodyOut, forPeriod // ); // bool isPassed = startState == XZONE_STATE_FAILED ? !isStarted : !forceStartedBodyOut ? isStarted : isStarted && isBodyOut; // passedBar.Clean(); if (!isPassed) { continue; } } // // Check Activation State ... if (activeState == XZONE_STATE_PASSED || activeState == XZONE_STATE_FAILED) { // bool isBodyIn = false; bool isActivated = iZone.IsActivated( passedDir, passedBar, isBodyIn, forceStartedBodyOut, forPeriod // ); // bool isPassed = activeState == XZONE_STATE_FAILED ? !isActivated : !forceActivatedBodyIn ? isActivated : isActivated && isBodyIn; // passedBar.Clean(); if (!isPassed) { continue; } } // // Check Break State ... if (breakState == XZONE_STATE_PASSED || breakState == XZONE_STATE_FAILED) { // bool isBodyOut = false; bool isBreaked = iZone.IsBreaked( passedDir, passedBar, isBodyOut, forceStartedBodyOut, forPeriod // ); // bool isPassed = breakState == XZONE_STATE_FAILED ? !isBreaked : !forceBreakedBodyOut ? isBreaked : isBreaked && isBodyOut; // passedBar.Clean(); if (!isPassed) { continue; } } // // Check Work State ... if (workState == XZONE_STATE_PASSED || workState == XZONE_STATE_FAILED) { // bool ignoreActivation = activeState != XZONE_STATE_PASSED; // bool isBodyOut = false; bool isWorked = iZone.IsWorked( passedDir, passedBar, isBodyOut, ignoreActivation, forceStartedBodyOut, forceActivatedBodyIn, forPeriod // ); // bool isPassed = workState == XZONE_STATE_FAILED ? !isWorked : !forceWorkedBodyOut ? isWorked : isWorked && isBodyOut; // passedBar.Clean(); if (!isPassed) { continue; } } // // Check Filtered Zone Doesn't Exists ... has = FindIndex( idx, iZone, dest // ); if (has) { // passedBar.Clean(); continue; } // Add( iZone, dest // ); // // End For ... } // result = ArraySize(dest); // return result; } // // Bullish OrderBlock ... int FilterBullishOrderBlocks( XCOrderBlock *&dest[], ENUM_TIMEFRAMES forPeriod = NULL, // // Start ... ENUM_XZONE_STATE startState = XZONE_STATE_PASSED, bool forceStartedBodyOut = false, // // Activation ... ENUM_XZONE_STATE activeState = XZONE_STATE_FAILED, bool forceActivatedBodyIn = false, // // Breaktion ... ENUM_XZONE_STATE breakState = XZONE_STATE_FAILED, bool forceBreakedBodyOut = false, // // Works ... ENUM_XZONE_STATE workState = XZONE_STATE_FAILED, bool forceWorkedBodyOut = false // ) { // int result = 0; // int idx = -1; int count = 0; bool has = false; // Clean(dest); // if (!IsValid(forPeriod)) { forPeriod = period; } // has = IsValid() && HasBullishOrderBlocks(); if (!has) { return result; } // XOHCL passedBar; ENUM_X_DIRECTION passedDir = X_DIRECTION_NONE; passedDir = X_DIRECTION_BULLISH; count = CountBullishOrderBlocks(); for (int i = 0; i < count; i++) { // XCOrderBlock *iZone = bullishOrderBlocks[i]; // // Check Started State ... if (startState == XZONE_STATE_PASSED || startState == XZONE_STATE_FAILED) { // bool isBodyOut = false; bool isStarted = iZone.IsStarted( passedDir, passedBar, isBodyOut, forPeriod // ); // bool isPassed = startState == XZONE_STATE_FAILED ? !isStarted : !forceStartedBodyOut ? isStarted : isStarted && isBodyOut; // passedBar.Clean(); if (!isPassed) { continue; } } // // Check Activation State ... if (activeState == XZONE_STATE_PASSED || activeState == XZONE_STATE_FAILED) { // bool isBodyIn = false; bool isActivated = iZone.IsActivated( passedDir, passedBar, isBodyIn, forceStartedBodyOut, forPeriod // ); // bool isPassed = activeState == XZONE_STATE_FAILED ? !isActivated : !forceActivatedBodyIn ? isActivated : isActivated && isBodyIn; // passedBar.Clean(); if (!isPassed) { continue; } } // // Check Break State ... if (breakState == XZONE_STATE_PASSED || breakState == XZONE_STATE_FAILED) { // bool isBodyOut = false; bool isBreaked = iZone.IsBreaked( passedDir, passedBar, isBodyOut, forceStartedBodyOut, forPeriod // ); // bool isPassed = breakState == XZONE_STATE_FAILED ? !isBreaked : !forceBreakedBodyOut ? isBreaked : isBreaked && isBodyOut; // passedBar.Clean(); if (!isPassed) { continue; } } // // Check Work State ... if (workState == XZONE_STATE_PASSED || workState == XZONE_STATE_FAILED) { // bool ignoreActivation = activeState != XZONE_STATE_PASSED; // bool isBodyOut = false; bool isWorked = iZone.IsWorked( passedDir, passedBar, isBodyOut, ignoreActivation, forceStartedBodyOut, forceActivatedBodyIn, forPeriod // ); // bool isPassed = workState == XZONE_STATE_FAILED ? !isWorked : !forceWorkedBodyOut ? isWorked : isWorked && isBodyOut; // passedBar.Clean(); if (!isPassed) { continue; } } // // Check Filtered Zone Doesn't Exists ... has = FindIndex( idx, iZone, dest // ); if (has) { // passedBar.Clean(); continue; } // Add( iZone, dest // ); // // End For ... } // result = ArraySize(dest); // return result; } // // Bearish OrderBlock ... int FilterBearishOrderBlocks( XCOrderBlock *&dest[], ENUM_TIMEFRAMES forPeriod = NULL, // // Start ... ENUM_XZONE_STATE startState = XZONE_STATE_PASSED, bool forceStartedBodyOut = false, // // Activation ... ENUM_XZONE_STATE activeState = XZONE_STATE_FAILED, bool forceActivatedBodyIn = false, // // Breaktion ... ENUM_XZONE_STATE breakState = XZONE_STATE_FAILED, bool forceBreakedBodyOut = false, // // Works ... ENUM_XZONE_STATE workState = XZONE_STATE_FAILED, bool forceWorkedBodyOut = false // ) { // int result = 0; // int idx = -1; int count = 0; bool has = false; // Clean(dest); // if (!IsValid(forPeriod)) { forPeriod = period; } // has = IsValid() && HasBearishOrderBlocks(); if (!has) { return result; } // XOHCL passedBar; ENUM_X_DIRECTION passedDir = X_DIRECTION_NONE; passedDir = X_DIRECTION_BEARISH; count = CountBearishOrderBlocks(); for (int i = 0; i < count; i++) { // XCOrderBlock *iZone = bearishOrderBlocks[i]; // // Check Started State ... if (startState == XZONE_STATE_PASSED || startState == XZONE_STATE_FAILED) { // bool isBodyOut = false; bool isStarted = iZone.IsStarted( passedDir, passedBar, isBodyOut, forPeriod // ); // bool isPassed = startState == XZONE_STATE_FAILED ? !isStarted : !forceStartedBodyOut ? isStarted : isStarted && isBodyOut; // passedBar.Clean(); if (!isPassed) { continue; } } // // Check Activation State ... if (activeState == XZONE_STATE_PASSED || activeState == XZONE_STATE_FAILED) { // bool isBodyIn = false; bool isActivated = iZone.IsActivated( passedDir, passedBar, isBodyIn, forceStartedBodyOut, forPeriod // ); // bool isPassed = activeState == XZONE_STATE_FAILED ? !isActivated : !forceActivatedBodyIn ? isActivated : isActivated && isBodyIn; // passedBar.Clean(); if (!isPassed) { continue; } } // // Check Break State ... if (breakState == XZONE_STATE_PASSED || breakState == XZONE_STATE_FAILED) { // bool isBodyOut = false; bool isBreaked = iZone.IsBreaked( passedDir, passedBar, isBodyOut, forceStartedBodyOut, forPeriod // ); // bool isPassed = breakState == XZONE_STATE_FAILED ? !isBreaked : !forceBreakedBodyOut ? isBreaked : isBreaked && isBodyOut; // passedBar.Clean(); if (!isPassed) { continue; } } // // Check Work State ... if (workState == XZONE_STATE_PASSED || workState == XZONE_STATE_FAILED) { // bool ignoreActivation = activeState != XZONE_STATE_PASSED; // bool isBodyOut = false; bool isWorked = iZone.IsWorked( passedDir, passedBar, isBodyOut, ignoreActivation, forceStartedBodyOut, forceActivatedBodyIn, forPeriod // ); // bool isPassed = workState == XZONE_STATE_FAILED ? !isWorked : !forceWorkedBodyOut ? isWorked : isWorked && isBodyOut; // passedBar.Clean(); if (!isPassed) { continue; } } // // Check Filtered Zone Doesn't Exists ... has = FindIndex( idx, iZone, dest // ); if (has) { // passedBar.Clean(); continue; } // Add( iZone, dest // ); // // End For ... } // result = ArraySize(dest); // return result; } // // FairValueGap ... int FilterFairValueGaps( XCFVG *&dest[], ENUM_TIMEFRAMES forPeriod = NULL, // // Start ... ENUM_XZONE_STATE startState = XZONE_STATE_PASSED, bool forceStartedBodyOut = false, // // Activation ... ENUM_XZONE_STATE activeState = XZONE_STATE_FAILED, bool forceActivatedBodyIn = false, // // Breaktion ... ENUM_XZONE_STATE breakState = XZONE_STATE_FAILED, bool forceBreakedBodyOut = false, // // Works ... ENUM_XZONE_STATE workState = XZONE_STATE_FAILED, bool forceWorkedBodyOut = false // ) { // int result = 0; // int idx = -1; int count = 0; bool has = false; // Clean(dest); // if (!IsValid(forPeriod)) { forPeriod = period; } // has = IsValid() && HasFairValueGaps(); if (!has) { return result; } // XOHCL passedBar; ENUM_X_DIRECTION passedDir = X_DIRECTION_NONE; count = CountFairValueGaps(); for (int i = 0; i < count; i++) { // XCFVG *iZone = fairValueGaps[i]; passedDir = iZone.GetDirection(); // // Check Started State ... if (startState == XZONE_STATE_PASSED || startState == XZONE_STATE_FAILED) { // bool isBodyOut = false; bool isStarted = iZone.IsStarted( passedDir, passedBar, isBodyOut, forPeriod // ); // bool isPassed = startState == XZONE_STATE_FAILED ? !isStarted : !forceStartedBodyOut ? isStarted : isStarted && isBodyOut; // passedBar.Clean(); if (!isPassed) { continue; } } // // Check Activation State ... if (activeState == XZONE_STATE_PASSED || activeState == XZONE_STATE_FAILED) { // bool isBodyIn = false; bool isActivated = iZone.IsActivated( passedDir, passedBar, isBodyIn, forceStartedBodyOut, forPeriod // ); // bool isPassed = activeState == XZONE_STATE_FAILED ? !isActivated : !forceActivatedBodyIn ? isActivated : isActivated && isBodyIn; // passedBar.Clean(); if (!isPassed) { continue; } } // // Check Break State ... if (breakState == XZONE_STATE_PASSED || breakState == XZONE_STATE_FAILED) { // bool isBodyOut = false; bool isBreaked = iZone.IsBreaked( passedDir, passedBar, isBodyOut, forceStartedBodyOut, forPeriod // ); // bool isPassed = breakState == XZONE_STATE_FAILED ? !isBreaked : !forceBreakedBodyOut ? isBreaked : isBreaked && isBodyOut; // passedBar.Clean(); if (!isPassed) { continue; } } // // Check Work State ... if (workState == XZONE_STATE_PASSED || workState == XZONE_STATE_FAILED) { // bool ignoreActivation = activeState != XZONE_STATE_PASSED; // bool isBodyOut = false; bool isWorked = iZone.IsWorked( passedDir, passedBar, isBodyOut, ignoreActivation, forceStartedBodyOut, forceActivatedBodyIn, forPeriod // ); // bool isPassed = workState == XZONE_STATE_FAILED ? !isWorked : !forceWorkedBodyOut ? isWorked : isWorked && isBodyOut; // passedBar.Clean(); if (!isPassed) { continue; } } // // Check Filtered Zone Doesn't Exists ... has = FindIndex( idx, iZone, dest // ); if (has) { // passedBar.Clean(); continue; } // Add( iZone, dest // ); // // End For ... } // result = ArraySize(dest); // return result; } // // Bullish FairValueGap ... int FilterBullishFairValueGaps( XCFVG *&dest[], ENUM_TIMEFRAMES forPeriod = NULL, // // Start ... ENUM_XZONE_STATE startState = XZONE_STATE_PASSED, bool forceStartedBodyOut = false, // // Activation ... ENUM_XZONE_STATE activeState = XZONE_STATE_FAILED, bool forceActivatedBodyIn = false, // // Breaktion ... ENUM_XZONE_STATE breakState = XZONE_STATE_FAILED, bool forceBreakedBodyOut = false, // // Works ... ENUM_XZONE_STATE workState = XZONE_STATE_FAILED, bool forceWorkedBodyOut = false // ) { // int result = 0; // int idx = -1; int count = 0; bool has = false; // Clean(dest); // if (!IsValid(forPeriod)) { forPeriod = period; } // has = IsValid() && HasBullishFairValueGaps(); if (!has) { return result; } // XOHCL passedBar; ENUM_X_DIRECTION passedDir = X_DIRECTION_NONE; passedDir = X_DIRECTION_BULLISH; count = CountBullishFairValueGaps(); for (int i = 0; i < count; i++) { // XCFVG *iZone = bullishFairValueGaps[i]; // // Check Started State ... if (startState == XZONE_STATE_PASSED || startState == XZONE_STATE_FAILED) { // bool isBodyOut = false; bool isStarted = iZone.IsStarted( passedDir, passedBar, isBodyOut, forPeriod // ); // bool isPassed = startState == XZONE_STATE_FAILED ? !isStarted : !forceStartedBodyOut ? isStarted : isStarted && isBodyOut; // passedBar.Clean(); if (!isPassed) { continue; } } // // Check Activation State ... if (activeState == XZONE_STATE_PASSED || activeState == XZONE_STATE_FAILED) { // bool isBodyIn = false; bool isActivated = iZone.IsActivated( passedDir, passedBar, isBodyIn, forceStartedBodyOut, forPeriod // ); // bool isPassed = activeState == XZONE_STATE_FAILED ? !isActivated : !forceActivatedBodyIn ? isActivated : isActivated && isBodyIn; // passedBar.Clean(); if (!isPassed) { continue; } } // // Check Break State ... if (breakState == XZONE_STATE_PASSED || breakState == XZONE_STATE_FAILED) { // bool isBodyOut = false; bool isBreaked = iZone.IsBreaked( passedDir, passedBar, isBodyOut, forceStartedBodyOut, forPeriod // ); // bool isPassed = breakState == XZONE_STATE_FAILED ? !isBreaked : !forceBreakedBodyOut ? isBreaked : isBreaked && isBodyOut; // passedBar.Clean(); if (!isPassed) { continue; } } // // Check Work State ... if (workState == XZONE_STATE_PASSED || workState == XZONE_STATE_FAILED) { // bool ignoreActivation = activeState != XZONE_STATE_PASSED; // bool isBodyOut = false; bool isWorked = iZone.IsWorked( passedDir, passedBar, isBodyOut, ignoreActivation, forceStartedBodyOut, forceActivatedBodyIn, forPeriod // ); // bool isPassed = workState == XZONE_STATE_FAILED ? !isWorked : !forceWorkedBodyOut ? isWorked : isWorked && isBodyOut; // passedBar.Clean(); if (!isPassed) { continue; } } // // Check Filtered Zone Doesn't Exists ... has = FindIndex( idx, iZone, dest // ); if (has) { // passedBar.Clean(); continue; } // Add( iZone, dest // ); // // End For ... } // result = ArraySize(dest); // return result; } // // Bearish FairValueGap ... int FilterBearishFairValueGaps( XCFVG *&dest[], ENUM_TIMEFRAMES forPeriod = NULL, // // Start ... ENUM_XZONE_STATE startState = XZONE_STATE_PASSED, bool forceStartedBodyOut = false, // // Activation ... ENUM_XZONE_STATE activeState = XZONE_STATE_FAILED, bool forceActivatedBodyIn = false, // // Breaktion ... ENUM_XZONE_STATE breakState = XZONE_STATE_FAILED, bool forceBreakedBodyOut = false, // // Works ... ENUM_XZONE_STATE workState = XZONE_STATE_FAILED, bool forceWorkedBodyOut = false // ) { // int result = 0; // int idx = -1; int count = 0; bool has = false; // Clean(dest); // if (!IsValid(forPeriod)) { forPeriod = period; } // has = IsValid() && HasBearishFairValueGaps(); if (!has) { return result; } // XOHCL passedBar; ENUM_X_DIRECTION passedDir = X_DIRECTION_NONE; passedDir = X_DIRECTION_BEARISH; count = CountBearishFairValueGaps(); for (int i = 0; i < count; i++) { // XCFVG *iZone = bearishFairValueGaps[i]; // // Check Started State ... if (startState == XZONE_STATE_PASSED || startState == XZONE_STATE_FAILED) { // bool isBodyOut = false; bool isStarted = iZone.IsStarted( passedDir, passedBar, isBodyOut, forPeriod // ); // bool isPassed = startState == XZONE_STATE_FAILED ? !isStarted : !forceStartedBodyOut ? isStarted : isStarted && isBodyOut; // passedBar.Clean(); if (!isPassed) { continue; } } // // Check Activation State ... if (activeState == XZONE_STATE_PASSED || activeState == XZONE_STATE_FAILED) { // bool isBodyIn = false; bool isActivated = iZone.IsActivated( passedDir, passedBar, isBodyIn, forceStartedBodyOut, forPeriod // ); // bool isPassed = activeState == XZONE_STATE_FAILED ? !isActivated : !forceActivatedBodyIn ? isActivated : isActivated && isBodyIn; // passedBar.Clean(); if (!isPassed) { continue; } } // // Check Break State ... if (breakState == XZONE_STATE_PASSED || breakState == XZONE_STATE_FAILED) { // bool isBodyOut = false; bool isBreaked = iZone.IsBreaked( passedDir, passedBar, isBodyOut, forceStartedBodyOut, forPeriod // ); // bool isPassed = breakState == XZONE_STATE_FAILED ? !isBreaked : !forceBreakedBodyOut ? isBreaked : isBreaked && isBodyOut; // passedBar.Clean(); if (!isPassed) { continue; } } // // Check Work State ... if (workState == XZONE_STATE_PASSED || workState == XZONE_STATE_FAILED) { // bool ignoreActivation = activeState != XZONE_STATE_PASSED; // bool isBodyOut = false; bool isWorked = iZone.IsWorked( passedDir, passedBar, isBodyOut, ignoreActivation, forceStartedBodyOut, forceActivatedBodyIn, forPeriod // ); // bool isPassed = workState == XZONE_STATE_FAILED ? !isWorked : !forceWorkedBodyOut ? isWorked : isWorked && isBodyOut; // passedBar.Clean(); if (!isPassed) { continue; } } // // Check Filtered Zone Doesn't Exists ... has = FindIndex( idx, iZone, dest // ); if (has) { // passedBar.Clean(); continue; } // Add( iZone, dest // ); // // End For ... } // result = ArraySize(dest); // return result; } // void Filter( XPOIState &dest, ENUM_TIMEFRAMES forPeriod = NULL, // // Start ... ENUM_XZONE_STATE startState = XZONE_STATE_PASSED, bool forceStartedBodyOut = false, // // Activation ... ENUM_XZONE_STATE activeState = XZONE_STATE_FAILED, bool forceActivatedBodyIn = false, // // Breaktion ... ENUM_XZONE_STATE breakState = XZONE_STATE_FAILED, bool forceBreakedBodyOut = false, // // Works ... ENUM_XZONE_STATE workState = XZONE_STATE_FAILED, bool forceWorkedBodyOut = false // ) { // int count = 0; bool has = false; // dest.Clean(); // if (!IsValid(forPeriod)) { forPeriod = period; } // has = IsValid() && HasChild(); if (!has) { return; } // dest = this; // // Support Zones ... FilterSupportZones( dest.supportZones, forPeriod, startState, forceStartedBodyOut, activeState, forceActivatedBodyIn, breakState, forceBreakedBodyOut, workState, forceWorkedBodyOut // ); // // Resistance Zones ... FilterResistanceZones( dest.resistanceZones, forPeriod, startState, forceStartedBodyOut, activeState, forceActivatedBodyIn, breakState, forceBreakedBodyOut, workState, forceWorkedBodyOut // ); // // Supply Zones ... FilterSupplyZones( dest.supplyZones, forPeriod, startState, forceStartedBodyOut, activeState, forceActivatedBodyIn, breakState, forceBreakedBodyOut, workState, forceWorkedBodyOut // ); // // Demand Zones ... FilterDemandZones( dest.demandZones, forPeriod, startState, forceStartedBodyOut, activeState, forceActivatedBodyIn, breakState, forceBreakedBodyOut, workState, forceWorkedBodyOut // ); // // OrderBlocks ... FilterOrderBlocks( dest.orderBlocks, forPeriod, startState, forceStartedBodyOut, activeState, forceActivatedBodyIn, breakState, forceBreakedBodyOut, workState, forceWorkedBodyOut // ); // // Bullish OrderBlocks ... FilterBullishOrderBlocks( dest.bullishOrderBlocks, forPeriod, startState, forceStartedBodyOut, activeState, forceActivatedBodyIn, breakState, forceBreakedBodyOut, workState, forceWorkedBodyOut // ); // // Bearish OrderBlocks ... FilterBearishOrderBlocks( dest.bearishOrderBlocks, forPeriod, startState, forceStartedBodyOut, activeState, forceActivatedBodyIn, breakState, forceBreakedBodyOut, workState, forceWorkedBodyOut // ); // // FairValueGaps ... FilterFairValueGaps( dest.fairValueGaps, forPeriod, startState, forceStartedBodyOut, activeState, forceActivatedBodyIn, breakState, forceBreakedBodyOut, workState, forceWorkedBodyOut // ); // // Bullish FairValueGaps ... FilterBullishFairValueGaps( dest.bullishFairValueGaps, forPeriod, startState, forceStartedBodyOut, activeState, forceActivatedBodyIn, breakState, forceBreakedBodyOut, workState, forceWorkedBodyOut // ); // // Bearish FairValueGaps ... FilterBearishFairValueGaps( dest.bearishFairValueGaps, forPeriod, startState, forceStartedBodyOut, activeState, forceActivatedBodyIn, breakState, forceBreakedBodyOut, workState, forceWorkedBodyOut // ); // } // }; // // Extensions Functions ... // /** * Update to Time of Specifiex Collection ... * * @param items: XOBFVG instance Collection ... * @param value: datetime ... */ void SpecifiedUpdateTo( XOBFVG &items[], datetime value = NULL // ) { // value = NormalizeTime(value); // int count = ArraySize(items); bool has = HasChild(items); if (!has) { return; } // for (int i = 0; i < count; i++) { items[i].UpdateTo(value); } } /** * Extract Box Zone's of Specified OBFVG ... * * @param box: XBoxZone instance, represent result ... * @param obfvg: XOBFVG instance, specified Model ... * * @return ( bool ) */ bool ToZoneBox( XBoxZone &box, XOBFVG &obfvg // ) { // bool result = false; // box.Clean(); // // Check Model Validation ... result = obfvg.IsValid(); if (!result) { return result; } // // Retrieve Model Main Fair Value Gap ... XCFVG *fvg; result = obfvg.GetMainFVG(fvg); if (!result) { // box.Clean(); ZeroMemory(fvg); // return result; } // bool isBullish = fvg.IsBullish(); // // Retrieve Main Fair Value Gap's Started Bar ... XOHCL startedBar; bool isBodyOut = false; bool isStarted = fvg.IsStarted( fvg.GetDirection(), startedBar, isBodyOut // ); result = isStarted; if (!result) { // box.Clean(); ZeroMemory(fvg); startedBar.Clean(); // return result; } // // Converts Main Fair Value Gaps to Box ... result = ToBox( box, fvg // ); if (!result) { // box.Clean(); ZeroMemory(fvg); startedBar.Clean(); // return result; } // // Validate Start Bar ... result = isBullish ? startedBar.high >= fvg.Upper() && startedBar.low < fvg.Upper() : startedBar.low <= fvg.Lower() && startedBar.high > fvg.Lower(); if (!result) { // box.Clean(); ZeroMemory(fvg); startedBar.Clean(); // return result; } // // Update Box using Started Bar ... box.lower = isBullish ? box.lower : startedBar.low; box.upper = isBullish ? startedBar.high : box.upper; // box.from = startedBar.NextAt(); // // Check Box Validation ... result = box.IsValid(); if (!result) { box.Clean(); } // // Cleanup Resources ... ZeroMemory(fvg); startedBar.Clean(); // return result; } /** * Converts to XBoxZone ... * * @return ( bool ) */ bool ToBox( XBoxZone &box, XOBFVG &item // ) { // bool result = false; // result = ToBox( box, item.ob // ); // return result; } /** * Converts to XBoxZone ... * * @return ( bool ) */ int ToBox( XOBFVG &source[], XBoxZone &dest[] // ) { // int result = 0; // Clean(dest); int count = ArraySize(source); if (!IsValidSize(count)) { return result; } // for (int i = 0; i < count; i++) { // XOBFVG iZone = source[i]; // XBoxZone iBox; bool hasBox = ToBox( iBox, iZone // ); // if (hasBox) { // AddRef( iBox, dest // ); } // iBox.Clean(); iZone.Clean(); } // result = ArraySize(dest); // return result; } // // // /** * Get Oldest Index ... * * @param source: XOBFVG instance Reference Collection ... * * @return ( int ) */ int GetOldest( XOBFVG &source[] // ) { // int result = -1; // int count = ArraySize(source); if (!IsValidSize(count)) { return result; } // XBoxZone tmpBoxes[]; int boxesCount = ToBox( source, tmpBoxes // ); if (!IsValidSize(boxesCount)) { // Clean(tmpBoxes); return result; } // XBoxZone selected; for (int i = 0; i < boxesCount; i++) { // XBoxZone iBox = tmpBoxes[i]; // bool canSet = !selected.IsValid() ? true : selected.from > iBox.from; if (canSet) { // result = i; selected = iBox; } } // Clean(tmpBoxes); selected.Clean(); // return result; } /** * Get Youngest Index ... * * @param source: XOBFVG instance Reference Collection ... * * @return ( int ) */ int GetYoungest( XOBFVG &source[] // ) { // int result = -1; // int count = ArraySize(source); if (!IsValidSize(count)) { return result; } // XBoxZone tmpBoxes[]; int boxesCount = ToBox( source, tmpBoxes // ); if (!IsValidSize(boxesCount)) { // Clean(tmpBoxes); return result; } // XBoxZone selected; for (int i = 0; i < boxesCount; i++) { // XBoxZone iBox = tmpBoxes[i]; // bool canSet = !selected.IsValid() ? true : selected.from < iBox.from; if (canSet) { // result = i; selected = iBox; } } // Clean(tmpBoxes); selected.Clean(); // return result; } /** * Get Highest Index ... * * @param source: XOBFVG instance Reference Collection ... * * @return ( int ) */ int GetHighest( XOBFVG &source[] // ) { // int result = -1; // int count = ArraySize(source); if (!IsValidSize(count)) { return result; } // XBoxZone tmpBoxes[]; int boxesCount = ToBox( source, tmpBoxes // ); if (!IsValidSize(boxesCount)) { // Clean(tmpBoxes); return result; } // XBoxZone selected; for (int i = 0; i < boxesCount; i++) { // XBoxZone iBox = tmpBoxes[i]; // bool canSet = !selected.IsValid() ? true : selected.upper < iBox.upper; if (canSet) { // result = i; selected = iBox; } } // Clean(tmpBoxes); selected.Clean(); // return result; } /** * Get Lowest Index ... * * @param source: XOBFVG instance Reference Collection ... * * @return ( int ) */ int GetLowest( XOBFVG &source[] // ) { // int result = -1; // int count = ArraySize(source); if (!IsValidSize(count)) { return result; } // XBoxZone tmpBoxes[]; int boxesCount = ToBox( source, tmpBoxes // ); if (!IsValidSize(boxesCount)) { // Clean(tmpBoxes); return result; } // XBoxZone selected; for (int i = 0; i < boxesCount; i++) { // XBoxZone iBox = tmpBoxes[i]; // bool canSet = !selected.IsValid() ? true : selected.lower > iBox.lower; if (canSet) { // result = i; selected = iBox; } } // Clean(tmpBoxes); selected.Clean(); // return result; } bool AddIfNotExists( XOBFVG &item, XOBFVG &items[] // ) { // bool result = false; // result = item.IsValid(); if (!result) { return result; } // int before = ArraySize(items); // int idx = FindIndex( item, items // ); bool has = IsValidIndex(idx); result = !has; if (!result) { return result; } // AddRef( item, items // ); // int after = ArraySize(items); // result = after > before; // return result; } int AddIfNotExists( XOBFVG &items[], XOBFVG &sources[] // ) { // int result = 0; // bool has = HasChild(items); if (!has) { return result; } // int before = ArraySize(sources); // int count = ArraySize(items); for (int i = 0; i < count; i++) { // has = AddIfNotExists( items[i], sources // ); } // int after = ArraySize(sources); // result = after > before; // return result; } // // XPOI State Event Parsers ... // // Swings ... // bool HasNewSwing(ENUM_XPOI_EVENTS &events[]) { return HasNewSwingLow(events) || HasNewSwingHigh(events); } // bool HasNewSwingLow(ENUM_XPOI_EVENTS &events[]) { return Contains( X_SWING_LOW_DETECTED, events // ); } // bool HasNewSwingHigh(ENUM_XPOI_EVENTS &events[]) { return Contains( X_SWING_HIGH_DETECTED, events // ); } // // Momentums ... // bool HasNewMomentum(ENUM_XPOI_EVENTS &events[]) { return HasNewBullishMomentum(events) || HasNewBearishMomentum(events); } // bool HasNewBullishMomentum(ENUM_XPOI_EVENTS &events[]) { return Contains( X_BULLISH_MOMENTUM_BAR_DETECTED, events // ); } // bool HasNewBearishMomentum(ENUM_XPOI_EVENTS &events[]) { return Contains( X_BEARISH_MOMENTUM_BAR_DETECTED, events // ); } // // Rejections ... // bool HasNewRejection(ENUM_XPOI_EVENTS &events[]) { return HasNewBullishRejection(events) || HasNewBearishRejection(events); } // bool HasNewBullishRejection(ENUM_XPOI_EVENTS &events[]) { return Contains( X_BULLISH_REJECTION_BAR_DETECTED, events // ); } // bool HasNewBearishRejection(ENUM_XPOI_EVENTS &events[]) { return Contains( X_BEARISH_REJECTION_BAR_DETECTED, events // ); } // // Support / Resistance Zones ... // bool HasNewSupportZone(ENUM_XPOI_EVENTS &events[]) { return Contains( X_SUPPORT_ZONE_DETECTED, events // ); } // bool HasNewResistanceZone(ENUM_XPOI_EVENTS &events[]) { return Contains( X_RESISTANCE_ZONE_DETECTED, events // ); } // // Supply / Demand Zones ... // bool HasNewSupplyZone(ENUM_XPOI_EVENTS &events[]) { return Contains( X_SUPPLY_ZONE_DETECTED, events // ); } // bool HasNewDemandZone(ENUM_XPOI_EVENTS &events[]) { return Contains( X_DEMAND_ZONE_DETECTED, events // ); } // // Fair Value Gaps ... // bool HasNewFairValueGap(ENUM_XPOI_EVENTS &events[]) { return HasNewBullishFairValueGap(events) || HasNewBearishFairValueGap(events); } // bool HasNewBullishFairValueGap(ENUM_XPOI_EVENTS &events[]) { return Contains( X_BULLISH_FVG_DETECTED, events // ); } // bool HasNewBearishFairValueGap(ENUM_XPOI_EVENTS &events[]) { return Contains( X_BEARISH_FVG_DETECTED, events // ); } // // Order Blocks ... // bool HasNewOrderBlock(ENUM_XPOI_EVENTS &events[]) { return HasNewBullishOrderBlock(events) || HasNewBearishOrderBlock(events); } // bool HasNewBullishOrderBlock(ENUM_XPOI_EVENTS &events[]) { return Contains( X_BULLISH_ORDERBLOCK_DETECTED, events // ); } // bool HasNewBearishOrderBlock(ENUM_XPOI_EVENTS &events[]) { return Contains( X_BEARISH_ORDERBLOCK_DETECTED, events // ); } // // Spikes ... // bool HasNewSpike(ENUM_XPOI_EVENTS &events[]) { return HasNewBullishSpike(events) || HasNewBearishSpike(events); } // bool HasNewBullishSpike(ENUM_XPOI_EVENTS &events[]) { return Contains( X_BULLISH_SPIKE_DETECTED, events // ); } // bool HasNewBearishSpike(ENUM_XPOI_EVENTS &events[]) { return Contains( X_BEARISH_SPIKE_DETECTED, events // ); } // // Sharps ... // bool HasNewSharp(ENUM_XPOI_EVENTS &events[]) { return HasNewBullishSharp(events) || HasNewBearishSharp(events); } // bool HasNewBullishSharp(ENUM_XPOI_EVENTS &events[]) { return Contains( X_BULLISH_SHARP_DETECTED, events // ); } // bool HasNewBearishSharp(ENUM_XPOI_EVENTS &events[]) { return Contains( X_BEARISH_SHARP_DETECTED, events // ); } // // Pullbacks ... // bool HasNewPullback(ENUM_XPOI_EVENTS &events[]) { return HasNewBullishPullback(events) || HasNewBearishPullback(events); } // bool HasNewBullishPullback(ENUM_XPOI_EVENTS &events[]) { return Contains( X_BULLISH_PULLBACK_DETECTED, events // ); } // bool HasNewBearishPullback(ENUM_XPOI_EVENTS &events[]) { return Contains( X_BEARISH_PULLBACK_DETECTED, events // ); } // // Consolidation Zones ... // bool HasNewConsolidationZone(ENUM_XPOI_EVENTS &events[]) { return HasNewBullishConsolidationZone(events) || HasNewBearishConsolidationZone(events); } // bool HasNewBullishConsolidationZone(ENUM_XPOI_EVENTS &events[]) { return Contains( X_BULLISH_CONSOLIDATION_ZONE_DETECTED, events // ); } // bool HasNewBearishConsolidationZone(ENUM_XPOI_EVENTS &events[]) { return Contains( X_BEARISH_CONSOLIDATION_ZONE_DETECTED, events // ); }