diff --git a/Documents/BKP/2.mq5 b/Documents/BKP/2.mq5 index 68f4b907..db7e47c9 100644 --- a/Documents/BKP/2.mq5 +++ b/Documents/BKP/2.mq5 @@ -447,3 +447,641 @@ // conditions.swingHighBuffer[cIDX] > conditions.fiboLevel1Buffer[cIDX] // // ; + + + /////////////////////////////////////////////////////////////////////////////////// + + + // + // bool DetectPeakPivot( + // int barIndex, + // XOHCL &zBar, + // XOHCL &cBar, + // XOHCL &pBar, + // XOHCL &p2Bar, + // XCAEAConditions &conditions // + // ) + // { + // // + // bool result = false; + + // // + // // Validate Args ... + // result = + // // + // barIndex >= 0 && + // zBar.IsValid() && + // cBar.IsValid() && + // pBar.IsValid() && + // p2Bar.IsValid() && + // detectPeakPivots + // // + // ; + // if (!result) + // { + // return result; + // } + + // // + // // Define Requirements ... + + // // + // int zIDX = 0; + // int cIDX = zIDX + 1; + // int pIDX = cIDX + 1; + // int p2IDX = pIDX + 1; + + // // + // datetime cTime = zBar.time; + // string symbol = zBar.symbol; + // ENUM_TIMEFRAMES period = zBar.period; + // double points = GetPoints(symbol); + + // // + // // Reading Conditional Values ... + + // // + // // PEAK ... + // double zPeak = conditions.peakBuffer[zIDX]; + // double cPeak = conditions.peakBuffer[cIDX]; + // double pPeak = conditions.peakBuffer[pIDX]; + // double p2Peak = conditions.peakBuffer[p2IDX]; + + // // + // // PEAK Golden ... + // double zPeakGolden = conditions.peakGoldenBuffer[zIDX]; + // double cPeakGolden = conditions.peakGoldenBuffer[cIDX]; + // double pPeakGolden = conditions.peakGoldenBuffer[pIDX]; + // double p2PeakGolden = conditions.peakGoldenBuffer[p2IDX]; + + // // + // // VALE ... + // double zVale = conditions.valeBuffer[zIDX]; + // double cVale = conditions.valeBuffer[cIDX]; + // double pVale = conditions.valeBuffer[pIDX]; + // double p2Vale = conditions.valeBuffer[p2IDX]; + + // // + // // VALE Golden ... + // double zValeGolden = conditions.valeGoldenBuffer[zIDX]; + // double cValeGolden = conditions.valeGoldenBuffer[cIDX]; + // double pValeGolden = conditions.valeGoldenBuffer[pIDX]; + // double p2ValeGolden = conditions.valeGoldenBuffer[p2IDX]; + + // // + // // SWING High .. + // double zSwingHigh = conditions.swingHighBuffer[zIDX]; + // double cSwingHigh = conditions.swingHighBuffer[cIDX]; + // double pSwingHigh = conditions.swingHighBuffer[pIDX]; + // double p2SwingHigh = conditions.swingHighBuffer[p2IDX]; + + // // + // // SWING Low ... + // double zSwingLow = conditions.swingLowBuffer[zIDX]; + // double cSwingLow = conditions.swingLowBuffer[cIDX]; + // double pSwingLow = conditions.swingLowBuffer[pIDX]; + // double p2SwingLow = conditions.swingLowBuffer[p2IDX]; + + // // + // // SUPPORT ... + // double zSupport = conditions.supportBuffer[zIDX]; + // double cSupport = conditions.supportBuffer[cIDX]; + // double pSupport = conditions.supportBuffer[pIDX]; + // double p2Support = conditions.supportBuffer[p2IDX]; + + // // + // // RESISTANCE ... + // double zResistance = conditions.resistanceBuffer[zIDX]; + // double cResistance = conditions.resistanceBuffer[cIDX]; + // double pResistance = conditions.resistanceBuffer[pIDX]; + // double p2Resistance = conditions.resistanceBuffer[p2IDX]; + + // // + // // Detecting Bar Conditions ... + + // // + // ENUM_X_DIRECTION cBarDir; + + // // + // // Rejected ... + // bool isCBarRejected = helper + // .barAnalyser + // .IsRejected( + // cBar, + // cBarDir, + // false, // Force Type ... + // true // Force Fibo Pressure ... + // ); + // bool isCBarBullishRejected = + // isCBarRejected && + // IsBullish(cBarDir); + // bool isCBarBearishRejected = + // isCBarRejected && + // IsBearish(cBarDir); + + // // + // // Engulfed ... + // bool isCBarEngulfed = helper + // .barAnalyser + // .IsEngulfed( + // cBar, + // cBarDir // + // ); + // bool isCBarBullishEngulfed = + // isCBarEngulfed && + // IsBullish(cBarDir); + // bool isCBarBearishEngulfed = + // isCBarEngulfed && + // IsBearish(cBarDir); + + // // + // // Prepare Conditinal Conditions ... + + // // + // bool isPeakSameLast = cPeak == pPeak; + // bool isPeakSameLastPrev = pPeak == p2Peak; + + // // + // if (applySwingsOnPVPivots) + // { + // // + // isPeakSameLast = + // isPeakSameLast && + // cSwingHigh == cPeak && + // cSwingHigh == pSwingHigh; + + // // + // isPeakSameLastPrev = + // isPeakSameLastPrev && + // pSwingHigh == pPeak && + // pSwingHigh == p2SwingHigh; + // } + + // // + // if (applySupportAndResistanceOnPVPivots) + // { + // // + // isPeakSameLast = + // isPeakSameLast && + // cResistance == cPeak && + // cResistance == pResistance; + + // // + // isPeakSameLastPrev = + // isPeakSameLastPrev && + // pResistance == pPeak && + // pResistance == p2Resistance; + // } + + // // + // bool isPeakSwitchedToSameLast = isPeakSameLast && + // !isPeakSameLastPrev; + // bool isPeakFinishedFromSameLast = !isPeakSameLast && + // isPeakSameLastPrev; + + // // + // // ZERO ... + // // Default Peak and Vale Selection ... + // bool isTypeZeroStart = isPeakFinishedFromSameLast; + // bool isTypeZeroContinue = isPeakSameLast; + // bool isTypeZeroFinished = isPeakSwitchedToSameLast; + // if (isTypeZeroFinished) + // { + // // + // bool hasSelectionType = selectRejectedPVPivots || + // selectEngulfedPVPivots; + + // // + // bool isPVRejected = + // isCBarBearishRejected && + // selectRejectedPVPivots; + + // // + // bool isPVEngulfed = + // isCBarBearishEngulfed && + // selectEngulfedPVPivots; + + // // + // bool isBarPassed = + // !hasSelectionType + // ? true + // : isPVRejected || + // isPVEngulfed; + + // // + // isTypeZeroFinished = + // isBarPassed && + // isTypeZeroFinished; + // if (!isTypeZeroFinished) + // { + // peakPivot.Clean(); + // } + // } + + // // + // // Summarizing Conditions ... + + // // + // result = false; + + // // + // bool hasStartCondition = + // // + // isTypeZeroStart + // // + // ; + // bool hasContinuationCondition = + // // + // isTypeZeroContinue + // // + // ; + // bool hasEndCondition = + // // + // isTypeZeroFinished + // // + // ; + + // // + // // ReInstance Pivot ... + // if (hasStartCondition) + // { + // // + // peakPivot.Clean(); + + // // + // peakPivot.type = XCA_PEAK; + // peakPivot.symbol = symbol; + // peakPivot.period = period; + + // // + // peakPivot.to = pBar.time; + // peakPivot.from = pBar.time; + // peakPivot.value = pPeak; + // peakPivot.reserve = pPeakGolden; + // } + + // // + // // Calculate and Fill Pivot Requirements ... + // if (hasContinuationCondition) + // { + // // + // peakPivot.from = pBar.time; + + // // + // peakPivot.reserve = + // peakPivot.reserve == 0 + // ? pPeakGolden + // : MathMax(peakPivot.reserve, pPeakGolden); + // } + + // // + // // End up Pivot and Store it ... + // if (hasEndCondition) + // { + // // + // result = + // peakPivot.IsValid() && + // peakPivot.GetAge() >= pivotVerifications; + // if (result) + // { + // // + // XBoxZone iBox; + // result = peakPivot.AsBox(iBox); + // if (result) + // { + // // + // newPeakPivotDetected = AddBox( + // iBox, + // peakPivots // + // ); + // } + + // // + // iBox.Clean(); + // } + + // // + // peakPivot.Clean(); + // } + + // // + // return result; + // } + + + + // // + // bool DetectValePivot( + // int barIndex, + // XOHCL &zBar, + // XOHCL &cBar, + // XOHCL &pBar, + // XOHCL &p2Bar, + // XCAEAConditions &conditions // + // ) + // { + // // + // bool result = false; + + // // + // // Validate Args ... + // result = + // // + // barIndex >= 0 && + // zBar.IsValid() && + // cBar.IsValid() && + // pBar.IsValid() && + // p2Bar.IsValid() && + // detectValePivots + // // + // ; + // if (!result) + // { + // return result; + // } + + // // + // // Define Requirements ... + + // // + // int zIDX = 0; + // int cIDX = zIDX + 1; + // int pIDX = cIDX + 1; + // int p2IDX = pIDX + 1; + + // // + // datetime cTime = zBar.time; + // string symbol = zBar.symbol; + // ENUM_TIMEFRAMES period = zBar.period; + // double points = GetPoints(symbol); + + // // + // // Reading Conditional Values ... + + // // + // // PEAK ... + // double zPeak = conditions.peakBuffer[zIDX]; + // double cPeak = conditions.peakBuffer[cIDX]; + // double pPeak = conditions.peakBuffer[pIDX]; + // double p2Peak = conditions.peakBuffer[p2IDX]; + + // // + // // PEAK Golden ... + // double zPeakGolden = conditions.peakGoldenBuffer[zIDX]; + // double cPeakGolden = conditions.peakGoldenBuffer[cIDX]; + // double pPeakGolden = conditions.peakGoldenBuffer[pIDX]; + // double p2PeakGolden = conditions.peakGoldenBuffer[p2IDX]; + + // // + // // VALE ... + // double zVale = conditions.valeBuffer[zIDX]; + // double cVale = conditions.valeBuffer[cIDX]; + // double pVale = conditions.valeBuffer[pIDX]; + // double p2Vale = conditions.valeBuffer[p2IDX]; + + // // + // // VALE Golden ... + // double zValeGolden = conditions.valeGoldenBuffer[zIDX]; + // double cValeGolden = conditions.valeGoldenBuffer[cIDX]; + // double pValeGolden = conditions.valeGoldenBuffer[pIDX]; + // double p2ValeGolden = conditions.valeGoldenBuffer[p2IDX]; + + // // + // // SWING High .. + // double zSwingHigh = conditions.swingHighBuffer[zIDX]; + // double cSwingHigh = conditions.swingHighBuffer[cIDX]; + // double pSwingHigh = conditions.swingHighBuffer[pIDX]; + // double p2SwingHigh = conditions.swingHighBuffer[p2IDX]; + + // // + // // SWING Low ... + // double zSwingLow = conditions.swingLowBuffer[zIDX]; + // double cSwingLow = conditions.swingLowBuffer[cIDX]; + // double pSwingLow = conditions.swingLowBuffer[pIDX]; + // double p2SwingLow = conditions.swingLowBuffer[p2IDX]; + + // // + // // SUPPORT ... + // double zSupport = conditions.supportBuffer[zIDX]; + // double cSupport = conditions.supportBuffer[cIDX]; + // double pSupport = conditions.supportBuffer[pIDX]; + // double p2Support = conditions.supportBuffer[p2IDX]; + + // // + // // RESISTANCE ... + // double zResistance = conditions.resistanceBuffer[zIDX]; + // double cResistance = conditions.resistanceBuffer[cIDX]; + // double pResistance = conditions.resistanceBuffer[pIDX]; + // double p2Resistance = conditions.resistanceBuffer[p2IDX]; + + // // + // // Detecting Bar Conditions ... + + // // + // ENUM_X_DIRECTION cBarDir; + + // // + // // Rejected ... + // bool isCBarRejected = helper + // .barAnalyser + // .IsRejected( + // cBar, + // cBarDir, + // false, // Force Type ... + // true // Force Fibo Pressure ... + // ); + // bool isCBarBullishRejected = + // isCBarRejected && + // IsBullish(cBarDir); + // bool isCBarBearishRejected = + // isCBarRejected && + // IsBearish(cBarDir); + + // // + // // Engulfed ... + // bool isCBarEngulfed = helper + // .barAnalyser + // .IsEngulfed( + // cBar, + // cBarDir // + // ); + // bool isCBarBullishEngulfed = + // isCBarEngulfed && + // IsBullish(cBarDir); + // bool isCBarBearishEngulfed = + // isCBarEngulfed && + // IsBearish(cBarDir); + + // // + // // Prepare Conditinal Conditions ... + + // // + // bool isValeSameLast = cVale == pVale; + // bool isValeSameLastPrev = pVale == p2Vale; + + // // + // if (applySwingsOnPVPivots) + // { + // // + // isValeSameLast = + // isValeSameLast && + // cSwingLow == cVale && + // cSwingLow == pSwingLow; + + // // + // isValeSameLastPrev = + // isValeSameLastPrev && + // pSwingLow == pVale && + // pSwingLow == p2SwingLow; + // } + + // // + // if (applySupportAndResistanceOnPVPivots) + // { + // // + // isValeSameLast = + // isValeSameLast && + // cSupport == cVale && + // cSupport == pSupport; + + // // + // isValeSameLastPrev = + // isValeSameLastPrev && + // pSupport == pVale && + // pSupport == p2Support; + // } + + // // + // bool isValeSwitchedToSameLast = isValeSameLast && + // !isValeSameLastPrev; + // bool isValeFinishedFromSameLast = !isValeSameLast && + // isValeSameLastPrev; + + // // + // // ZERO ... + // // Default Peak and Vale Selection ... + // bool isTypeZeroStart = isValeFinishedFromSameLast; + // bool isTypeZeroContinue = isValeSameLast; + // bool isTypeZeroFinished = isValeSwitchedToSameLast; + // if (isTypeZeroFinished) + // { + // // + // bool hasSelectionType = selectRejectedPVPivots || + // selectEngulfedPVPivots; + + // // + // bool isPVRejected = + // isCBarBullishRejected && + // selectRejectedPVPivots; + + // // + // bool isPVEngulfed = + // isCBarBullishEngulfed && + // selectEngulfedPVPivots; + + // // + // bool isBarPassed = + // !hasSelectionType + // ? true + // : isPVRejected || + // isPVEngulfed; + + // // + // isTypeZeroFinished = + // isBarPassed && + // isTypeZeroFinished; + // if (!isTypeZeroFinished) + // { + // valePivot.Clean(); + // } + // } + + // // + // // Summarizing Conditions ... + + // // + // result = false; + + // // + // bool hasStartCondition = + // // + // isTypeZeroStart + // // + // ; + // bool hasContinuationCondition = + // // + // isTypeZeroContinue + // // + // ; + // bool hasEndCondition = + // // + // isTypeZeroFinished + // // + // ; + + // // + // // ReInstance Pivot ... + // if (hasStartCondition) + // { + // // + // valePivot.Clean(); + + // // + // valePivot.type = XCA_VALE; + // valePivot.symbol = symbol; + // valePivot.period = period; + + // // + // valePivot.to = pBar.time; + // valePivot.from = pBar.time; + // valePivot.value = pVale; + // valePivot.reserve = pValeGolden; + // } + + // // + // // Calculate and Fill Pivot Requirements ... + // if (hasContinuationCondition) + // { + // // + // valePivot.from = pBar.time; + + // // + // valePivot.reserve = + // valePivot.reserve == 0 + // ? pValeGolden + // : MathMin(valePivot.reserve, pValeGolden); + // } + + // // + // // End up Pivot and Store it ... + // if (hasEndCondition) + // { + // // + // result = + // valePivot.IsValid() && + // valePivot.GetAge() >= pivotVerifications; + // if (result) + // { + // // + // XBoxZone iBox; + // result = valePivot.AsBox(iBox); + // if (result) + // { + // // + // newPeakPivotDetected = AddBox( + // iBox, + // valePivots // + // ); + // } + + // // + // iBox.Clean(); + // } + + // // + // valePivot.Clean(); + // } + + // // + // return result; + // } diff --git a/XCAEA/Classes/xcaea.x-poi.detector.class.mq5 b/XCAEA/Classes/xcaea.x-poi.detector.class.mq5 index 80305da4..83e205cc 100644 --- a/XCAEA/Classes/xcaea.x-poi.detector.class.mq5 +++ b/XCAEA/Classes/xcaea.x-poi.detector.class.mq5 @@ -652,12 +652,13 @@ class XCXCAEAPOIDetector : public XCBase detectFVGBearishPivots = false; // - maxAllowedFVGLife = 0; - detectFVGTypeOne = false; - detectFVGTypeTwo = false; + selectSameBarFVGs = false; + maxAllowedFVGLifetime = 0; + validateFVGUsingPV = false; applyPVToFVGBoundary = false; selectRejectedFVGPivots = false; selectEngulfedFVGPivots = false; + validateFVGUsingManalyser = false; applyLastBarToFVGBoundary = false; selectOnlyFVGWhichHasIndirectionalLastBar = false; @@ -770,8 +771,9 @@ class XCXCAEAPOIDetector : public XCBase if (detectPeakPivots) { // - newPeakPivotDetected = DetectPeakPivot( + newPeakPivotDetected = DetectPeakAndValePivot( barIndex, + X_DIRECTION_BEARISH, zBar, cBar, pBar, @@ -785,8 +787,9 @@ class XCXCAEAPOIDetector : public XCBase if (detectValePivots) { // - newValePivotDetected = DetectValePivot( + newValePivotDetected = DetectPeakAndValePivot( barIndex, + X_DIRECTION_BULLISH, zBar, cBar, pBar, @@ -1030,71 +1033,16 @@ class XCXCAEAPOIDetector : public XCBase // PV ... // + int maxAllowedPVLifetime; // Max Allowed PV Life ... bool applySwingsOnPVPivots; // Apply Swings on PV Pivots ... bool selectRejectedPVPivots; // Select Rejected PV Pivots ... bool selectEngulfedPVPivots; // Select Engulfed PV Pivots ... bool applySupportAndResistanceOnPVPivots; // Apply Support and Resistance on PV Pivots ... // - void ValidatePeakValePivots( - XBoxZone &unavailables[], - int barIndex = 0 // - ) - { - // - bool has = false; - - // - // PEAK ... - has = HasPeakPivots(); - if (has) - { - // - ApplyValidationOnBoxes( - peakPivots, - unavailables, - barIndex // - ); - } - - // - // VALE ... - has = HasValePivots(); - if (has) - { - // - ApplyValidationOnBoxes( - valePivots, - unavailables, - barIndex // - ); - } - } - - // - // PEAK ... - - // - XCAPivot peakPivot; - bool detectPeakPivots; - XBoxZone peakPivots[]; - bool newPeakPivotDetected; - - // - bool HasPeakPivots() - { - return HasChild(peakPivots); - } - - // - int CountPeakPivots() - { - return ArraySize(peakPivots); - } - - // - bool DetectPeakPivot( + bool DetectPeakAndValePivot( int barIndex, + ENUM_X_DIRECTION forDir, XOHCL &zBar, XOHCL &cBar, XOHCL &pBar, @@ -1105,6 +1053,29 @@ class XCXCAEAPOIDetector : public XCBase // bool result = false; + // + // Checking Direction ... + result = HasDirection(forDir); + if (!result) + { + return result; + } + + // + bool forBullish = IsBullish(forDir); + bool forBearish = IsBearish(forDir); + + // + // Check Allowed ... + result = + forBullish + ? detectValePivots + : detectPeakPivots; + if (!result) + { + return result; + } + // // Validate Args ... result = @@ -1113,8 +1084,7 @@ class XCXCAEAPOIDetector : public XCBase zBar.IsValid() && cBar.IsValid() && pBar.IsValid() && - p2Bar.IsValid() && - detectPeakPivots + p2Bar.IsValid() // ; if (!result) @@ -1210,15 +1180,49 @@ class XCXCAEAPOIDetector : public XCBase cBar, cBarDir, false, // Force Type ... - true // Force Fibo Pressure ... + false // Force Fibo Pressure ... ); + + // bool isCBarBullishRejected = + forBullish && isCBarRejected && IsBullish(cBarDir); bool isCBarBearishRejected = + forBearish && isCBarRejected && IsBearish(cBarDir); + // + bool isPBarRejected = helper + .barAnalyser + .IsRejected( + pBar, + cBarDir, + false, // Force Type ... + false // Force Fibo Pressure ... + ); + bool isPBarBullishRejected = + forBullish && + isPBarRejected && + IsBullish(cBarDir); + bool isPBarBearishRejected = + forBearish && + isPBarRejected && + IsBearish(cBarDir); + + // + bool isBarBullishRejected = + forBullish && + (isCBarBullishRejected || + isPBarBullishRejected); + + // + bool isBarBearishRejected = + forBearish && + (isCBarBearishRejected || + isPBarBearishRejected); + // // Engulfed ... bool isCBarEngulfed = helper @@ -1228,15 +1232,48 @@ class XCXCAEAPOIDetector : public XCBase cBarDir // ); bool isCBarBullishEngulfed = + forBullish && isCBarEngulfed && IsBullish(cBarDir); bool isCBarBearishEngulfed = + forBearish && isCBarEngulfed && IsBearish(cBarDir); + // + bool isPBarEngulfed = helper + .barAnalyser + .IsEngulfed( + pBar, + cBarDir // + ); + bool isPBarBullishEngulfed = + forBullish && + isPBarEngulfed && + IsBullish(cBarDir); + bool isPBarBearishEngulfed = + forBearish && + isPBarEngulfed && + IsBearish(cBarDir); + + // + bool isBarBullishEngulfed = + forBullish && + (isCBarBullishEngulfed || + isPBarBullishEngulfed); + + // + bool isBarBearishEngulfed = + forBearish && + (isCBarBearishEngulfed || + isPBarBearishEngulfed); + // // Prepare Conditinal Conditions ... + // + // PEAK ... + // bool isPeakSameLast = cPeak == pPeak; bool isPeakSameLastPrev = pPeak == p2Peak; @@ -1279,300 +1316,8 @@ class XCXCAEAPOIDetector : public XCBase bool isPeakFinishedFromSameLast = !isPeakSameLast && isPeakSameLastPrev; - // - // ZERO ... - // Default Peak and Vale Selection ... - bool isTypeZeroStart = isPeakFinishedFromSameLast; - bool isTypeZeroContinue = isPeakSameLast; - bool isTypeZeroFinished = isPeakSwitchedToSameLast; - if (isTypeZeroFinished) - { - // - bool hasSelectionType = selectRejectedPVPivots || - selectEngulfedPVPivots; - - // - bool isPVRejected = - isCBarBearishRejected && - selectRejectedPVPivots; - - // - bool isPVEngulfed = - isCBarBearishEngulfed && - selectEngulfedPVPivots; - - // - bool isBarPassed = - !hasSelectionType - ? true - : isPVRejected || - isPVEngulfed; - - // - isTypeZeroFinished = - isBarPassed && - isTypeZeroFinished; - if (!isTypeZeroFinished) - { - peakPivot.Clean(); - } - } - - // - // Summarizing Conditions ... - - // - result = false; - - // - bool hasStartCondition = - // - isTypeZeroStart - // - ; - bool hasContinuationCondition = - // - isTypeZeroContinue - // - ; - bool hasEndCondition = - // - isTypeZeroFinished - // - ; - - // - // ReInstance Pivot ... - if (hasStartCondition) - { - // - peakPivot.Clean(); - - // - peakPivot.type = XCA_PEAK; - peakPivot.symbol = symbol; - peakPivot.period = period; - - // - peakPivot.to = pBar.time; - peakPivot.from = pBar.time; - peakPivot.value = pPeak; - peakPivot.reserve = pPeakGolden; - } - - // - // Calculate and Fill Pivot Requirements ... - if (hasContinuationCondition) - { - // - peakPivot.from = pBar.time; - - // - peakPivot.reserve = - peakPivot.reserve == 0 - ? pPeakGolden - : MathMax(peakPivot.reserve, pPeakGolden); - } - - // - // End up Pivot and Store it ... - if (hasEndCondition) - { - // - result = - peakPivot.IsValid() && - peakPivot.GetAge() >= pivotVerifications; - if (result) - { - // - XBoxZone iBox; - result = peakPivot.AsBox(iBox); - if (result) - { - // - newPeakPivotDetected = AddBox( - iBox, - peakPivots // - ); - } - - // - iBox.Clean(); - } - - // - peakPivot.Clean(); - } - - // - return result; - } - - // - // VALE ... - - // - XCAPivot valePivot; - bool detectValePivots; - XBoxZone valePivots[]; - bool newValePivotDetected; - - // - bool HasValePivots() - { - return HasChild(valePivots); - } - - // - int CountValePivots() - { - return ArraySize(valePivots); - } - - // - bool DetectValePivot( - int barIndex, - XOHCL &zBar, - XOHCL &cBar, - XOHCL &pBar, - XOHCL &p2Bar, - XCAEAConditions &conditions // - ) - { - // - bool result = false; - - // - // Validate Args ... - result = - // - barIndex >= 0 && - zBar.IsValid() && - cBar.IsValid() && - pBar.IsValid() && - p2Bar.IsValid() && - detectValePivots - // - ; - if (!result) - { - return result; - } - - // - // Define Requirements ... - - // - int zIDX = 0; - int cIDX = zIDX + 1; - int pIDX = cIDX + 1; - int p2IDX = pIDX + 1; - - // - datetime cTime = zBar.time; - string symbol = zBar.symbol; - ENUM_TIMEFRAMES period = zBar.period; - double points = GetPoints(symbol); - - // - // Reading Conditional Values ... - - // - // PEAK ... - double zPeak = conditions.peakBuffer[zIDX]; - double cPeak = conditions.peakBuffer[cIDX]; - double pPeak = conditions.peakBuffer[pIDX]; - double p2Peak = conditions.peakBuffer[p2IDX]; - - // - // PEAK Golden ... - double zPeakGolden = conditions.peakGoldenBuffer[zIDX]; - double cPeakGolden = conditions.peakGoldenBuffer[cIDX]; - double pPeakGolden = conditions.peakGoldenBuffer[pIDX]; - double p2PeakGolden = conditions.peakGoldenBuffer[p2IDX]; - // // VALE ... - double zVale = conditions.valeBuffer[zIDX]; - double cVale = conditions.valeBuffer[cIDX]; - double pVale = conditions.valeBuffer[pIDX]; - double p2Vale = conditions.valeBuffer[p2IDX]; - - // - // VALE Golden ... - double zValeGolden = conditions.valeGoldenBuffer[zIDX]; - double cValeGolden = conditions.valeGoldenBuffer[cIDX]; - double pValeGolden = conditions.valeGoldenBuffer[pIDX]; - double p2ValeGolden = conditions.valeGoldenBuffer[p2IDX]; - - // - // SWING High .. - double zSwingHigh = conditions.swingHighBuffer[zIDX]; - double cSwingHigh = conditions.swingHighBuffer[cIDX]; - double pSwingHigh = conditions.swingHighBuffer[pIDX]; - double p2SwingHigh = conditions.swingHighBuffer[p2IDX]; - - // - // SWING Low ... - double zSwingLow = conditions.swingLowBuffer[zIDX]; - double cSwingLow = conditions.swingLowBuffer[cIDX]; - double pSwingLow = conditions.swingLowBuffer[pIDX]; - double p2SwingLow = conditions.swingLowBuffer[p2IDX]; - - // - // SUPPORT ... - double zSupport = conditions.supportBuffer[zIDX]; - double cSupport = conditions.supportBuffer[cIDX]; - double pSupport = conditions.supportBuffer[pIDX]; - double p2Support = conditions.supportBuffer[p2IDX]; - - // - // RESISTANCE ... - double zResistance = conditions.resistanceBuffer[zIDX]; - double cResistance = conditions.resistanceBuffer[cIDX]; - double pResistance = conditions.resistanceBuffer[pIDX]; - double p2Resistance = conditions.resistanceBuffer[p2IDX]; - - // - // Detecting Bar Conditions ... - - // - ENUM_X_DIRECTION cBarDir; - - // - // Rejected ... - bool isCBarRejected = helper - .barAnalyser - .IsRejected( - cBar, - cBarDir, - false, // Force Type ... - true // Force Fibo Pressure ... - ); - bool isCBarBullishRejected = - isCBarRejected && - IsBullish(cBarDir); - bool isCBarBearishRejected = - isCBarRejected && - IsBearish(cBarDir); - - // - // Engulfed ... - bool isCBarEngulfed = helper - .barAnalyser - .IsEngulfed( - cBar, - cBarDir // - ); - bool isCBarBullishEngulfed = - isCBarEngulfed && - IsBullish(cBarDir); - bool isCBarBearishEngulfed = - isCBarEngulfed && - IsBearish(cBarDir); - - // - // Prepare Conditinal Conditions ... // bool isValeSameLast = cVale == pVale; @@ -1617,12 +1362,41 @@ class XCXCAEAPOIDetector : public XCBase isValeSameLastPrev; // - // ZERO ... - // Default Peak and Vale Selection ... - bool isTypeZeroStart = isValeFinishedFromSameLast; - bool isTypeZeroContinue = isValeSameLast; - bool isTypeZeroFinished = isValeSwitchedToSameLast; - if (isTypeZeroFinished) + // Summarizing Conditions ... + + // + result = false; + + // + bool hasStartCondition = + // + forBullish + ? isValeFinishedFromSameLast + : isPeakFinishedFromSameLast + // + ; + + // + bool hasContinuationCondition = + // + forBullish + ? isValeSameLast + : isPeakSameLast + // + ; + + // + bool hasEndCondition = + // + forBullish + ? isValeSwitchedToSameLast + : isPeakSwitchedToSameLast + // + ; + + // + // Apply Validations ... + if (hasEndCondition) { // bool hasSelectionType = selectRejectedPVPivots || @@ -1630,13 +1404,19 @@ class XCXCAEAPOIDetector : public XCBase // bool isPVRejected = - isCBarBullishRejected && - selectRejectedPVPivots; + forBullish + ? (isBarBullishRejected && + selectRejectedPVPivots) + : (isBarBearishRejected && + selectRejectedPVPivots); // bool isPVEngulfed = - isCBarBullishEngulfed && - selectEngulfedPVPivots; + forBullish + ? (isBarBullishEngulfed && + selectEngulfedPVPivots) + : (isBarBearishEngulfed && + selectEngulfedPVPivots); // bool isBarPassed = @@ -1646,55 +1426,72 @@ class XCXCAEAPOIDetector : public XCBase isPVEngulfed; // - isTypeZeroFinished = + hasEndCondition = isBarPassed && - isTypeZeroFinished; - if (!isTypeZeroFinished) + hasEndCondition; + if (!hasEndCondition) { - valePivot.Clean(); + // + // VALE ... + if (forBullish) + { + valePivot.Clean(); + } + + // + // PEAK ... + if (forBearish) + { + peakPivot.Clean(); + } } } // - // Summarizing Conditions ... - // - result = false; - // - bool hasStartCondition = - // - isTypeZeroStart - // - ; - bool hasContinuationCondition = - // - isTypeZeroContinue - // - ; - bool hasEndCondition = - // - isTypeZeroFinished - // - ; // // ReInstance Pivot ... if (hasStartCondition) { // - valePivot.Clean(); + // VALE ... + if (forBullish) + { + // + valePivot.Clean(); + + // + valePivot.type = XCA_VALE; + valePivot.symbol = symbol; + valePivot.period = period; + + // + valePivot.to = pBar.time; + valePivot.from = pBar.time; + valePivot.value = pVale; + valePivot.reserve = pValeGolden; + } // - valePivot.type = XCA_VALE; - valePivot.symbol = symbol; - valePivot.period = period; + // PEAK ... + if (forBearish) + { + // + peakPivot.Clean(); - // - valePivot.to = pBar.time; - valePivot.from = pBar.time; - valePivot.value = pVale; - valePivot.reserve = pValeGolden; + // + peakPivot.type = XCA_PEAK; + peakPivot.symbol = symbol; + peakPivot.period = period; + + // + peakPivot.to = pBar.time; + peakPivot.from = pBar.time; + peakPivot.value = pPeak; + peakPivot.reserve = pPeakGolden; + } } // @@ -1702,13 +1499,32 @@ class XCXCAEAPOIDetector : public XCBase if (hasContinuationCondition) { // - valePivot.from = pBar.time; + // VALE ... + if (forBullish) + { + // + valePivot.from = pBar.time; + + // + valePivot.reserve = + valePivot.reserve == 0 + ? pValeGolden + : MathMin(valePivot.reserve, pValeGolden); + } // - valePivot.reserve = - valePivot.reserve == 0 - ? pValeGolden - : MathMin(valePivot.reserve, pValeGolden); + // PEAK ... + if (forBearish) + { + // + peakPivot.from = pBar.time; + + // + peakPivot.reserve = + peakPivot.reserve == 0 + ? pPeakGolden + : MathMax(peakPivot.reserve, pPeakGolden); + } } // @@ -1716,45 +1532,184 @@ class XCXCAEAPOIDetector : public XCBase if (hasEndCondition) { // - result = - valePivot.IsValid() && - valePivot.GetAge() >= pivotVerifications; - if (result) + // VALE ... + if (forBullish) { // - XBoxZone iBox; - result = valePivot.AsBox(iBox); + result = + valePivot.IsValid() && + valePivot.GetAge() >= pivotVerifications; if (result) { // - newPeakPivotDetected = AddBox( - iBox, - valePivots // - ); + XBoxZone iBox; + result = valePivot.AsBox(iBox); + if (result) + { + // + newPeakPivotDetected = AddBox( + iBox, + valePivots // + ); + } + + // + iBox.Clean(); } // - iBox.Clean(); + valePivot.Clean(); } // - valePivot.Clean(); + // PEAK ... + if (forBearish) + { + // + result = + peakPivot.IsValid() && + peakPivot.GetAge() >= pivotVerifications; + if (result) + { + // + XBoxZone iBox; + result = peakPivot.AsBox(iBox); + if (result) + { + // + newPeakPivotDetected = AddBox( + iBox, + peakPivots // + ); + } + + // + iBox.Clean(); + } + + // + peakPivot.Clean(); + } } // return result; } + // + void ValidatePeakValePivots( + XBoxZone &unavailables[], + int barIndex = 0 // + ) + { + // + bool has = false; + + // + bool applyLifetimeValidating = maxAllowedPVLifetime > 0; + + // + // PEAK ... + has = HasPeakPivots(); + if (has) + { + // + ApplyValidationOnBoxes( + peakPivots, + unavailables, + barIndex // + ); + + // + if (applyLifetimeValidating) + { + // + ApplyLifeTimeValidationOnBoxes( + peakPivots, + maxAllowedPVLifetime, + barIndex // + ); + } + } + + // + // VALE ... + has = HasValePivots(); + if (has) + { + // + ApplyValidationOnBoxes( + valePivots, + unavailables, + barIndex // + ); + + // + if (applyLifetimeValidating) + { + // + ApplyLifeTimeValidationOnBoxes( + valePivots, + maxAllowedPVLifetime, + barIndex // + ); + } + } + } + + // + // PEAK ... + + // + XCAPivot peakPivot; + bool detectPeakPivots; + XBoxZone peakPivots[]; + bool newPeakPivotDetected; + + // + bool HasPeakPivots() + { + return HasChild(peakPivots); + } + + // + int CountPeakPivots() + { + return ArraySize(peakPivots); + } + + // + // VALE ... + + // + XCAPivot valePivot; + bool detectValePivots; + XBoxZone valePivots[]; + bool newValePivotDetected; + + // + bool HasValePivots() + { + return HasChild(valePivots); + } + + // + int CountValePivots() + { + return ArraySize(valePivots); + } + // // FVG ... // - bool maxAllowedFVGLife; // Max Allowed FVG Life ... - bool detectFVGTypeOne; // Detect FVG Type One ( Validating Using MAnalyser ) ... - bool detectFVGTypeTwo; // Detect FVG Type Two ( Validating Using PV ) ... + bool selectSameBarFVGs; // Select FVGs which has Same Type Bars ... + bool validateFVGUsingPV; // Detect FVG Type Two ( Validating Using PV ) ... + int maxAllowedFVGLifetime; // Max Allowed FVG Life ... bool applyPVToFVGBoundary; // Apply PV to FVG Boundary ... bool selectRejectedFVGPivots; // Select Rejected FVG Pivots ... bool selectEngulfedFVGPivots; // Select Engulfed FVG Pivots ... + bool validateFVGUsingManalyser; // Detect FVG Type One ( Validating Using MAnalyser ) ... bool applyLastBarToFVGBoundary; // Apply Last Bar to FVG Boundary ... bool selectOnlyFVGWhichHasIndirectionalLastBar; // Select Only FVGs which has Indirectionsl Last Bar, uses to Order Block ... @@ -1906,10 +1861,10 @@ class XCXCAEAPOIDetector : public XCBase IsBearish(p2BarDir); // - // - // + // Prepare Conditinal Conditions ... // + // Default FVG Detection ... XBoxZone fvgBox; bool isFVG = barAnalyser.IsFVG( cBar, @@ -1917,79 +1872,13 @@ class XCXCAEAPOIDetector : public XCBase ); bool isBullishFVG = isFVG && + forBullish && fvgBox.IsBullish(); bool isBearishFVG = isFVG && + forBearish && fvgBox.IsBearish(); - // - // Prepare Conditinal Conditions ... - - // - // ZERO ... - // --------- - // Pure FVG Detected ... - bool canDetectPureFVG = - !detectFVGTypeOne && - !detectFVGTypeTwo; - - // - bool isPureFVGBullish = - canDetectPureFVG && - isBullishFVG; - - // - bool isPureFVGBearish = - canDetectPureFVG && - isBearishFVG; - - // - // ONE: - // ------- - // Type One Using MAL and MAH in - // Manalyser for Validating FVG(s) ... - - // - bool isFVGTypeOneBullish = - forBullish && - isBullishFVG && - detectFVGTypeOne && - fvgBox.upper <= cMAL; - - // - bool isFVGTypeOneBearish = - forBearish && - isBearishFVG && - detectFVGTypeOne && - fvgBox.lower >= cMAH; - - // - // TWO: - // ----- - // Type Two Using PV for Validating FVG(s) ... - - // - bool isFVGTypeTwoBullish = - forBullish && - isBullishFVG && - detectFVGTypeTwo && - // - (p2Peak < pPeak || - pPeak < cPeak) - // - ; - - // - bool isFVGTypeTwoBearish = - forBearish && - isBearishFVG && - detectFVGTypeTwo && - // - (p2Vale > pVale || - pVale > cVale) - // - ; - // // Summarizing Conditions ... @@ -1999,82 +1888,182 @@ class XCXCAEAPOIDetector : public XCBase // bool hasStartCondition = false; bool hasContinuationCondition = false; - bool hasEndCondition = - forBullish - ? - // - (isPureFVGBullish || - isFVGTypeOneBullish || - isFVGTypeTwoBullish) - // - : - // - (isPureFVGBearish || - isFVGTypeOneBearish || - isFVGTypeTwoBearish) - // - ; + bool hasEndCondition = isBullishFVG || + isBearishFVG; // - // Validate FVG Selection ... - if (hasEndCondition && - selectOnlyFVGWhichHasIndirectionalLastBar) + // Apply all Filtering ... + if (hasEndCondition) { // XOHCL p3Bar; p2Bar.GetPreviousBar(p3Bar); // - hasEndCondition = - p3Bar.IsValid() && - hasEndCondition && - (forBullish - ? p3Bar.IsBearish() - : p3Bar.IsBullish()); + bool isFVGValid = true; + + // + // Validate FVG Using Manalyser ... + bool isManalyserValid = false; + if (validateFVGUsingManalyser) + { + // + isManalyserValid = + hasEndCondition && + (forBullish + ? fvgBox.upper <= cMAL + : fvgBox.lower >= cMAH); + } + + // + // Validate FVG Using PV ... + bool isPVValid = false; + if (validateFVGUsingPV) + { + // + isPVValid = + hasEndCondition && + (forBullish + ? (p2Peak < pPeak || + pPeak < cPeak) + : (p2Vale > pVale || + pVale > cVale)); + } + + // + // Select Pure FVG ... + bool isPureFVGValid = + !validateFVGUsingPV && + !validateFVGUsingManalyser; + + // + // Summarise Validation ... + isFVGValid = + isPVValid || + isPureFVGValid || + isManalyserValid; + + // + bool isFVGBarPassed = false; + + // + // Select Same Bars FVGs ... + bool isFVGHasSameBar = true; + if (selectSameBarFVGs) + { + // + isFVGHasSameBar = + forBullish + ? (cBar.IsBullish() && + pBar.IsBullish() && + p2Bar.IsBullish()) + : (cBar.IsBearish() && + pBar.IsBearish() && + p2Bar.IsBearish()); + isFVGBarPassed = + isFVGBarPassed || + isFVGHasSameBar; + } + + // + // Select Rejected FVG ... + bool isFVGRejected = true; + if (selectRejectedFVGPivots) + { + // + isFVGRejected = + (forBullish + ? isP2BarBullishRejected + : isP2BarBearishRejected); + isFVGBarPassed = + isFVGBarPassed || + isFVGRejected; + } + + // + // Select Engulfed FVG ... + bool isFVGEngulfed = true; + if (selectEngulfedFVGPivots) + { + // + isFVGEngulfed = + (forBullish + ? isP2BarBullishEngulfed + : isP2BarBearishEngulfed); + isFVGBarPassed = + isFVGBarPassed || + isFVGEngulfed; + } + + // + // Select Only FVGs Which Has Indirectional Last Bar ... + bool isFVGHasIndirectionalStart = true; + if (selectOnlyFVGWhichHasIndirectionalLastBar) + { + // + isFVGHasIndirectionalStart = + p3Bar.IsValid() && + (forBullish + ? p3Bar.IsBearish() + : p3Bar.IsBullish()); + isFVGBarPassed = + isFVGBarPassed || + isFVGHasIndirectionalStart; + } + + // + // Summarise Bar Pass ... + isFVGBarPassed = + (selectSameBarFVGs || + selectRejectedFVGPivots || + selectEngulfedFVGPivots || + selectOnlyFVGWhichHasIndirectionalLastBar) + ? isFVGBarPassed + : true; + + // + hasEndCondition = isFVGValid && + isFVGBarPassed; + + // + // Apply Boundary ... + if (hasEndCondition) + { + // + double iValue = + forBullish + ? fvgBox.upper + : fvgBox.lower; + + // + if (applyPVToFVGBoundary) + { + // + fvgBox.upper = + forBullish + ? fvgBox.upper + : cPeak; + + // + fvgBox.lower = + forBullish + ? cVale + : fvgBox.lower; + } + + // + if (applyLastBarToFVGBoundary) + { + // + fvgBox.lower = MathMin(p3Bar.low, fvgBox.lower); + fvgBox.upper = MathMax(p3Bar.high, fvgBox.upper); + } + } // p3Bar.Clean(); } - // - // Validate FVG based on Selection Type ... - if (hasEndCondition && (selectRejectedFVGPivots || - selectEngulfedFVGPivots)) - { - // - // Checking Bar Passed ... - - // - bool canSelectUsingBar = - selectRejectedFVGPivots || - selectEngulfedFVGPivots; - - // - bool isPivotRejected = - selectRejectedFVGPivots && - (forBullish - ? isP2BarBullishRejected - : isP2BarBearishRejected); - - // - bool isPivotEngulfed = - selectEngulfedFVGPivots && - (forBullish - ? isP2BarBullishEngulfed - : isP2BarBearishEngulfed); - - bool isBarPassed = - !canSelectUsingBar - ? true - : (isPivotRejected || - isPivotEngulfed); - - // - hasEndCondition = - isBarPassed && - hasEndCondition; - } - // // ReInstance Pivot ... if (hasStartCondition) @@ -2112,59 +2101,6 @@ class XCXCAEAPOIDetector : public XCBase ? fvgBox.upper : fvgBox.lower; - // - if (applyLastBarToFVGBoundary) - { - // - XOHCL p3Bar; - p2Bar.GetPreviousBar(p3Bar); - - // - double iBoundary = - forBullish - ? cBar.low - : cBar.high; - - // - double values[] = { - iBoundary, - pBar.high, - pBar.low, - p2Bar.high, - p2Bar.low // - }; - - // - double minValue = GetMin(values); - double maxValue = GetMax(values); - - // - iPivot.value = - forBullish - ? minValue - : maxValue; - - // - iPivot.reserve = - forBullish - ? maxValue - : minValue; - - // - Clean(values); - p3Bar.Clean(); - } - - // - if (applyPVToFVGBoundary) - { - // - iPivot.value = - forBullish - ? MathMin(iPivot.value, cVale) - : MathMax(iPivot.value, cPeak); - } - // result = iPivot.IsValid(); if (result) @@ -2211,6 +2147,9 @@ class XCXCAEAPOIDetector : public XCBase // bool has = false; + // + bool applyLifetimeValidating = maxAllowedFVGLifetime > 0; + // // Bullish ... has = HasFVGBullishPivots(); @@ -2222,6 +2161,17 @@ class XCXCAEAPOIDetector : public XCBase unavailables, barIndex // ); + + // + if (applyLifetimeValidating) + { + // + ApplyLifeTimeValidationOnBoxes( + fvgBullishPivots, + maxAllowedFVGLifetime, + barIndex // + ); + } } // @@ -2235,6 +2185,17 @@ class XCXCAEAPOIDetector : public XCBase unavailables, barIndex // ); + + // + if (applyLifetimeValidating) + { + // + ApplyLifeTimeValidationOnBoxes( + fvgBearishPivots, + maxAllowedFVGLifetime, + barIndex // + ); + } } } @@ -2281,6 +2242,9 @@ class XCXCAEAPOIDetector : public XCBase // // TREND ... + // + int maxAllowedTrendLifetime; // Max Allowed Trend Life ... + // bool DetectTrendPivot( int barIndex, @@ -2591,6 +2555,9 @@ class XCXCAEAPOIDetector : public XCBase // bool has = false; + // + bool applyLifetimeValidating = maxAllowedTrendLifetime > 0; + // // Bullish ... has = HasTrendBullishPivots(); @@ -2602,6 +2569,17 @@ class XCXCAEAPOIDetector : public XCBase unavailables, barIndex // ); + + // + if (applyLifetimeValidating) + { + // + ApplyLifeTimeValidationOnBoxes( + trendBullishPivots, + maxAllowedTrendLifetime, + barIndex // + ); + } } // @@ -2615,6 +2593,17 @@ class XCXCAEAPOIDetector : public XCBase unavailables, barIndex // ); + + // + if (applyLifetimeValidating) + { + // + ApplyLifeTimeValidationOnBoxes( + trendBearishPivots, + maxAllowedTrendLifetime, + barIndex // + ); + } } } @@ -2889,6 +2878,24 @@ class XCXCAEAPOIDetector : public XCBase // result = isValid && !isBreaked; + if (!result) + { + // + int idx = -1; + bool isExists = FindBoxIndex( + idx, + box, + invalidPivots // + ); + if (!isExists) + { + // + AddRef( + box, + invalidPivots // + ); + } + } // // Cleanup Resource ... @@ -2933,6 +2940,14 @@ class XCXCAEAPOIDetector : public XCBase // bool has = false; + // + // Invalid Pivots ... + has = HasInvalidPivots(); + if (has) + { + ApplySortOnBoxes(invalidPivots); + } + // // PV ... @@ -3109,6 +3124,97 @@ class XCXCAEAPOIDetector : public XCBase Clean(tmp); } + // + void ApplyLifeTimeValidationOnBoxes( + XBoxZone &items[], + int maxAllowedAge = 0, + int barIndex = 0 // + ) + { + // + bool has = false; + + // + barIndex = NormalizeInt(barIndex, 0); + + // + has = + maxAllowedAge > 0 && + HasChild(items); + if (!has) + { + return; + } + + // + datetime cTime = GetBarTime( + helper.GetSymbol(), + helper.GetPeriod(), + barIndex // + ); + + // + XBoxZone tmp[]; + Copy( + items, + tmp // + ); + Clean(items); + + // + while (HasChild(tmp)) + { + // + XBoxZone iBox = tmp[0]; + ArrayRemove( + tmp, + 0, + 1 // + ); + + // + datetime defTo = iBox.to; + iBox.to = cTime; + + // + int iAge = iBox.GetAge(); + has = iAge <= maxAllowedAge; + iBox.to = defTo; + if (has) + { + // + AddRef( + iBox, + items // + ); + } + else + { + // + int idx = -1; + bool isExists = FindBoxIndex( + idx, + iBox, + invalidPivots // + ); + if (!isExists) + { + // + AddRef( + iBox, + invalidPivots // + ); + } + } + + // + iBox.Clean(); + } + + // + Clean(tmp); + } + // }; diff --git a/XCAEA/Classes/xcaea.x-poi.drawer.class.mq5 b/XCAEA/Classes/xcaea.x-poi.drawer.class.mq5 index 5aee8cc5..c115473c 100644 --- a/XCAEA/Classes/xcaea.x-poi.drawer.class.mq5 +++ b/XCAEA/Classes/xcaea.x-poi.drawer.class.mq5 @@ -800,7 +800,7 @@ class XCXCAEAPOIDrawer : public XCBase bool canUpdateTo = IsValid(to); if (canUpdateTo) { - // item.to = to; + item.to = to; } // @@ -853,7 +853,7 @@ class XCXCAEAPOIDrawer : public XCBase bool canUpdateTo = IsValid(to); if (canUpdateTo) { - // item.to = to; + item.to = to; } // diff --git a/XCAEA/Signals/xcaea.signaller.class.mq5 b/XCAEA/Signals/xcaea.signaller.class.mq5 index bae05d33..24876cb5 100644 --- a/XCAEA/Signals/xcaea.signaller.class.mq5 +++ b/XCAEA/Signals/xcaea.signaller.class.mq5 @@ -207,12 +207,12 @@ class XCXCAEASignaller : XCBase // drawer.Draw(cTime); // - // drawer.DrawPeakPivots(cTime); - // drawer.DrawValePivots(cTime); + drawer.DrawPeakPivots(cTime); + drawer.DrawValePivots(cTime); // drawer.DrawFVGBullishPivots(cTime); // drawer.DrawFVGBearishPivots(cTime); - drawer.DrawTrendBullishPivots(cTime); - drawer.DrawTrendBearishPivots(cTime); + // drawer.DrawTrendBullishPivots(cTime); + // drawer.DrawTrendBearishPivots(cTime); // // Retrieve Valid Pviots ... @@ -871,7 +871,8 @@ class XCXCAEASignaller : XCBase detector = new XCXCAEAPOIDetector(helper); // - detector.maxAllowedPivots = 50; + // Common Configurations ... + detector.maxAllowedPivots = 0; detector.pivotVerifications = 5; detector.ticksDividerInPoints = 15; detector.pivotDetectionLoopbac = 200; @@ -881,6 +882,9 @@ class XCXCAEASignaller : XCBase // // PV ... + + // + detector.maxAllowedPVLifetime = 0; detector.applySwingsOnPVPivots = true; detector.selectRejectedPVPivots = true; detector.selectEngulfedPVPivots = true; @@ -896,20 +900,32 @@ class XCXCAEASignaller : XCBase // // FVG ... - detector.maxAllowedFVGLife = 0; - detector.detectFVGTypeOne = true; - detector.detectFVGTypeTwo = false; - detector.applyPVToFVGBoundary = false; - detector.detectFVGBullishPivots = true; - detector.detectFVGBearishPivots = true; - detector.selectRejectedFVGPivots = true; - detector.selectEngulfedFVGPivots = true; - detector.applyLastBarToFVGBoundary = false; - detector.selectOnlyFVGWhichHasIndirectionalLastBar = true; + // + detector.selectSameBarFVGs = true; + detector.maxAllowedFVGLifetime = 0; + detector.validateFVGUsingPV = false; + detector.applyPVToFVGBoundary = false; + detector.selectRejectedFVGPivots = true; + detector.selectEngulfedFVGPivots = true; + detector.validateFVGUsingManalyser = true; + detector.applyLastBarToFVGBoundary = false; + detector.selectOnlyFVGWhichHasIndirectionalLastBar = true; + + // + // Bullish ... + detector.detectFVGBullishPivots = true; + + // + // Bearish ... + detector.detectFVGBearishPivots = true; + // // TREND ... + // + detector.maxAllowedTrendLifetime = 0; + // // Bullish ... detector.detectTrendBullishPivots = true; @@ -918,6 +934,9 @@ class XCXCAEASignaller : XCBase // Bearish ... detector.detectTrendBearishPivots = true; + // + // DRAWER ... + // // Initialize and Configure Drawer ... drawer = new XCXCAEAPOIDrawer(detector);