diff --git a/X121SMCEA/Signals/x-121.smc.xwz.signal.lib.mq5 b/X121SMCEA/Signals/x-121.smc.xwz.signal.lib.mq5 index 3a93df99..94fc39e0 100644 --- a/X121SMCEA/Signals/x-121.smc.xwz.signal.lib.mq5 +++ b/X121SMCEA/Signals/x-121.smc.xwz.signal.lib.mq5 @@ -783,6 +783,7 @@ struct X121SMCStrategyXWZWorkingZone // XBoxZone currSharp; XBoxZone prevSharp; + XBoxZone sharpConsolidation; // // Retrieve Current Sharp ... @@ -847,13 +848,74 @@ struct X121SMCStrategyXWZWorkingZone Clean(tmpBoxes); // + // Preparing Sharp Consolidation Box ... has = currSharp.IsValid() && - prevSharp.IsValid(); + prevSharp.IsValid() && + prevSharp.lower < currSharp.upper; + if (has) + { + // + sharpConsolidation.type = "XSHCNZ"; + sharpConsolidation.dir = currSharp.dir; + sharpConsolidation.symbol = currSharp.symbol; + sharpConsolidation.period = currSharp.period; + + // + sharpConsolidation.from = prevSharp.to; + sharpConsolidation.to = currSharp.from; + + // + int toIDX = GetBarIndex( + currSharp.symbol, + currSharp.period, + sharpConsolidation.to // + ); + int fromIDX = GetBarIndex( + currSharp.symbol, + currSharp.period, + sharpConsolidation.from // + ); + int length = fromIDX - toIDX; + + // + XOHCL toBar; + has = toBar.Init( + sharpConsolidation.symbol, + sharpConsolidation.period, + toIDX // + ); + + // + if (has) + { + // + double upper = toBar.FindHighest( + length, + MODE_HIGH // + ); + + // + double lower = toBar.FindLowest( + length, + MODE_LOW // + ); + + // + sharpConsolidation.upper = upper; + sharpConsolidation.lower = lower; + } + + // + has = sharpConsolidation.IsValid(); + } + + // if (has) { // XCBoxObject *iCurrObj; XCBoxObject *iPrevObj; + XCBoxObject *iSharpConsolidationObj; has = drawer.DrawBox( currSharp, iCurrObj // @@ -864,22 +926,15 @@ struct X121SMCStrategyXWZWorkingZone prevSharp, iPrevObj // ); + has = + has && + drawer.DrawBox( + sharpConsolidation, + iSharpConsolidationObj // + ); if (has) { - // Print("Sharp Detection ..."); - - // - iCurrObj.Delete(); - iPrevObj.Delete(); - - // - iCurrObj.Detach(); - iPrevObj.Detach(); - - // - ZeroMemory(iCurrObj); - ZeroMemory(iPrevObj); } } }