diff --git a/Indicators/x-saherelm.x121.xcatb.v1.mq5 b/Indicators/x-saherelm.x121.xcatb.v1.mq5 index a22843f5..13f83674 100644 --- a/Indicators/x-saherelm.x121.xcatb.v1.mq5 +++ b/Indicators/x-saherelm.x121.xcatb.v1.mq5 @@ -659,20 +659,22 @@ string mTriggerBarConditions; // POI(s) ... // -bool mDrawLiquidities = false; +// Liquidities ... +bool mDrawLiquidities = true; bool mDetectLiquidities = true; - -// -bool mDrawRangeBreakes = true; -bool mDetectRangeBreakes = true; - -// XBoxZone mBullishLiquidities[]; XBoxZone mBearishLiquidities[]; +XPOIStyle mBullishLiquidityStyle; +XPOIStyle mBearishLiquidityStyle; // +// Range Breakes ... +bool mDrawRangeBreakes = true; +bool mDetectRangeBreakes = true; XBoxZone mBullishRangeBreakes[]; XBoxZone mBearishRangeBreakes[]; +XPOIStyle mBullishRangeBreakStyle; +XPOIStyle mBearishRangeBreakStyle; // // Counters ... @@ -1025,6 +1027,35 @@ int OnInit() mDrawer = new XCPOIDrawer(); mBarAnalyser = new XCBarAnalyser(); + // + // Preparing POI Styles ... + + // + // Liquidities ... + + // + // Bullish ... + mBullishLiquidityStyle.width = 1; + mBullishLiquidityStyle.clr = clrLime; + + // + // Bearish ... + mBearishLiquidityStyle.width = 1; + mBearishLiquidityStyle.clr = clrRed; + + // + // Range Breakes ... + + // + // Bullish ... + mBullishRangeBreakStyle.width = 1; + mBullishRangeBreakStyle.clr = clrAqua; + + // + // Bearish ... + mBearishRangeBreakStyle.width = 1; + mBearishRangeBreakStyle.clr = clrMagenta; + // // Init Succeed ... return INIT_SUCCEEDED; @@ -1088,6 +1119,18 @@ void OnDeinit(const int reason) Clean(mBullishTrendChanges); Clean(mBearishTrendChanges); + // + Clean(mBullishLiquidities); + Clean(mBearishLiquidities); + Clean(mBullishRangeBreakes); + Clean(mBearishRangeBreakes); + + // + mBullishLiquidityStyle.Clean(); + mBearishLiquidityStyle.Clean(); + mBullishRangeBreakStyle.Clean(); + mBearishRangeBreakStyle.Clean(); + // } @@ -3564,6 +3607,142 @@ void PrepareMarketConditions( isTriggerBarCond6Bearish || isTriggerBarCond7Bearish; + // + // Resetting Counters Based on Conditions ... + + // + // XPV ... + + // + if (!isSamePeak) + { + // + mSamePeakCount = 0; + mSamePeakGoldenMin = 0; + mSamePeakGoldenMax = 0; + } + + // + if (!isSameVale) + { + // + mSameValeCount = 0; + mSameValeGoldenMin = 0; + mSameValeGoldenMax = 0; + } + + // + if (!isSamePeakGolden) + { + mSamePeakGoldenCount = 0; + } + + // + if (!isSameValeGolden) + { + mSameValeGoldenCount = 0; + } + + // + // XKI ... + + // + if (!isSameKI) + { + mSameKICount = 0; + } + + // + if (!isSameBullishKI) + { + mSameBullishKICount = 0; + } + + // + if (!isSameBearishKI) + { + mSameBearishKICount = 0; + } + + // + // XSB ... + + // + if (isSBSwitchedToBullish) + { + // + mSameSBCount = 0; + mSameBullishSBCount = 0; + } + + // + if (isSBSwitchedToBearish) + { + // + mSameSBCount = 0; + mSameBearishSBCount = 0; + } + + // + // XSAR ... + + // + if (isSarSwitchedToBullish) + { + // + mSameSarCount = 0; + mSameBullishSarCount = 0; + } + + // + if (isSarSwitchedToBearish) + { + // + mSameSarCount = 0; + mSameBearishSarCount = 0; + } + + // + // XHKS ... + + // + if (isHKSSwitchedToBullish) + { + // + mSameHKSCount = 0; + mSameBullishHKSCount = 0; + } + + // + if (isHKSSwitchedToBearish) + { + // + mSameHKSCount = 0; + mSameBearishHKSCount = 0; + } + + // + // XTREND ... + + // + if (isTrendSwitchedToBullish) + { + // + mSameTrendCount = 0; + mSameBullishTrendCount = 0; + } + + // + if (isTrendSwitchedToBearish) + { + // + mSameTrendCount = 0; + mSameBearishTrendCount = 0; + } + + // + // Preparing Conditions ... + // // XPV ... @@ -3771,13 +3950,6 @@ void PrepareMarketConditions( ? peakGoldenBuffer[pIndex] : MathMax(mSamePeakGoldenMax, peakGoldenBuffer[pIndex]); } - else - { - // - mSamePeakCount = 0; - mSamePeakGoldenMin = 0; - mSamePeakGoldenMax = 0; - } // if (isSameVale) @@ -3793,33 +3965,18 @@ void PrepareMarketConditions( ? valeGoldenBuffer[pIndex] : MathMax(mSameValeGoldenMax, valeGoldenBuffer[pIndex]); } - else - { - // - mSameValeCount = 0; - mSameValeGoldenMin = 0; - mSameValeGoldenMax = 0; - } // if (isSamePeakGolden) { mSamePeakGoldenCount++; } - else - { - mSamePeakGoldenCount = 0; - } // if (isSameValeGolden) { mSameValeGoldenCount++; } - else - { - mSameValeGoldenCount = 0; - } // // XSB Shifts ... @@ -3917,10 +4074,6 @@ void PrepareMarketConditions( { mSameBullishSBCount++; } - else - { - mSameBullishSBCount = 0; - } // bool isDBearish = @@ -3930,10 +4083,6 @@ void PrepareMarketConditions( { mSameBearishSBCount++; } - else - { - mSameBearishSBCount = 0; - } // if (isDBullish || @@ -3941,22 +4090,6 @@ void PrepareMarketConditions( { mSameSBCount++; } - else - { - mSameSBCount = 0; - } - } - else if (isSBSwitchedToBullish) - { - // - mSameSBCount = 0; - mSameBullishSBCount = 0; - } - else if (isSBSwitchedToBearish) - { - // - mSameSBCount = 0; - mSameBearishSBCount = 0; } // @@ -4051,10 +4184,6 @@ void PrepareMarketConditions( { mSameBullishSarCount++; } - else - { - mSameBullishSarCount = 0; - } // bool isDBearish = @@ -4064,10 +4193,6 @@ void PrepareMarketConditions( { mSameBearishSarCount++; } - else - { - mSameBearishSarCount = 0; - } // if (isDBullish || @@ -4075,22 +4200,6 @@ void PrepareMarketConditions( { mSameSarCount++; } - else - { - mSameSarCount = 0; - } - } - else if (isSarSwitchedToBullish) - { - // - mSameSarCount = 0; - mSameBullishSarCount = 0; - } - else if (isSarSwitchedToBearish) - { - // - mSameSarCount = 0; - mSameBearishSarCount = 0; } // @@ -4189,10 +4298,6 @@ void PrepareMarketConditions( { mSameBullishHKSCount++; } - else - { - mSameBullishHKSCount = 0; - } // bool isDBearish = @@ -4202,10 +4307,6 @@ void PrepareMarketConditions( { mSameBearishHKSCount++; } - else - { - mSameBearishHKSCount = 0; - } // if (isDBullish || @@ -4213,22 +4314,6 @@ void PrepareMarketConditions( { mSameHKSCount++; } - else - { - mSameHKSCount = 0; - } - } - else if (isHKSSwitchedToBullish) - { - // - mSameHKSCount = 0; - mSameBullishHKSCount = 0; - } - else if (isHKSSwitchedToBearish) - { - // - mSameHKSCount = 0; - mSameBearishHKSCount = 0; } // @@ -4316,30 +4401,18 @@ void PrepareMarketConditions( { mSameKICount++; } - else - { - mSameKICount = 0; - } // if (isSameBullishKI) { mSameBullishKICount++; } - else - { - mSameBullishKICount = 0; - } // if (isSameBearishKI) { mSameBearishKICount++; } - else - { - mSameBearishKICount = 0; - } // // XTREND Shifts ... @@ -4433,10 +4506,6 @@ void PrepareMarketConditions( { mSameBullishTrendCount++; } - else - { - mSameBullishTrendCount = 0; - } // bool isDBearish = @@ -4446,10 +4515,6 @@ void PrepareMarketConditions( { mSameBearishTrendCount++; } - else - { - mSameBearishTrendCount = 0; - } // if (isDBullish || @@ -4457,22 +4522,6 @@ void PrepareMarketConditions( { mSameTrendCount++; } - else - { - mSameTrendCount = 0; - } - } - else if (isTrendSwitchedToBullish) - { - // - mSameTrendCount = 0; - mSameBullishTrendCount = 0; - } - else if (isTrendSwitchedToBearish) - { - // - mSameTrendCount = 0; - mSameBearishTrendCount = 0; } // @@ -4622,23 +4671,16 @@ void DetectPOIs( // // Bullish ... bool isBullishPeakPOI = - (isSamePeakOverLast - // && - // mSamePeakCount >= mRangeBreakesMinLength - ); + (isSamePeakOverLast && + mSamePeakCount >= mRangeBreakesMinLength); bool isBullishValePOI = - (isSameValeOverLast - // && - // mSameValeCount >= mRangeBreakesMinLength - ); + (isSameValeOverLast && + mSameValeCount >= mRangeBreakesMinLength); mHas = isBullishPeakPOI || isBullishValePOI; if (mHas) { - // - Print("Bullish PV: ", mSamePeakCount, ",", mSameValeCount); - // if (isBullishPeakPOI) { @@ -4688,9 +4730,6 @@ void DetectPOIs( isBearishValePOI; if (mHas) { - // - Print("Bearish PV ..."); - // if (isBearishPeakPOI) { @@ -4794,6 +4833,35 @@ void ValidatePOIs( ); } + // + // Range Breakes ... + + // + // Bullish ... + mHas = HasChild(mBullishRangeBreakes); + if (mHas) + { + // + ValidateBoxes( + mBullishRangeBreakes, + barIndex, + barsLength // + ); + } + + // + // Bearish ... + mHas = HasChild(mBearishRangeBreakes); + if (mHas) + { + // + ValidateBoxes( + mBearishRangeBreakes, + barIndex, + barsLength // + ); + } + // } @@ -4852,6 +4920,25 @@ void DrawPOIs( ); if (mHas) { + // + if (iBox.IsBullish()) + { + // + mDrawer.ApplyStyle( + iBObj, + mBullishLiquidityStyle // + ); + } + else + { + // + mDrawer.ApplyStyle( + iBObj, + mBearishLiquidityStyle // + ); + } + + // mObjects.Add(iBObj); } @@ -4881,6 +4968,25 @@ void DrawPOIs( ); if (mHas) { + // + if (iBox.IsBullish()) + { + // + mDrawer.ApplyStyle( + iBObj, + mBullishLiquidityStyle // + ); + } + else + { + // + mDrawer.ApplyStyle( + iBObj, + mBearishLiquidityStyle // + ); + } + + // mObjects.Add(iBObj); } @@ -4915,6 +5021,25 @@ void DrawPOIs( ); if (mHas) { + // + if (iBox.IsBullish()) + { + // + mDrawer.ApplyStyle( + iBObj, + mBullishRangeBreakStyle // + ); + } + else + { + // + mDrawer.ApplyStyle( + iBObj, + mBearishRangeBreakStyle // + ); + } + + // mObjects.Add(iBObj); } @@ -4944,6 +5069,25 @@ void DrawPOIs( ); if (mHas) { + // + if (iBox.IsBullish()) + { + // + mDrawer.ApplyStyle( + iBObj, + mBullishRangeBreakStyle // + ); + } + else + { + // + mDrawer.ApplyStyle( + iBObj, + mBearishRangeBreakStyle // + ); + } + + // mObjects.Add(iBObj); }