diff --git a/Documents/BKP/usefull.mq5 b/Documents/BKP/usefull.mq5 index a29ccefe..e5c3ed41 100644 --- a/Documents/BKP/usefull.mq5 +++ b/Documents/BKP/usefull.mq5 @@ -6769,4 +6769,207 @@ void HandleStrategiesOnTick() // // Custom Testing Functions ... -// \ No newline at end of file +// + +///////////////////////////////////////////////////////////////////////////////////////////////////////// + + + // + bool isCHHKCBullishBreaked = + // + ( + // + chhkConditions.isCBearish && + chhkConditions.isSBullish && + chhkConditions.isMBullish && + chhkConditions.isLBullish && + chhkConditions.isHBullish + // + ) + // + ; + + // + bool isCHHKSBullishBreaked = + // + ( + // + chhkConditions.isSBearish && + chhkConditions.isCBullish && + chhkConditions.isMBullish && + chhkConditions.isLBullish && + chhkConditions.isHBullish + // + ) + // + ; + + // + bool isCHHKMBullishBreaked = + // + ( + // + chhkConditions.isMBearish && + chhkConditions.isCBullish && + chhkConditions.isSBullish && + chhkConditions.isLBullish && + chhkConditions.isHBullish + // + ) + // + ; + + // + bool isCHHKLBullishBreaked = + // + ( + // + chhkConditions.isLBearish && + chhkConditions.isCBullish && + chhkConditions.isSBullish && + chhkConditions.isMBullish && + chhkConditions.isHBullish + // + ) + // + ; + + // + bool isCHHKHBullishBreaked = + // + ( + // + chhkConditions.isHBearish && + chhkConditions.isCBullish && + chhkConditions.isSBullish && + chhkConditions.isMBullish && + chhkConditions.isLBullish + // + ) + // + ; + + + // + bool isCHHKBullishBreaked = + // + isCHHKCBullishBreaked + // + || + // + isCHHKSBullishBreaked + // + || + // + isCHHKMBullishBreaked + // + || + // + isCHHKLBullishBreaked + // + || + // + isCHHKHBullishBreaked + // + ; + + + + // + bool isCHHKCBearishBreaked = + // + ( + // + chhkConditions.isCBullish && + chhkConditions.isSBearish && + chhkConditions.isMBearish && + chhkConditions.isLBearish && + chhkConditions.isHBearish + // + ) + // + ; + + // + bool isCHHKSBearishBreaked = + // + ( + // + chhkConditions.isSBullish && + chhkConditions.isCBearish && + chhkConditions.isMBearish && + chhkConditions.isLBearish && + chhkConditions.isHBearish + // + ) + // + ; + + // + bool isCHHKMBearishBreaked = + // + ( + // + chhkConditions.isMBullish && + chhkConditions.isCBearish && + chhkConditions.isSBearish && + chhkConditions.isLBearish && + chhkConditions.isHBearish + // + ) + // + ; + + // + bool isCHHKLBearishBreaked = + // + ( + // + chhkConditions.isLBullish && + chhkConditions.isCBearish && + chhkConditions.isSBearish && + chhkConditions.isMBearish && + chhkConditions.isHBearish + // + ) + // + ; + + // + bool isCHHKHBearishBreaked = + // + ( + // + chhkConditions.isHBullish && + chhkConditions.isCBearish && + chhkConditions.isSBearish && + chhkConditions.isMBearish && + chhkConditions.isLBearish + // + ) + // + ; + + + // + bool isCHHKBearishBreaked = + // + isCHHKCBearishBreaked + // + || + // + isCHHKSBearishBreaked + // + || + // + isCHHKMBearishBreaked + // + || + // + isCHHKLBearishBreaked + // + || + // + isCHHKHBearishBreaked + // + ; diff --git a/Experts/x-test-strategies.ea.mq5 b/Experts/x-test-strategies.ea.mq5 index 1e5b2daa..06321b2b 100644 --- a/Experts/x-test-strategies.ea.mq5 +++ b/Experts/x-test-strategies.ea.mq5 @@ -318,37 +318,6 @@ bool InitialEA() RegisterStrategy(eurusdXTDTStrategy); } - // - // XCHKM ... - if (useXCHKM) - { - // - XSCXCHKMStrategy *eurusdXCHKMStrategy; - eurusdXCHKMStrategy = new XSCXCHKMStrategy( - eurusdSymbol, - PERIOD_M5, - eaVolume, - 0.75, // eaR2R, // R2R ... - eaSlippage, - magicNumber, - true, // Ignore Signal Execution - false, // Use TP SL Point - false, // Use Max - eaTPPoint, // TP - eaSLPoint, // SL - eaIgnoreTP, - eaIgnoreSL, - eaAllowLong, - eaAllowShort, - eaMaxAllowedLongs, // Max Longs - eaMaxAllowedShorts // Max Shorts - ); - eurusdXCHKMStrategy.SetAlertLogAlerts(true); - eurusdXCHKMStrategy.SetAlertEnableAlerts(true); - eurusdXCHKMStrategy.AddSignalEventHandler(OnSignalRecieved); - RegisterStrategy(eurusdXCHKMStrategy); - } - // // XTest ... if (useXTest) @@ -379,6 +348,37 @@ bool InitialEA() eurusdTestStrategy.AddSignalEventHandler(OnSignalRecieved); RegisterStrategy(eurusdTestStrategy); } + + // + // XCHKM ... + if (useXCHKM) + { + // + XSCXCHKMStrategy *eurusdXCHKMStrategy; + eurusdXCHKMStrategy = new XSCXCHKMStrategy( + eurusdSymbol, + PERIOD_M5, + eaVolume, + eaR2R, // R2R ... + eaSlippage, + magicNumber, + true, // Ignore Signal Execution + false, // Use TP SL Point + false, // Use Max + eaTPPoint, // TP + eaSLPoint, // SL + eaIgnoreTP, + eaIgnoreSL, + eaAllowLong, + eaAllowShort, + eaMaxAllowedLongs, // Max Longs + eaMaxAllowedShorts // Max Shorts + ); + eurusdXCHKMStrategy.SetAlertLogAlerts(true); + eurusdXCHKMStrategy.SetAlertEnableAlerts(true); + eurusdXCHKMStrategy.AddSignalEventHandler(OnSignalRecieved); + RegisterStrategy(eurusdXCHKMStrategy); + } } // diff --git a/Helpers/x-saherelm.xchstr.helper.mq5 b/Helpers/x-saherelm.xchstr.helper.mq5 index 581a725e..7bb47a28 100644 --- a/Helpers/x-saherelm.xchstr.helper.mq5 +++ b/Helpers/x-saherelm.xchstr.helper.mq5 @@ -1288,12 +1288,12 @@ public: // // Short ... - CopyCTrend( + CopySTrend( zIndex, loopback, conditions.sTrend // ); - CopyCState( + CopySState( zIndex, loopback, conditions.sState // @@ -1301,12 +1301,12 @@ public: // // Medium ... - CopyCTrend( + CopyMTrend( zIndex, loopback, conditions.mTrend // ); - CopyCState( + CopyMState( zIndex, loopback, conditions.mState // @@ -1314,12 +1314,12 @@ public: // // Long ... - CopyCTrend( + CopyLTrend( zIndex, loopback, conditions.lTrend // ); - CopyCState( + CopyLState( zIndex, loopback, conditions.lState // @@ -1327,12 +1327,12 @@ public: // // Hind ... - CopyCTrend( + CopyHTrend( zIndex, loopback, conditions.hTrend // ); - CopyCState( + CopyHState( zIndex, loopback, conditions.hState // diff --git a/Strategies/x-saherelm.xchkm.strategy.mq5 b/Strategies/x-saherelm.xchkm.strategy.mq5 index 838c88d4..8611cad2 100644 --- a/Strategies/x-saherelm.xchkm.strategy.mq5 +++ b/Strategies/x-saherelm.xchkm.strategy.mq5 @@ -25,10 +25,10 @@ // // Import(s) Helper(s) ... #include "../Helpers/x-saherelm.xpv.helper.mq5" -#include "../Helpers/x-saherelm.xstr.helper.mq5" #include "../Helpers/x-saherelm.xche.helper.mq5" -#include "../Helpers/x-saherelm.xchma.helper.mq5" +#include "../Helpers/x-saherelm.xchm.helper.mq5" #include "../Helpers/x-saherelm.xchhk.helper.mq5" +#include "../Helpers/x-saherelm.xchstr.helper.mq5" // // Base Classes ... @@ -99,12 +99,12 @@ public: { // delete pvHelper; - delete strHelper; delete cheHelper; // + delete chmHelper; delete chhkHelper; - delete chmaHelper; + delete chstrHelper; } // @@ -154,9 +154,9 @@ public: // Retrieve Conditions ... // - // XCHMA ... - XCHMAConditions chmaConditions; - result = chmaHelper.GetConditions(chmaConditions); + // XPV ... + XPVConditions pvConditions; + result = pvHelper.GetConditions(pvConditions); if (!result) { return result; @@ -164,6 +164,24 @@ public: // // XCHE ... + XCHEConditions cheConditions; + result = cheHelper.GetConditions(cheConditions); + if (!result) + { + return result; + } + + // + // XCHM ... + XCHMConditions chmConditions; + result = chmHelper.GetConditions(chmConditions); + if (!result) + { + return result; + } + + // + // XCHHK ... XCHHKConditions chhkConditions; result = chhkHelper.GetConditions(chhkConditions); if (!result) @@ -171,6 +189,15 @@ public: return result; } + // + // XCHSTR ... + XCHSTRConditions chstrConditions; + result = chstrHelper.GetConditions(chstrConditions); + if (!result) + { + return result; + } + // // Start Calculations ... @@ -322,84 +349,125 @@ public: ); // - // Detect XCHMA based Conditions ... + // XCHM ... + // Detect XCHMbased Conditions ... // // Bullish ... // - bool isCHMAHCrossedOver = + bool isCHMHSwithedToBullish = // ( // - chmaConditions.isHFastCrossedOverSlow && - chmaConditions.isLFastOverSlow && - chmaConditions.isMFastOverSlow && - chmaConditions.isSFastOverSlow + chmConditions.isHFastCrossedOverSlow && + chmConditions.isLFastOverSlow && + chmConditions.isMFastOverSlow && + chmConditions.isSFastOverSlow && + chmConditions.isCFastOverSlow // ) // ; // - bool isCHMALCrossedOver = + bool isCHMLSwithedToBullish = // ( // - chmaConditions.isLFastCrossedOverSlow && - chmaConditions.isHFastOverSlow && - chmaConditions.isMFastOverSlow && - chmaConditions.isSFastOverSlow + chmConditions.isLFastCrossedOverSlow && + chmConditions.isHFastOverSlow && + chmConditions.isMFastOverSlow && + chmConditions.isSFastOverSlow && + chmConditions.isCFastOverSlow // ) // ; // - bool isCHMAMCrossedOver = + bool isCHMMSwithedToBullish = // ( // - chmaConditions.isMFastCrossedOverSlow && - chmaConditions.isHFastOverSlow && - chmaConditions.isLFastOverSlow && - chmaConditions.isSFastOverSlow + chmConditions.isMFastCrossedOverSlow && + chmConditions.isHFastOverSlow && + chmConditions.isLFastOverSlow && + chmConditions.isSFastOverSlow && + chmConditions.isCFastOverSlow // ) // ; // - bool isCHMASCrossedOver = + bool isCHMSSwithedToBullish = // ( // - chmaConditions.isSFastCrossedOverSlow && - chmaConditions.isHFastOverSlow && - chmaConditions.isLFastOverSlow && - chmaConditions.isMFastOverSlow + chmConditions.isSFastCrossedOverSlow && + chmConditions.isHFastOverSlow && + chmConditions.isLFastOverSlow && + chmConditions.isMFastOverSlow && + chmConditions.isCFastOverSlow // ) // ; // - // Bullish XCHMA Conditions ... - bool isCHMABullish = + bool isCHMCSwithedToBullish = // - isCHMAHCrossedOver + ( + // + chmConditions.isCFastCrossedOverSlow && + chmConditions.isHFastOverSlow && + chmConditions.isLFastOverSlow && + chmConditions.isMFastOverSlow && + chmConditions.isSFastOverSlow + // + ) + // + ; + + // + // Bullish Conclusion ... + + // + bool isCHMBullish = + // + ( + // + chmConditions.isHFastOverSlow && + chmConditions.isLFastOverSlow && + chmConditions.isMFastOverSlow && + chmConditions.isSFastOverSlow && + chmConditions.isCFastOverSlow + // + ) + // + ; + + // + bool isCHMSwitchedToBullish = + // + isCHMHSwithedToBullish // || // - isCHMALCrossedOver + isCHMLSwithedToBullish // || // - isCHMAMCrossedOver + isCHMMSwithedToBullish // || // - isCHMASCrossedOver + isCHMSSwithedToBullish + // + || + // + isCHMCSwithedToBullish // ; @@ -407,168 +475,209 @@ public: // Bearish ... // - bool isCHMAHCrossedUnder = + bool isCHMCHSwitchedToBearish = // ( // - chmaConditions.isHFastCrossedUnderSlow && - chmaConditions.isLFastUnderSlow && - chmaConditions.isMFastUnderSlow && - chmaConditions.isSFastUnderSlow + chmConditions.isHFastCrossedUnderSlow && + chmConditions.isLFastUnderSlow && + chmConditions.isMFastUnderSlow && + chmConditions.isSFastUnderSlow && + chmConditions.isCFastUnderSlow // ) // ; // - bool isCHMALCrossedUnder = + bool isCHMCLSwitchedToBearish = // ( // - chmaConditions.isLFastCrossedUnderSlow && - chmaConditions.isHFastUnderSlow && - chmaConditions.isMFastUnderSlow && - chmaConditions.isSFastUnderSlow + chmConditions.isLFastCrossedUnderSlow && + chmConditions.isHFastUnderSlow && + chmConditions.isMFastUnderSlow && + chmConditions.isSFastUnderSlow && + chmConditions.isCFastUnderSlow // ) // ; // - bool isCHMAMCrossedUnder = + bool isCHMCMSwitchedToBearish = // ( // - chmaConditions.isMFastCrossedUnderSlow && - chmaConditions.isHFastUnderSlow && - chmaConditions.isLFastUnderSlow && - chmaConditions.isSFastUnderSlow + chmConditions.isMFastCrossedUnderSlow && + chmConditions.isHFastUnderSlow && + chmConditions.isLFastUnderSlow && + chmConditions.isSFastUnderSlow && + chmConditions.isCFastUnderSlow // ) // ; // - bool isCHMASCrossedUnder = + bool isCHMCSSwitchedToBearish = // ( // - chmaConditions.isSFastCrossedUnderSlow && - chmaConditions.isHFastUnderSlow && - chmaConditions.isLFastUnderSlow && - chmaConditions.isMFastUnderSlow + chmConditions.isSFastCrossedUnderSlow && + chmConditions.isHFastUnderSlow && + chmConditions.isLFastUnderSlow && + chmConditions.isMFastUnderSlow && + chmConditions.isCFastUnderSlow // ) // ; // - // Bullish XCHMA Conditions ... - bool isCHMABearish = + bool isCHMCCSwitchedToBearish = // - isCHMAHCrossedUnder + ( + // + chmConditions.isCFastCrossedUnderSlow && + chmConditions.isHFastUnderSlow && + chmConditions.isLFastUnderSlow && + chmConditions.isMFastUnderSlow && + chmConditions.isSFastUnderSlow + // + ) + // + ; + + // + // Bearish Conclusion ... + + // + bool isCHMBearish = + // + ( + // + chmConditions.isHFastUnderSlow && + chmConditions.isLFastUnderSlow && + chmConditions.isMFastUnderSlow && + chmConditions.isSFastUnderSlow && + chmConditions.isCFastUnderSlow + // + ) + // + ; + + // + bool isCHMSwitchedToBearish = + // + isCHMCHSwitchedToBearish // || // - isCHMALCrossedUnder + isCHMCLSwitchedToBearish // || // - isCHMAMCrossedUnder + isCHMCMSwitchedToBearish // || // - isCHMASCrossedUnder + isCHMCSSwitchedToBearish + // + || + // + isCHMCCSwitchedToBearish // ; // // Max ... - double maxCHMA = MathMax( - chmaConditions.cFast[cIndex], - chmaConditions.cSlow[cIndex] // + double chmMax = MathMax( + chmConditions.cFast[cIndex], + chmConditions.cSlow[cIndex] // ); - maxCHMA = MathMax( - maxCHMA, - chmaConditions.sFast[cIndex] // + chmMax = MathMax( + chmMax, + chmConditions.sFast[cIndex] // ); - maxCHMA = MathMax( - maxCHMA, - chmaConditions.sSlow[cIndex] // + chmMax = MathMax( + chmMax, + chmConditions.sSlow[cIndex] // ); - maxCHMA = MathMax( - maxCHMA, - chmaConditions.mFast[cIndex] // + chmMax = MathMax( + chmMax, + chmConditions.mFast[cIndex] // ); - maxCHMA = MathMax( - maxCHMA, - chmaConditions.mSlow[cIndex] // + chmMax = MathMax( + chmMax, + chmConditions.mSlow[cIndex] // ); - maxCHMA = MathMax( - maxCHMA, - chmaConditions.lFast[cIndex] // + chmMax = MathMax( + chmMax, + chmConditions.lFast[cIndex] // ); - maxCHMA = MathMax( - maxCHMA, - chmaConditions.lSlow[cIndex] // + chmMax = MathMax( + chmMax, + chmConditions.lSlow[cIndex] // ); - maxCHMA = MathMax( - maxCHMA, - chmaConditions.hFast[cIndex] // + chmMax = MathMax( + chmMax, + chmConditions.hFast[cIndex] // ); - maxCHMA = MathMax( - maxCHMA, - chmaConditions.hSlow[cIndex] // + chmMax = MathMax( + chmMax, + chmConditions.hSlow[cIndex] // ); // - // Min - double minCHMA = MathMin( - chmaConditions.cFast[cIndex], - chmaConditions.cSlow[cIndex] // + // Min ... + double chmMin = MathMin( + chmConditions.cFast[cIndex], + chmConditions.cSlow[cIndex] // ); - minCHMA = MathMin( - minCHMA, - chmaConditions.sFast[cIndex] // + chmMin = MathMin( + chmMin, + chmConditions.sFast[cIndex] // ); - minCHMA = MathMin( - minCHMA, - chmaConditions.sSlow[cIndex] // + chmMin = MathMin( + chmMin, + chmConditions.sSlow[cIndex] // ); - minCHMA = MathMin( - minCHMA, - chmaConditions.mFast[cIndex] // + chmMin = MathMin( + chmMin, + chmConditions.mFast[cIndex] // ); - minCHMA = MathMin( - minCHMA, - chmaConditions.mSlow[cIndex] // + chmMin = MathMin( + chmMin, + chmConditions.mSlow[cIndex] // ); - minCHMA = MathMin( - minCHMA, - chmaConditions.lFast[cIndex] // + chmMin = MathMin( + chmMin, + chmConditions.lFast[cIndex] // ); - minCHMA = MathMin( - minCHMA, - chmaConditions.lSlow[cIndex] // + chmMin = MathMin( + chmMin, + chmConditions.lSlow[cIndex] // ); - minCHMA = MathMin( - minCHMA, - chmaConditions.hFast[cIndex] // + chmMin = MathMin( + chmMin, + chmConditions.hFast[cIndex] // ); - minCHMA = MathMin( - minCHMA, - chmaConditions.hSlow[cIndex] // + chmMin = MathMin( + chmMin, + chmConditions.hSlow[cIndex] // ); // - double chmaDistanceDiffInPoint = + double chmDistanceDiffInPoint = // - (maxCHMA - minCHMA) / points + (chmMax - chmMin) / points // ; // - // XCHHM Conditions ... + // XCHHK ... + // Detect XCHHK Conditions ... // // Bullish ... @@ -649,71 +758,14 @@ public: ; // - bool isCHHKCBullishBreaked = - // - ( - // - chhkConditions.isCBearish && - chhkConditions.isSBullish && - chhkConditions.isMBullish && - chhkConditions.isLBullish && - chhkConditions.isHBullish - // - ) - // - ; + // Bullish Conclusion ... // - bool isCHHKSBullishBreaked = + bool isCHHKBullish = // ( // - chhkConditions.isSBearish && - chhkConditions.isCBullish && - chhkConditions.isMBullish && - chhkConditions.isLBullish && - chhkConditions.isHBullish - // - ) - // - ; - - // - bool isCHHKMBullishBreaked = - // - ( - // - chhkConditions.isMBearish && - chhkConditions.isCBullish && - chhkConditions.isSBullish && - chhkConditions.isLBullish && - chhkConditions.isHBullish - // - ) - // - ; - - // - bool isCHHKLBullishBreaked = - // - ( - // - chhkConditions.isLBearish && - chhkConditions.isCBullish && - chhkConditions.isSBullish && - chhkConditions.isMBullish && - chhkConditions.isHBullish - // - ) - // - ; - - // - bool isCHHKHBullishBreaked = - // - ( - // - chhkConditions.isHBearish && + chhkConditions.isHBullish && chhkConditions.isCBullish && chhkConditions.isSBullish && chhkConditions.isMBullish && @@ -724,7 +776,7 @@ public: ; // - bool isCHHKBullish = + bool isCHHKSwitchedBullish = // isCHHKCSwitchedToBullish // @@ -746,29 +798,6 @@ public: // ; - // - bool isCHHKBullishBreaked = - // - isCHHKCBullishBreaked - // - || - // - isCHHKSBullishBreaked - // - || - // - isCHHKMBullishBreaked - // - || - // - isCHHKLBullishBreaked - // - || - // - isCHHKHBullishBreaked - // - ; - // // Bearish ... @@ -848,71 +877,14 @@ public: ; // - bool isCHHKCBearishBreaked = - // - ( - // - chhkConditions.isCBullish && - chhkConditions.isSBearish && - chhkConditions.isMBearish && - chhkConditions.isLBearish && - chhkConditions.isHBearish - // - ) - // - ; + // Bearish Conclusion ... // - bool isCHHKSBearishBreaked = + bool isCHHKBearish = // ( // - chhkConditions.isSBullish && - chhkConditions.isCBearish && - chhkConditions.isMBearish && - chhkConditions.isLBearish && - chhkConditions.isHBearish - // - ) - // - ; - - // - bool isCHHKMBearishBreaked = - // - ( - // - chhkConditions.isMBullish && - chhkConditions.isCBearish && - chhkConditions.isSBearish && - chhkConditions.isLBearish && - chhkConditions.isHBearish - // - ) - // - ; - - // - bool isCHHKLBearishBreaked = - // - ( - // - chhkConditions.isLBullish && - chhkConditions.isCBearish && - chhkConditions.isSBearish && - chhkConditions.isMBearish && - chhkConditions.isHBearish - // - ) - // - ; - - // - bool isCHHKHBearishBreaked = - // - ( - // - chhkConditions.isHBullish && + chhkConditions.isHBearish && chhkConditions.isCBearish && chhkConditions.isSBearish && chhkConditions.isMBearish && @@ -923,7 +895,7 @@ public: ; // - bool isCHHKBearish = + bool isCHHKSwitchedToBearish = // isCHHKCSwitchedToBearish // @@ -945,109 +917,373 @@ public: // ; - // - bool isCHHKBearishBreaked = - // - isCHHKCBearishBreaked - // - || - // - isCHHKSBearishBreaked - // - || - // - isCHHKMBearishBreaked - // - || - // - isCHHKLBearishBreaked - // - || - // - isCHHKHBearishBreaked - // - ; - // // Max High ... - double maxCHHKHigh = MathMax( + double chhkHighMax = MathMax( chhkConditions.cBars[cIndex].high, chhkConditions.sBars[cIndex].high // ); - maxCHHKHigh = MathMax( - maxCHHKHigh, + chhkHighMax = MathMax( + chhkHighMax, chhkConditions.mBars[cIndex].high // ); - maxCHHKHigh = MathMax( - maxCHHKHigh, + chhkHighMax = MathMax( + chhkHighMax, chhkConditions.lBars[cIndex].high // ); - maxCHHKHigh = MathMax( - maxCHHKHigh, + chhkHighMax = MathMax( + chhkHighMax, chhkConditions.hBars[cIndex].high // ); // // Min High ... - double minCHHKHigh = MathMin( + double chhkHighMin = MathMin( chhkConditions.cBars[cIndex].high, chhkConditions.sBars[cIndex].high // ); - minCHHKHigh = MathMin( - minCHHKHigh, + chhkHighMin = MathMin( + chhkHighMin, chhkConditions.mBars[cIndex].high // ); - minCHHKHigh = MathMin( - minCHHKHigh, + chhkHighMin = MathMin( + chhkHighMin, chhkConditions.lBars[cIndex].high // ); - minCHHKHigh = MathMin( - minCHHKHigh, + chhkHighMin = MathMin( + chhkHighMin, chhkConditions.hBars[cIndex].high // ); // // Max Low ... - double maxCHHKLow = MathMax( + double chhkLowMax = MathMax( chhkConditions.cBars[cIndex].low, chhkConditions.sBars[cIndex].low // ); - maxCHHKLow = MathMax( - maxCHHKLow, + chhkLowMax = MathMax( + chhkLowMax, chhkConditions.mBars[cIndex].low // ); - maxCHHKLow = MathMax( - maxCHHKLow, + chhkLowMax = MathMax( + chhkLowMax, chhkConditions.lBars[cIndex].low // ); - maxCHHKLow = MathMax( - maxCHHKLow, + chhkLowMax = MathMax( + chhkLowMax, chhkConditions.hBars[cIndex].low // ); // // Min Low ... - double minCHHKLow = MathMin( + double chhkLowMin = MathMin( chhkConditions.cBars[cIndex].low, chhkConditions.sBars[cIndex].low // ); - minCHHKLow = MathMin( - minCHHKLow, + chhkLowMin = MathMin( + chhkLowMin, chhkConditions.mBars[cIndex].low // ); - minCHHKLow = MathMin( - minCHHKLow, + chhkLowMin = MathMin( + chhkLowMin, chhkConditions.lBars[cIndex].low // ); - minCHHKLow = MathMin( - minCHHKLow, + chhkLowMin = MathMin( + chhkLowMin, chhkConditions.hBars[cIndex].low // ); // double chhkDistanceDiffInPoint = // - (maxCHHKHigh - minCHHKLow) / points + (chhkHighMax - chhkLowMin) / points + // + ; + + // + // XCHSTR ... + // Detect XCHSTR Conditions ... + + // + // Bullish ... + + // + bool isCHSTRHSwitchedToBullish = + // + ( + // + chstrConditions.isHSwitchedToBullish && + chstrConditions.isLBullish && + chstrConditions.isMBullish && + chstrConditions.isSBullish && + chstrConditions.isCBullish + // + ) + // + ; + + // + bool isCHSTRLSwitchedToBullish = + // + ( + // + chstrConditions.isLSwitchedToBullish && + chstrConditions.isHBullish && + chstrConditions.isMBullish && + chstrConditions.isSBullish && + chstrConditions.isCBullish + // + ) + // + ; + + // + bool isCHSTRMSwitchedToBullish = + // + ( + // + chstrConditions.isMSwitchedToBullish && + chstrConditions.isHBullish && + chstrConditions.isLBullish && + chstrConditions.isSBullish && + chstrConditions.isCBullish + // + ) + // + ; + + // + bool isCHSTRSSwitchedToBullish = + // + ( + // + chstrConditions.isSSwitchedToBullish && + chstrConditions.isHBullish && + chstrConditions.isLBullish && + chstrConditions.isMBullish && + chstrConditions.isCBullish + // + ) + // + ; + + // + bool isCHSTRCSwitchedToBullish = + // + ( + // + chstrConditions.isCSwitchedToBullish && + chstrConditions.isHBullish && + chstrConditions.isLBullish && + chstrConditions.isMBullish && + chstrConditions.isSBullish + // + ) + // + ; + + // + // Bullish Conclusion ... + + // + bool isCHSTRCBullish = + // + ( + // + chstrConditions.isCBullish && + chstrConditions.isHBullish && + chstrConditions.isLBullish && + chstrConditions.isMBullish && + chstrConditions.isSBullish + // + ) + // + ; + + // + bool isCHMSTRBullish = + // + isCHSTRHSwitchedToBullish + // + || + // + isCHSTRLSwitchedToBullish + // + || + // + isCHSTRMSwitchedToBullish + // + || + // + isCHSTRSSwitchedToBullish + // + || + // + isCHSTRCSwitchedToBullish + // + ; + + // + // Bearish ... + + // + bool isCHSTRHSwitchedToBearish = + // + ( + // + chstrConditions.isHSwitchedToBearish && + chstrConditions.isLBearish && + chstrConditions.isMBearish && + chstrConditions.isSBearish && + chstrConditions.isCBearish + // + ) + // + ; + + // + bool isCHSTRLSwitchedToBearish = + // + ( + // + chstrConditions.isLSwitchedToBearish && + chstrConditions.isHBearish && + chstrConditions.isMBearish && + chstrConditions.isSBearish && + chstrConditions.isCBearish + // + ) + // + ; + + // + bool isCHSTRMSwitchedToBearish = + // + ( + // + chstrConditions.isMSwitchedToBearish && + chstrConditions.isHBearish && + chstrConditions.isLBearish && + chstrConditions.isSBearish && + chstrConditions.isCBearish + // + ) + // + ; + + // + bool isCHSTRSSwitchedToBearish = + // + ( + // + chstrConditions.isSSwitchedToBearish && + chstrConditions.isHBearish && + chstrConditions.isLBearish && + chstrConditions.isMBearish && + chstrConditions.isCBearish + // + ) + // + ; + + // + bool isCHSTRCSwitchedToBearish = + // + ( + // + chstrConditions.isCSwitchedToBearish && + chstrConditions.isHBearish && + chstrConditions.isLBearish && + chstrConditions.isMBearish && + chstrConditions.isSBearish + // + ) + // + ; + + // + // Bearish Conclusion ... + + // + bool isCHSTRBearish = + // + ( + // + chstrConditions.isCBearish && + chstrConditions.isHBearish && + chstrConditions.isLBearish && + chstrConditions.isMBearish && + chstrConditions.isSBearish + // + ) + // + ; + + // + bool isCHSTRSwitchedToBearish = + // + isCHSTRHSwitchedToBearish + // + || + // + isCHSTRLSwitchedToBearish + // + || + // + isCHSTRMSwitchedToBearish + // + || + // + isCHSTRSSwitchedToBearish + // + || + // + isCHSTRCSwitchedToBearish + // + ; + + // + // Max ... + double chstrMax = MathMax( + chstrConditions.cTrend[cIndex], + chstrConditions.sTrend[cIndex] // + ); + chstrMax = MathMax( + chstrMax, + chstrConditions.mTrend[cIndex] // + ); + chstrMax = MathMax( + chstrMax, + chstrConditions.lTrend[cIndex] // + ); + chstrMax = MathMax( + chstrMax, + chstrConditions.hTrend[cIndex] // + ); + + // + // Min ... + double chstrMin = MathMin( + chstrConditions.cTrend[cIndex], + chstrConditions.sTrend[cIndex] // + ); + chstrMin = MathMin( + chstrMin, + chstrConditions.mTrend[cIndex] // + ); + chstrMin = MathMin( + chstrMin, + chstrConditions.lTrend[cIndex] // + ); + chstrMin = MathMin( + chstrMin, + chstrConditions.hTrend[cIndex] // + ); + + // + double chstrDistanceDiffInPoint = + // + (chstrMax - chstrMin) / points // ; @@ -1057,25 +1293,27 @@ public: // // Preparing Signals for Execution ... + bool allowCHMSignals = false; bool allowCHHKSignals = true; - bool allowCHMASignals = false; + bool allowCHSTRSignals = false; // + // Check Signals based on: // XCHMA ... - if (allowCHMASignals) + if (allowCHMSignals) { // double pressureDistance = 200; // - if (isCHMABullish) + if (isCHMBullish) { // hasLong = // - isCHMABullish && + isCHMBullish && hasBullishPattern && - chmaDistanceDiffInPoint <= pressureDistance + chmDistanceDiffInPoint <= pressureDistance // ; @@ -1084,19 +1322,19 @@ public: { // type = POSITION_TYPE_SELL; - sl = minCHMA; + sl = chmMin; } } // - if (isCHMABearish) + if (isCHMBearish) { // hasShort = // - isCHMABearish && + isCHMBearish && hasBearishPattern && - chmaDistanceDiffInPoint <= pressureDistance + chmDistanceDiffInPoint <= pressureDistance // ; @@ -1105,12 +1343,13 @@ public: { // type = POSITION_TYPE_SELL; - sl = minCHMA; + sl = chmMin; } } } // + // Check Signals based on: // XCHHK ... if (allowCHHKSignals) { @@ -1118,7 +1357,7 @@ public: double pressureDistance = 200; // - if (isCHHKBullish) + if (isCHHKSwitchedBullish) { // hasLong = @@ -1134,12 +1373,12 @@ public: { // type = POSITION_TYPE_BUY; - sl = maxCHHKLow; + sl = chhkLowMax; } } // - if (isCHHKBearish) + if (isCHHKSwitchedToBearish) { // hasShort = @@ -1155,11 +1394,18 @@ public: { // type = POSITION_TYPE_SELL; - sl = minCHHKHigh; + sl = chhkHighMin; } } } + // + // Check Signals based on: + // XCHSTR ... + if (allowCHSTRSignals) + { + } + // // forceCloseLongs = isCHHKBullishBreaked; // forceCloseShorts = isCHHKBearishBreaked; @@ -1274,8 +1520,8 @@ protected: // // XSTR ... - XSTRInputs strInputs; - XSCXSTRHelper *strHelper; + XCHSTRInputs chstrInputs; + XSCXCHSTRHelper *chstrHelper; // // XCHE ... @@ -1289,8 +1535,8 @@ protected: // // XCHMA ... - XCHMAInputs chmaInputs; - XSCXCHMAHelper *chmaHelper; + XCHMInputs chmInputs; + XSCXCHMHelper *chmHelper; // // Private ... @@ -1311,69 +1557,30 @@ private: resistanceTime = NULL; isResistanceTested = false; - // - // XCHMA ... - - // - chmaInputs.Default(); - - // - chmaInputs.showFast = true; - chmaInputs.showSlow = true; - chmaInputs.showCCFast = false; - chmaInputs.showCCSlow = false; - chmaInputs.showSCFast = false; - chmaInputs.showSCSlow = false; - chmaInputs.showMCFast = false; - chmaInputs.showMCSlow = false; - chmaInputs.showLCFast = false; - chmaInputs.showLCSlow = false; - chmaInputs.showHCFast = false; - chmaInputs.showHCSlow = false; - - // - chmaHelper = new XSCXCHMAHelper(); - chmaHelper.Init( - mSymbol, - mPeriod, - chmaInputs // - ); - - // - // XCHHK ... - - // - chhkInputs.Default(); - - // - chhkInputs.showCurrent = true; - chhkInputs.showShort = true; - chhkInputs.showMedium = true; - chhkInputs.showLong = true; - chhkInputs.showHind = true; - - // - chhkHelper = new XSCXCHHKHelper(); - chhkHelper.Init( - mSymbol, - mPeriod, - chhkInputs // - ); - // // XPV ... // pvInputs.Default(); + // + pvInputs.scMethod = X_PERIOD_MANUALLY; + pvInputs.scPeriod = PERIOD_M10; + pvInputs.mcMethod = X_PERIOD_MANUALLY; + pvInputs.mcPeriod = PERIOD_M15; + pvInputs.lcMethod = X_PERIOD_MANUALLY; + pvInputs.lcPeriod = PERIOD_M20; + pvInputs.hcMethod = X_PERIOD_MANUALLY; + pvInputs.hcPeriod = PERIOD_M30; + // pvInputs.showPeaksAndVales = true; pvInputs.showLevels = false; pvInputs.showConsolidations = false; pvInputs.showFibo1Levels = false; - pvInputs.showFibo2Levels = false; - pvInputs.showFibo3Levels = false; - pvInputs.showFibo4Levels = false; + pvInputs.showFibo2Levels = true; + pvInputs.showFibo3Levels = true; + pvInputs.showFibo4Levels = true; pvInputs.showFibo5Levels = false; // @@ -1384,24 +1591,6 @@ private: pvInputs // ); - // - // XSTR ... - - // - strInputs.Default(); - - // - strInputs.showTrends = true; - strInputs.fillTrends = false; - - // - strHelper = new XSCXSTRHelper(); - strHelper.Init( - mSymbol, - mPeriod, - strInputs // - ); - // // XCHE ... @@ -1409,10 +1598,10 @@ private: cheInputs.Default(); // - cheInputs.showLongExit1Line = true; - cheInputs.showShortExit1Line = true; - cheInputs.showLongExit2Line = true; - cheInputs.showShortExit2Line = true; + cheInputs.showLongExit1Line = false; + cheInputs.showShortExit1Line = false; + cheInputs.showLongExit2Line = false; + cheInputs.showShortExit2Line = false; // cheHelper = new XSCXCHEHelper(); @@ -1421,6 +1610,106 @@ private: mPeriod, cheInputs // ); + + // + // XCHM ... + + // + chmInputs.Default(); + + // + chmInputs.scMethod = X_PERIOD_MANUALLY; + chmInputs.scPeriod = PERIOD_M10; + chmInputs.mcMethod = X_PERIOD_MANUALLY; + chmInputs.mcPeriod = PERIOD_M15; + chmInputs.lcMethod = X_PERIOD_MANUALLY; + chmInputs.lcPeriod = PERIOD_M20; + chmInputs.hcMethod = X_PERIOD_MANUALLY; + chmInputs.hcPeriod = PERIOD_M30; + + // + chmInputs.showFast = true; + chmInputs.showSlow = true; + chmInputs.showCCFast = false; + chmInputs.showCCSlow = false; + chmInputs.showSCFast = false; + chmInputs.showSCSlow = false; + chmInputs.showMCFast = false; + chmInputs.showMCSlow = false; + chmInputs.showLCFast = false; + chmInputs.showLCSlow = false; + chmInputs.showHCFast = false; + chmInputs.showHCSlow = false; + + // + chmHelper = new XSCXCHMHelper(); + chmHelper.Init( + mSymbol, + mPeriod, + chmInputs // + ); + + // + // XCHHK ... + + // + chhkInputs.Default(); + + // + chhkInputs.scMethod = X_PERIOD_MANUALLY; + chhkInputs.scPeriod = PERIOD_M10; + chhkInputs.mcMethod = X_PERIOD_MANUALLY; + chhkInputs.mcPeriod = PERIOD_M15; + chhkInputs.lcMethod = X_PERIOD_MANUALLY; + chhkInputs.lcPeriod = PERIOD_M20; + chhkInputs.hcMethod = X_PERIOD_MANUALLY; + chhkInputs.hcPeriod = PERIOD_M30; + + // + chhkInputs.showCurrent = false; + chhkInputs.showShort = false; + chhkInputs.showMedium = false; + chhkInputs.showLong = false; + chhkInputs.showHind = false; + + // + chhkHelper = new XSCXCHHKHelper(); + chhkHelper.Init( + mSymbol, + mPeriod, + chhkInputs // + ); + + // + // XCHSTR ... + + // + chstrInputs.Default(); + + // + chstrInputs.scMethod = X_PERIOD_MANUALLY; + chstrInputs.scPeriod = PERIOD_M10; + chstrInputs.mcMethod = X_PERIOD_MANUALLY; + chstrInputs.mcPeriod = PERIOD_M15; + chstrInputs.lcMethod = X_PERIOD_MANUALLY; + chstrInputs.lcPeriod = PERIOD_M20; + chstrInputs.hcMethod = X_PERIOD_MANUALLY; + chstrInputs.hcPeriod = PERIOD_M30; + + // + chstrInputs.showCurrent = true; + chstrInputs.showShort = true; + chstrInputs.showMedium = true; + chstrInputs.showLong = true; + chstrInputs.showHind = true; + + // + chstrHelper = new XSCXCHSTRHelper(); + chstrHelper.Init( + mSymbol, + mPeriod, + chstrInputs // + ); } //