From 062ce1518145c375ad580553ed5909a90db89718 Mon Sep 17 00:00:00 2001 From: Hadi Khazaee Asl Date: Sat, 21 Jun 2025 02:34:10 +0330 Subject: [PATCH] last ... --- Indicators/x-saherelm.x121.xcatb.v1.mq5 | 212 +++++++++++++++++- Libraries/x-saherelm.x-poi.extensions.lib.mq5 | 8 - 2 files changed, 206 insertions(+), 14 deletions(-) diff --git a/Indicators/x-saherelm.x121.xcatb.v1.mq5 b/Indicators/x-saherelm.x121.xcatb.v1.mq5 index 4fc80355..a22843f5 100644 --- a/Indicators/x-saherelm.x121.xcatb.v1.mq5 +++ b/Indicators/x-saherelm.x121.xcatb.v1.mq5 @@ -659,19 +659,20 @@ string mTriggerBarConditions; // POI(s) ... // -XBoxZone tmpBoxes[]; +bool mDrawLiquidities = false; +bool mDetectLiquidities = true; // -bool mDrawLiquidities = true; -bool mDetectLiquidities = true; +bool mDrawRangeBreakes = true; +bool mDetectRangeBreakes = true; // XBoxZone mBullishLiquidities[]; XBoxZone mBearishLiquidities[]; -// // -// XBoxZone mBullishLiquidities[]; -// XBoxZone mBearishLiquidities[]; +// +XBoxZone mBullishRangeBreakes[]; +XBoxZone mBearishRangeBreakes[]; // // Counters ... @@ -4603,6 +4604,133 @@ void DetectPOIs( } } + // + // Range Breakes ... + int mRangeBreakesMinLength = 5; + if (mDetectRangeBreakes) + { + // + XBoxZone iRB; + + // + iRB.type = "XRNGB"; + iRB.at = iPBar.time; + iRB.to = iPBar.time; + iRB.symbol = _Symbol; + iRB.period = _Period; + + // + // Bullish ... + bool isBullishPeakPOI = + (isSamePeakOverLast + // && + // mSamePeakCount >= mRangeBreakesMinLength + ); + bool isBullishValePOI = + (isSameValeOverLast + // && + // mSameValeCount >= mRangeBreakesMinLength + ); + mHas = + isBullishPeakPOI || + isBullishValePOI; + if (mHas) + { + // + Print("Bullish PV: ", mSamePeakCount, ",", mSameValeCount); + + // + if (isBullishPeakPOI) + { + // + iRB.lower = mSamePeakGoldenMax; + iRB.upper = peakBuffer[barIndex + 1]; + + // + iRB.from = iPBar.time - (mSamePeakCount * PeriodSeconds(_Period)); + } + + // + if (isBullishValePOI) + { + // + iRB.upper = mSameValeGoldenMin; + iRB.lower = valeBuffer[barIndex + 1]; + + // + iRB.from = iPBar.time - (mSameValeCount * PeriodSeconds(_Period)); + } + + // + iRB.dir = X_DIRECTION_BULLISH; + + // + if (iRB.IsValid()) + { + // + AddIfNotExists( + iRB, + mBullishRangeBreakes // + ); + } + } + + // + // Bearish ... + bool isBearishPeakPOI = + (isSamePeakUnderLast && + mSamePeakCount >= mRangeBreakesMinLength); + bool isBearishValePOI = + (isSameValeUnderLast && + mSameValeCount >= mRangeBreakesMinLength); + mHas = + isBearishPeakPOI || + isBearishValePOI; + if (mHas) + { + // + Print("Bearish PV ..."); + + // + if (isBearishPeakPOI) + { + // + iRB.lower = mSamePeakGoldenMax; + iRB.upper = peakBuffer[barIndex + 1]; + + // + iRB.from = iPBar.time - (mSamePeakCount * PeriodSeconds(_Period)); + } + + // + if (isBearishValePOI) + { + // + iRB.upper = mSameValeGoldenMin; + iRB.lower = valeBuffer[barIndex + 1]; + + // + iRB.from = iPBar.time - (mSameValeCount * PeriodSeconds(_Period)); + } + + // + iRB.dir = X_DIRECTION_BEARISH; + + // + if (iRB.IsValid()) + { + // + AddIfNotExists( + iRB, + mBearishRangeBreakes // + ); + } + } + + // + iRB.Clean(); + } + // // Cleanup Resources ... @@ -4692,6 +4820,13 @@ void DrawPOIs( const long &tickVolume[] // ) { + // + datetime to = GetBarTime( + _Symbol, + _Period, + barIndex // + ); + // // Liquidities ... if (mDrawLiquidities) @@ -4707,6 +4842,7 @@ void DrawPOIs( { // XBoxZone iBox = mBullishLiquidities[i]; + iBox.to = to; // XCBoxObject *iBObj; @@ -4735,6 +4871,70 @@ void DrawPOIs( { // XBoxZone iBox = mBearishLiquidities[i]; + iBox.to = to; + + // + XCBoxObject *iBObj; + mHas = mDrawer.DrawBox( + iBox, + iBObj // + ); + if (mHas) + { + mObjects.Add(iBObj); + } + + // + iBox.Clean(); + } + } + } + + // + // Range Breakes ... + if (mDrawRangeBreakes) + { + // + // Bullish ... + mCount = ArraySize(mBullishRangeBreakes); + mHas = IsValidSize(mCount); + if (mHas) + { + // + for (int i = 0; i < mCount; i++) + { + // + XBoxZone iBox = mBullishRangeBreakes[i]; + iBox.to = to; + + // + XCBoxObject *iBObj; + mHas = mDrawer.DrawBox( + iBox, + iBObj // + ); + if (mHas) + { + mObjects.Add(iBObj); + } + + // + iBox.Clean(); + } + } + + // + // Bearish ... + mCount = ArraySize(mBearishRangeBreakes); + mHas = IsValidSize(mCount); + if (mHas) + { + // + for (int i = 0; i < mCount; i++) + { + // + XBoxZone iBox = mBearishRangeBreakes[i]; + iBox.to = to; // XCBoxObject *iBObj; diff --git a/Libraries/x-saherelm.x-poi.extensions.lib.mq5 b/Libraries/x-saherelm.x-poi.extensions.lib.mq5 index 78ad3abb..785304d3 100644 --- a/Libraries/x-saherelm.x-poi.extensions.lib.mq5 +++ b/Libraries/x-saherelm.x-poi.extensions.lib.mq5 @@ -1213,11 +1213,6 @@ void ValidateBoxes( // // Select Indexed Box ... XBoxZone iBox = tmp[0]; - datetime to = GetBarTime( - iBox.symbol, - iBox.period, - barIndex // - ); // // Remove Indexed Box ... @@ -1236,9 +1231,6 @@ void ValidateBoxes( ); if (has) { - // - iBox.to = to; - // AddRef( iBox,