diff --git a/X121SMCEA/Signals/x-121.smc.xwz.signal.class.mq5 b/X121SMCEA/Signals/x-121.smc.xwz.signal.class.mq5 index ef299734..ce13d876 100644 --- a/X121SMCEA/Signals/x-121.smc.xwz.signal.class.mq5 +++ b/X121SMCEA/Signals/x-121.smc.xwz.signal.class.mq5 @@ -430,49 +430,49 @@ class XCX121SMCXWZSignalDetector : public XCBase workingZone.HasBreakedZones(); if (hasBreakedZones) { + // // + // if (!hasSelectedZone) + // { + // // + // int selectedIDX = -1; + // int count = workingZone.CountBreakedZones(); + // for (int i = 0; i < count; i++) + // { + // // + // bool has = DetectSelectedZoneConditions( + // isSelectedZoneReversal, + // workingZone.breakedZones[i], + // decisionState, + // decisionXConditions // + // ); - if (!hasSelectedZone) - { - // - int selectedIDX = -1; - int count = workingZone.CountBreakedZones(); - for (int i = 0; i < count; i++) - { - // - bool has = DetectSelectedZoneConditions( - isSelectedZoneReversal, - workingZone.breakedZones[i], - decisionState, - decisionXConditions // - ); + // // + // if (has) + // { + // // + // selectedIDX = i; + // selectedZone = workingZone.breakedZones[i]; - // - if (has) - { - // - selectedIDX = i; - selectedZone = workingZone.breakedZones[i]; + // // + // break; + // } + // } - // - break; - } - } + // // + // if (IsValidIndex(selectedIDX)) + // { + // // + // ArrayRemove( + // workingZone.breakedZones, + // selectedIDX, + // 1 // + // ); - // - if (IsValidIndex(selectedIDX)) - { - // - ArrayRemove( - workingZone.breakedZones, - selectedIDX, - 1 // - ); - - // - hasSelectedZone = selectedZone.IsValid(); - provider = X121SMC_XWZ_PROVIDER_ACTIVATED_ZONE; - } - } + // // + // hasSelectedZone = selectedZone.IsValid(); + // provider = X121SMC_XWZ_PROVIDER_ACTIVATED_ZONE; + // } + // } } // @@ -667,6 +667,11 @@ class XCX121SMCXWZSignalDetector : public XCBase { } + // + if (!hasSignalBox) + { + } + // // // @@ -771,6 +776,7 @@ class XCX121SMCXWZSignalDetector : public XCBase selectedZone, selectedZoneDir, workingZone, + decisionXConditions, zIndex, maxAllowedSLDistanceInPoint // ); @@ -824,132 +830,132 @@ class XCX121SMCXWZSignalDetector : public XCBase // if (hasSignalBox) { - // - workingZone.mInsideZoneObjects.Clear(); - workingZone.mBreakedZoneObjects.Clear(); - workingZone.mWaitingZoneObjects.Clear(); - workingZone.mWorkingZoneObjects.Clear(); + // // + // workingZone.mInsideZoneObjects.Clear(); + // workingZone.mBreakedZoneObjects.Clear(); + // workingZone.mWaitingZoneObjects.Clear(); + // workingZone.mWorkingZoneObjects.Clear(); - // - XCBoxObject *iObj; - signalBox.to = cTime; - bool isCreated = drawer.CreateBox( - signalBox, - iObj // - ); + // // + // XCBoxObject *iObj; + // signalBox.to = cTime; + // bool isCreated = drawer.CreateBox( + // signalBox, + // iObj // + // ); - // - if (isCreated) - { - // - iObj.BoxWidth(2); - iObj.BoxColor(clrYellow); - iObj.BoxStyle(STYLE_SOLID); - } + // // + // if (isCreated) + // { + // // + // iObj.BoxWidth(2); + // iObj.BoxColor(clrYellow); + // iObj.BoxStyle(STYLE_SOLID); + // } - // - bool isSignalBoxBullishDir = signalBox.IsBullish(); + // // + // bool isSignalBoxBullishDir = signalBox.IsBullish(); - // - // Calculate Priority ... - hasPriority = - hasWorkingZone && - workingZone - .DetectPriority( - priority, - signalBox.dir, - zIndex, - period // - ); + // // + // // Calculate Priority ... + // hasPriority = + // hasWorkingZone && + // workingZone + // .DetectPriority( + // priority, + // signalBox.dir, + // zIndex, + // period // + // ); - // - // Calculate Risk Reward Ration based on Priority ... - hasRewardAmount = CalculateRiskReward( - priority, - reward, - amountPercent // - ); + // // + // // Calculate Risk Reward Ration based on Priority ... + // hasRewardAmount = CalculateRiskReward( + // priority, + // reward, + // amountPercent // + // ); - // - // Calculate Pivot and Point ... + // // + // // Calculate Pivot and Point ... - // - pivot = - isSignalBoxBullishDir - ? signalBox.lower - : signalBox.upper; + // // + // pivot = + // isSignalBoxBullishDir + // ? signalBox.lower + // : signalBox.upper; - // - point = - isSignalBoxBullishDir - ? signalBox.upper - : signalBox.lower; + // // + // point = + // isSignalBoxBullishDir + // ? signalBox.upper + // : signalBox.lower; - // - double defaultTarget = - isSignalBoxBullishDir - ? signalBox.upper - : signalBox.lower; - Add( - defaultTarget, - targets // - ); + // // + // double defaultTarget = + // isSignalBoxBullishDir + // ? signalBox.upper + // : signalBox.lower; + // Add( + // defaultTarget, + // targets // + // ); - // - // Detect SLs ... - double iAtr = decisionXConditions.atrBuffer[0]; - iAtr *= 1.5; + // // + // // Detect SLs ... + // double iAtr = decisionXConditions.atrBuffer[0]; + // iAtr *= 1.5; - // - double defaultSL = - isSignalBoxBullishDir - ? decisionXConditions.valesBuffer[0] - iAtr - : decisionXConditions.peaksBuffer[0] + iAtr; + // // + // double defaultSL = + // isSignalBoxBullishDir + // ? decisionXConditions.valesBuffer[0] - iAtr + // : decisionXConditions.peaksBuffer[0] + iAtr; - // - Add( - defaultSL, - sls // - ); + // // + // Add( + // defaultSL, + // sls // + // ); - // - // Summaries Conditions ... - result = - pivot > 0 && - point > 0 && - hasPriority && - hasRewardAmount; - if (result) - { - // - isBullish = signalBox.IsBullish(); - isBearish = signalBox.IsBearish(); + // // + // // Summaries Conditions ... + // result = + // pivot > 0 && + // point > 0 && + // hasPriority && + // hasRewardAmount; + // if (result) + // { + // // + // isBullish = signalBox.IsBullish(); + // isBearish = signalBox.IsBearish(); - // - Copy( - sls, - mConditions.sls // - ); - Copy( - targets, - mConditions.targets // - ); + // // + // Copy( + // sls, + // mConditions.sls // + // ); + // Copy( + // targets, + // mConditions.targets // + // ); - // - mConditions.pivot = pivot; - mConditions.point = point; - mConditions.reward = reward; - mConditions.setupTime = cTime; - mConditions.priority = priority; - mConditions.provider = provider; - mConditions.dir = signalBox.dir; - mConditions.signalBox = signalBox; - mConditions.amountPercent = amountPercent; - } + // // + // mConditions.pivot = pivot; + // mConditions.point = point; + // mConditions.reward = reward; + // mConditions.setupTime = cTime; + // mConditions.priority = priority; + // mConditions.provider = provider; + // mConditions.dir = signalBox.dir; + // mConditions.signalBox = signalBox; + // mConditions.amountPercent = amountPercent; + // } - // - signalBox.Clean(); - hasSignalBox = false; + // // + // signalBox.Clean(); + // hasSignalBox = false; } // @@ -967,8 +973,8 @@ class XCX121SMCXWZSignalDetector : public XCBase true, // Draw Breaked Zones ... true, // Draw Supply Zone ... true, // Draw Demand Zone ... - true, // Draw Supply Zones ... - true, // Draw Demand Zones ... + false, // Draw Supply Zones ... + false, // Draw Demand Zones ... false, // Draw Support Zones ... false // Draw Resistance Zones ... ); @@ -1294,6 +1300,7 @@ class XCX121SMCXWZSignalDetector : public XCBase { // bool result = false; + return false; // Clean(guards); diff --git a/X121SMCEA/Signals/x-121.smc.xwz.signal.lib.mq5 b/X121SMCEA/Signals/x-121.smc.xwz.signal.lib.mq5 index b438b53e..81d7f8e2 100644 --- a/X121SMCEA/Signals/x-121.smc.xwz.signal.lib.mq5 +++ b/X121SMCEA/Signals/x-121.smc.xwz.signal.lib.mq5 @@ -310,45 +310,45 @@ struct X121SMCStrategyXWZWorkingZone ); } - // - // Support Zones ... - has = HasSupportZones(); - if (!has) - { - // - count = stfState.FilterSupportZones( - supportZones, - period, - XZONE_STATE_PASSED, - false, - XZONE_STATE_FAILED, - false, - XZONE_STATE_FAILED, - false, - XZONE_STATE_IGNORED, - false // - ); - } + // // + // // Support Zones ... + // has = HasSupportZones(); + // if (!has) + // { + // // + // count = stfState.FilterSupportZones( + // supportZones, + // period, + // XZONE_STATE_PASSED, + // false, + // XZONE_STATE_FAILED, + // false, + // XZONE_STATE_FAILED, + // false, + // XZONE_STATE_IGNORED, + // false // + // ); + // } - // - // Resistance Zones ... - has = HasResistanceZones(); - if (!has) - { - // - count = stfState.FilterResistanceZones( - resistanceZones, - period, - XZONE_STATE_PASSED, - false, - XZONE_STATE_FAILED, - false, - XZONE_STATE_FAILED, - false, - XZONE_STATE_IGNORED, - false // - ); - } + // // + // // Resistance Zones ... + // has = HasResistanceZones(); + // if (!has) + // { + // // + // count = stfState.FilterResistanceZones( + // resistanceZones, + // period, + // XZONE_STATE_PASSED, + // false, + // XZONE_STATE_FAILED, + // false, + // XZONE_STATE_FAILED, + // false, + // XZONE_STATE_IGNORED, + // false // + // ); + // } // has = ttfState.HasConsolidationZones(); @@ -546,6 +546,24 @@ struct X121SMCStrategyXWZWorkingZone ); } + // + // Detect Waiting Zones based on TTF and TTF ... + Clean(tmpWaitingZones); + count = ExtractOBFVGs( + tmpWaitingZones, + stfState, + stfState // + ); + has = IsValidSize(count); + if (has) + { + // + AddIfNotExists( + tmpWaitingZones, + waitingZones // + ); + } + // // Since Usig States for Extracting Supply/Demand or // Support/Resistance Zones and State's has Max Alllowed Restrication ... @@ -750,201 +768,201 @@ struct X121SMCStrategyXWZWorkingZone } Clean(tmpDemands); - // - // Support Zones ... - XCSupportZone *tmpSupports[]; - count = stfState.FilterSupportZones( - tmpSupports, - period, - XZONE_STATE_PASSED, - false, - XZONE_STATE_FAILED, - false, - XZONE_STATE_FAILED, - false, - XZONE_STATE_IGNORED, - false // - ); - has = IsValidSize(count); - if (has) - { - // - for (int i = 0; i < count; i++) - { - // - XBoxZone iBox; - has = ToBox( - iBox, - tmpSupports[i] // - ); - if (!has) - { - // - iBox.Clean(); - continue; - } + // // + // // Support Zones ... + // XCSupportZone *tmpSupports[]; + // count = stfState.FilterSupportZones( + // tmpSupports, + // period, + // XZONE_STATE_PASSED, + // false, + // XZONE_STATE_FAILED, + // false, + // XZONE_STATE_FAILED, + // false, + // XZONE_STATE_IGNORED, + // false // + // ); + // has = IsValidSize(count); + // if (has) + // { + // // + // for (int i = 0; i < count; i++) + // { + // // + // XBoxZone iBox; + // has = ToBox( + // iBox, + // tmpSupports[i] // + // ); + // if (!has) + // { + // // + // iBox.Clean(); + // continue; + // } - // - // Find Index ... + // // + // // Find Index ... - // - idx = FindIndex( - iBox, - insideBoxes // - ); - has = !IsValidIndex(idx); - if (!has) - { - // - iBox.Clean(); - continue; - } + // // + // idx = FindIndex( + // iBox, + // insideBoxes // + // ); + // has = !IsValidIndex(idx); + // if (!has) + // { + // // + // iBox.Clean(); + // continue; + // } - // - idx = FindIndex( - iBox, - breakedBoxes // - ); - has = !IsValidIndex(idx); - if (!has) - { - // - iBox.Clean(); - continue; - } + // // + // idx = FindIndex( + // iBox, + // breakedBoxes // + // ); + // has = !IsValidIndex(idx); + // if (!has) + // { + // // + // iBox.Clean(); + // continue; + // } - // - idx = FindIndex( - tmpSupports[i], - supportZones // - ); - has = !IsValidIndex(idx); - if (!has) - { - // - iBox.Clean(); - continue; - } + // // + // idx = FindIndex( + // tmpSupports[i], + // supportZones // + // ); + // has = !IsValidIndex(idx); + // if (!has) + // { + // // + // iBox.Clean(); + // continue; + // } - // - // Checking Price Validation ... - has = cBar.low > tmpSupports[i].Upper(); - if (!has) - { - // - iBox.Clean(); - continue; - } + // // + // // Checking Price Validation ... + // has = cBar.low > tmpSupports[i].Upper(); + // if (!has) + // { + // // + // iBox.Clean(); + // continue; + // } - // - Add( - tmpSupports[i], - supportZones // - ); + // // + // Add( + // tmpSupports[i], + // supportZones // + // ); - // - iBox.Clean(); - } - } - Clean(tmpSupports); + // // + // iBox.Clean(); + // } + // } + // Clean(tmpSupports); - // - // Resistance Zones .. - XCResistanceZone *tmpResistances[]; - count = stfState.FilterResistanceZones( - tmpResistances, - period, - XZONE_STATE_PASSED, - false, - XZONE_STATE_FAILED, - false, - XZONE_STATE_FAILED, - false, - XZONE_STATE_IGNORED, - false // - ); - has = IsValidSize(count); - if (has) - { - // - for (int i = 0; i < count; i++) - { - // - XBoxZone iBox; - has = ToBox( - iBox, - tmpResistances[i] // - ); - if (!has) - { - // - iBox.Clean(); - continue; - } + // // + // // Resistance Zones .. + // XCResistanceZone *tmpResistances[]; + // count = stfState.FilterResistanceZones( + // tmpResistances, + // period, + // XZONE_STATE_PASSED, + // false, + // XZONE_STATE_FAILED, + // false, + // XZONE_STATE_FAILED, + // false, + // XZONE_STATE_IGNORED, + // false // + // ); + // has = IsValidSize(count); + // if (has) + // { + // // + // for (int i = 0; i < count; i++) + // { + // // + // XBoxZone iBox; + // has = ToBox( + // iBox, + // tmpResistances[i] // + // ); + // if (!has) + // { + // // + // iBox.Clean(); + // continue; + // } - // - // Find Index ... + // // + // // Find Index ... - // - idx = FindIndex( - iBox, - insideBoxes // - ); - has = !IsValidIndex(idx); - if (!has) - { - // - iBox.Clean(); - continue; - } + // // + // idx = FindIndex( + // iBox, + // insideBoxes // + // ); + // has = !IsValidIndex(idx); + // if (!has) + // { + // // + // iBox.Clean(); + // continue; + // } - // - idx = FindIndex( - iBox, - breakedBoxes // - ); - has = !IsValidIndex(idx); - if (!has) - { - // - iBox.Clean(); - continue; - } + // // + // idx = FindIndex( + // iBox, + // breakedBoxes // + // ); + // has = !IsValidIndex(idx); + // if (!has) + // { + // // + // iBox.Clean(); + // continue; + // } - // - idx = FindIndex( - tmpResistances[i], - resistanceZones // - ); - has = !IsValidIndex(idx); - if (!has) - { - // - iBox.Clean(); - continue; - } + // // + // idx = FindIndex( + // tmpResistances[i], + // resistanceZones // + // ); + // has = !IsValidIndex(idx); + // if (!has) + // { + // // + // iBox.Clean(); + // continue; + // } - // - // Checking Price Validation ... - has = cBar.high < tmpResistances[i].Lower(); - if (!has) - { - // - iBox.Clean(); - continue; - } + // // + // // Checking Price Validation ... + // has = cBar.high < tmpResistances[i].Lower(); + // if (!has) + // { + // // + // iBox.Clean(); + // continue; + // } - // - Add( - tmpResistances[i], - resistanceZones // - ); + // // + // Add( + // tmpResistances[i], + // resistanceZones // + // ); - // - iBox.Clean(); - } - } - Clean(tmpResistances); + // // + // iBox.Clean(); + // } + // } + // Clean(tmpResistances); // // STF TTF ... @@ -2513,29 +2531,29 @@ struct X121SMCStrategyXWZWorkingZone } } - // - // Boxes ... - has = HasInsideBoxes(); - if (has) - { - // - count = CountInsideBoxes(); - for (int i = 0; i < count; i++) - { - // - XCBoxObject *object; - bool isCreated = drawer.DrawBox( - insideBoxes[i], - object // - ); + // // + // // Boxes ... + // has = HasInsideBoxes(); + // if (has) + // { + // // + // count = CountInsideBoxes(); + // for (int i = 0; i < count; i++) + // { + // // + // XCBoxObject *object; + // bool isCreated = drawer.DrawBox( + // insideBoxes[i], + // object // + // ); - // - if (isCreated) - { - mInsideZoneObjects.Add(object); - } - } - } + // // + // if (isCreated) + // { + // mInsideZoneObjects.Add(object); + // } + // } + // } } // @@ -2570,29 +2588,29 @@ struct X121SMCStrategyXWZWorkingZone } } - // - // Boxes ... - has = HasBreakedBoxes(); - if (has) - { - // - count = CountBreakedBoxes(); - for (int i = 0; i < count; i++) - { - // - XCBoxObject *object; - bool isCreated = drawer.DrawBox( - breakedBoxes[i], - object // - ); + // // + // // Boxes ... + // has = HasBreakedBoxes(); + // if (has) + // { + // // + // count = CountBreakedBoxes(); + // for (int i = 0; i < count; i++) + // { + // // + // XCBoxObject *object; + // bool isCreated = drawer.DrawBox( + // breakedBoxes[i], + // object // + // ); - // - if (isCreated) - { - mInsideZoneObjects.Add(object); - } - } - } + // // + // if (isCreated) + // { + // mInsideZoneObjects.Add(object); + // } + // } + // } } // @@ -4413,6 +4431,7 @@ bool DetectSelectedZoneSLCandidates( XOBFVG &selectedZone, ENUM_X_DIRECTION forDir, X121SMCStrategyXWZWorkingZone &workingZone, + X121Conditions &conditions, int barIndex = 0, double maxAllowedSLDistanceInPoint = 300 // ) @@ -4476,127 +4495,138 @@ bool DetectSelectedZoneSLCandidates( int idx = -1; bool has = false; + // + double pvSL = isBullish + ? conditions.valesBuffer[0] + : conditions.peaksBuffer[1]; + + // + Add( + pvSL, + sls // + ); + // // Based On Passed Bars ... - XOHCL passedBar; - bool isPassed = false; - bool isBodyState = false; - ENUM_X_DIRECTION passedDir = selectedZone.GetDirection(); + // XOHCL passedBar; + // bool isPassed = false; + // bool isBodyState = false; + // ENUM_X_DIRECTION passedDir = selectedZone.GetDirection(); - // - // Started Bar ... - isPassed = selectedZone.ob.IsStarted( - passedDir, - passedBar, - isBodyState // - ); - if (isPassed) - { - // - double iSL = - isBullish - ? passedBar.low - : passedBar.high; - double iSLDiff = MathAbs(iSL - pivot); - has = - iSLDiff > 0 && - iSLDiff <= maxAllowedSLDistanceInPoint * points; - if (has) - { - // - Add( - iSL, - sls // - ); - } - } + // // + // // Started Bar ... + // isPassed = selectedZone.ob.IsStarted( + // passedDir, + // passedBar, + // isBodyState // + // ); + // if (isPassed) + // { + // // + // double iSL = + // isBullish + // ? passedBar.low + // : passedBar.high; + // double iSLDiff = MathAbs(iSL - pivot); + // has = + // iSLDiff > 0 && + // iSLDiff <= maxAllowedSLDistanceInPoint * points; + // if (has) + // { + // // + // Add( + // iSL, + // sls // + // ); + // } + // } - // - // Activation Bar ... - passedBar.Clean(); - isPassed = selectedZone.ob.IsActivated( - passedDir, - passedBar, - isBodyState // - ); - if (isPassed) - { - // - double iSL = - isBullish - ? passedBar.low - : passedBar.high; - double iSLDiff = MathAbs(iSL - pivot); - has = - iSLDiff > 0 && - iSLDiff <= maxAllowedSLDistanceInPoint * points; - if (has) - { - // - Add( - iSL, - sls // - ); - } - } + // // + // // Activation Bar ... + // passedBar.Clean(); + // isPassed = selectedZone.ob.IsActivated( + // passedDir, + // passedBar, + // isBodyState // + // ); + // if (isPassed) + // { + // // + // double iSL = + // isBullish + // ? passedBar.low + // : passedBar.high; + // double iSLDiff = MathAbs(iSL - pivot); + // has = + // iSLDiff > 0 && + // iSLDiff <= maxAllowedSLDistanceInPoint * points; + // if (has) + // { + // // + // Add( + // iSL, + // sls // + // ); + // } + // } - // - // Worked Bar ... - passedBar.Clean(); - isPassed = selectedZone.ob.IsActivated( - passedDir, - passedBar, - isBodyState // - ); - if (isPassed) - { - // - double iSL = - isBullish - ? passedBar.low - : passedBar.high; - double iSLDiff = MathAbs(iSL - pivot); - has = - iSLDiff > 0 && - iSLDiff <= maxAllowedSLDistanceInPoint * points; - if (has) - { - // - Add( - iSL, - sls // - ); - } - } + // // + // // Worked Bar ... + // passedBar.Clean(); + // isPassed = selectedZone.ob.IsActivated( + // passedDir, + // passedBar, + // isBodyState // + // ); + // if (isPassed) + // { + // // + // double iSL = + // isBullish + // ? passedBar.low + // : passedBar.high; + // double iSLDiff = MathAbs(iSL - pivot); + // has = + // iSLDiff > 0 && + // iSLDiff <= maxAllowedSLDistanceInPoint * points; + // if (has) + // { + // // + // Add( + // iSL, + // sls // + // ); + // } + // } - // - // Breaked Bar ... - passedBar.Clean(); - isPassed = selectedZone.ob.IsActivated( - passedDir, - passedBar, - isBodyState // - ); - if (isPassed) - { - // - double iSL = - isBullish - ? passedBar.low - : passedBar.high; - double iSLDiff = MathAbs(iSL - pivot); - has = - iSLDiff > 0 && - iSLDiff <= maxAllowedSLDistanceInPoint * points; - if (has) - { - // - Add( - iSL, - sls // - ); - } - } + // // + // // Breaked Bar ... + // passedBar.Clean(); + // isPassed = selectedZone.ob.IsActivated( + // passedDir, + // passedBar, + // isBodyState // + // ); + // if (isPassed) + // { + // // + // double iSL = + // isBullish + // ? passedBar.low + // : passedBar.high; + // double iSLDiff = MathAbs(iSL - pivot); + // has = + // iSLDiff > 0 && + // iSLDiff <= maxAllowedSLDistanceInPoint * points; + // if (has) + // { + // // + // Add( + // iSL, + // sls // + // ); + // } + // } // // Based On Consolidation Zones ... @@ -4777,99 +4807,99 @@ bool DetectSelectedZoneSLCandidates( // // Support Zones ... - has = workingZone.HasSupportZones(); - if (has) - { - // - XCSupportZone *tmpZones[]; - Copy( - workingZone.supportZones, - tmpZones // - ); - XCSupportZone *selectedSupport = NULL; + // has = workingZone.HasSupportZones(); + // if (has) + // { + // // + // XCSupportZone *tmpZones[]; + // Copy( + // workingZone.supportZones, + // tmpZones // + // ); + // XCSupportZone *selectedSupport = NULL; - // - while (HasChild(tmpZones)) - { - // - idx = GetLowest(tmpZones); - has = IsValidIndex(idx); - if (!has) - { - break; - } + // // + // while (HasChild(tmpZones)) + // { + // // + // idx = GetLowest(tmpZones); + // has = IsValidIndex(idx); + // if (!has) + // { + // break; + // } - // - XCSupportZone *iZone = tmpZones[idx]; - ArrayRemove( - tmpZones, - idx, - 1 // - ); + // // + // XCSupportZone *iZone = tmpZones[idx]; + // ArrayRemove( + // tmpZones, + // idx, + // 1 // + // ); - // - // Validate Zone ... - has = - isBullish - ? IsBelowDiff( - iZone, - selectedZone.ob, - true // Ignore Inside ... - ) - : IsAboveDiff( - iZone, - selectedZone.ob, - true // Ignore Inside ... - ); - if (!has) - { - continue; - } + // // + // // Validate Zone ... + // has = + // isBullish + // ? IsBelowDiff( + // iZone, + // selectedZone.ob, + // true // Ignore Inside ... + // ) + // : IsAboveDiff( + // iZone, + // selectedZone.ob, + // true // Ignore Inside ... + // ); + // if (!has) + // { + // continue; + // } - // - has = - selectedSupport == NULL - ? true - : isBullish - ? selectedSupport.Lower() < iZone.Lower() - : selectedSupport.Upper() > iZone.Upper(); - if (!has) - { - continue; - } + // // + // has = + // selectedSupport == NULL + // ? true + // : isBullish + // ? selectedSupport.Lower() < iZone.Lower() + // : selectedSupport.Upper() > iZone.Upper(); + // if (!has) + // { + // continue; + // } - // - selectedSupport = iZone; + // // + // selectedSupport = iZone; - // - } + // // + // } - // - has = selectedSupport != NULL; - if (has) - { - // - double iSL = isBullish - ? selectedSupport.Lower() - : selectedSupport.Upper(); - double iSLDiff = MathAbs(iSL - pivot); - has = - iSLDiff > 0 && - iSLDiff <= maxAllowedSLDistanceInPoint * points; - if (has) - { - // - Add( - iSL, - sls // - ); - } - } + // // + // has = selectedSupport != NULL; + // if (has) + // { + // // + // double iSL = isBullish + // ? selectedSupport.Lower() + // : selectedSupport.Upper(); + // double iSLDiff = MathAbs(iSL - pivot); + // has = + // iSLDiff > 0 && + // iSLDiff <= maxAllowedSLDistanceInPoint * points; + // if (has) + // { + // // + // Add( + // iSL, + // sls // + // ); + // } + // } - // - Clean(tmpZones); - ZeroMemory(selectedSupport); - } + // // + // Clean(tmpZones); + // ZeroMemory(selectedSupport); + // } // // Supply Zones ... @@ -4970,107 +5000,107 @@ bool DetectSelectedZoneSLCandidates( // // Resistance Zones ... - has = workingZone.HasDemandZones(); - if (has) - { - // - XCResistanceZone *tmpZones[]; - Copy( - workingZone.resistanceZones, - tmpZones // - ); - XCResistanceZone *selectedResistance = NULL; + // has = workingZone.HasDemandZones(); + // if (has) + // { + // // + // XCResistanceZone *tmpZones[]; + // Copy( + // workingZone.resistanceZones, + // tmpZones // + // ); + // XCResistanceZone *selectedResistance = NULL; - // - while (HasChild(tmpZones)) - { - // - idx = GetHighest(tmpZones); - has = IsValidIndex(idx); - if (!has) - { - break; - } + // // + // while (HasChild(tmpZones)) + // { + // // + // idx = GetHighest(tmpZones); + // has = IsValidIndex(idx); + // if (!has) + // { + // break; + // } - // - XCResistanceZone *iZone = tmpZones[idx]; - ArrayRemove( - tmpZones, - idx, - 1 // - ); + // // + // XCResistanceZone *iZone = tmpZones[idx]; + // ArrayRemove( + // tmpZones, + // idx, + // 1 // + // ); - // - // Validate Zone ... - has = - !isBullish - ? IsAboveDiff( - iZone, - selectedZone.ob, - true // Ignore Inside ... - ) - : IsBelowDiff( - iZone, - selectedZone.ob, - true // Ignore Inside ... - ); - if (!has) - { - continue; - } + // // + // // Validate Zone ... + // has = + // !isBullish + // ? IsAboveDiff( + // iZone, + // selectedZone.ob, + // true // Ignore Inside ... + // ) + // : IsBelowDiff( + // iZone, + // selectedZone.ob, + // true // Ignore Inside ... + // ); + // if (!has) + // { + // continue; + // } - // - has = - selectedResistance == NULL - ? true - : !isBullish - ? selectedResistance.Upper() < iZone.Upper() - : selectedResistance.Lower() > iZone.Lower(); - if (!has) - { - continue; - } + // // + // has = + // selectedResistance == NULL + // ? true + // : !isBullish + // ? selectedResistance.Upper() < iZone.Upper() + // : selectedResistance.Lower() > iZone.Lower(); + // if (!has) + // { + // continue; + // } - // - selectedResistance = iZone; + // // + // selectedResistance = iZone; - // - } + // // + // } - // - has = selectedResistance != NULL; - if (has) - { - // - double iSL = - !isBullish - ? selectedResistance.Upper() - : selectedResistance.Lower(); - double iSLDiff = MathAbs(iSL - pivot); - has = - iSLDiff > 0 && - iSLDiff <= maxAllowedSLDistanceInPoint * points; - if (has) - { - // - Add( - iSL, - sls // - ); - } - } + // // + // has = selectedResistance != NULL; + // if (has) + // { + // // + // double iSL = + // !isBullish + // ? selectedResistance.Upper() + // : selectedResistance.Lower(); + // double iSLDiff = MathAbs(iSL - pivot); + // has = + // iSLDiff > 0 && + // iSLDiff <= maxAllowedSLDistanceInPoint * points; + // if (has) + // { + // // + // Add( + // iSL, + // sls // + // ); + // } + // } - // - Clean(tmpZones); - ZeroMemory(selectedResistance); - } + // // + // Clean(tmpZones); + // ZeroMemory(selectedResistance); + // } // // Cleanp Resources ... // cBar.Clean(); - passedBar.Clean(); + // passedBar.Clean(); result = HasChild(sls); //