From 416d3c4a043b925a78862b4c65f8c265b52964a0 Mon Sep 17 00:00:00 2001 From: Hadi Khazaee Asl Date: Sat, 25 Jan 2025 03:20:15 +0330 Subject: [PATCH] last works on x Signalling ... --- Documents/BKP/1/tmp.codes.mq5 | 222 ++++ Libraries/x-saherelm.x-poi.lib.mq5 | 598 +++++++++- .../x-121.smc.market.cycle.helper.class.mq5 | 66 ++ X121SMCEA/Signals/x-121.smc.x.signal.lib.mq5 | 1049 ++++++++--------- .../Strategy/x-121.smc.strategy.class.mq5 | 321 ++++- 5 files changed, 1651 insertions(+), 605 deletions(-) diff --git a/Documents/BKP/1/tmp.codes.mq5 b/Documents/BKP/1/tmp.codes.mq5 index 2d5f91cb..aeadfe95 100644 --- a/Documents/BKP/1/tmp.codes.mq5 +++ b/Documents/BKP/1/tmp.codes.mq5 @@ -373,3 +373,225 @@ int DrawX121SMCStrategyConditions( // // !(decisionXConditions.isVWapBearishState || // // decisionXConditions.isVWapBearishOrdered) && // // + +///////////////////////////////////////////////////////////////////// + + visionXConditions.isBreakedUpPrevCheMax && + visionXConditions.isCheSwitchedToBullish + + visionXConditions.isCheSwitchedToBearish && + visionXConditions.isBreakedDownPrevCheMin + +////////////////////////////////////////////////////////////////////// + + // + bool hasOrderBlock = hasBullishOrderBlocks || + hasBearishOrderBlocks; + if (hasOrderBlock) + { + // + Print("Detect Order Block ..."); + + // + XCBaseObject *drawnObjects[]; + + // + if (hasBullishOrderBlocks) + { + // + for (int i = 0; i < bullishOrderBlocksCount; i++) + { + // + XCOrderBlock *iOb = bullishOBs[i]; + + // + XCBullishOrderBlockObject *iObObj; + bool isCreated = triggerCycleHelper + .mPOIDetector + .mDrawer + .CreateBullishOrderBlock( + iOb, + iObObj // + ); + if (isCreated) + { + // + Add( + (XCBaseObject *)iObObj, + drawnObjects // + ); + } + } + } + + // + if (hasBearishOrderBlocks) + { + // + for (int i = 0; i < bearishOrderBlocksCount; i++) + { + // + XCOrderBlock *iOb = bearishOBs[i]; + + // + XCBearishOrderBlockObject *iObObj; + bool isCreated = triggerCycleHelper + .mPOIDetector + .mDrawer + .CreateBearishOrderBlock( + iOb, + iObObj // + ); + if (isCreated) + { + // + Add( + (XCBaseObject *)iObObj, + drawnObjects // + ); + } + } + } + + // + int drawnCount = ArraySize(drawnObjects); + if (IsValidSize(drawnCount)) + { + Print(""); + } + } + +////////////////////////////////////////////////////////////////////// + + + // + // Summarize Conditions ... + + // + bool isCondition1Bullish = + // + // Vision ... + ( + // + false + // + ) + // + && + // + // Consolidation ... + ( + // + true + // + ) + // + && + // + // Verification ... + ( + // + true + // + ) + // + && + // + // Analyse ... + ( + // + true + // + ) + // + && + // + // Decision ... + ( + // + true + // + ) + // + ; + + // + bool isCondition1Bearish = + // + // Vision ... + ( + // + false + // + ) + // + && + // + // Consolidation ... + ( + // + true + // + ) + // + && + // + // Verification ... + ( + // + true + // + ) + // + && + // + // Analyse ... + ( + // + true + // + ) + // + && + // + // Decision ... + ( + // + true + // + ) + // + ; + + // + bool hasCondition1 = isCondition1Bullish || + isCondition1Bearish; + if (hasCondition1) + { + // + ENUM_X_DIRECTION pzDir = + isCondition1Bullish + ? X_DIRECTION_BULLISH + : X_DIRECTION_BEARISH; + + // + double point = GetEntry( + conditions.symbol, + pzDir // + ); + + // + // Manipulate Conditions Point ... + + // + conditions.point = point; + + // + // Manipulate Conditions Pivot ... + + // + // conditions.pivot = + // isCondition1Bullish + // ? conditions.pivotZone.upper + // : conditions.pivotZone.lower; + } diff --git a/Libraries/x-saherelm.x-poi.lib.mq5 b/Libraries/x-saherelm.x-poi.lib.mq5 index 37ccf75e..049be861 100644 --- a/Libraries/x-saherelm.x-poi.lib.mq5 +++ b/Libraries/x-saherelm.x-poi.lib.mq5 @@ -6195,12 +6195,6 @@ struct XStateZones // int result = 0; - // - if (!IsValid()) - { - return result; - } - // result = ArraySize(supportZones); @@ -6214,12 +6208,6 @@ struct XStateZones // int result = 0; - // - if (!IsValid()) - { - return result; - } - // result = ArraySize(resistanceZones); @@ -6233,12 +6221,6 @@ struct XStateZones // int result = 0; - // - if (!IsValid()) - { - return result; - } - // result = ArraySize(supplyZones); @@ -6252,12 +6234,6 @@ struct XStateZones // int result = 0; - // - if (!IsValid()) - { - return result; - } - // result = ArraySize(demandZones); @@ -6271,12 +6247,6 @@ struct XStateZones // int result = 0; - // - if (!IsValid()) - { - return result; - } - // result = ArraySize(bullishOrderBlocks); @@ -6290,12 +6260,6 @@ struct XStateZones // int result = 0; - // - if (!IsValid()) - { - return result; - } - // result = ArraySize(bearishOrderBlocks); @@ -6309,12 +6273,6 @@ struct XStateZones // int result = 0; - // - if (!IsValid()) - { - return result; - } - // result = ArraySize(bullishFairValueGaps); @@ -6328,12 +6286,6 @@ struct XStateZones // int result = 0; - // - if (!IsValid()) - { - return result; - } - // result = ArraySize(bearishFairValueGaps); @@ -9400,6 +9352,17 @@ bool CalculatePriceInsideZones( return result; } +/** + * Calculate Zone by Providing Specified Data ... + * + * @param zones: XStateZone instance Reference ... + * @param source: XPOIState instance Reference ... + * @param upper: Double ... + * @param lower: Double ... + * @param from: DateTime ... + * + * @return ( bool ) + */ bool CalculateStateZones( XStateZones &zones, XPOIState &source, @@ -10647,6 +10610,136 @@ double CalculateTarget( return result; } +/** + * Detect Valid Order Blocks ... + * + * @param forDir: ENUM_X_DIRECTION member ... + * @param source: XPOIState instance Reference ... + * + * @return ( int ) + */ +int DetectDirectionOrderBlocks( + ENUM_X_DIRECTION forDir, + XPOIState &source, + XCOrderBlock *&orderBlocks[] // +) +{ + // + int result = 0; + + // + Clean(orderBlocks); + + // + bool isValid = + // + source.IsValid() && + source.HasChild() && + HasDirection(forDir) + // + ; + if (!isValid) + { + return result; + } + + // + datetime cTime = TimeCurrent(); + + // + XOHCL cBar; + bool isInited = cBar.Init( + source.symbol, + source.period, + 1 // + ); + if (!isInited) + { + return result; + } + + // + int count = 0; + + // + // Bullish ... + count = source.CountBullishOrderBlocks(); + isValid = IsValidSize(count) && + IsBullish(forDir); + if (isValid) + { + // + for (int i = 0; i < count; i++) + { + // + XCOrderBlock *iOB = source.bullishOrderBlocks[i]; + + // + // Update Order Block Time ... + iOB.To(cTime); + + // + // Check Order Block Validation ... + isValid = IsValid( + iOB, + forDir, + cBar.symbol, + cBar.period // + ); + if (isValid) + { + // + Add( + iOB, + orderBlocks // + ); + } + } + } + + // + // Bearish ... + count = source.CountBearishOrderBlocks(); + isValid = IsValidSize(count) && + IsBearish(forDir); + if (isValid) + { + // + for (int i = 0; i < count; i++) + { + // + XCOrderBlock *iOB = source.bearishOrderBlocks[i]; + + // + // Update Order Block Time ... + iOB.To(cTime); + + // + // Check Order Block Validation ... + isValid = IsValid( + iOB, + forDir, + cBar.symbol, + cBar.period // + ); + if (isValid) + { + // + Add( + iOB, + orderBlocks // + ); + } + } + } + + // + result = ArraySize(orderBlocks); + + // + return result; +} + /** * Test Market for Detect Order Block FVG ... * @@ -11011,6 +11104,415 @@ bool DetectFVGOB( return result; } +/** + * Detect a Zone Breaker Bar ... + * + * @param toBar: XOHCL instance Reference ... + * @param fromBar: XOHCL instance Reference ... + * @param breakerBar: XOHCL instance Reference ... + * @param forDir: ENUM_X_DIRECTION member ... + * @param symbol: String ... + * @param period: ENUM_TIMEFRAMES member ... + * + * @return ( bool ) + */ +bool HasBreakerBar( + XOHCL &toBar, + XOHCL &fromBar, + XOHCL &breakerBar, + ENUM_X_DIRECTION forDir, + string symbol, + ENUM_TIMEFRAMES period, + XCZone *zone // +) +{ + // + bool result = false; + + // + toBar.Clean(); + fromBar.Clean(); + breakerBar.Clean(); + + // + result = + // + zone != NULL && + IsValid(zone.To()) && + IsValid(zone.From()) && + HasDirection(forDir); + if (!result) + { + return result; + } + + // + result = fromBar.Init( + symbol, + period, + zone.From() // + ); + if (!result) + { + return result; + } + + // + result = toBar.Init( + symbol, + period, + zone.To() // + ); + if (!result) + { + return result; + } + + // + int toIndex = toBar.Index(); + int fromIndex = fromBar.Index(); + + // + double upper = zone.Upper(); + double lower = zone.Lower(); + + // + // Detect Zone BreakerBar ... + for (int i = fromIndex; i >= toIndex; i--) + { + // + XOHCL iBar; + result = iBar.Init( + symbol, + period, + i // + ); + + // + if (!result) + { + continue; + } + + // + result = + // + IsBullish(forDir) + ? + // + iBar.low < upper && + iBar.high > upper && + iBar.GetUp() > upper + // + : + // + iBar.high > lower && + iBar.low < lower && + iBar.GetDown() < lower + // + ; + if (result) + { + // + breakerBar = iBar; + break; + } + } + + // + result = breakerBar.IsValid(); + + // + return result; +} + +/** + * Check a Zone is Valid for Specified Direction ... + * + * @param toBar: XOHCL instance Reference ... + * @param fromBar: XOHCL instance Reference ... + * @param breakerBar: XOHCL instance Reference ... + * @param forDir: ENUM_X_DIRECTION member ... + * + * @return ( bool ) + */ +bool IsValid( + XOHCL &toBar, + XOHCL &fromBar, + XOHCL &breakerBar, + ENUM_X_DIRECTION forDir, + XCZone *zone // +) +{ + // + bool result = false; + + // + result = + // + zone != NULL && + toBar.IsValid() && + fromBar.IsValid() && + breakerBar.IsValid() && + HasDirection(forDir) + // + ; + if (!result) + { + return result; + } + + // + int toIndex = toBar.Index(); + int fromIndex = fromBar.Index(); + int breakerIndex = breakerBar.Index(); + + // + double upper = zone.Upper(); + double lower = zone.Lower(); + + // + bool isBreaked = false; + for (int i = breakerIndex - 1; i >= toIndex; i--) + { + // + XOHCL iBar; + result = iBar.Init( + fromBar.symbol, + fromBar.period, + i // + ); + + // + if (!result) + { + continue; + } + + // + isBreaked = + // + IsBullish(forDir) + // + ? + // + iBar.low < upper + // + : + // + iBar.high > lower + // + ; + if (isBreaked) + { + break; + } + } + + // + result = !isBreaked; + + // + return result; +} + +/** + * Validate Specified Order Block ... + * + * @param forDir: ENUM_X_DIRECTION member ... + * @param symbol: String ... + * @param period: ENUM_TIMEFRAMES member ... + * + * @return ( bool ) + */ +bool IsValid( + XCOrderBlock *orderBlock, + ENUM_X_DIRECTION forDir, + string symbol, + ENUM_TIMEFRAMES period // +) +{ + // + bool result = false; + + // + result = + // + IsValid(symbol) && + IsValid(period) && + orderBlock != NULL && + HasDirection(forDir) && + orderBlock.IsValid() + // + ; + if (!result) + { + return result; + } + + // + XOHCL toBar; + XOHCL fromBar; + XOHCL breakerBar; + result = HasBreakerBar( + toBar, + fromBar, + breakerBar, + forDir, + symbol, + period, + (XCZone *)orderBlock // + ); + if (!result) + { + return result; + } + + // + // Validate Zone Touch ... + result = IsValid( + toBar, + fromBar, + breakerBar, + forDir, + (XCZone *)orderBlock // + ); + + // + return result; +} + +/** + * Get Oldest Zone ... + * + * @return ( int ) + */ +int GetOldest( + XCZone *&source[] // +) +{ + // + int result = -1; + + // + int count = ArraySize(source); + if (!IsValidSize(count)) + { + return result; + } + + // + XCZone *oldest = NULL; + for (int i = 0; i < count; i++) + { + // + XCZone *iZone = source[i]; + + // + bool canSet = + oldest == NULL || + (oldest != NULL && + oldest.From() > iZone.From()); + if (canSet) + { + // + result = i; + oldest = iZone; + } + } + + // + return result; +} + +/** + * Get Youngest Zone ... + * + * @return ( int ) + */ +int GetYoungest( + XCZone *&source[] // +) +{ + // + int result = -1; + + // + int count = ArraySize(source); + if (!IsValidSize(count)) + { + return result; + } + + // + XCZone *youngest = NULL; + for (int i = 0; i < count; i++) + { + // + XCZone *iZone = source[i]; + + // + bool canSet = + youngest == NULL || + (youngest != NULL && + youngest.From() < iZone.From()); + if (canSet) + { + // + result = i; + youngest = iZone; + } + } + + // + return result; +} + +template +bool ToZone( + T *&source[], + XCZone *&dest[] // +) +{ + // + bool result = false; + + // + Clean(dest); + + // + int count = ArraySize(source); + result = IsValidSize(count); + if (!result) + { + return result; + } + + // + for (int i = 0; i < count; i++) + { + // + T *item = source[i]; + + // + if (item != NULL) + { + // + Add( + (XCZone *)item, + dest // + ); + } + } + + // + int destCount = ArraySize(dest); + result = IsValidSize(destCount); + + // + return result; +} + // typedef void (*TOnPOIEvent)(ENUM_XPOI_EVENTS event, XCBasePOI *param // 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 0ae3f1ca..e6e98d90 100644 --- a/X121SMCEA/Classes/x-121.smc.market.cycle.helper.class.mq5 +++ b/X121SMCEA/Classes/x-121.smc.market.cycle.helper.class.mq5 @@ -82,6 +82,7 @@ class XC121SMCCycleHelper : public XCBase // // POI Detector ... + XCPOIDrawer *mPOIDrawer; XCPOIDetector *mPOIDetector; // @@ -166,6 +167,22 @@ class XC121SMCCycleHelper : public XCBase // Initialize Bar Analyser Class Instance ... mBarAnalyser = new XCBarAnalyser(); + // + // Initial and Configure POI Drawer if Required ... + mPOIDrawer = new XCPOIDrawer(); + mPOIDrawer.ChartIdentification(0); + mPOIDrawer.SubWindowIdentification(0); + + // + mPOIDrawer.DemandZoneFill(false); + mPOIDrawer.SupplyZoneFill(false); + mPOIDrawer.BullishFVGFill(false); + mPOIDrawer.BearishFVGFill(false); + mPOIDrawer.SupportZoneFill(false); + mPOIDrawer.ResistanceZoneFill(false); + mPOIDrawer.BullishOrderBlockFill(false); + mPOIDrawer.BearishOrderBlockFill(false); + // // Set Chart Style ... ApplyChartStyle(); @@ -552,6 +569,55 @@ class XC121SMCCycleHelper : public XCBase return result; } + /** + * Detect Order Blocks ... + * + * @return ( int ) + */ + bool DetectOrderBlocks( + XCOrderBlock *&bullishOrderBlocks[], + XCOrderBlock *&bearishOrderBlocks[] // + ) + { + // + bool result = false; + + // + Clean(bullishOrderBlocks); + Clean(bearishOrderBlocks); + + // + XPOIState state; + mPOIDetector.GetState(state); + bool isValid = state.IsValid() && + state.HasChild(); + if (!isValid) + { + return result; + } + + // + int bullOBsCount = DetectDirectionOrderBlocks( + X_DIRECTION_BULLISH, + state, + bullishOrderBlocks // + ); + + // + int bearOBsCount = DetectDirectionOrderBlocks( + X_DIRECTION_BEARISH, + state, + bearishOrderBlocks // + ); + + // + result = IsValidSize(bullOBsCount + + bearOBsCount); + + // + return result; + } + /** * Retrieve Cycle Conditions ... * diff --git a/X121SMCEA/Signals/x-121.smc.x.signal.lib.mq5 b/X121SMCEA/Signals/x-121.smc.x.signal.lib.mq5 index 8be92d7a..034606a7 100644 --- a/X121SMCEA/Signals/x-121.smc.x.signal.lib.mq5 +++ b/X121SMCEA/Signals/x-121.smc.x.signal.lib.mq5 @@ -54,26 +54,8 @@ struct X121SMCStrategyXSignalConditions double point; // - double peak; - datetime peakTime; - - // - double higherPeak; - datetime higherPeakTime; - - // - double vale; - datetime valeTime; - - // - double lowerVale; - datetime lowerValeTime; - - // - ENUM_XPV_PIVOTS pvType; - - // - XPVPivot pivotZone; + XCOrderBlock *bullishOBs[]; + XCOrderBlock *bearishOBs[]; // // Constructor ... @@ -194,86 +176,34 @@ struct X121SMCStrategyXSignalConditions point = 0; // - pvType = XPV_NONE; + Clean(bullishOBs); + Clean(bearishOBs); // - peak = 0; - peakTime = NULL; - - // - higherPeak = 0; - higherPeakTime = NULL; - - // - vale = 0; - valeTime = NULL; - - // - lowerVale = 0; - lowerValeTime = NULL; - - // - pivotZone.Clean(); } // - bool HasPeak() + int CountBullishOBs() { - // - bool result = false; - - // - result = - peak > 0 && - IsValid(peakTime); - - // - return result; + return ArraySize(bullishOBs); } // - bool HasHigherPeak() + bool HasBullishOBs() { - // - bool result = false; - - // - result = - higherPeak > 0 && - IsValid(higherPeakTime); - - // - return result; + return IsValidSize(CountBullishOBs()); } // - bool HasVale() + int CountBearishOBs() { - // - bool result = false; - - // - result = - vale > 0 && - IsValid(valeTime); - - // - return result; + return ArraySize(bearishOBs); } // - bool HasLowerVale() + bool HasBearishOBs() { - // - bool result = false; - - // - result = - lowerVale > 0 && - IsValid(lowerValeTime); - - // - return result; + return IsValidSize(CountBearishOBs()); } // @@ -330,7 +260,7 @@ bool DetectX121SMCXSiganlSetup( // XOHCL zBar; - result = consolidationCycleHelper.GetBar( + result = decisionCycleHelper.GetBar( zBar, zIndex // ); @@ -341,7 +271,7 @@ bool DetectX121SMCXSiganlSetup( // XOHCL cBar; - result = consolidationCycleHelper.GetBar( + result = decisionCycleHelper.GetBar( cBar, cIndex // ); @@ -352,7 +282,7 @@ bool DetectX121SMCXSiganlSetup( // XOHCL pBar; - result = consolidationCycleHelper.GetBar( + result = decisionCycleHelper.GetBar( pBar, pIndex // ); @@ -780,6 +710,454 @@ bool DetectX121SMCXSiganlSetup( // ; + // + // Detect Order Block ... + + // + bool hasBullishOrderBlocks = conditions.HasBullishOBs(); + int bullishOrderBlocksCount = conditions.CountBullishOBs(); + + // + bool hasBearishOrderBlocks = conditions.HasBearishOBs(); + int bearishOrderBlocksCount = conditions.CountBearishOBs(); + + // + bool hasOrderBlocks = hasBullishOrderBlocks && + hasBearishOrderBlocks; + if (!hasOrderBlocks) + { + // + XCOrderBlock *bullishOBs[]; + XCOrderBlock *bearishOBs[]; + bool hasOrderBlocks = visionCycleHelper.DetectOrderBlocks( + bullishOBs, + bearishOBs // + ); + + // + if (!hasBullishOrderBlocks) + { + // + Copy( + bullishOBs, + conditions.bullishOBs // + ); + } + + // + if (!hasBearishOrderBlocks) + { + // + Copy( + bearishOBs, + conditions.bearishOBs // + ); + } + + // + hasBullishOrderBlocks = conditions.HasBullishOBs(); + bullishOrderBlocksCount = conditions.CountBullishOBs(); + + // + hasBearishOrderBlocks = conditions.HasBearishOBs(); + bearishOrderBlocksCount = conditions.CountBearishOBs(); + } + + // + bool hasOldestBullishOB = false; + bool hasYoungestBullishOB = false; + XCOrderBlock *oldestBullishOB = NULL; + XCOrderBlock *youngestBullishOB = NULL; + if (hasBullishOrderBlocks) + { + // + XCZone *zones[]; + bool isConverted = ToZone( + conditions.bullishOBs, + zones // + ); + + // + int oldestIDX = GetOldest(zones); + hasOldestBullishOB = IsValidIndex(oldestIDX); + if (hasOldestBullishOB) + { + oldestBullishOB = conditions.bullishOBs[oldestIDX]; + } + + // + int youngestIDX = GetYoungest(zones); + hasYoungestBullishOB = IsValidIndex(youngestIDX); + if (hasYoungestBullishOB) + { + youngestBullishOB = conditions.bullishOBs[youngestIDX]; + } + } + + // + bool hasOldestBearishOB = false; + bool hasYoungestBearishOB = false; + XCOrderBlock *oldestBearishOB = NULL; + XCOrderBlock *youngestBearishOB = NULL; + if (hasBearishOrderBlocks) + { + // + XCZone *zones[]; + bool isConverted = ToZone( + conditions.bearishOBs, + zones // + ); + + // + int oldestIDX = GetOldest(zones); + hasOldestBearishOB = IsValidIndex(oldestIDX); + if (hasOldestBearishOB) + { + oldestBearishOB = conditions.bearishOBs[oldestIDX]; + } + + // + int youngestIDX = GetYoungest(zones); + hasYoungestBearishOB = IsValidIndex(youngestIDX); + if (hasYoungestBearishOB) + { + youngestBearishOB = conditions.bearishOBs[youngestIDX]; + } + } + + // + bool hasPriceInsideOB = false; + XCOrderBlock *priceInsideOB = NULL; + + // + if (!hasPriceInsideOB && + hasBullishOrderBlocks) + { + // + for (int i = 0; i < bullishOrderBlocksCount; i++) + { + // + XCOrderBlock *iOb = conditions.bullishOBs[i]; + + // + bool isInside = IsPriceInsideZone( + decisionXConditions.valesBuffer[1], + (XCZone *)iOb // + ); + if (isInside) + { + // + hasPriceInsideOB = true; + priceInsideOB = iOb; + break; + } + } + } + + // + if (!hasPriceInsideOB && + hasBearishOrderBlocks) + { + // + for (int i = 0; i < bearishOrderBlocksCount; i++) + { + // + XCOrderBlock *iOb = conditions.bearishOBs[i]; + + // + bool isInside = IsPriceInsideZone( + decisionXConditions.peaksBuffer[1], + (XCZone *)iOb // + ); + if (isInside) + { + // + hasPriceInsideOB = true; + priceInsideOB = iOb; + break; + } + } + } + + // + XStateZones obState; + bool hasOBState = false; + XOHCL priceInsideOBBreakerBar; + if (hasPriceInsideOB) + { + // + XOHCL toBar; + XOHCL fromBar; + ENUM_X_DIRECTION forDir = + priceInsideOB.IsBullish() + ? X_DIRECTION_BULLISH + : X_DIRECTION_BEARISH; + bool hasBreakerBar = HasBreakerBar( + toBar, + fromBar, + priceInsideOBBreakerBar, + forDir, + priceInsideOB.GetSymbol(), + priceInsideOB.GetPeriod(), + (XCZone *)priceInsideOB // + ); + if (hasBreakerBar) + { + // + CalculateStateZones( + obState, + consolidationState, + priceInsideOB.Upper(), + priceInsideOB.Lower(), + priceInsideOBBreakerBar.time // + ); + } + + // + hasOBState = obState.IsValid(); + } + + // + bool isSameCyclesPeak = + // + triggerXConditions.peaksBuffer[1] == decisionXConditions.peaksBuffer[1] && + decisionXConditions.peaksBuffer[1] == analyseXConditions.peaksBuffer[1] && + analyseXConditions.peaksBuffer[1] == verificationXConditions.peaksBuffer[1] && + verificationXConditions.peaksBuffer[1] == consolidationXConditions.peaksBuffer[1] + // + ; + + // + bool isSameCyclesVale = + // + triggerXConditions.valesBuffer[1] == decisionXConditions.valesBuffer[1] && + decisionXConditions.valesBuffer[1] == analyseXConditions.valesBuffer[1] && + analyseXConditions.valesBuffer[1] == verificationXConditions.valesBuffer[1] && + verificationXConditions.valesBuffer[1] == consolidationXConditions.valesBuffer[1] + // + ; + + // + bool hasSameCyclesPV = + hasOBState && + hasPriceInsideOB && + (isSameCyclesPeak || + isSameCyclesVale); + + // + // DRAW ... + // + + // + XCBaseObject *drawnObjects[]; + + // + if (hasBullishOrderBlocks) + { + // + for (int i = 0; i < bullishOrderBlocksCount; i++) + { + // + XCOrderBlock *iOb = conditions.bullishOBs[i]; + + // + XCBullishOrderBlockObject *iObObj; + bool isCreated = visionCycleHelper + .mPOIDrawer + .CreateBullishOrderBlock( + iOb, + iObObj // + ); + if (isCreated) + { + // + Add( + (XCBaseObject *)iObObj, + drawnObjects // + ); + } + } + } + + // + if (hasBearishOrderBlocks) + { + // + for (int i = 0; i < bearishOrderBlocksCount; i++) + { + // + XCOrderBlock *iOb = conditions.bearishOBs[i]; + + // + XCBearishOrderBlockObject *iObObj; + bool isCreated = visionCycleHelper + .mPOIDrawer + .CreateBearishOrderBlock( + iOb, + iObObj // + ); + if (isCreated) + { + // + Add( + (XCBaseObject *)iObObj, + drawnObjects // + ); + } + } + } + + // + // if (hasOldestBullishOB) + // { + // // + // XCBullishOrderBlockObject *iObj; + // bool isCreated = visionCycleHelper + // .mPOIDrawer + // .CreateBullishOrderBlock( + // oldestBullishOB, + // iObj // + // ); + // if (isCreated) + // { + // } + // } + + // // + // if (hasYoungestBullishOB) + // { + // // + // XCBullishOrderBlockObject *iObj; + // bool isCreated = visionCycleHelper + // .mPOIDrawer + // .CreateBullishOrderBlock( + // youngestBullishOB, + // iObj // + // ); + // if (isCreated) + // { + // } + // } + + // // + // if (hasOldestBearishOB) + // { + // // + // XCBearishOrderBlockObject *iObj; + // bool isCreated = visionCycleHelper + // .mPOIDrawer + // .CreateBearishOrderBlock( + // oldestBearishOB, + // iObj // + // ); + // if (isCreated) + // { + // } + // } + + // // + // if (hasYoungestBearishOB) + // { + // // + // XCBearishOrderBlockObject *iObj; + // bool isCreated = visionCycleHelper + // .mPOIDrawer + // .CreateBearishOrderBlock( + // youngestBearishOB, + // iObj // + // ); + // if (isCreated) + // { + // } + // } + + // + if (hasPriceInsideOB) + { + // + bool isBullish = priceInsideOB.IsBullish(); + + // + bool isCreated = false; + XCBaseObject *iObObj = NULL; + if (isBullish) + { + // + XCBullishOrderBlockObject *iObj; + isCreated = visionCycleHelper + .mPOIDrawer + .CreateBullishOrderBlock( + priceInsideOB, + iObj // + ); + + // + if (isCreated) + { + // + iObj.ZoneColor(clrYellow); + iObObj = (XCBaseObject *)iObj; + } + } + else + { + // + XCBearishOrderBlockObject *iObj; + isCreated = visionCycleHelper + .mPOIDrawer + .CreateBearishOrderBlock( + priceInsideOB, + iObj // + ); + + // + if (isCreated) + { + // + iObj.ZoneColor(clrOrangeRed); + iObObj = (XCBaseObject *)iObj; + } + } + + // + if (isCreated) + { + // + Add( + iObObj, + drawnObjects // + ); + } + } + + // + if (hasOBState) + { + // + XCBaseObject *stateObjects[]; + int stateObjectsCount = consolidationCycleHelper + .mPOIDrawer + .DrawStateZones( + obState, + stateObjects // + ); + if (IsValidSize(stateObjectsCount)) + { + // + Copy( + stateObjects, + drawnObjects, + false // + ); + } + } + + // + int drawnCount = ArraySize(drawnObjects); + if (IsValidSize(drawnCount)) + { + } + // // // @@ -790,29 +1168,42 @@ bool DetectX121SMCXSiganlSetup( // bool isCondition1Bullish = // - // decisionXConditions.isRsiSlopeBullish && - // analyseXConditions.isRsiSlopeBullish && - // verificationXConditions.isRsiSlopeBullish && - // consolidationXConditions.isRsiSlopeBullish && - // visionXConditions.isRsiCrossedOverOverSold + hasSameCyclesPV && + isCBarBullishFormed && + priceInsideOB.IsBullish() && // - (decisionXConditions.isBreakedUpPrevAtrLower || - decisionXConditions.isRejectedUpPrevAtrLower) + (decisionXConditions.isBreakedUpPrevSar || + decisionXConditions.isBreakedUpPrevStr || + decisionXConditions.isVWapMaxBreakedUp || + decisionXConditions.isBreakedUpPrevCheMax || + decisionXConditions.isBreakedUpPrevAtrLower) && + // + (decisionXConditions.isSarSwitchedToBullish || + decisionXConditions.isStrSwitchedToBullish || + decisionXConditions.isCheSwitchedToBullish || + decisionXConditions.isVWapSwitchedToBullishState || + decisionXConditions.isVWapSwitchedToBullishOrdered) // ; // bool isCondition1Bearish = // - // decisionXConditions.isRsiSlopeBearish && - // analyseXConditions.isRsiSlopeBearish && - // verificationXConditions.isRsiSlopeBearish && - // consolidationXConditions.isRsiSlopeBearish && - // visionXConditions.isRsiCrossedUnderOverBought + hasSameCyclesPV && + isCBarBearishFormed && + priceInsideOB.IsBearish() && // - // cBar.IsBearish() && - (decisionXConditions.isBreakedDownPrevAtrUpper || - decisionXConditions.isRejectedDownPrevAtrUpper) + (decisionXConditions.isBreakedDownPrevSar || + decisionXConditions.isBreakedDownPrevStr || + decisionXConditions.isVWapMinBreakedDown || + decisionXConditions.isBreakedDownPrevCheMin || + decisionXConditions.isBreakedDownPrevAtrUpper) && + // + (decisionXConditions.isSarSwitchedToBearish || + decisionXConditions.isStrSwitchedToBearish || + decisionXConditions.isCheSwitchedToBearish || + decisionXConditions.isVWapSwitchedToBearishState || + decisionXConditions.isVWapSwitchedToBearishOrdered) // ; @@ -843,10 +1234,10 @@ bool DetectX121SMCXSiganlSetup( // Manipulate Conditions Pivot ... // - // conditions.pivot = - // isCondition1Bullish - // ? conditions.pivotZone.upper - // : conditions.pivotZone.lower; + conditions.pivot = + isCondition1Bullish + ? priceInsideOB.Upper() + : priceInsideOB.Lower(); } // @@ -856,18 +1247,14 @@ bool DetectX121SMCXSiganlSetup( // isBullish = // - // false isCondition1Bullish - // isCondition2Bullish // ; // isBearish = // - // false isCondition1Bearish - // isCondition2Bearish // ; @@ -974,9 +1361,8 @@ bool DetectX121SMCXSiganlTrigger( // XOHCL zBar; - result = zBar.Init( - symbol, - period, + result = decisionCycleHelper.GetBar( + zBar, zIndex // ); if (!result) @@ -986,9 +1372,8 @@ bool DetectX121SMCXSiganlTrigger( // XOHCL cBar; - result = cBar.Init( - symbol, - period, + result = decisionCycleHelper.GetBar( + cBar, cIndex // ); if (!result) @@ -998,9 +1383,8 @@ bool DetectX121SMCXSiganlTrigger( // XOHCL pBar; - result = pBar.Init( - symbol, - period, + result = decisionCycleHelper.GetBar( + pBar, pIndex // ); if (!result) @@ -1024,23 +1408,6 @@ bool DetectX121SMCXSiganlTrigger( // // Cycles Conditions ... - // - // Trigger ... - ENUM_XPOI_EVENTS triggerPoiEvents[]; - ENUM_X_CYCLE_EVENTS triggerCycleEvents[]; - X121SMCCycleConditions triggerConditions; - result = triggerCycleHelper.GetConditions( - triggerCycleEvents, - triggerPoiEvents, - triggerConditions, - zIndex, - loopback // - ); - if (!result) - { - return result; - } - // // Decision ... ENUM_XPOI_EVENTS decisionPoiEvents[]; @@ -1058,138 +1425,17 @@ bool DetectX121SMCXSiganlTrigger( return result; } - // - // Analyse ... - ENUM_XPOI_EVENTS analysePoiEvents[]; - ENUM_X_CYCLE_EVENTS analyseCycleEvents[]; - X121SMCCycleConditions analyseConditions; - result = analyseCycleHelper.GetConditions( - analyseCycleEvents, - analysePoiEvents, - analyseConditions, - zIndex, - loopback // - ); - if (!result) - { - return result; - } - - // - // Verification ... - ENUM_XPOI_EVENTS verificationPoiEvents[]; - ENUM_X_CYCLE_EVENTS verificationCycleEvents[]; - X121SMCCycleConditions verificationConditions; - result = verificationCycleHelper.GetConditions( - verificationCycleEvents, - verificationPoiEvents, - verificationConditions, - zIndex, - loopback // - ); - if (!result) - { - return result; - } - - // - // Consolidation ... - ENUM_XPOI_EVENTS consolidationPoiEvents[]; - ENUM_X_CYCLE_EVENTS consolidationCycleEvents[]; - X121SMCCycleConditions consolidationConditions; - result = consolidationCycleHelper.GetConditions( - consolidationCycleEvents, - consolidationPoiEvents, - consolidationConditions, - zIndex, - loopback // - ); - if (!result) - { - return result; - } - - // - // Vision ... - ENUM_XPOI_EVENTS visionPoiEvents[]; - ENUM_X_CYCLE_EVENTS visionCycleEvents[]; - X121SMCCycleConditions visionConditions; - result = visionCycleHelper.GetConditions( - visionCycleEvents, - visionPoiEvents, - visionConditions, - zIndex, - loopback // - ); - if (!result) - { - return result; - } - // // Cycles POI States ... - XPOIState triggerState = triggerConditions.state; XPOIState decisionState = decisionConditions.state; - XPOIState analyseState = analyseConditions.state; - XPOIState verificationState = verificationConditions.state; - XPOIState consolidationState = consolidationConditions.state; - XPOIState visionState = visionConditions.state; // // Cycle X121Conditions ... - X121Conditions triggerXConditions = triggerConditions.x121Conditions; X121Conditions decisionXConditions = decisionConditions.x121Conditions; - X121Conditions analyseXConditions = analyseConditions.x121Conditions; - X121Conditions verificationXConditions = verificationConditions.x121Conditions; - X121Conditions consolidationXConditions = consolidationConditions.x121Conditions; - X121Conditions visionXConditions = visionConditions.x121Conditions; // // Trigger Conditions ... - // - // SAR ... - double sar = decisionXConditions.sarBuffer[1]; - - // - // STR ... - double str = decisionXConditions.strBuffer[1]; - - // - // CHE ... - double le1 = decisionXConditions.le1Buffer[1]; - double le2 = decisionXConditions.le2Buffer[1]; - double se1 = decisionXConditions.se1Buffer[1]; - double se2 = decisionXConditions.se2Buffer[1]; - - // - // ATR ... - double atrUpper = decisionXConditions.atrUpperBuffer[1]; - double atrLower = decisionXConditions.atrLowerBuffer[1]; - - // - // PV ... - double peak = decisionXConditions.peaksBuffer[1]; - double vale = decisionXConditions.valesBuffer[1]; - - // - int higherPeakIDX = -1; - double higherPeak = decisionCycleHelper - .mX121Helper - .xpvHelper.GetHigherPeak( - higherPeakIDX, - peak // - ); - - // - int lowerValeIDX = -1; - double lowerVale = decisionCycleHelper - .mX121Helper - .xpvHelper.GetLowerVale( - lowerValeIDX, - vale // - ); - // // Slopes ... @@ -1233,10 +1479,6 @@ bool DetectX121SMCXSiganlTrigger( // double point = conditions.point; - // bool isPointBreaked = - // isBullish - // ? ask > point && bid > point - // : ask < point && bid < point; bool isPointBreaked = IsBarBreak( point, setupDir, @@ -1249,20 +1491,18 @@ bool DetectX121SMCXSiganlTrigger( // isBullish = // - isBullish && + isBullish // && // isPointBreaked && - // isSlopesBullish && - cBar.IsBullish() + // isSlopesBullish // ; // isBearish = // - isBearish && + isBearish // && // isPointBreaked && - // isSlopesBearish && - cBar.IsBearish() + // isSlopesBearish // ; @@ -1283,18 +1523,8 @@ bool DetectX121SMCXSiganlTrigger( // // Cleanup Arrays ... - ArrayFree(triggerPoiEvents); - ArrayFree(triggerCycleEvents); ArrayFree(decisionPoiEvents); ArrayFree(decisionCycleEvents); - ArrayFree(analysePoiEvents); - ArrayFree(analyseCycleEvents); - ArrayFree(verificationPoiEvents); - ArrayFree(verificationCycleEvents); - ArrayFree(consolidationPoiEvents); - ArrayFree(consolidationCycleEvents); - ArrayFree(visionPoiEvents); - ArrayFree(visionCycleEvents); // return result; @@ -1303,259 +1533,18 @@ bool DetectX121SMCXSiganlTrigger( // // Detect Nearest Pivot Point ... - // - // Detect Target ... - double target = CalculateTarget( - cBar, - decisionState, - setupDir // - ); - if (target == 0) - { - // - target = CalculateTarget( - cBar, - analyseState, - setupDir // - ); - - // - if (target == 0) - { - // - target = CalculateTarget( - cBar, - verificationState, - setupDir // - ); - } - } - target = 0; - // double entry = GetEntry( conditions.symbol, setupDir // ); - // - // Filling SL Candidates ... - double momentumBarPointsDif = 30 * points; - - // - // Bullish Momentum Bar Selection ... - XOHCL bullishMomentumBar; - int bullishMomentumBarsCount = decisionState.CountBullishMomentumBars(); - if (IsValidSize(bullishMomentumBarsCount)) - { - // - for (int i = 0; i < bullishMomentumBarsCount; i++) - { - // - XCMomentumBar *iMomentum = decisionState.bullishMomentumBars[i]; - - // - XOHCL iBar; - bool isFilled = iMomentum.FillBar(iBar); - if (!isFilled) - { - continue; - } - - // - bool isValidDistane = (MathAbs(iBar.low) - entry) >= momentumBarPointsDif; - if (!isValidDistane) - { - continue; - } - - // - bool isIndexPassed = iBar.Index() <= 5; - if (!isIndexPassed) - { - continue; - } - - // - bool canSet = - !bullishMomentumBar.IsValid() || - (bullishMomentumBar.IsValid() && - bullishMomentumBar.low < entry && - bullishMomentumBar.Index() > iBar.Index()); - if (canSet) - { - bullishMomentumBar = iBar; - } - } - } - - // - // Bearish Momentum Bar Selection ... - XOHCL bearishMomentumBar; - int bearishMomentumBarsCount = decisionState.CountBearishMomentumBars(); - if (IsValidSize(bearishMomentumBarsCount)) - { - // - for (int i = 0; i < bearishMomentumBarsCount; i++) - { - // - XCMomentumBar *iMomentum = decisionState.bearishMomentumBars[i]; - - // - XOHCL iBar; - bool isFilled = iMomentum.FillBar(iBar); - if (!isFilled) - { - continue; - } - - // - bool isValidDistane = (MathAbs(iBar.high) - entry) >= momentumBarPointsDif; - if (!isValidDistane) - { - continue; - } - - // - bool isIndexPassed = iBar.Index() <= 5; - if (!isIndexPassed) - { - continue; - } - - // - bool canSet = - !bearishMomentumBar.IsValid() || - (bearishMomentumBar.IsValid() && - bearishMomentumBar.high > entry && - bearishMomentumBar.Index() > iBar.Index()); - if (canSet) - { - bearishMomentumBar = iBar; - } - } - } - // double sls[]; Add( - sar, + conditions.pivot, sls // ); - Add( - str, - sls // - ); - - // - if (isBullish) - { - // - Add( - atrLower, - sls // - ); - - // // - // Add( - // vale, - // sls // - // ); - - // - if (bullishMomentumBar.IsValid()) - { - // - Add( - bullishMomentumBar.low, - sls // - ); - } - - // // - // if (IsValidIndex(lowerValeIDX)) - // { - // // - // Add( - // lowerVale, - // sls // - // ); - // } - - // - if (le1 != EMPTY_VALUE) - { - // - Add( - le1, - sls // - ); - } - - // - if (le2 != EMPTY_VALUE) - { - // - Add( - le2, - sls // - ); - } - } - else - { - // - Add( - atrUpper, - sls // - ); - - // // - // Add( - // peak, - // sls // - // ); - - // - if (bearishMomentumBar.IsValid()) - { - // - Add( - bearishMomentumBar.high, - sls // - ); - } - - // - // if (IsValidIndex(higherPeakIDX)) - // { - // // - // Add( - // higherPeak, - // sls // - // ); - // } - - // - if (se1 != EMPTY_VALUE) - { - // - Add( - se1, - sls // - ); - } - - // - if (se2 != EMPTY_VALUE) - { - // - Add( - se2, - sls // - ); - } - } // double iAtr = decisionConditions.x121Conditions.atrBuffer[1]; @@ -1570,23 +1559,11 @@ bool DetectX121SMCXSiganlTrigger( ? slsMin - iAtr : slsMax + iAtr; double risk = MathAbs(entry - sl); - double riskInPoints = risk / points; - if (riskInPoints >= 150) - { - // - target = - isBullish - ? entry + (points * 200) - : entry - (points * 200); - - // - target = 0; - } // // Filling Conditions Props ... conditions.sl = sl; - conditions.target = target; + // conditions.target = target; conditions.triggerTime = cTime; conditions.type = isBullish ? X_POSITION_TYPE_LONG @@ -1594,19 +1571,9 @@ bool DetectX121SMCXSiganlTrigger( // // Cleanup Arrays ... - ArrayFree(triggerPoiEvents); - ArrayFree(triggerCycleEvents); ArrayFree(decisionPoiEvents); ArrayFree(decisionCycleEvents); - ArrayFree(analysePoiEvents); - ArrayFree(analyseCycleEvents); - ArrayFree(verificationPoiEvents); - ArrayFree(verificationCycleEvents); - ArrayFree(consolidationPoiEvents); - ArrayFree(consolidationCycleEvents); - ArrayFree(visionPoiEvents); - ArrayFree(visionCycleEvents); - + // return result; } diff --git a/X121SMCEA/Strategy/x-121.smc.strategy.class.mq5 b/X121SMCEA/Strategy/x-121.smc.strategy.class.mq5 index 23c1ec85..ddb5a121 100644 --- a/X121SMCEA/Strategy/x-121.smc.strategy.class.mq5 +++ b/X121SMCEA/Strategy/x-121.smc.strategy.class.mq5 @@ -28,8 +28,8 @@ // #include "../Signals/x-121.smc.x.signal.lib.mq5" -#include "../Signals/x-121.smc.xpz.signal.lib.mq5" #include "../Signals/x-121.smc.xpvt.signal.lib.mq5" +#include "../Signals/x-121.smc.xpz.signal.lib.mq5" #include "../Signals/x-121.smc.xrspvi.signal.lib.mq5" #include "../Signals/x-121.smc.xstrpv.signal.lib.mq5" @@ -185,14 +185,15 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy // // Check Spread for Signalling Conditions ... - bool isSpreadPassed = IsSpreadPass(); - result = isSpreadPassed; - if (!result) - { - // - conditions.Clean(); - return result; - } + // TODO: Uncomment this ... + // bool isSpreadPassed = IsSpreadPass(); + // result = isSpreadPassed; + // if (!result) + // { + // // + // conditions.Clean(); + // return result; + // } // // Detect Signal Conditions ... @@ -1722,8 +1723,8 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy // // XATR ... - x121Inputs.xatrInputs.showATRUpper = showAll || true; - x121Inputs.xatrInputs.showATRLower = showAll || true; + x121Inputs.xatrInputs.showATRUpper = showAll || false; + x121Inputs.xatrInputs.showATRLower = showAll || false; // x121Inputs.xatrInputs.atrMultiplier = 1.5; @@ -1731,16 +1732,16 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy // // XSTR ... - x121Inputs.xstrInputs.showStr = true || false; + x121Inputs.xstrInputs.showStr = showAll || false; x121Inputs.xstrInputs.showStrUpper = showAll || false; x121Inputs.xstrInputs.showStrLower = showAll || false; // // XCHE ... - x121Inputs.xcheInputs.showLE1 = showAll || true; - x121Inputs.xcheInputs.showLE2 = showAll || true; - x121Inputs.xcheInputs.showSE1 = showAll || true; - x121Inputs.xcheInputs.showSE2 = showAll || true; + x121Inputs.xcheInputs.showLE1 = showAll || false; + x121Inputs.xcheInputs.showLE2 = showAll || false; + x121Inputs.xcheInputs.showSE1 = showAll || false; + x121Inputs.xcheInputs.showSE2 = showAll || false; // // XDON ... @@ -1762,6 +1763,7 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy int requiredPOIS = MaxAllowedRequiredPOIs(); // + // Trigger Cycle ... mTriggerCycleHelper = new XC121SMCCycleHelper(); isInited = mTriggerCycleHelper.Init( symbol, @@ -1769,8 +1771,56 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy x121Inputs, requiredPOIS // ); + if (isInited) + { + // + // Configure POI Drawer ... + color bullishColor = clrYellowGreen; + color bearishColor = clrChocolate; + + // + // Bars ... + mTriggerCycleHelper.mPOIDrawer.BarBullishColor(bullishColor); + mTriggerCycleHelper.mPOIDrawer.BarBearishColor(bearishColor); + + // + // Swings ... + mTriggerCycleHelper.mPOIDrawer.SwingLowColor(bullishColor); + mTriggerCycleHelper.mPOIDrawer.SwingHighColor(bearishColor); + + // + // Momentum ... + mTriggerCycleHelper.mPOIDrawer.BullishMomentumBarColor(bullishColor); + mTriggerCycleHelper.mPOIDrawer.BearishMomentumBarColor(bearishColor); + + // + // Rejection ... + mTriggerCycleHelper.mPOIDrawer.BullishRejectionBarColor(bullishColor); + mTriggerCycleHelper.mPOIDrawer.BearishRejectionBarColor(bearishColor); + + // + // Support and Resistance ... + mTriggerCycleHelper.mPOIDrawer.SupportZoneColor(bullishColor); + mTriggerCycleHelper.mPOIDrawer.ResistanceZoneColor(bearishColor); + + // + // Demand and Supply ... + mTriggerCycleHelper.mPOIDrawer.DemandZoneColor(bullishColor); + mTriggerCycleHelper.mPOIDrawer.SupplyZoneColor(bearishColor); + + // + // Order Blocks ... + mTriggerCycleHelper.mPOIDrawer.BullishOrderBlockColor(bullishColor); + mTriggerCycleHelper.mPOIDrawer.BearishOrderBlockColor(bearishColor); + + // + // Fair Value Gaps ... + mTriggerCycleHelper.mPOIDrawer.BullishFVGColor(bullishColor); + mTriggerCycleHelper.mPOIDrawer.BearishFVGColor(bearishColor); + } // + // Decision Cycle ... mDecisionCycleHelper = new XC121SMCCycleHelper(); isInited = mDecisionCycleHelper.Init( symbol, @@ -1778,8 +1828,56 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy x121Inputs, requiredPOIS // ); + if (isInited) + { + // + // Configure POI Drawer ... + color bullishColor = clrDodgerBlue; + color bearishColor = clrSienna; + + // + // Bars ... + mDecisionCycleHelper.mPOIDrawer.BarBullishColor(bullishColor); + mDecisionCycleHelper.mPOIDrawer.BarBearishColor(bearishColor); + + // + // Swings ... + mDecisionCycleHelper.mPOIDrawer.SwingLowColor(bullishColor); + mDecisionCycleHelper.mPOIDrawer.SwingHighColor(bearishColor); + + // + // Momentum ... + mDecisionCycleHelper.mPOIDrawer.BullishMomentumBarColor(bullishColor); + mDecisionCycleHelper.mPOIDrawer.BearishMomentumBarColor(bearishColor); + + // + // Rejection ... + mDecisionCycleHelper.mPOIDrawer.BullishRejectionBarColor(bullishColor); + mDecisionCycleHelper.mPOIDrawer.BearishRejectionBarColor(bearishColor); + + // + // Support and Resistance ... + mDecisionCycleHelper.mPOIDrawer.SupportZoneColor(bullishColor); + mDecisionCycleHelper.mPOIDrawer.ResistanceZoneColor(bearishColor); + + // + // Demand and Supply ... + mDecisionCycleHelper.mPOIDrawer.DemandZoneColor(bullishColor); + mDecisionCycleHelper.mPOIDrawer.SupplyZoneColor(bearishColor); + + // + // Order Blocks ... + mDecisionCycleHelper.mPOIDrawer.BullishOrderBlockColor(bullishColor); + mDecisionCycleHelper.mPOIDrawer.BearishOrderBlockColor(bearishColor); + + // + // Fair Value Gaps ... + mDecisionCycleHelper.mPOIDrawer.BullishFVGColor(bullishColor); + mDecisionCycleHelper.mPOIDrawer.BearishFVGColor(bearishColor); + } // + // Analyse Cycle ... mAnalyseCycleHelper = new XC121SMCCycleHelper(); isInited = mAnalyseCycleHelper.Init( symbol, @@ -1787,8 +1885,56 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy x121Inputs, requiredPOIS // ); + if (isInited) + { + // + // Configure POI Drawer ... + color bullishColor = clrMediumSeaGreen; + color bearishColor = clrBlueViolet; + + // + // Bars ... + mAnalyseCycleHelper.mPOIDrawer.BarBullishColor(bullishColor); + mAnalyseCycleHelper.mPOIDrawer.BarBearishColor(bearishColor); + + // + // Swings ... + mAnalyseCycleHelper.mPOIDrawer.SwingLowColor(bullishColor); + mAnalyseCycleHelper.mPOIDrawer.SwingHighColor(bearishColor); + + // + // Momentum ... + mAnalyseCycleHelper.mPOIDrawer.BullishMomentumBarColor(bullishColor); + mAnalyseCycleHelper.mPOIDrawer.BearishMomentumBarColor(bearishColor); + + // + // Rejection ... + mAnalyseCycleHelper.mPOIDrawer.BullishRejectionBarColor(bullishColor); + mAnalyseCycleHelper.mPOIDrawer.BearishRejectionBarColor(bearishColor); + + // + // Support and Resistance ... + mAnalyseCycleHelper.mPOIDrawer.SupportZoneColor(bullishColor); + mAnalyseCycleHelper.mPOIDrawer.ResistanceZoneColor(bearishColor); + + // + // Demand and Supply ... + mAnalyseCycleHelper.mPOIDrawer.DemandZoneColor(bullishColor); + mAnalyseCycleHelper.mPOIDrawer.SupplyZoneColor(bearishColor); + + // + // Order Blocks ... + mAnalyseCycleHelper.mPOIDrawer.BullishOrderBlockColor(bullishColor); + mAnalyseCycleHelper.mPOIDrawer.BearishOrderBlockColor(bearishColor); + + // + // Fair Value Gaps ... + mAnalyseCycleHelper.mPOIDrawer.BullishFVGColor(bullishColor); + mAnalyseCycleHelper.mPOIDrawer.BearishFVGColor(bearishColor); + } // + // Verification Cycle ... mVerificationCycleHelper = new XC121SMCCycleHelper(); isInited = mVerificationCycleHelper.Init( symbol, @@ -1796,8 +1942,56 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy x121Inputs, requiredPOIS // ); + if (isInited) + { + // + // Configure POI Drawer ... + color bullishColor = clrOliveDrab; + color bearishColor = clrSteelBlue; + + // + // Bars ... + mVerificationCycleHelper.mPOIDrawer.BarBullishColor(bullishColor); + mVerificationCycleHelper.mPOIDrawer.BarBearishColor(bearishColor); + + // + // Swings ... + mVerificationCycleHelper.mPOIDrawer.SwingLowColor(bullishColor); + mVerificationCycleHelper.mPOIDrawer.SwingHighColor(bearishColor); + + // + // Momentum ... + mVerificationCycleHelper.mPOIDrawer.BullishMomentumBarColor(bullishColor); + mVerificationCycleHelper.mPOIDrawer.BearishMomentumBarColor(bearishColor); + + // + // Rejection ... + mVerificationCycleHelper.mPOIDrawer.BullishRejectionBarColor(bullishColor); + mVerificationCycleHelper.mPOIDrawer.BearishRejectionBarColor(bearishColor); + + // + // Support and Resistance ... + mVerificationCycleHelper.mPOIDrawer.SupportZoneColor(bullishColor); + mVerificationCycleHelper.mPOIDrawer.ResistanceZoneColor(bearishColor); + + // + // Demand and Supply ... + mVerificationCycleHelper.mPOIDrawer.DemandZoneColor(bullishColor); + mVerificationCycleHelper.mPOIDrawer.SupplyZoneColor(bearishColor); + + // + // Order Blocks ... + mVerificationCycleHelper.mPOIDrawer.BullishOrderBlockColor(bullishColor); + mVerificationCycleHelper.mPOIDrawer.BearishOrderBlockColor(bearishColor); + + // + // Fair Value Gaps ... + mVerificationCycleHelper.mPOIDrawer.BullishFVGColor(bullishColor); + mVerificationCycleHelper.mPOIDrawer.BearishFVGColor(bearishColor); + } // + // Consolidation Cycle ... mConsolidationCycleHelper = new XC121SMCCycleHelper(); isInited = mConsolidationCycleHelper.Init( symbol, @@ -1805,8 +1999,56 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy x121Inputs, requiredPOIS // ); + if (isInited) + { + // + // Configure POI Drawer ... + color bullishColor = clrLime; + color bearishColor = clrRed; + + // + // Bars ... + mConsolidationCycleHelper.mPOIDrawer.BarBullishColor(bullishColor); + mConsolidationCycleHelper.mPOIDrawer.BarBearishColor(bearishColor); + + // + // Swings ... + mConsolidationCycleHelper.mPOIDrawer.SwingLowColor(bullishColor); + mConsolidationCycleHelper.mPOIDrawer.SwingHighColor(bearishColor); + + // + // Momentum ... + mConsolidationCycleHelper.mPOIDrawer.BullishMomentumBarColor(bullishColor); + mConsolidationCycleHelper.mPOIDrawer.BearishMomentumBarColor(bearishColor); + + // + // Rejection ... + mConsolidationCycleHelper.mPOIDrawer.BullishRejectionBarColor(bullishColor); + mConsolidationCycleHelper.mPOIDrawer.BearishRejectionBarColor(bearishColor); + + // + // Support and Resistance ... + mConsolidationCycleHelper.mPOIDrawer.SupportZoneColor(bullishColor); + mConsolidationCycleHelper.mPOIDrawer.ResistanceZoneColor(bearishColor); + + // + // Demand and Supply ... + mConsolidationCycleHelper.mPOIDrawer.DemandZoneColor(bullishColor); + mConsolidationCycleHelper.mPOIDrawer.SupplyZoneColor(bearishColor); + + // + // Order Blocks ... + mConsolidationCycleHelper.mPOIDrawer.BullishOrderBlockColor(bullishColor); + mConsolidationCycleHelper.mPOIDrawer.BearishOrderBlockColor(bearishColor); + + // + // Fair Value Gaps ... + mConsolidationCycleHelper.mPOIDrawer.BullishFVGColor(bullishColor); + mConsolidationCycleHelper.mPOIDrawer.BearishFVGColor(bearishColor); + } // + // Vision Cycle ... mVisionCycleHelper = new XC121SMCCycleHelper(); isInited = mVisionCycleHelper.Init( symbol, @@ -1814,6 +2056,53 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy x121Inputs, requiredPOIS // ); + if (isInited) + { + // + // Configure POI Drawer ... + color bullishColor = clrAqua; + color bearishColor = clrMagenta; + + // + // Bars ... + mVisionCycleHelper.mPOIDrawer.BarBullishColor(bullishColor); + mVisionCycleHelper.mPOIDrawer.BarBearishColor(bearishColor); + + // + // Swings ... + mVisionCycleHelper.mPOIDrawer.SwingLowColor(bullishColor); + mVisionCycleHelper.mPOIDrawer.SwingHighColor(bearishColor); + + // + // Momentum ... + mVisionCycleHelper.mPOIDrawer.BullishMomentumBarColor(bullishColor); + mVisionCycleHelper.mPOIDrawer.BearishMomentumBarColor(bearishColor); + + // + // Rejection ... + mVisionCycleHelper.mPOIDrawer.BullishRejectionBarColor(bullishColor); + mVisionCycleHelper.mPOIDrawer.BearishRejectionBarColor(bearishColor); + + // + // Support and Resistance ... + mVisionCycleHelper.mPOIDrawer.SupportZoneColor(bullishColor); + mVisionCycleHelper.mPOIDrawer.ResistanceZoneColor(bearishColor); + + // + // Demand and Supply ... + mVisionCycleHelper.mPOIDrawer.DemandZoneColor(bullishColor); + mVisionCycleHelper.mPOIDrawer.SupplyZoneColor(bearishColor); + + // + // Order Blocks ... + mVisionCycleHelper.mPOIDrawer.BullishOrderBlockColor(bullishColor); + mVisionCycleHelper.mPOIDrawer.BearishOrderBlockColor(bearishColor); + + // + // Fair Value Gaps ... + mVisionCycleHelper.mPOIDrawer.BullishFVGColor(bullishColor); + mVisionCycleHelper.mPOIDrawer.BearishFVGColor(bearishColor); + } } //