// // Checking Bar Based on Positions State ... ENUM_X_DIRECTION iBarPosDir; bool isBarValidForDir = cHelper .mBarAnalyser .IsValidForPosition( cBar, iBarPosDir // ); bool isBarValidForBullish = isBarValidForDir && IsBullish(iBarPosDir); bool isBarValidForBearish = isBarValidForDir && IsBearish(iBarPosDir); // // Check Bar Place Based on Golden Zones ... // bool isBarInPeaksGoldenZone = cBar.high <= cXConditions.peaksBuffer[cIDX] && cBar.low >= cXConditions.peaksGoldenBuffer[cIDX]; // bool isBarInValesGoldenZone = cBar.high >= cXConditions.valesBuffer[cIDX] && cBar.low <= cXConditions.valesGoldenBuffer[cIDX]; // XCPOIDrawer *drawer = provider.visionCycleHelper.mPOIDrawer; // // X3MA ... // bool isX3MaFastMidOverPeaksGoldeZone = isX3MaFastOverPeaksGoldenZone && isX3MaMidOverPeaksGoldenZone; // bool isX3MaFastMidUnderValesGoldeZone = isX3MaFastUnderValesGoldenZone && isX3MaMidUnderValesGoldenZone; // // XVWAP ... // bool isVWapFastMidOverPeaksGoldeZone = isVWapFastOverPeaksGoldenZone && isVWapMidOverPeaksGoldenZone; // bool isVWapFastMidUnderValesGoldeZone = isVWapFastUnderValesGoldenZone && isVWapMidUnderValesGoldenZone; // // // bool isX3MaVWapFastUnderValuesGoldenZone = isX3MaFastUnderValesGoldenZone && isVWapFastUnderValesGoldenZone; // bool isX3MaVWapFastOverPeaksGoldenZone = isX3MaFastOverPeaksGoldenZone && isVWapFastOverPeaksGoldenZone; // // // double x3MaFastMidMax = MathMax( cXConditions.x3maFastBuffer[cIDX], cXConditions.x3maMidBuffer[cIDX] // ); // double x3MaFastMidMin = MathMin( cXConditions.x3maFastBuffer[cIDX], cXConditions.x3maMidBuffer[cIDX] // ); // double vwapFastMidMax = MathMax( cXConditions.vwapFastBuffer[cIDX], cXConditions.vwapMidBuffer[cIDX] // ); // double vwapFastMidMin = MathMin( cXConditions.vwapFastBuffer[cIDX], cXConditions.vwapMidBuffer[cIDX] // ); // // // double x3maVWapFastMidMax = MathMax(x3MaFastMidMax, vwapFastMidMax); double x3maVWapFastMidMin = MathMin(x3MaFastMidMin, vwapFastMidMin); // double x3maVWapMax = MathMax(cXConditions.x3maMax, cXConditions.vwapMax); double x3maVWapMin = MathMin(cXConditions.x3maMin, cXConditions.vwapMin); // double x3maVWapDiff = x3maVWapMax - x3maVWapMin; // double atr = cXConditions.atrBuffer[cIDX]; // bool isConsolidate = x3maVWapDiff <= (3 * atr); // bool isX3MaVWapSwitchedToBullish = // // VWap ... ( // (cXConditions.isVWapBullishOrdered && cXConditions.isVWapSwitchedToBullishState) || (cXConditions.isVWapBullishState && cXConditions.isVWapSwitchedToBullishOrdered) // ) // || // // X3Ma ... ( // (cXConditions.isX3MaBullishOrdered && cXConditions.isX3MaSwitchedToBullishState) || (cXConditions.isX3MaBullishState && cXConditions.isX3MaSwitchedToBullishOrdered) // ) // ; // bool isX3MaVWapSwitchedToBearish = // // VWap ... ( // (cXConditions.isVWapBearishOrdered && cXConditions.isVWapSwitchedToBearishState) || (cXConditions.isVWapBearishState && cXConditions.isVWapSwitchedToBearishOrdered) // ) // || // // X3Ma ... ( // (cXConditions.isX3MaBearishOrdered && cXConditions.isX3MaSwitchedToBearishState) || (cXConditions.isX3MaBearishState && cXConditions.isX3MaSwitchedToBearishOrdered) // ) // ; // // Bullish Conditions ... isBullish = // // Base Condition ... ( // false // // isConsolidate && // isBarValidForBullish && // cXConditions.isSarBullish && // isX3MaVWapSwitchedToBullish && // cXConditions.isNewPeakOverLast // && // isVWapFastMidUnderValesGoldeZone // && // cXConditions.isAtrLowerSlopeBullish // ) // ; // // Bearish Conditions ... isBearish = // // Base Condition ... ( // false // // isConsolidate && // isBarValidForBearish && // cXConditions.isSarBearish && // isX3MaVWapSwitchedToBearish && // cXConditions.isNewValeUnderLast // && // isVWapFastMidOverPeaksGoldeZone // && // cXConditions.isAtrUpperSlopeBearish // ) // ; //////////////////////////////////////////////////////////////////// // // XWPVZ ... bool HasXWPVZConditions( ENUM_X_CYCLES cycle, XSignalBox &box, ENUM_X_DIRECTION &dir, X121SMCStrategySignalProviderData &provider, int barIndex = 0 // ) { // bool result = false; // box.Clean(); dir = X_DIRECTION_NONE; // // Fil Selected Data ... XPOIState cState; X121Conditions cXConditions; XPOIStateEvents cStateEvents; XC121SMCCycleHelper *cHelper; X121SMCCycleConditions cConditions; result = provider.SelectCycle( cycle, cState, cStateEvents, cXConditions, cHelper, cConditions // ); if (!result) { // cState.Clean(); ZeroMemory(cHelper); cConditions.Clean(); cXConditions.Clean(); cStateEvents.Clean(); // return result; } Parse(cXConditions); // // Normalize Args ... // 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; int ppIDX = pIDX + 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(); ZeroMemory(cHelper); cConditions.Clean(); cXConditions.Clean(); // return result; } // XCPOIDrawer *drawer = provider.visionCycleHelper.mPOIDrawer; // // Checking Other Conditions ... // // Checking Bar Based on Positions State ... ENUM_X_DIRECTION iBarPosDir; bool isBarValidForDir = cHelper .mBarAnalyser .IsValidForPosition( cBar, iBarPosDir // ); bool isBarValidForBullish = isBarValidForDir && IsBullish(iBarPosDir); bool isBarValidForBearish = isBarValidForDir && IsBearish(iBarPosDir); // // // // Continuation Bullish ... // bool isContinuationBullish = // // // isBarValidForBullish && // cXConditions.isSarBullish && // cXConditions.isStrBullish && // cXConditions.isNewPeakOverLast // // // ; // // // // Continuation Bearish ... // bool isContinuationBearish = // // // isBarValidForBearish && // cXConditions.isSarBearish && // cXConditions.isStrBearish && // cXConditions.isNewValeUnderLast // // // ; // XBoxZone obBox; XBoxZone fvgBox; XBoxZone supResBox; XBoxZone tmpBoxes[]; bool isBullishFVGRejected = false; bool isBearishFVGRejected = false; bool isFVGLowerBullishRejected = false; bool isFVGUpperBullishRejected = false; bool isFVGLowerBearishRejected = false; bool isFVGUpperBearishRejected = false; has = cState.HasFairValueGaps(); if (has) { // // Converts FairValueGaps to Box ... ToBox( cState.fairValueGaps, tmpBoxes // ); // // Select FVG ... while (HasChild(tmpBoxes)) { // idx = GetYoungest(tmpBoxes); has = IsValidIndex(idx); if (!has) { break; } // XBoxZone iBox = tmpBoxes[idx]; ArrayRemove( tmpBoxes, idx, 1 // ); // isFVGLowerBullishRejected = // cBar.low < iBox.lower && cBar.GetDown() > iBox.lower // ; // isFVGUpperBullishRejected = // cBar.low < iBox.upper && cBar.GetDown() > iBox.upper // ; // isFVGLowerBearishRejected = // cBar.high > iBox.lower && cBar.GetUp() < iBox.lower // ; // isFVGUpperBearishRejected = // cBar.high > iBox.upper && cBar.GetUp() < iBox.upper // ; // // // isBullishFVGRejected = // iBox.IsBullish() && cBar.IsBullish() && (isFVGLowerBullishRejected // || isFVGUpperBullishRejected ) // ; // isBearishFVGRejected = // iBox.IsBearish() && cBar.IsBearish() && ( // isFVGLowerBearishRejected || isFVGUpperBearishRejected) // ; // has = isBullishFVGRejected || isBearishFVGRejected; if (has) { // iBox.to = TimeCurrent(); fvgBox = iBox; iBox.Clean(); break; } // iBox.Clean(); } Clean(tmpBoxes); // // Select Order Block which FVG is Inside it ... has = fvgBox.IsValid(); if (has) { // // Converts Order Blocks to Box ... ToBox( cState.orderBlocks, tmpBoxes // ); // // Select Order Blocks ... has = HasChild(tmpBoxes); if (has) { // while (HasChild(tmpBoxes)) { // idx = GetYoungest(tmpBoxes); has = IsValidIndex(idx); if (!has) { break; } // XBoxZone iBox = tmpBoxes[idx]; ArrayRemove( tmpBoxes, idx, 1 // ); // // Validate Order Blocks ... bool isSameDir = iBox.dir == fvgBox.dir; bool isFVGInsideOB = IsBoxInsideOr( fvgBox, iBox // ); // has = isSameDir && isFVGInsideOB; if (has) { // iBox.to = TimeCurrent(); obBox = iBox; iBox.Clean(); break; } // iBox.Clean(); } } } // has = obBox.IsValid(); if (!has) { // obBox.Clean(); fvgBox.Clean(); // isBullishFVGRejected = false; isBearishFVGRejected = false; isFVGLowerBullishRejected = false; isFVGUpperBullishRejected = false; isFVGLowerBearishRejected = false; isFVGUpperBearishRejected = false; } Clean(tmpBoxes); // // Checking Support nad Resistance ... bool isDirBullish = obBox.IsBullish() && fvgBox.IsBullish(); has = obBox.IsValid() && fvgBox.IsValid(); if (has) { // // Converts Support or Resistance to Boxes ... if (isDirBullish) { // ToBox( cState.supportZones, tmpBoxes // ); } else { // ToBox( cState.resistanceZones, tmpBoxes // ); } // // Selecting Support nad Resistance ... has = HasChild(tmpBoxes); if (has) { // while (HasChild(tmpBoxes)) { // idx = GetYoungest(tmpBoxes); has = IsValidIndex(idx); if (!has) { break; } // XBoxZone iBox = tmpBoxes[idx]; ArrayRemove( tmpBoxes, idx, 1 // ); // // Validate Support and Resistane ... bool isDirPassed = iBox.dir == obBox.dir; bool isPlacePassed = IsBoxAbove( iBox, fvgBox // ) || IsBoxAbove( fvgBox, iBox // ) || IsBoxInside( iBox, fvgBox // ) || IsBoxInside( fvgBox, iBox // ); has = isDirPassed && isPlacePassed; if (has) { // iBox.to = TimeCurrent(); supResBox = iBox; iBox.Clean(); break; } // iBox.Clean(); } } // has = obBox.IsValid() && fvgBox.IsValid() && supResBox.IsValid(); if (!has) { // obBox.Clean(); fvgBox.Clean(); supResBox.Clean(); // isBullishFVGRejected = false; isBearishFVGRejected = false; isFVGLowerBullishRejected = false; isFVGUpperBullishRejected = false; isFVGLowerBearishRejected = false; isFVGUpperBearishRejected = false; } } } Clean(tmpBoxes); // // Checking OB and FVG Validation ... has = obBox.IsValid() && fvgBox.IsValid() && supResBox.IsValid(); if (has) { // // Draw OB ... if (obBox.IsValid()) { // XCBoxObject *iObj; has = drawer.DrawBox( obBox, iObj // ); if (has) { iObj.BoxStyle(STYLE_DASH); } } // // Draw FVG ... if (fvgBox.IsValid()) { // XCBoxObject *iObj; has = drawer.DrawBox( fvgBox, iObj // ); if (has) { iObj.BoxStyle(STYLE_SOLID); } } // // Draw Sup/Res Box ... if (supResBox.IsValid()) { // XCBoxObject *iObj; has = drawer.DrawBox( supResBox, iObj // ); if (has) { iObj.BoxStyle(STYLE_DOT); } } } // // Bullish Conditions ... isBullish = // // Base Condition ... ( // // false isBullishFVGRejected // ) // ; // // Bearish Conditions ... isBearish = // // Base Condition ... ( // // false isBearishFVGRejected // ) // ; // // Filling Requirements ... result = isBullish || isBearish; if (result) { // dir = isBullish ? X_DIRECTION_BULLISH : X_DIRECTION_BEARISH; // box.ob = obBox; box.fvg = fvgBox; box.sharp = supResBox; } // // Check All Conditions ... result = box.IsValid() && HasDirection(dir) && (isBullish || isBearish); // // Cleanup Resources ... zBar.Clean(); cBar.Clean(); pBar.Clean(); cState.Clean(); ZeroMemory(cHelper); cConditions.Clean(); cStateEvents.Clean(); cXConditions.Clean(); // return result; }