diff --git a/Documents/BKP/tmp.sig.codes.mq5 b/Documents/BKP/tmp.sig.codes.mq5 index 40eb6785..70060d09 100644 --- a/Documents/BKP/tmp.sig.codes.mq5 +++ b/Documents/BKP/tmp.sig.codes.mq5 @@ -1,214 +1,798 @@ +// +// 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(); + // - // 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); + 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(); // - // Check Bar Place Based on Golden Zones ... + return result; + } - // - bool isBarInPeaksGoldenZone = - cBar.high <= cXConditions.peaksBuffer[cIDX] && - cBar.low >= cXConditions.peaksGoldenBuffer[cIDX]; + // + XCPOIDrawer *drawer = provider.visionCycleHelper.mPOIDrawer; - // - bool isBarInValesGoldenZone = - cBar.high >= cXConditions.valesBuffer[cIDX] && - cBar.low <= cXConditions.valesGoldenBuffer[cIDX]; + // + // Checking Other Conditions ... - // - XCPOIDrawer *drawer = provider.visionCycleHelper.mPOIDrawer; + // + // 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); - // - // X3MA ... + // // + // // Continuation Bullish ... + // bool isContinuationBullish = + // // + // isBarValidForBullish && + // cXConditions.isSarBullish && + // cXConditions.isStrBullish && + // cXConditions.isNewPeakOverLast + // // + // ; - // - bool isX3MaFastMidOverPeaksGoldeZone = - isX3MaFastOverPeaksGoldenZone && - isX3MaMidOverPeaksGoldenZone; + // // + // // 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) + { // - 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] // + // Converts FairValueGaps to Box ... + ToBox( + cState.fairValueGaps, + tmpBoxes // ); // - double x3MaFastMidMin = MathMin( - cXConditions.x3maFastBuffer[cIDX], - cXConditions.x3maMidBuffer[cIDX] // - ); + // 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); // - double vwapFastMidMax = MathMax( - cXConditions.vwapFastBuffer[cIDX], - cXConditions.vwapMidBuffer[cIDX] // - ); + // 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(); + } + } + } // - double vwapFastMidMin = MathMin( - cXConditions.vwapFastBuffer[cIDX], - cXConditions.vwapMidBuffer[cIDX] // - ); + 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); + } + } // - double x3maVWapFastMidMax = MathMax(x3MaFastMidMax, vwapFastMidMax); - double x3maVWapFastMidMin = MathMin(x3MaFastMidMin, vwapFastMidMin); + // Draw FVG ... + if (fvgBox.IsValid()) + { + // + XCBoxObject *iObj; + has = drawer.DrawBox( + fvgBox, + iObj // + ); + if (has) + { + iObj.BoxStyle(STYLE_SOLID); + } + } // - double x3maVWapMax = MathMax(cXConditions.x3maMax, cXConditions.vwapMax); - double x3maVWapMin = MathMin(cXConditions.x3maMin, cXConditions.vwapMin); + // 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; // - double x3maVWapDiff = x3maVWapMax - x3maVWapMin; + box.ob = obBox; + box.fvg = fvgBox; + box.sharp = supResBox; + } - // - double atr = cXConditions.atrBuffer[cIDX]; + // + // Check All Conditions ... + result = + box.IsValid() && + HasDirection(dir) && + (isBullish || + isBearish); - // - bool isConsolidate = x3maVWapDiff <= (3 * atr); + // + // Cleanup Resources ... + zBar.Clean(); + cBar.Clean(); + pBar.Clean(); + cState.Clean(); + ZeroMemory(cHelper); + cConditions.Clean(); + cStateEvents.Clean(); + cXConditions.Clean(); - // - 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 - // - ) - // - ; + // + return result; +} diff --git a/Helpers/x-saherelm.x121.helper.mq5 b/Helpers/x-saherelm.x121.helper.mq5 index c0d0e265..4cccdc0a 100644 --- a/Helpers/x-saherelm.x121.helper.mq5 +++ b/Helpers/x-saherelm.x121.helper.mq5 @@ -440,6 +440,10 @@ struct X121Conditions double x3maMax; double vwapMin; double vwapMax; + double senkouMax; + double senkouMin; + double tenKijMax; + double tenKijMin; // bool isSarIncreased; @@ -723,7 +727,10 @@ struct X121Conditions vwapMax = 0; x3maMin = 0; x3maMax = 0; - + senkouMax = 0; + senkouMin = 0; + tenKijMax = 0; + tenKijMin = 0; // // Slopes ... @@ -3626,6 +3633,12 @@ class XCX121Helper : public XCBase conditions.isSenkouSpanACrossedOverB = xichConditions.isSenkouSpanACrossedOverB; conditions.isSenkouSpanACrossedUnderB = xichConditions.isSenkouSpanACrossedUnderB; + // + conditions.tenKijMax = MathMax(xichConditions.tenkanSenBuffer[cIDX], xichConditions.kijunSenBuffer[cIDX]); + conditions.tenKijMin = MathMin(xichConditions.tenkanSenBuffer[cIDX], xichConditions.kijunSenBuffer[cIDX]); + conditions.senkouMax = MathMax(xichConditions.senkouSpanABuffer[cIDX], xichConditions.senkouSpanBBuffer[cIDX]); + conditions.senkouMin = MathMin(xichConditions.senkouSpanABuffer[cIDX], xichConditions.senkouSpanBBuffer[cIDX]); + // // Slopes ... diff --git a/Helpers/x-saherelm.x121.xich.helper.mq5 b/Helpers/x-saherelm.x121.xich.helper.mq5 index ebb2a30e..870493a1 100644 --- a/Helpers/x-saherelm.x121.xich.helper.mq5 +++ b/Helpers/x-saherelm.x121.xich.helper.mq5 @@ -901,15 +901,15 @@ class XCX121XICHHelper : public XCBaseHelper // bool isSenkouSpanAOverB = - conditions.senkouSpanABuffer[cIDX] > conditions.senkouSpanABuffer[cIDX]; + conditions.senkouSpanABuffer[cIDX] > conditions.senkouSpanBBuffer[cIDX]; bool isSenkouSpanAOverBPrev = - conditions.senkouSpanABuffer[pIDX] > conditions.senkouSpanABuffer[pIDX]; + conditions.senkouSpanABuffer[pIDX] > conditions.senkouSpanBBuffer[pIDX]; // bool isSenkouSpanAUnderB = - conditions.senkouSpanABuffer[cIDX] < conditions.senkouSpanABuffer[cIDX]; + conditions.senkouSpanABuffer[cIDX] < conditions.senkouSpanBBuffer[cIDX]; bool isSenkouSpanAUnderBPrev = - conditions.senkouSpanABuffer[pIDX] < conditions.senkouSpanABuffer[pIDX]; + conditions.senkouSpanABuffer[pIDX] < conditions.senkouSpanBBuffer[pIDX]; // bool isSenkouSpanACrossedOverB = isSenkouSpanAOverB && diff --git a/Indicators/x-saherelm.x121.xich.mq5 b/Indicators/x-saherelm.x121.xich.mq5 index fc2f459b..89b3fb8a 100644 --- a/Indicators/x-saherelm.x121.xich.mq5 +++ b/Indicators/x-saherelm.x121.xich.mq5 @@ -85,7 +85,7 @@ double tenkanSenBuffer[]; #property indicator_type1 DRAW_LINE #property indicator_color1 clrBrown #property indicator_style1 STYLE_SOLID -#property indicator_width1 1 +#property indicator_width1 2 // #define kijunSenBufferIndex 1 @@ -96,7 +96,7 @@ double kijunSenBuffer[]; #property indicator_type2 DRAW_LINE #property indicator_color2 clrDodgerBlue #property indicator_style2 STYLE_SOLID -#property indicator_width2 1 +#property indicator_width2 2 // #define chikouSpanBufferIndex 2 @@ -107,7 +107,7 @@ double chikouSpanBuffer[]; #property indicator_type3 DRAW_LINE #property indicator_color3 clrDarkGreen #property indicator_style3 STYLE_SOLID -#property indicator_width3 1 +#property indicator_width3 2 // #define senkouSpanABufferIndex 3 @@ -118,7 +118,7 @@ double senkouSpanABuffer[]; #property indicator_type4 DRAW_LINE #property indicator_color4 clrLightGray #property indicator_style4 STYLE_DASHDOTDOT -#property indicator_width4 1 +#property indicator_width4 2 // #define senkouSpanBBufferIndex 4 @@ -129,7 +129,7 @@ double senkouSpanBBuffer[]; #property indicator_type5 DRAW_LINE #property indicator_color5 clrLightGray #property indicator_style5 STYLE_DASHDOTDOT -#property indicator_width5 1 +#property indicator_width5 2 // #define senkouABufferIndex 5 @@ -147,7 +147,7 @@ double senkouBBuffer[]; #property indicator_type6 DRAW_FILLING #property indicator_color6 clrAqua, clrMagenta #property indicator_style6 STYLE_SOLID -#property indicator_width6 1 +#property indicator_width6 2 // // Data Buffers ... diff --git a/Libraries/x-saherelm.x-ohcl.lib.mq5 b/Libraries/x-saherelm.x-ohcl.lib.mq5 index 2403460c..77d1de64 100644 --- a/Libraries/x-saherelm.x-ohcl.lib.mq5 +++ b/Libraries/x-saherelm.x-ohcl.lib.mq5 @@ -960,6 +960,119 @@ struct XOHCL return result; } + // + bool HasFiboPressure( + ENUM_X_DIRECTION forDir, + ENUM_X_FIBO_LEVELS level = X_FIBO_LEVEL_382 // + ) + { + // + bool result = false; + + // + result = IsValid() && + HasDirection(forDir); + if (!result) + { + return result; + } + + // + bool isBullish = IsBullish(forDir); + bool isBearish = IsBearish(forDir); + + // + double fiboLevelValue = GetFibonacciLevel( + high, + low, + level, + forDir // + ); + + // + isBullish = + isBullish && + GetDown() > fiboLevelValue; + isBearish = + isBearish && + GetUp() < fiboLevelValue; + + // + result = isBullish || + isBearish; + + // + return result; + } + + // + bool IsRejected( + double price, + ENUM_X_DIRECTION forDir, + bool forceType = false, + bool forcePressure = false // + ) + { + // + bool result = false; + + // + result = IsValid() && + price > 0 && + HasDirection(forDir); + if (!result) + { + return result; + } + + // + bool isBullish = + IsBullish(forDir) && + low < price && + GetDown() > price; + + // + bool isBearish = + IsBearish(forDir) && + high > price && + GetUp() < price; + + // + if (forceType) + { + // + isBullish = + isBullish && + IsBullish(); + + // + isBearish = + isBearish && + IsBearish(); + } + + // + if (forcePressure) + { + // + isBullish = + isBullish && + HasFiboPressure(forDir); + + // + isBearish = + isBearish && + HasFiboPressure(forDir); + } + + // + result = isBullish || + isBearish; + + // + return result; + } + // // Find Highest Bar Index ... int FindHighestIndex( diff --git a/Libraries/x-saherelm.x-poi.extensions.lib.mq5 b/Libraries/x-saherelm.x-poi.extensions.lib.mq5 index af878ad1..56beaec1 100644 --- a/Libraries/x-saherelm.x-poi.extensions.lib.mq5 +++ b/Libraries/x-saherelm.x-poi.extensions.lib.mq5 @@ -3240,4 +3240,139 @@ bool DetectBoxNearestPriceOut( return result; } +/** + * Count number of Box Retests ... + * + * @param box: XBoxZone instance Reference ... + * @param forDir: ENUM_X_DIRECTION member, Specified Retesting Direction ... + * @param forPeriod: ENUM_TIMEFRAMES member, Specified Retesting Period ... + * @param forceType: bool, Specified Retest Bar Direction is Same as Retesting Direction ... + * @param forcePressure: bool, Specified Retest Bar must Has Fibo Pressure or not ... + * + * @return ( int ) + */ +int CountBoxRetest( + XBoxZone &box, + ENUM_X_DIRECTION forDir = NULL, + ENUM_TIMEFRAMES forPeriod = NULL, + bool forceType = false, + bool forcePressure = false // +) +{ + // + int result = 0; + + // + if (!IsValid(forPeriod)) + { + forPeriod = box.period; + } + + // + if (!IsValid(forDir)) + { + forDir = box.dir; + } + + // + bool isValid = + box.IsValid() && + IsValid(forDir); + if (!isValid) + { + return result; + } + + // + int fromIDX = GetBarIndex( + box.symbol, + forPeriod, + box.from // + ); + + // + int toIDX = GetBarIndex( + box.symbol, + forPeriod, + box.to // + ); + + // + for (int i = fromIDX; i >= toIDX; i--) + { + // + // Initialize Indexed Bar ... + XOHCL iBar; + isValid = iBar.Init( + box.symbol, + forPeriod, + i // + ); + if (!isValid) + { + // + iBar.Clean(); + continue; + } + + // + bool isUpperBullishRejected = iBar.IsRejected( + box.upper, + X_DIRECTION_BULLISH, + forceType, + forcePressure // + ); + bool isUpperBearishRejected = iBar.IsRejected( + box.upper, + X_DIRECTION_BEARISH, + forceType, + forcePressure // + ); + + // + bool isLowerBullishRejected = iBar.IsRejected( + box.lower, + X_DIRECTION_BULLISH, + forceType, + forcePressure // + ); + bool isLowerBearishRejected = iBar.IsRejected( + box.lower, + X_DIRECTION_BEARISH, + forceType, + forcePressure // + ); + + // + if (forDir == X_DIRECTION_ALL || + forDir == X_DIRECTION_BULLISH) + { + // + if (isUpperBullishRejected || + isLowerBullishRejected) + { + result++; + } + } + + // + if (forDir == X_DIRECTION_ALL || + forDir == X_DIRECTION_BEARISH) + { + // + if (isUpperBearishRejected || + isLowerBearishRejected) + { + result++; + } + } + + // + iBar.Clean(); + } + + // + return result; +} + // \ No newline at end of file diff --git a/Libraries/x-saherelm.x-poi.state.lib.mq5 b/Libraries/x-saherelm.x-poi.state.lib.mq5 index 2641a4a3..3279865e 100644 --- a/Libraries/x-saherelm.x-poi.state.lib.mq5 +++ b/Libraries/x-saherelm.x-poi.state.lib.mq5 @@ -1052,6 +1052,205 @@ struct XPOIState return ArraySize(bearishConsolidationZones); } + // + // Box Retrievers ... + + // + int SupportResistancesAsBox(XBoxZone &items[]) + { + // + XBoxZone tmpBoxes[]; + + // + ToBox( + supportZones, + tmpBoxes // + ); + Copy( + tmpBoxes, + items, + false // + ); + Clean(tmpBoxes); + + // + ToBox( + resistanceZones, + tmpBoxes // + ); + Copy( + tmpBoxes, + items, + false // + ); + Clean(tmpBoxes); + + // + int result = ArraySize(items); + + // + return result; + } + + // + int SupplyDemandsAsBox(XBoxZone &items[]) + { + // + XBoxZone tmpBoxes[]; + + // + ToBox( + supplyZones, + tmpBoxes // + ); + Copy( + tmpBoxes, + items, + false // + ); + Clean(tmpBoxes); + + // + ToBox( + demandZones, + tmpBoxes // + ); + Copy( + tmpBoxes, + items, + false // + ); + Clean(tmpBoxes); + + // + int result = ArraySize(items); + + // + return result; + } + + // + int OrderBlocksAsBox(XBoxZone &items[]) + { + // + XBoxZone tmpBoxes[]; + + // + ToBox( + bullishOrderBlocks, + tmpBoxes // + ); + Copy( + tmpBoxes, + items, + false // + ); + Clean(tmpBoxes); + + // + ToBox( + bearishOrderBlocks, + tmpBoxes // + ); + Copy( + tmpBoxes, + items, + false // + ); + Clean(tmpBoxes); + + // + int result = ArraySize(items); + + // + return result; + } + + // + int FairValueGapsAsBox(XBoxZone &items[]) + { + // + XBoxZone tmpBoxes[]; + + // + ToBox( + bullishFairValueGaps, + tmpBoxes // + ); + Copy( + tmpBoxes, + items, + false // + ); + Clean(tmpBoxes); + + // + ToBox( + bearishFairValueGaps, + tmpBoxes // + ); + Copy( + tmpBoxes, + items, + false // + ); + Clean(tmpBoxes); + + // + int result = ArraySize(items); + + // + return result; + } + + // + int SpikesAsBox(XBoxZone &items[]) + { + // + Copy( + bullishSpikes, + items, + false // + ); + + // + Copy( + bearishSpikes, + items, + false // + ); + + // + int result = ArraySize(items); + + // + return result; + } + + // + int SharpsAsBox(XBoxZone &items[]) + { + // + Copy( + bullishSharps, + items, + false // + ); + + // + Copy( + bearishSharps, + items, + false // + ); + + // + int result = ArraySize(items); + + // + return result; + } + // // Tools ... 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 7ef06fd6..343cc60e 100644 --- a/X121SMCEA/Classes/x-121.smc.market.cycle.helper.class.mq5 +++ b/X121SMCEA/Classes/x-121.smc.market.cycle.helper.class.mq5 @@ -3499,6 +3499,7 @@ struct X121SMCStrategyConditionParser // XWPVZ ... bool HasXWPVZConditions( ENUM_X_CYCLES cycle, + ENUM_X_CYCLES vCycle, XSignalBox &box, ENUM_X_DIRECTION &dir, X121SMCStrategySignalProviderData &provider, @@ -3541,6 +3542,42 @@ struct X121SMCStrategyConditionParser } Parse(cXConditions); + // + // Fil Selected Data ... + XPOIState vState; + X121Conditions vXConditions; + XPOIStateEvents vStateEvents; + XC121SMCCycleHelper *vHelper; + X121SMCCycleConditions vConditions; + result = provider.SelectCycle( + vCycle, + vState, + vStateEvents, + vXConditions, + vHelper, + vConditions // + ); + if (!result) + { + // + cState.Clean(); + ZeroMemory(cHelper); + cConditions.Clean(); + cXConditions.Clean(); + cStateEvents.Clean(); + + // + vState.Clean(); + ZeroMemory(vHelper); + cConditions.Clean(); + vXConditions.Clean(); + vStateEvents.Clean(); + + // + return result; + } + Parse(vXConditions); + // // Normalize Args ... @@ -3569,6 +3606,7 @@ struct X121SMCStrategyConditionParser XOHCL zBar; XOHCL cBar; XOHCL pBar; + XOHCL pPBar; // // Initial Bars ... @@ -3583,6 +3621,9 @@ struct X121SMCStrategyConditionParser result = result && cBar.GetPreviousBar(pBar); + result = + result && + pBar.GetPreviousBar(pPBar); if (!result) { // @@ -3620,156 +3661,156 @@ struct X121SMCStrategyConditionParser isBarValidForDir && IsBearish(iBarPosDir); - // // - // // Continuation Bullish ... - // bool isContinuationBullish = - // // - // isBarValidForBullish && - // cXConditions.isSarBullish && - // cXConditions.isStrBullish && - // cXConditions.isNewPeakOverLast - // // - // ; + // + // Senkou Span A/B Rejections ... - // // - // // Continuation Bearish ... - // bool isContinuationBearish = - // // - // isBarValidForBearish && - // cXConditions.isSarBearish && - // cXConditions.isStrBearish && - // cXConditions.isNewValeUnderLast - // // - // ; + // + bool forceType = false; + bool forcePressure = true; + + // + bool isBullishRejectSenkouAB = cBar.IsRejected( + cXConditions.senkouMax, + X_DIRECTION_BULLISH, + forceType, // Force Type ... + forcePressure // Force Pressure ... + ); + + // + bool isBearishRejectSenkouAB = cBar.IsRejected( + cXConditions.senkouMin, + X_DIRECTION_BEARISH, + forceType, // Force Type ... + forcePressure // Force Pressure ... + ); + + // + // TenkanSen/KijunSen Rejections ... + + // + bool isBullishRejectTenKij = cBar.IsRejected( + cXConditions.tenKijMax, + X_DIRECTION_BULLISH, + forceType, // Force Type ... + forcePressure // Force Pressure ... + ); + + // + bool isBearishRejectTenKij = cBar.IsRejected( + cXConditions.tenKijMin, + X_DIRECTION_BEARISH, + forceType, // Force Type ... + forcePressure // Force Pressure ... + ); + + // + // X3MaFast Rejections ... + + // + bool isBullishRejectedFastMa = cBar.IsRejected( + cXConditions.x3maFastBuffer[cIDX], + X_DIRECTION_BULLISH, + forceType, // Force Type ... + forcePressure // Force Pressure ... + ); + + // + bool isBearishRejectedFastMa = cBar.IsRejected( + cXConditions.x3maFastBuffer[cIDX], + X_DIRECTION_BEARISH, + forceType, // Force Type ... + forcePressure // Force Pressure ... + ); + + // + bool isValidBullishRejectedFastMa = + isBullishRejectedFastMa && + cBar.low > cXConditions.senkouMax; + + // + bool isValidBearishRejectedFastMa = + isBearishRejectedFastMa && + cBar.high < cXConditions.senkouMin; + + // + // Bigger Cycle Verification ... + + // + double vBullishScore = 0; + double vBearishScore = 0; + vXConditions.GenerateScore( + vBullishScore, + vBearishScore // + ); + + // + bool isVBUllishPassed = + cBar.low > vXConditions.senkouMax && + vBullishScore > (vBearishScore * 1.5); + + // + bool isVBearishPassed = + cBar.high < vXConditions.senkouMin && + vBearishScore > (vBullishScore * 1.5); + + // + // Bullish Conditions ... + isBullish = + // + isVBUllishPassed && + isBullishRejectSenkouAB + // + ; + + // + // Bearish Conditions ... + isBearish = + // + isVBearishPassed && + isBearishRejectSenkouAB + // + ; + + // + result = isBullish || + isBearish; + if (result) + { + // + dir = + isBullish + ? X_DIRECTION_BULLISH + : X_DIRECTION_BEARISH; + } + + // + // Detecting a Zone and Validate it ... + + // + XBoxZone tmpBoxes[]; // 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) + bool hasOB = false; + bool hasFVG = false; + bool hasSupRes = false; + + // + // Select Support and Resistance ... + if (result) { // - // Converts FairValueGaps to Box ... - ToBox( - cState.fairValueGaps, - tmpBoxes // - ); - - // - // Select FVG ... - while (HasChild(tmpBoxes)) + if (!hasSupRes) { // - idx = GetYoungest(tmpBoxes); - has = IsValidIndex(idx); - if (!has) - { - break; - } + cState.OrderBlocksAsBox(tmpBoxes); + cState.FairValueGapsAsBox(tmpBoxes); + cState.SupplyDemandsAsBox(tmpBoxes); + cState.SupportResistancesAsBox(tmpBoxes); // - 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) { @@ -3777,7 +3818,7 @@ struct X121SMCStrategyConditionParser while (HasChild(tmpBoxes)) { // - idx = GetYoungest(tmpBoxes); + idx = GetOldest(tmpBoxes); has = IsValidIndex(idx); if (!has) { @@ -3791,133 +3832,43 @@ struct X121SMCStrategyConditionParser idx, 1 // ); + iBox.to = TimeCurrent(); // - // Validate Order Blocks ... - bool isSameDir = iBox.dir == fvgBox.dir; - bool isFVGInsideOB = IsBoxInsideOr( - fvgBox, - iBox // + // Try to Validate Support and Resistance ... + int retests = CountBoxRetest( + iBox, + dir, + cBar.period // ); + bool isTyped = + isBullish + ? iBox.IsBullish() + : iBox.IsBearish(); + bool isRetested = retests >= 1; + bool isPlaced = + isBullish + ? ( + // + (cBar.low < iBox.upper && + cBar.low > iBox.lower) + // + ) + : ( + // + (cBar.high < iBox.upper && + cBar.high > iBox.lower) + // + ); // has = - isSameDir && - isFVGInsideOB; + isTyped && + isPlaced && + isRetested; 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; @@ -3929,95 +3880,20 @@ struct X121SMCStrategyConditionParser } // - 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; - } + hasSupRes = supResBox.IsValid(); + Clean(tmpBoxes); } } - 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); - } - } - } + Clean(tmpBoxes); // // Bullish Conditions ... isBullish = // - // Base Condition ... - ( - // - // false - isBullishFVGRejected - // - ) + isBullish && + hasSupRes // ; @@ -4025,13 +3901,8 @@ struct X121SMCStrategyConditionParser // Bearish Conditions ... isBearish = // - // Base Condition ... - ( - // - // false - isBearishFVGRejected - // - ) + isBearish && + hasSupRes // ; @@ -4043,14 +3914,36 @@ struct X121SMCStrategyConditionParser if (result) { // - dir = - isBullish - ? X_DIRECTION_BULLISH - : X_DIRECTION_BEARISH; + bool drawBoxes = true; + if (drawBoxes) + { + // + if (hasSupRes) + { + // + supResBox.to = TimeCurrent(); + + // + XCBoxObject *iObj; + has = drawer.DrawBox( + supResBox, + iObj // + ); + + // + if (has) + { + iObj.BoxWidth(2); + iObj.BoxStyle(STYLE_DOT); + } + } + } // - result = false; Print("Signal ..."); + result = false; + isBearish = false; + isBullish = false; } // @@ -4066,11 +3959,17 @@ struct X121SMCStrategyConditionParser zBar.Clean(); cBar.Clean(); pBar.Clean(); + pPBar.Clean(); cState.Clean(); - ZeroMemory(cHelper); + vState.Clean(); cConditions.Clean(); + cConditions.Clean(); + ZeroMemory(cHelper); + ZeroMemory(vHelper); cStateEvents.Clean(); cXConditions.Clean(); + vXConditions.Clean(); + vStateEvents.Clean(); // return result; diff --git a/X121SMCEA/Signals/x-121.smc.xwz.signal.class.mq5 b/X121SMCEA/Signals/x-121.smc.xwz.signal.class.mq5 index 9dabc372..19900f9a 100644 --- a/X121SMCEA/Signals/x-121.smc.xwz.signal.class.mq5 +++ b/X121SMCEA/Signals/x-121.smc.xwz.signal.class.mq5 @@ -118,12 +118,12 @@ class XCX121SMCXWZSignalDetector : public XCBase result = provider.Prepare( zIndex, loopback, - false, // Trigger ... - true, // Decision ... - true, // Analyse ... - true, // Verification ... - true, // Consolidation ... - true // Vision ... + true, // Trigger ... + true, // Decision ... + true, // Analyse ... + true, // Verification ... + true, // Consolidation ... + true // Vision ... ); if (!result) { @@ -516,6 +516,33 @@ class XCX121SMCXWZSignalDetector : public XCBase // Fix rf Reward ... rfRewar = 2; } + else if (signalProvider == X121SMC_XWZ_PROVIDER_XWPVZ) + { + // + iAtr = provider.decisionXConditions.atrBuffer[1]; + iAtr *= 0; + + // + Clean(sls); + + // + // Prepare Box fro SL ... + double risk = pivot - point; + + iSL = risk <= (100 * points) + ? pivot + : isBullish + ? NormalizePrice(entry - (50 * points), signalBox.ob.symbol) + : NormalizePrice(entry + (50 * points), signalBox.ob.symbol); + Add( + iSL, + sls // + ); + + // + // Fix rf Reward ... + rfRewar = 2; + } // Print("XWZ ", ToString(signalBoxDir), " Signal Provided: ", EnumToString(signalProvider)); diff --git a/X121SMCEA/Signals/x-121.smc.xwz.signal.lib.mq5 b/X121SMCEA/Signals/x-121.smc.xwz.signal.lib.mq5 index ddbeaff3..72a78154 100644 --- a/X121SMCEA/Signals/x-121.smc.xwz.signal.lib.mq5 +++ b/X121SMCEA/Signals/x-121.smc.xwz.signal.lib.mq5 @@ -2102,6 +2102,7 @@ struct X121SMCStrategyXWZWorkingZone // isSenario5Happend = cParser.HasXWPVZConditions( X_CYCLE_DECISION, + X_CYCLE_CONSOLIDATION, box, dir, provider, diff --git a/X121SMCEA/Strategy/x-121.smc.strategy.class.mq5 b/X121SMCEA/Strategy/x-121.smc.strategy.class.mq5 index df0f7169..fb263093 100644 --- a/X121SMCEA/Strategy/x-121.smc.strategy.class.mq5 +++ b/X121SMCEA/Strategy/x-121.smc.strategy.class.mq5 @@ -734,9 +734,6 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy // bool showAll = false; - // - x121Inputs.showRSI = showAll || false; - // // XPV ... @@ -769,7 +766,10 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy x121Inputs.x3maInputs.x3maSlowMALength = 200; // - x121Inputs.xichInputs.shiftKumo = false; + x121Inputs.xichInputs.shiftKumo = true; + + // + x121Inputs.showRSI = showAll || false; // // x121Inputs.xcheInputs.cheLength = 14; @@ -800,8 +800,8 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy // // XPV ... x121Inputs.xpvInputs.showSar = showAll || false; - x121Inputs.xpvInputs.showPeaks = showAll || false; - x121Inputs.xpvInputs.showVales = showAll || false; + x121Inputs.xpvInputs.showPeaks = showAll || true; + x121Inputs.xpvInputs.showVales = showAll || true; x121Inputs.xpvInputs.showSupports = showAll || false; x121Inputs.xpvInputs.showResistances = showAll || false; x121Inputs.xpvInputs.showGoldenZones = showAll || false; @@ -854,7 +854,7 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy // // X3MA ... - x121Inputs.x3maInputs.showX3MaFast = showAll || false; + x121Inputs.x3maInputs.showX3MaFast = showAll || true; x121Inputs.x3maInputs.showX3MaMid = showAll || false; x121Inputs.x3maInputs.showX3MaSlow = showAll || false; @@ -862,7 +862,7 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy // XICH ... x121Inputs.xichInputs.showTenkanSen = showAll || true; x121Inputs.xichInputs.showKijunSen = showAll || true; - x121Inputs.xichInputs.showChikouSpan = showAll || false; + x121Inputs.xichInputs.showChikouSpan = showAll || true; x121Inputs.xichInputs.showSenkouSpanA = showAll || true; x121Inputs.xichInputs.showSenkouSpanB = showAll || true; x121Inputs.xichInputs.showKumo = showAll || false;