diff --git a/Documents/BKP/1/signals/3.mq5 b/Documents/BKP/1/signals/3.mq5 new file mode 100644 index 00000000..4b32c90a --- /dev/null +++ b/Documents/BKP/1/signals/3.mq5 @@ -0,0 +1,36 @@ + // isLowsUnderValesGolden && + // conditions.isStrSwitchedToBullish + // + // conditions.isStrBullish && + // conditions.isRejectUpHSM // && + // + // isStrBullishVPattern && + // isSwingLowSameAsVale && + // !conditions.isNewPeakUnderLast + // + // zBar.IsBullish() && + // isSameStrBreakedUp && + // isCBarValidForBullish && + // conditions.isStrBullish && + // conditions.isATROverLast && + // conditions.isVidyaUnderLSM // && + // zBar.close > conditions.strSMHighBuffer[cIDX] + // + + + // isHighsOverPeaksGolden && + // conditions.isStrSwitchedToBearish + // conditions.isStrBearish && + // conditions.isRejectDownLSM // && + // + // isStrBearishVPattern && + // isSwingHighSameAsPeak && + // !conditions.isNewValeOverLast + // + // zBar.IsBearish() && + // isSameStrBreakedDown && + // isCBarValidForBearish && + // conditions.isStrBearish && + // conditions.isATRUnderLast && + // conditions.isVidyaOverHSM // && + // zBar.close < conditions.strSMLowBuffer[cIDX] diff --git a/Helpers/x-saherelm.x121.xstr.helper.mq5 b/Helpers/x-saherelm.x121.xstr.helper.mq5 index 4cf9d994..79dd07d2 100644 --- a/Helpers/x-saherelm.x121.xstr.helper.mq5 +++ b/Helpers/x-saherelm.x121.xstr.helper.mq5 @@ -197,7 +197,7 @@ struct X121XSTRConditions // bool isRejectUpVidya; - bool isClosedOverVidya; + bool isCloseOverVidya; bool isCrossedOverVidya; // @@ -356,7 +356,7 @@ struct X121XSTRConditions isCrossedUnderHSM = false; isCrossedUnderLSM = false; isCrossedUnderStr = false; - isClosedOverVidya = false; + isCloseOverVidya = false; isRejectDownVidya = false; isCloseUnderVidya = false; isCrossedOverVidya = false; @@ -407,7 +407,7 @@ struct X121XSTRConditions { bullishScore += minScore; } - if (isClosedOverVidya) + if (isCloseOverVidya) { bullishScore += minScore; } @@ -618,7 +618,7 @@ struct X121XSTRConditions ToString("isStrSwitchedToBullish", isStrSwitchedToBullish, ignoreFalseConditions, separator) + ToString("isStrSwitchedToBearish", isStrSwitchedToBearish, ignoreFalseConditions, separator) + ToString("isRejectUpVidya", isRejectUpVidya, ignoreFalseConditions, separator) + - ToString("isClosedOverVidya", isClosedOverVidya, ignoreFalseConditions, separator) + + ToString("isCloseOverVidya", isCloseOverVidya, ignoreFalseConditions, separator) + ToString("isCrossedOverVidya", isCrossedOverVidya, ignoreFalseConditions, separator) + ToString("isRejectDownVidya", isRejectDownVidya, ignoreFalseConditions, separator) + ToString("isCloseUnderVidya", isCloseUnderVidya, ignoreFalseConditions, separator) + @@ -1497,10 +1497,10 @@ class XCX121XSTRHelper : public XCBaseHelper ); // - bool isClosedOverVidya = cBar.close > vidyaBuffer[cIDX]; - bool isClosedOverVidyaPrev = pBar.close > vidyaBuffer[pIDX]; - bool isCrossedOverVidya = isClosedOverVidya && - !isClosedOverVidyaPrev; + bool isCloseOverVidya = cBar.close > vidyaBuffer[cIDX]; + bool isCloseOverVidyaPrev = pBar.close > vidyaBuffer[pIDX]; + bool isCrossedOverVidya = isCloseOverVidya && + !isCloseOverVidyaPrev; // bool isRejectDownVidya = cBar.IsRejected( @@ -1672,7 +1672,7 @@ class XCX121XSTRHelper : public XCBaseHelper conditions.isCrossedUnderHSM = isCrossedUnderHSM; conditions.isCrossedUnderLSM = isCrossedUnderLSM; conditions.isCrossedUnderStr = isCrossedUnderStr; - conditions.isClosedOverVidya = isClosedOverVidya; + conditions.isCloseOverVidya = isCloseOverVidya; conditions.isRejectDownVidya = isRejectDownVidya; conditions.isCloseUnderVidya = isCloseUnderVidya; conditions.isCrossedOverVidya = isCrossedOverVidya; diff --git a/XSTRCCI/Helpers/xstrcci.helper.mq5 b/XSTRCCI/Helpers/xstrcci.helper.mq5 index 947e9d17..e04501f9 100644 --- a/XSTRCCI/Helpers/xstrcci.helper.mq5 +++ b/XSTRCCI/Helpers/xstrcci.helper.mq5 @@ -22,9 +22,15 @@ // // Imports ... +#include "../../Classes/x-saherelm.x-bar.analyser.class.mq5" +#include "../../Classes/x-saherelm.x-poi.class.mq5" +#include "../../Classes/x-saherelm.x-poi.drawer.class.mq5" +#include "../../Helpers/x-saherelm.x121.x3ma.helper.mq5" #include "../../Helpers/x-saherelm.x121.xcc.helper.mq5" #include "../../Helpers/x-saherelm.x121.xct.helper.mq5" +#include "../../Helpers/x-saherelm.x121.xich.helper.mq5" #include "../../Helpers/x-saherelm.x121.xoscs.helper.mq5" +#include "../../Helpers/x-saherelm.x121.xpv.helper.mq5" #include "../../Helpers/x-saherelm.x121.xstr.helper.mq5" // @@ -47,6 +53,9 @@ struct XSTRCCIInputs // X121XCTInputs ctInputs; X121XCCInputs ccInputs; + X121XPVInputs pvInputs; + X121X3MAInputs ma3Inputs; + X121XICHInputs ichInputs; X121XSTRInputs strInputs; X121XOCSInputs oscsInputs; @@ -81,6 +90,9 @@ struct XSTRCCIInputs // ctInputs.Clean(); ccInputs.Clean(); + pvInputs.Clean(); + ma3Inputs.Clean(); + ichInputs.Clean(); strInputs.Clean(); oscsInputs.Clean(); @@ -96,6 +108,9 @@ struct XSTRCCIInputs // ctInputs.Default(); ccInputs.Default(); + pvInputs.Default(); + ma3Inputs.Default(); + ichInputs.Default(); strInputs.Default(); oscsInputs.Default(); } @@ -115,6 +130,9 @@ struct XSTRCCIInputs // ctInputs.IsValid() && ccInputs.IsValid() && + pvInputs.IsValid() && + ma3Inputs.IsValid() && + ichInputs.IsValid() && strInputs.IsValid() && oscsInputs.IsValid() // @@ -137,11 +155,17 @@ struct XSTRCCIInputs // int ctMax = ctInputs.Max(); int ccMax = ccInputs.Max(); + int pvMax = pvInputs.Max(); + int ma3Max = ma3Inputs.Max(); + int ichMax = ichInputs.Max(); int strMax = strInputs.Max(); int ocsMax = oscsInputs.Max(); // result = MathMax(strMax, ocsMax); + result = MathMax(result, ma3Max); + result = MathMax(result, ichMax); + result = MathMax(result, pvMax); result = MathMax(result, ccMax); result = MathMax(result, ctMax); @@ -160,6 +184,66 @@ struct XSTRCCIConditions ENUM_TIMEFRAMES period; datetime time; + // + // XPV ... + + // + // Buffers ... + + // + // Buffers ... + double sarBuffer[]; + double cHHBuffer[]; + double cLLBuffer[]; + double sHHBuffer[]; + double sLLBuffer[]; + double mHHBuffer[]; + double mLLBuffer[]; + double lHHBuffer[]; + double lLLBuffer[]; + double hHHBuffer[]; + double hLLBuffer[]; + double trendBuffer[]; + double peaksBuffer[]; + double valesBuffer[]; + double supportsBuffer[]; + double swingLowsBuffer[]; + double swingHighsBuffer[]; + double trendColorBuffer[]; + double trendStateBuffer[]; + double peaksGoldenBuffer[]; + double valesGoldenBuffer[]; + double resistancesBuffer[]; + double fractalsUpperBuffer[]; + double fractalsLowerBuffer[]; + + // + // Conditions ... + + // + // SAR ... + + // + bool isSarBullish; + bool isSarBearish; + + // + bool isSarSwitchedToBullish; + bool isSarSwitchedToBearish; + + // + // XPV ... + + // + bool isNewPeak; + bool isNewPeakOverLast; + bool isNewPeakUnderLast; + + // + bool isNewVale; + bool isNewValeOverLast; + bool isNewValeUnderLast; + // // XSTR ... @@ -195,7 +279,7 @@ struct XSTRCCIConditions // bool isRejectUpVidya; - bool isClosedOverVidya; + bool isCloseOverVidya; bool isCrossedOverVidya; // @@ -275,6 +359,94 @@ struct XSTRCCIConditions bool isVidyaUnderStr; bool isVidyaCrossedUnderStr; + // + // X3MA ... + + // + // Buffers ... + double x3maFastBuffer[]; + double x3maMidBuffer[]; + double x3maSlowBuffer[]; + double x3maFastStateBuffer[]; + double x3maMidStateBuffer[]; + double x3maSlowStateBuffer[]; + + // + // Conditions ... + + // + bool isX3MaFastBullish; + bool isX3MaFastBearish; + bool isX3MaFastNeutural; + + // + bool isX3MaMidBullish; + bool isX3MaMidBearish; + bool isX3MaMidNeutural; + + // + bool isX3MaSlowBullish; + bool isX3MaSlowBearish; + bool isX3MaSlowNeutural; + + // + bool isX3MaFastOverMid; + bool isX3MaMidOverSlow; + + // + bool isX3MaFastUnderMid; + bool isX3MaMidUnderSlow; + + // + bool isX3MaBullishState; + bool isX3MaBearishState; + bool isX3MaNeuturalState; + + // + bool isX3MaBullishOrdered; + bool isX3MaBearishOrdered; + + // + bool isX3MaSwitchedToBullishOrdered; + bool isX3MaSwitchedToBearishOrdered; + + // + bool isX3MaSwitchedToBullishState; + bool isX3MaSwitchedToBearishState; + bool isX3MaSwitchedToNeuturalState; + + // + // XICH ... + + // + // Buffers ... + + // + double kijunSenBuffer[]; + double tenkanSenBuffer[]; + double chikouSpanBuffer[]; + double senkouSpanABuffer[]; + double senkouSpanBBuffer[]; + + // + // Conditions ... + + // + bool isTenkanSenOverKijunSen; + bool isTenkanSenUnderKijunSen; + + // + bool isTenkanSenCrossedOverKijunSen; + bool isTenkanSenCrossedUnderKijunSen; + + // + bool isSenkouSpanAOverB; + bool isSenkouSpanAUnderB; + + // + bool isSenkouSpanACrossedOverB; + bool isSenkouSpanACrossedUnderB; + // // XOSCS ... @@ -532,6 +704,89 @@ struct XSTRCCIConditions period = NULL; time = NULL; + // + // XPV ... + + // + // Buffers ... + + // + Clean(sarBuffer); + Clean(cHHBuffer); + Clean(cLLBuffer); + Clean(sHHBuffer); + Clean(sLLBuffer); + Clean(mHHBuffer); + Clean(mLLBuffer); + Clean(lHHBuffer); + Clean(lLLBuffer); + Clean(hHHBuffer); + Clean(hLLBuffer); + Clean(trendBuffer); + Clean(peaksBuffer); + Clean(valesBuffer); + Clean(supportsBuffer); + Clean(swingLowsBuffer); + Clean(swingHighsBuffer); + Clean(trendColorBuffer); + Clean(trendStateBuffer); + Clean(peaksGoldenBuffer); + Clean(valesGoldenBuffer); + Clean(resistancesBuffer); + Clean(fractalsUpperBuffer); + Clean(fractalsLowerBuffer); + + // + // Clean(bullishTrendBuffer); + // Clean(bearishTrendBuffer); + + // + ArraySetAsSeries(sarBuffer, true); + ArraySetAsSeries(cHHBuffer, true); + ArraySetAsSeries(cLLBuffer, true); + ArraySetAsSeries(sHHBuffer, true); + ArraySetAsSeries(sLLBuffer, true); + ArraySetAsSeries(mHHBuffer, true); + ArraySetAsSeries(mLLBuffer, true); + ArraySetAsSeries(lHHBuffer, true); + ArraySetAsSeries(lLLBuffer, true); + ArraySetAsSeries(hHHBuffer, true); + ArraySetAsSeries(hLLBuffer, true); + ArraySetAsSeries(trendBuffer, true); + ArraySetAsSeries(peaksBuffer, true); + ArraySetAsSeries(valesBuffer, true); + ArraySetAsSeries(supportsBuffer, true); + ArraySetAsSeries(swingLowsBuffer, true); + ArraySetAsSeries(swingHighsBuffer, true); + ArraySetAsSeries(trendColorBuffer, true); + ArraySetAsSeries(trendStateBuffer, true); + ArraySetAsSeries(peaksGoldenBuffer, true); + ArraySetAsSeries(valesGoldenBuffer, true); + ArraySetAsSeries(resistancesBuffer, true); + ArraySetAsSeries(fractalsUpperBuffer, true); + ArraySetAsSeries(fractalsLowerBuffer, true); + + // + // Conditions ... + + // + isSarBullish = false; + isSarBearish = false; + + // + isSarSwitchedToBullish = false; + isSarSwitchedToBearish = false; + + // + isNewPeak = false; + isNewPeakOverLast = false; + isNewPeakUnderLast = false; + + // + isNewVale = false; + isNewValeOverLast = false; + isNewValeUnderLast = false; + // // XSTR ... @@ -591,7 +846,7 @@ struct XSTRCCIConditions isCrossedUnderHSM = false; isCrossedUnderLSM = false; isCrossedUnderStr = false; - isClosedOverVidya = false; + isCloseOverVidya = false; isRejectDownVidya = false; isCloseUnderVidya = false; isCrossedOverVidya = false; @@ -605,6 +860,111 @@ struct XSTRCCIConditions isStrSwitchedToBullish = false; isStrSwitchedToBearish = false; + // + // X3MA ... + + // + // Buffers ... + + // + Clean(x3maFastBuffer); + Clean(x3maMidBuffer); + Clean(x3maSlowBuffer); + Clean(x3maFastStateBuffer); + Clean(x3maMidStateBuffer); + Clean(x3maSlowStateBuffer); + + // + ArraySetAsSeries(x3maFastBuffer, true); + ArraySetAsSeries(x3maMidBuffer, true); + ArraySetAsSeries(x3maSlowBuffer, true); + ArraySetAsSeries(x3maFastStateBuffer, true); + ArraySetAsSeries(x3maMidStateBuffer, true); + ArraySetAsSeries(x3maSlowStateBuffer, true); + + // + // Conditions ... + + // + isX3MaFastBullish = false; + isX3MaFastBearish = false; + isX3MaFastNeutural = false; + + // + isX3MaMidBullish = false; + isX3MaMidBearish = false; + isX3MaMidNeutural = false; + + // + isX3MaSlowBullish = false; + isX3MaSlowBearish = false; + isX3MaSlowNeutural = false; + + // + isX3MaFastOverMid = false; + isX3MaMidOverSlow = false; + + // + isX3MaFastUnderMid = false; + isX3MaMidUnderSlow = false; + + // + isX3MaBullishState = false; + isX3MaBearishState = false; + isX3MaNeuturalState = false; + + // + isX3MaBullishOrdered = false; + isX3MaBearishOrdered = false; + + // + isX3MaSwitchedToBullishOrdered = false; + isX3MaSwitchedToBearishOrdered = false; + + // + isX3MaSwitchedToBullishState = false; + isX3MaSwitchedToBearishState = false; + isX3MaSwitchedToNeuturalState = false; + + // + // XICH ... + + // + // Buffers ... + + // + Clean(kijunSenBuffer); + Clean(tenkanSenBuffer); + Clean(chikouSpanBuffer); + Clean(senkouSpanABuffer); + Clean(senkouSpanBBuffer); + + // + ArraySetAsSeries(kijunSenBuffer, true); + ArraySetAsSeries(tenkanSenBuffer, true); + ArraySetAsSeries(chikouSpanBuffer, true); + ArraySetAsSeries(senkouSpanABuffer, true); + ArraySetAsSeries(senkouSpanBBuffer, true); + + // + // Conditions ... + + // + isTenkanSenOverKijunSen = false; + isTenkanSenUnderKijunSen = false; + + // + isTenkanSenCrossedOverKijunSen = false; + isTenkanSenCrossedUnderKijunSen = false; + + // + isSenkouSpanAOverB = false; + isSenkouSpanAUnderB = false; + + // + isSenkouSpanACrossedOverB = false; + isSenkouSpanACrossedUnderB = false; + // // XOSCS ... @@ -815,6 +1175,29 @@ struct XSTRCCIConditions double minScore = 0.5; double highScore = 1.5; + // + // XPV ... + + // + if (isSarBullish) + { + bullishScore += minScore; + } + if (isSarSwitchedToBullish) + { + bullishScore += score; + } + + // + if (isSarBearish) + { + bearishScore += minScore; + } + if (isSarSwitchedToBearish) + { + bearishScore += score; + } + // // XSTR ... @@ -831,7 +1214,7 @@ struct XSTRCCIConditions { bullishScore += minScore; } - if (isClosedOverVidya) + if (isCloseOverVidya) { bullishScore += minScore; } @@ -982,8 +1365,139 @@ struct XSTRCCIConditions bearishScore += minScore; } + // + // X3MA ... + + // + if (isX3MaBullishState) + { + bullishScore += score; + } + if (isX3MaBullishOrdered) + { + bullishScore += score; + } + if (isX3MaSwitchedToBullishState) + { + bullishScore += highScore; + } + if (isX3MaSwitchedToBullishOrdered) + { + bullishScore += highScore; + } + if (!isX3MaBullishState && + !isX3MaSwitchedToBullishState) + { + // + if (isX3MaFastBullish) + { + bullishScore += minScore; + } + if (isX3MaSlowBullish) + { + bullishScore += minScore; + } + } + if (!isX3MaBullishOrdered && + !isX3MaSwitchedToBullishOrdered) + { + // + if (isX3MaFastOverMid) + { + bullishScore += minScore; + } + if (isX3MaMidOverSlow) + { + bullishScore += minScore; + } + } + + // + if (isX3MaBearishState) + { + bearishScore += score; + } + if (isX3MaBearishOrdered) + { + bearishScore += score; + } + if (isX3MaSwitchedToBearishState) + { + bearishScore += highScore; + } + if (isX3MaSwitchedToBearishOrdered) + { + bearishScore += highScore; + } + if (!isX3MaBearishState && + !isX3MaSwitchedToBearishState) + { + // + if (isX3MaFastBearish) + { + bearishScore += minScore; + } + if (isX3MaSlowBearish) + { + bearishScore += minScore; + } + } + if (!isX3MaBearishOrdered && + !isX3MaSwitchedToBearishOrdered) + { + // + if (isX3MaFastUnderMid) + { + bearishScore += minScore; + } + if (isX3MaMidUnderSlow) + { + bearishScore += minScore; + } + } + + // + // XICH ... + + // + if (isSenkouSpanAOverB) + { + bullishScore += minScore; + } + if (isTenkanSenOverKijunSen) + { + bullishScore += minScore; + } + if (isSenkouSpanACrossedOverB) + { + bullishScore += highScore; + } + if (isTenkanSenCrossedOverKijunSen) + { + bullishScore += highScore; + } + + // + if (isSenkouSpanAUnderB) + { + bearishScore += minScore; + } + if (isTenkanSenUnderKijunSen) + { + bearishScore += minScore; + } + if (isSenkouSpanACrossedUnderB) + { + bearishScore += highScore; + } + if (isTenkanSenCrossedUnderKijunSen) + { + bearishScore += highScore; + } + // // XOCS ... + // // AC ... @@ -1457,6 +1971,57 @@ struct XSTRCCIConditions // string conditionsStr = // + // + "-----------------------" + separator + + "XPV: " + separator + + "-----------------------" + separator + + ToString("isSarBullish", isSarBullish, ignoreFalseConditions, separator) + + ToString("isSarBearish", isSarBearish, ignoreFalseConditions, separator) + + ToString("isSarSwitchedToBullish", isSarSwitchedToBullish, ignoreFalseConditions, separator) + + ToString("isSarSwitchedToBearish", isSarSwitchedToBearish, ignoreFalseConditions, separator) + + ToString("isNewPeak", isNewPeak, ignoreFalseConditions, separator) + + ToString("isNewPeakOverLast", isNewPeakOverLast, ignoreFalseConditions, separator) + + ToString("isNewPeakUnderLast", isNewPeakUnderLast, ignoreFalseConditions, separator) + + ToString("isNewVale", isNewVale, ignoreFalseConditions, separator) + + ToString("isNewValeOverLast", isNewValeOverLast, ignoreFalseConditions, separator) + + ToString("isNewValeUnderLast", isNewValeUnderLast, ignoreFalseConditions, separator) + + "-----------------------" + separator + + "XICH: " + separator + + "-----------------------" + separator + + ToString("isTenkanSenOverKijunSen", isTenkanSenOverKijunSen, ignoreFalseConditions, separator) + + ToString("isTenkanSenUnderKijunSen", isTenkanSenUnderKijunSen, ignoreFalseConditions, separator) + + ToString("isTenkanSenCrossedOverKijunSen", isTenkanSenCrossedOverKijunSen, ignoreFalseConditions, separator) + + ToString("isTenkanSenCrossedUnderKijunSen", isTenkanSenCrossedUnderKijunSen, ignoreFalseConditions, separator) + + ToString("isSenkouSpanAOverB", isSenkouSpanAOverB, ignoreFalseConditions, separator) + + ToString("isSenkouSpanAUnderB", isSenkouSpanAUnderB, ignoreFalseConditions, separator) + + ToString("isSenkouSpanACrossedOverB", isSenkouSpanACrossedOverB, ignoreFalseConditions, separator) + + ToString("isSenkouSpanACrossedUnderB", isSenkouSpanACrossedUnderB, ignoreFalseConditions, separator) + + "-----------------------" + separator + + "X3MA: " + separator + + "-----------------------" + separator + + ToString("isX3MaFastBullish", isX3MaFastBullish, ignoreFalseConditions, separator) + + ToString("isX3MaFastBearish", isX3MaFastBearish, ignoreFalseConditions, separator) + + ToString("isX3MaFastNeutural", isX3MaFastNeutural, ignoreFalseConditions, separator) + + ToString("isX3MaMidBullish", isX3MaMidBullish, ignoreFalseConditions, separator) + + ToString("isX3MaMidBearish", isX3MaMidBearish, ignoreFalseConditions, separator) + + ToString("isX3MaMidNeutural", isX3MaMidNeutural, ignoreFalseConditions, separator) + + ToString("isX3MaSlowBullish", isX3MaSlowBullish, ignoreFalseConditions, separator) + + ToString("isX3MaSlowBearish", isX3MaSlowBearish, ignoreFalseConditions, separator) + + ToString("isX3MaSlowNeutural", isX3MaSlowNeutural, ignoreFalseConditions, separator) + + ToString("isX3MaFastOverMid", isX3MaFastOverMid, ignoreFalseConditions, separator) + + ToString("isX3MaMidOverSlow", isX3MaMidOverSlow, ignoreFalseConditions, separator) + + ToString("isX3MaFastUnderMid", isX3MaFastUnderMid, ignoreFalseConditions, separator) + + ToString("isX3MaMidUnderSlow", isX3MaMidUnderSlow, ignoreFalseConditions, separator) + + ToString("isX3MaBullishState", isX3MaBullishState, ignoreFalseConditions, separator) + + ToString("isX3MaBearishState", isX3MaBearishState, ignoreFalseConditions, separator) + + ToString("isX3MaNeuturalState", isX3MaNeuturalState, ignoreFalseConditions, separator) + + ToString("isX3MaBullishOrdered", isX3MaBullishOrdered, ignoreFalseConditions, separator) + + ToString("isX3MaBearishOrdered", isX3MaBearishOrdered, ignoreFalseConditions, separator) + + ToString("isX3MaSwitchedToBullishOrdered", isX3MaSwitchedToBullishOrdered, ignoreFalseConditions, separator) + + ToString("isX3MaSwitchedToBearishOrdered", isX3MaSwitchedToBearishOrdered, ignoreFalseConditions, separator) + + ToString("isX3MaSwitchedToBullishState", isX3MaSwitchedToBullishState, ignoreFalseConditions, separator) + + ToString("isX3MaSwitchedToBearishState", isX3MaSwitchedToBearishState, ignoreFalseConditions, separator) + + ToString("isX3MaSwitchedToNeuturalState", isX3MaSwitchedToNeuturalState, ignoreFalseConditions, separator) + "-----------------------" + separator + "XSTR: " + separator + "-----------------------" + separator + @@ -1465,7 +2030,7 @@ struct XSTRCCIConditions ToString("isStrSwitchedToBullish", isStrSwitchedToBullish, ignoreFalseConditions, separator) + ToString("isStrSwitchedToBearish", isStrSwitchedToBearish, ignoreFalseConditions, separator) + ToString("isRejectUpVidya", isRejectUpVidya, ignoreFalseConditions, separator) + - ToString("isClosedOverVidya", isClosedOverVidya, ignoreFalseConditions, separator) + + ToString("isCloseOverVidya", isCloseOverVidya, ignoreFalseConditions, separator) + ToString("isCrossedOverVidya", isCrossedOverVidya, ignoreFalseConditions, separator) + ToString("isRejectDownVidya", isRejectDownVidya, ignoreFalseConditions, separator) + ToString("isCloseUnderVidya", isCloseUnderVidya, ignoreFalseConditions, separator) + @@ -1636,8 +2201,20 @@ class XCXSTRCCIHelper : XCBase public: // // Props ... + + // + XCPOIDrawer *poiDrawer; + XCPOIDetector *poiDetector; + + // + XCBarAnalyser *barAnalyser; + + // XCX121XCCHelper *ccHelper; XCX121XCTHelper *ctHelper; + XCX121XPVHelper *pvHelper; + XCX121X3MAHelper *ma3Helper; + XCX121XICHHelper *ichHelper; XCX121XSTRHelper *strHelper; XCX121XOCSHelper *ocsHelper; @@ -1645,6 +2222,8 @@ class XCXSTRCCIHelper : XCBase // Constructor ... XCXSTRCCIHelper() { + // + barAnalyser = new XCBarAnalyser(); } // @@ -1657,9 +2236,17 @@ class XCXSTRCCIHelper : XCBase // ZeroMemory(ccHelper); ZeroMemory(ctHelper); + ZeroMemory(pvHelper); + ZeroMemory(ma3Helper); + ZeroMemory(ichHelper); ZeroMemory(strHelper); ZeroMemory(ocsHelper); + // + ZeroMemory(poiDrawer); + ZeroMemory(poiDetector); + ZeroMemory(barAnalyser); + // IndicatorRelease(acHandler); IndicatorRelease(adHandler); @@ -1721,6 +2308,16 @@ class XCXSTRCCIHelper : XCBase mSymbol = symbol; mPeriod = period; + // + poiDetector = new XCPOIDetector( + symbol, + period // + ); + poiDetector.Init(); + + // + poiDrawer = new XCPOIDrawer(); + // // Setting Inputs ... @@ -1752,6 +2349,17 @@ class XCXSTRCCIHelper : XCBase mInputs.ccInputs // ); + // + // XPV ... + pvHelper = new XCX121XPVHelper(); + result = + result && + pvHelper.Init( + symbol, + period, + mInputs.pvInputs // + ); + // // XSTR ... strHelper = new XCX121XSTRHelper(); @@ -1763,6 +2371,28 @@ class XCXSTRCCIHelper : XCBase mInputs.strInputs // ); + // + // X3MA ... + ma3Helper = new XCX121X3MAHelper(); + result = + result && + ma3Helper.Init( + symbol, + period, + mInputs.ma3Inputs // + ); + + // + // XICH ... + ichHelper = new XCX121XICHHelper(); + result = + result && + ichHelper.Init( + symbol, + period, + mInputs.ichInputs // + ); + // // XOSC ... ocsHelper = new XCX121XOCSHelper(); @@ -1783,6 +2413,10 @@ class XCXSTRCCIHelper : XCBase ZeroMemory(strHelper); ZeroMemory(ocsHelper); + // + ZeroMemory(poiDrawer); + ZeroMemory(poiDetector); + // return result; } @@ -2024,6 +2658,35 @@ class XCXSTRCCIHelper : XCBase // // Conditions Readers ... + /** + * Retrieve Conditions ... + * + * @param conditions: Argument 1 + * @param barIndex: int, Specified Bar Index ... + * @param loopback: int, Loopback looking for others ... + * + * @return ( bool ) + */ + bool GetPVConditions( + X121XPVConditions &conditions, // + int barIndex = 0, // + int loopback = 5 // + ) + { + // + bool result = false; + + // + result = pvHelper.GetConditions( + conditions, + barIndex, + loopback // + ); + + // + return result; + } + /** * Retrieve Conditions ... * @@ -2053,6 +2716,64 @@ class XCXSTRCCIHelper : XCBase return result; } + /** + * Retrieve Conditions ... + * + * @param conditions: Argument 1 + * @param barIndex: int, Specified Bar Index ... + * @param loopback: int, Loopback looking for others ... + * + * @return ( bool ) + */ + bool GetMA3Conditions( + X121X3MAConditions &conditions, // + int barIndex = 0, // + int loopback = 5 // + ) + { + // + bool result = false; + + // + result = ma3Helper.GetConditions( + conditions, + barIndex, + loopback // + ); + + // + return result; + } + + /** + * Retrieve Conditions ... + * + * @param conditions: Argument 1 + * @param barIndex: int, Specified Bar Index ... + * @param loopback: int, Loopback looking for others ... + * + * @return ( bool ) + */ + bool GetICHConditions( + X121XICHConditions &conditions, // + int barIndex = 0, // + int loopback = 5 // + ) + { + // + bool result = false; + + // + result = ichHelper.GetConditions( + conditions, + barIndex, + loopback // + ); + + // + return result; + } + /** * Retrieve Conditions ... * @@ -2129,7 +2850,10 @@ class XCXSTRCCIHelper : XCBase XOHCL pBar; // + X121XPVConditions xpvConditions; X121XSTRConditions xstrConditions; + X121X3MAConditions x3maConditions; + X121XICHConditions xichConditions; X121XOCSConditions xocsConditions; // @@ -2148,6 +2872,16 @@ class XCXSTRCCIHelper : XCBase // // Conditions Retriever ... + // + // XPV ... + result = + result && + GetPVConditions( + xpvConditions, + barIndex, + loopback // + ); + // // XSTR ... result = @@ -2158,6 +2892,26 @@ class XCXSTRCCIHelper : XCBase loopback // ); + // + // X3MA ... + result = + result && + GetMA3Conditions( + x3maConditions, + barIndex, + loopback // + ); + + // + // XICH ... + result = + result && + GetICHConditions( + xichConditions, + barIndex, + loopback // + ); + // // XOSCS ... result = @@ -2178,8 +2932,11 @@ class XCXSTRCCIHelper : XCBase pBar.Clean(); // - xocsConditions.Clean(); + xpvConditions.Clean(); xstrConditions.Clean(); + x3maConditions.Clean(); + xichConditions.Clean(); + xocsConditions.Clean(); // return result; @@ -2196,6 +2953,171 @@ class XCXSTRCCIHelper : XCBase // // Conditions ... + // + // XPV ... + + // + // Buffers ... + + // + Copy( + xpvConditions.sarBuffer, + conditions.sarBuffer // + ); + + // + Copy( + xpvConditions.cHHBuffer, + conditions.cHHBuffer // + ); + + // + Copy( + xpvConditions.cLLBuffer, + conditions.cLLBuffer // + ); + + // + Copy( + xpvConditions.sHHBuffer, + conditions.sHHBuffer // + ); + + // + Copy( + xpvConditions.sLLBuffer, + conditions.sLLBuffer // + ); + + // + Copy( + xpvConditions.mHHBuffer, + conditions.mHHBuffer // + ); + + // + Copy( + xpvConditions.mLLBuffer, + conditions.mLLBuffer // + ); + + // + Copy( + xpvConditions.lHHBuffer, + conditions.lHHBuffer // + ); + + // + Copy( + xpvConditions.lLLBuffer, + conditions.lLLBuffer // + ); + + // + Copy( + xpvConditions.hHHBuffer, + conditions.hHHBuffer // + ); + + // + Copy( + xpvConditions.hLLBuffer, + conditions.hLLBuffer // + ); + + // + Copy( + xpvConditions.trendBuffer, + conditions.trendBuffer // + ); + + // + Copy( + xpvConditions.peaksBuffer, + conditions.peaksBuffer // + ); + + // + Copy( + xpvConditions.valesBuffer, + conditions.valesBuffer // + ); + + // + Copy( + xpvConditions.supportsBuffer, + conditions.supportsBuffer // + ); + + // + Copy( + xpvConditions.swingLowsBuffer, + conditions.swingLowsBuffer // + ); + + // + Copy( + xpvConditions.swingHighsBuffer, + conditions.swingHighsBuffer // + ); + + // + Copy( + xpvConditions.trendColorBuffer, + conditions.trendColorBuffer // + ); + + // + Copy( + xpvConditions.trendStateBuffer, + conditions.trendStateBuffer // + ); + + // + Copy( + xpvConditions.peaksGoldenBuffer, + conditions.peaksGoldenBuffer // + ); + + // + Copy( + xpvConditions.valesGoldenBuffer, + conditions.valesGoldenBuffer // + ); + + // + Copy( + xpvConditions.resistancesBuffer, + conditions.resistancesBuffer // + ); + + // + Copy( + xpvConditions.fractalsUpperBuffer, + conditions.fractalsUpperBuffer // + ); + + // + Copy( + xpvConditions.fractalsLowerBuffer, + conditions.fractalsLowerBuffer // + ); + + // + // Conditions ... + + // + conditions.isNewPeak = xpvConditions.isNewPeak; + conditions.isNewVale = xpvConditions.isNewVale; + conditions.isSarBullish = xpvConditions.isSarBullish; + conditions.isSarBearish = xpvConditions.isSarBearish; + conditions.isNewPeakOverLast = xpvConditions.isNewPeakOverLast; + conditions.isNewValeOverLast = xpvConditions.isNewValeOverLast; + conditions.isNewPeakUnderLast = xpvConditions.isNewPeakUnderLast; + conditions.isNewValeUnderLast = xpvConditions.isNewValeUnderLast; + conditions.isSarSwitchedToBullish = xpvConditions.isSarSwitchedToBullish; + conditions.isSarSwitchedToBearish = xpvConditions.isSarSwitchedToBearish; + // // XSTR ... @@ -2281,7 +3203,7 @@ class XCXSTRCCIHelper : XCBase conditions.isCrossedUnderHSM = xstrConditions.isCrossedUnderHSM; conditions.isCrossedUnderLSM = xstrConditions.isCrossedUnderLSM; conditions.isCrossedUnderStr = xstrConditions.isCrossedUnderStr; - conditions.isClosedOverVidya = xstrConditions.isClosedOverVidya; + conditions.isCloseOverVidya = xstrConditions.isCloseOverVidya; conditions.isRejectDownVidya = xstrConditions.isRejectDownVidya; conditions.isCloseUnderVidya = xstrConditions.isCloseUnderVidya; conditions.isCrossedOverVidya = xstrConditions.isCrossedOverVidya; @@ -2295,6 +3217,125 @@ class XCXSTRCCIHelper : XCBase conditions.isStrSwitchedToBullish = xstrConditions.isStrSwitchedToBullish; conditions.isStrSwitchedToBearish = xstrConditions.isStrSwitchedToBearish; + // + // X3MA ... + + // + // Buffers ... + + // + Copy( + x3maConditions.x3maFastBuffer, + conditions.x3maFastBuffer // + ); + + // + Copy( + x3maConditions.x3maMidBuffer, + conditions.x3maMidBuffer // + ); + + // + Copy( + x3maConditions.x3maSlowBuffer, + conditions.x3maSlowBuffer // + ); + + // + Copy( + x3maConditions.x3maFastStateBuffer, + conditions.x3maFastStateBuffer // + ); + + // + Copy( + x3maConditions.x3maMidStateBuffer, + conditions.x3maMidStateBuffer // + ); + + // + Copy( + x3maConditions.x3maSlowStateBuffer, + conditions.x3maSlowStateBuffer // + ); + + // + // Conditions ... + + // + conditions.isX3MaMidBullish = x3maConditions.isX3MaMidBullish; + conditions.isX3MaMidBearish = x3maConditions.isX3MaMidBearish; + conditions.isX3MaFastBullish = x3maConditions.isX3MaFastBullish; + conditions.isX3MaFastBearish = x3maConditions.isX3MaFastBearish; + conditions.isX3MaMidNeutural = x3maConditions.isX3MaMidNeutural; + conditions.isX3MaSlowBullish = x3maConditions.isX3MaSlowBullish; + conditions.isX3MaSlowBearish = x3maConditions.isX3MaSlowBearish; + conditions.isX3MaFastOverMid = x3maConditions.isX3MaFastOverMid; + conditions.isX3MaMidOverSlow = x3maConditions.isX3MaMidOverSlow; + conditions.isX3MaFastNeutural = x3maConditions.isX3MaFastNeutural; + conditions.isX3MaSlowNeutural = x3maConditions.isX3MaSlowNeutural; + conditions.isX3MaFastUnderMid = x3maConditions.isX3MaFastUnderMid; + conditions.isX3MaMidUnderSlow = x3maConditions.isX3MaMidUnderSlow; + conditions.isX3MaBullishState = x3maConditions.isX3MaBullishState; + conditions.isX3MaBearishState = x3maConditions.isX3MaBearishState; + conditions.isX3MaNeuturalState = x3maConditions.isX3MaNeuturalState; + conditions.isX3MaBullishOrdered = x3maConditions.isX3MaBullishOrdered; + conditions.isX3MaBearishOrdered = x3maConditions.isX3MaBearishOrdered; + conditions.isX3MaSwitchedToBullishState = x3maConditions.isX3MaSwitchedToBullishState; + conditions.isX3MaSwitchedToBearishState = x3maConditions.isX3MaSwitchedToBearishState; + conditions.isX3MaSwitchedToNeuturalState = x3maConditions.isX3MaSwitchedToNeuturalState; + conditions.isX3MaSwitchedToBullishOrdered = x3maConditions.isX3MaSwitchedToBullishOrdered; + conditions.isX3MaSwitchedToBearishOrdered = x3maConditions.isX3MaSwitchedToBearishOrdered; + + // + // XICH ... + + // + // Buffers ... + + // + Copy( + xichConditions.kijunSenBuffer, + conditions.kijunSenBuffer // + ); + + // + Copy( + xichConditions.tenkanSenBuffer, + conditions.tenkanSenBuffer // + ); + + // + Copy( + xichConditions.chikouSpanBuffer, + conditions.chikouSpanBuffer // + ); + + // + Copy( + xichConditions.senkouSpanABuffer, + conditions.senkouSpanABuffer // + ); + + // + Copy( + xichConditions.senkouSpanBBuffer, + conditions.senkouSpanBBuffer // + ); + + // + // Conditions ... + + // + conditions.isSenkouSpanAOverB = xichConditions.isSenkouSpanAOverB; + conditions.isSenkouSpanAUnderB = xichConditions.isSenkouSpanAUnderB; + conditions.isTenkanSenOverKijunSen = xichConditions.isTenkanSenOverKijunSen; + conditions.isTenkanSenUnderKijunSen = xichConditions.isTenkanSenUnderKijunSen; + conditions.isSenkouSpanACrossedOverB = xichConditions.isSenkouSpanACrossedOverB; + conditions.isSenkouSpanACrossedUnderB = xichConditions.isSenkouSpanACrossedUnderB; + conditions.isTenkanSenCrossedOverKijunSen = xichConditions.isTenkanSenCrossedOverKijunSen; + conditions.isTenkanSenCrossedUnderKijunSen = xichConditions.isTenkanSenCrossedUnderKijunSen; + // // XOSCS ... @@ -2496,7 +3537,10 @@ class XCXSTRCCIHelper : XCBase pBar.Clean(); // + xpvConditions.Clean(); xstrConditions.Clean(); + x3maConditions.Clean(); + xichConditions.Clean(); xocsConditions.Clean(); // diff --git a/XSTRCCI/Libraries/xstrcci.signaller.lib.mq5 b/XSTRCCI/Libraries/xstrcci.signaller.lib.mq5 index f78f93a5..e23a7b1b 100644 --- a/XSTRCCI/Libraries/xstrcci.signaller.lib.mq5 +++ b/XSTRCCI/Libraries/xstrcci.signaller.lib.mq5 @@ -24,6 +24,7 @@ #include "../../Libraries/x-saherelm.common.lib.mq5" #include "../../Libraries/x-saherelm.x-poi.lib.mq5" #include "../../Libraries/x-saherelm.x-trade.lib.mq5" +#include "../Helpers/xstrcci.helper.mq5" // // Enumeration ... @@ -418,4 +419,370 @@ int AddGuard( return result; } +// +bool DetectXSTRCCIConditions( + XBoxZone &box, + ENUM_X_DIRECTION &dir, + XCXSTRCCIHelper *helper, + int barIndex = 0, + int loopback = 10 // +) +{ + // + bool result = false; + + // + box.Clean(); + dir = X_DIRECTION_NONE; + + // + if (barIndex < 0) + { + barIndex = 0; + } + loopback = NormalizeInt(loopback, 5); + + // + string symbol = helper.GetSymbol(); + ENUM_TIMEFRAMES period = helper.GetPeriod(); + + // + XSTRCCIConditions conditions; + result = helper.GetConditions( + conditions, + barIndex, + loopback // + ); + if (!result) + { + // + conditions.Clean(); + return result; + } + + // + int zIDX = barIndex; + int cIDX = zIDX + 1; + int pIDX = cIDX + 1; + int ppIDX = pIDX + 1; + int p3IDX = ppIDX + 1; + int p4IDX = p3IDX + 1; + + // + XOHCL zBar; + XOHCL cBar; + XOHCL pBar; + XOHCL ppBar; + XOHCL p3Bar; + XOHCL p4Bar; + result = zBar.Init( + symbol, + period, + zIDX // + ); + result = + result && + zBar.GetPreviousBar(cBar); + result = + result && + cBar.GetPreviousBar(pBar); + result = + result && + pBar.GetPreviousBar(ppBar); + result = + result && + ppBar.GetPreviousBar(p3Bar); + result = + result && + p3Bar.GetPreviousBar(p4Bar); + if (!result) + { + // + zBar.Clean(); + cBar.Clean(); + pBar.Clean(); + ppBar.Clean(); + p3Bar.Clean(); + p4Bar.Clean(); + + // + return result; + } + + // + // Bars Conditions ... + + // + ENUM_X_DIRECTION cBarDir; + + // + // Hammer ... + bool isCBarHammer = helper + .barAnalyser + .IsHammer( + cBar, + cBarDir // + ); + bool isCBarBullishHammer = + isCBarHammer && + IsBullish(cBarDir); + bool isCBarBearishHammer = + isCBarHammer && + IsBearish(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); + + // + // Momentum ... + bool isCBarMomentum = helper + .barAnalyser + .IsMomentum( + cBar, + cBarDir, + 1 // + ); + bool isCBarBullishMomentum = + isCBarMomentum && + IsBullish(cBarDir); + bool isCBarBearishMomentum = + isCBarMomentum && + IsBearish(cBarDir); + + // + // Bar Sumarise ... + + // + bool isCBarValidForBullish = + (isCBarBullishHammer || + isCBarBullishRejected || + isCBarBullishMomentum || + isCBarBullishEngulfed); + + // + bool isCBarValidForBearish = + (isCBarBearishHammer || + isCBarBearishRejected || + isCBarBearishMomentum || + isCBarBearishEngulfed); + + // + // Conditions ... + + // + bool isLowsUnderValesGolden = + // + pBar.low < conditions.valesGoldenBuffer[pIDX] && + ppBar.low < conditions.valesGoldenBuffer[ppIDX] && + p3Bar.low < conditions.valesGoldenBuffer[p3IDX] && + p4Bar.low < conditions.valesGoldenBuffer[p4IDX] + // + ; + + // + bool isHighsOverPeaksGolden = + // + pBar.high > conditions.peaksGoldenBuffer[pIDX] && + ppBar.high > conditions.peaksGoldenBuffer[ppIDX] && + p3Bar.high > conditions.peaksGoldenBuffer[p3IDX] && + p4Bar.high > conditions.peaksGoldenBuffer[p4IDX] + // + ; + + // + bool isSwingLowSameAsVale = + conditions.swingLowsBuffer[p4IDX] == conditions.valesBuffer[p4IDX]; + + // + bool isSwingHighSameAsPeak = + conditions.swingHighsBuffer[p4IDX] == conditions.peaksBuffer[p4IDX]; + + // + bool isStrSame = conditions.strBuffer[cIDX] == conditions.strBuffer[pIDX] && + conditions.strBuffer[pIDX] == conditions.strBuffer[ppIDX]; + + // + bool isSameStrBreakedUp = + isStrSame && + conditions.strBuffer[zIDX] > conditions.strBuffer[cIDX]; + + // + bool isSameStrBreakedDown = + isStrSame && + conditions.strBuffer[zIDX] < conditions.strBuffer[cIDX]; + + // + bool isStrBullishVPattern = + // + conditions.strStateBuffer[zIDX] > 0 && + conditions.strStateBuffer[cIDX] > 0 && + conditions.strStateBuffer[pIDX] > 0 && + conditions.strBuffer[pIDX] < conditions.strBuffer[ppIDX] && + conditions.strBuffer[pIDX] < conditions.strBuffer[cIDX] && + conditions.strBuffer[pIDX] < conditions.strBuffer[zIDX] && + conditions.strBuffer[zIDX] > conditions.strBuffer[cIDX] + // + ; + + // + bool isStrBearishVPattern = + // + conditions.strStateBuffer[zIDX] < 0 && + conditions.strStateBuffer[cIDX] < 0 && + conditions.strStateBuffer[pIDX] < 0 && + conditions.strBuffer[pIDX] > conditions.strBuffer[ppIDX] && + conditions.strBuffer[pIDX] > conditions.strBuffer[cIDX] && + conditions.strBuffer[pIDX] > conditions.strBuffer[zIDX] && + conditions.strBuffer[zIDX] < conditions.strBuffer[cIDX] + // + ; + + // + bool isCBarLowInTKZone = + // + cBar.low < conditions.tenkanSenBuffer[cIDX] && + cBar.low > conditions.kijunSenBuffer[cIDX] + // + ; + + // + bool isCBarHighInTKZone = + // + cBar.high > conditions.tenkanSenBuffer[cIDX] && + cBar.high < conditions.kijunSenBuffer[cIDX] + // + ; + + // + // Summarise Conditions ... + + // + bool isBullish = + // + isCBarLowInTKZone && + isCBarBullishRejected && + isCBarValidForBullish && + conditions.isX3MaSlowBullish && + conditions.isTenkanSenOverKijunSen && + conditions.kijunSenBuffer[cIDX] > conditions.x3maSlowBuffer[cIDX] + // + ; + + // + bool isBearish = + // + isCBarHighInTKZone && + isCBarBearishRejected && + isCBarValidForBearish && + conditions.isX3MaSlowBearish && + conditions.isTenkanSenUnderKijunSen && + conditions.kijunSenBuffer[cIDX] < conditions.x3maSlowBuffer[cIDX] + // + ; + + // + result = isBullish || + isBearish; + if (result) + { + // + dir = + isBullish + ? X_DIRECTION_BULLISH + : X_DIRECTION_BEARISH; + + // + double entry = GetEntry( + conditions.symbol, + dir // + ); + double sl = conditions.kijunSenBuffer[cIDX]; + + // + box.dir = dir; + box.symbol = conditions.symbol; + box.period = conditions.period; + + // + box.upper = + isBullish + ? entry + : sl; + + // + box.lower = + isBullish + ? sl + : entry; + + // + box.to = zBar.time; + box.from = p4Bar.time; + + // + box.type = ToString(dir) + "_Signal_" + conditions.symbol + "_" + ToString(conditions.period); + + // + XCBoxObject *iObj; + bool isCreated = helper.poiDrawer.DrawBox( + box, + iObj // + ); + if (isCreated) + { + Print("Signal Box ..."); + } + } + + // + result = box.IsValid() && + HasDirection(dir); + + // + // Cleanup Resources ... + + // + zBar.Clean(); + cBar.Clean(); + pBar.Clean(); + ppBar.Clean(); + p3Bar.Clean(); + p4Bar.Clean(); + + // + conditions.Clean(); + + // + return result; +} + // \ No newline at end of file diff --git a/XSTRCCI/Signals/xstrcci.signaller.class.mq5 b/XSTRCCI/Signals/xstrcci.signaller.class.mq5 index 3c3fc14b..c285be76 100644 --- a/XSTRCCI/Signals/xstrcci.signaller.class.mq5 +++ b/XSTRCCI/Signals/xstrcci.signaller.class.mq5 @@ -40,6 +40,7 @@ class XCXSTRCCISignaller : XCBase double rfReward; bool isPassedBoxes; XSTRCCIInputs inputs; + XBarTracker barTraker; XCXSTRCCIHelper *helper; bool continuesRFTillTarget; XSTRCCIStrategyConditions mConditions; @@ -96,6 +97,117 @@ class XCXSTRCCISignaller : XCBase // bool result = false; + // + // Check Bar Processing ... + if (!barTraker.CanProcessBar()) + { + return result; + } + + // + bool isBullish = false; + bool isBearish = false; + + // + int zIndex = 0; + int cIndex = zIndex + 1; + int pIndex = cIndex + 1; + int ppIndex = pIndex + 1; + + // + int loopback = 10; + + // + double ask = GetAsk(symbol); + double bid = GetBid(symbol); + datetime cTime = TimeCurrent(); + double points = GetPoints(symbol); + + // + mConditions.symbol = symbol; + mConditions.period = period; + + // + XOHCL zBar; + XOHCL cBar; + XOHCL pBar; + XOHCL pPBar; + result = zBar.Init( + symbol, + period, + zIndex // + ); + result = + result && + zBar.GetPreviousBar(cBar); + result = + result && + cBar.GetPreviousBar(pBar); + result = + result && + pBar.GetPreviousBar(pPBar); + if (!result) + { + // + zBar.Clean(); + cBar.Clean(); + pBar.Clean(); + pPBar.Clean(); + + // + return result; + } + + // + // Setup Conditions ... + double sls[]; + double sl = 0; + double pivot = 0; + double point = 0; + double targets[]; + XBoxZone signalBox; + bool hasSignalBox = false; + ENUM_X_DIRECTION signalBoxDir = X_DIRECTION_NONE; + + // + // Checking Conditions ... + + // + hasSignalBox = DetectXSTRCCIConditions( + signalBox, + signalBoxDir, + helper, + zIndex, + loopback // + ); + + // + isBullish = hasSignalBox && + IsBullish(signalBoxDir); + + // + isBearish = hasSignalBox && + IsBearish(signalBoxDir); + + // + result = isBullish || + isBearish; + if (result) + { + // + // Do What we Want ... + barTraker.Waits(); + } + + // + // Cleanup Resource ... + + // + zBar.Clean(); + cBar.Clean(); + pBar.Clean(); + pPBar.Clean(); + // return result; } @@ -303,6 +415,12 @@ class XCXSTRCCISignaller : XCBase isPassedBoxes = false; continuesRFTillTarget = true; + // + barTraker.Init( + symbol, + period // + ); + // inputs.Default(); @@ -317,21 +435,48 @@ class XCXSTRCCISignaller : XCBase // XCT ... inputs.ctInputs.showCandleTime = true; + // + // XPV ... + inputs.pvInputs.showSar = false; + inputs.pvInputs.showPeaks = false; + inputs.pvInputs.showVales = false; + inputs.pvInputs.showTrend = false; + inputs.pvInputs.showSwingLows = false; + inputs.pvInputs.showSwingHighs = false; + inputs.pvInputs.showGoldenZones = false; + inputs.pvInputs.showSupports = false; + inputs.pvInputs.showResistances = false; + // // XSTR ... - inputs.strInputs.showStr = true; - inputs.strInputs.showVidya = true; + inputs.strInputs.showStr = false; + inputs.strInputs.showVidya = false; inputs.strInputs.showStrUpper = false; inputs.strInputs.showStrLower = false; - inputs.strInputs.showStrSMLow = true; - inputs.strInputs.showStrSMHigh = true; + inputs.strInputs.showStrSMLow = false; + inputs.strInputs.showStrSMHigh = false; + + // + // X3MA ... + inputs.ma3Inputs.showX3MaFast = false; + inputs.ma3Inputs.showX3MaMid = false; + inputs.ma3Inputs.showX3MaSlow = true; + + // + // XICH ... + inputs.ichInputs.showKumo = false; + inputs.ichInputs.showKijunSen = true; + inputs.ichInputs.showTenkanSen = true; + inputs.ichInputs.showChikouSpan = false; + inputs.ichInputs.showSenkouSpanA = false; + inputs.ichInputs.showSenkouSpanB = false; // // XOSCS ... - inputs.oscsInputs.rsiLength = 5; - inputs.oscsInputs.mfiLength = 5; - inputs.oscsInputs.rviLength = 5; - inputs.oscsInputs.cciLength = 5; + // inputs.oscsInputs.rsiLength = 5; + // inputs.oscsInputs.mfiLength = 5; + // inputs.oscsInputs.rviLength = 5; + // inputs.oscsInputs.cciLength = 5; // // Oscillators Views ... @@ -367,6 +512,9 @@ class XCXSTRCCISignaller : XCBase // mObjects.Clear(); mBarObjects.Clear(); + + // + barTraker.Clean(); } //