From 31a0e0f9a8ce67e64584d1a123e9631575bfe5e0 Mon Sep 17 00:00:00 2001 From: Hadi Khazaee Asl Date: Fri, 31 May 2024 22:17:36 +0330 Subject: [PATCH] last ... --- .../BKPS/X121.Long.Conditions.mq5 | 356 ++++++++++++++++++ .../BKPS/X121.Short.Conditions.mq5 | 356 ++++++++++++++++++ 2 files changed, 712 insertions(+) create mode 100644 MQLTestWorkspace/BKPS/X121.Long.Conditions.mq5 create mode 100644 MQLTestWorkspace/BKPS/X121.Short.Conditions.mq5 diff --git a/MQLTestWorkspace/BKPS/X121.Long.Conditions.mq5 b/MQLTestWorkspace/BKPS/X121.Long.Conditions.mq5 new file mode 100644 index 0000000..5789e45 --- /dev/null +++ b/MQLTestWorkspace/BKPS/X121.Long.Conditions.mq5 @@ -0,0 +1,356 @@ +// +// X121 Long ... + + // + int zIndex = 0; + int cIndex = zIndex + 1; + int pIndex = cIndex + 1; + + // + XOHCL cBar = GetBar(cIndex); + XOHCL pBar = GetBar(pIndex); + + // + // XSTR ... + + // + ENUM_XSTR_TREND_STATES cStrState = str + .GetState(cIndex); + double cStrTrend = str.GetTrend(cIndex); + bool isCStrBullish = cStrState == X_STR_BULLISH; + bool isCStrBearish = cStrState == X_STR_BEARISH; + + // + ENUM_XSTR_TREND_STATES pStrState = str + .GetState(pIndex); + double pStrTrend = str.GetTrend(pIndex); + bool isPStrBullish = pStrState == X_STR_BULLISH; + bool isPStrBearish = pStrState == X_STR_BEARISH; + + // + bool isTrendBullish = isCStrBullish; + bool isTrendBearish = isCStrBearish; + + // + bool isTrendSwitchedToBullish = + // + isCStrBullish && + !isPStrBullish + // + ; + + // + bool isTrendSwitchedToBearish = + // + isCStrBearish && + !isPStrBearish + // + ; + + // + // XCHE ... + + // + double cCHELongExit1 = che.GetLongExit1(cIndex); + double cCHELongExit2 = che.GetLongExit2(cIndex); + + // + double pCHELongExit1 = che.GetLongExit1(pIndex); + double pCHELongExit2 = che.GetLongExit2(pIndex); + + // + double cCHEShortExit1 = che.GetShortExit1(cIndex); + double cCHEShortExit2 = che.GetShortExit2(cIndex); + + // + double pCHEShortExit1 = che.GetShortExit1(pIndex); + double pCHEShortExit2 = che.GetShortExit2(pIndex); + + // + bool CCHEHasLongExit1 = NotEmpty(cCHELongExit1); + bool CCHEHasLongExit2 = NotEmpty(cCHELongExit2); + + // + bool CCHEHasShortExit1 = NotEmpty(cCHEShortExit1); + bool CCHEHasShortExit2 = NotEmpty(cCHEShortExit2); + + // + bool PCHEHasLongExit1 = NotEmpty(pCHELongExit1); + bool PCHEHasLongExit2 = NotEmpty(pCHELongExit2); + + // + bool PCHEHasShortExit1 = NotEmpty(pCHEShortExit1); + bool PCHEHasShortExit2 = NotEmpty(pCHEShortExit2); + + // + bool isCCHEBullish = + // + CCHEHasLongExit1 && + CCHEHasLongExit2 + // + ; + + // + bool isCCHEBearish = + // + CCHEHasShortExit1 && + CCHEHasShortExit2 + // + ; + + // + bool isPCHEBullish = + // + PCHEHasLongExit1 && + PCHEHasLongExit2 + // + ; + + // + bool isPCHEBearish = + // + PCHEHasShortExit1 && + PCHEHasShortExit2 + // + ; + + // + bool isCHEBullish = isCCHEBullish; + bool isCHEBearish = isCCHEBearish; + bool isCHESwitchedToBullish = + // + isCCHEBullish && + !isPCHEBullish + // + ; + bool isCHESwitchedToBearish = + // + isCCHEBearish && + !isPCHEBearish + // + ; + + // + // XMC ... + + // + double cMCFast = mc.GetFast(cIndex); + double pMCFast = mc.GetFast(pIndex); + + // + double cMCSlow = mc.GetSlow(cIndex); + double pMCSlow = mc.GetSlow(pIndex); + + // + double cMCVerifier = mc.GetVerifier(cIndex); + double pMCVerifier = mc.GetVerifier(pIndex); + + // + bool isCMCFastOverSlow = cMCFast > cMCSlow; + bool isPMCFastOverSlow = pMCFast > pMCSlow; + + // + bool isCMCFastUnderSlow = cMCFast < cMCSlow; + bool isPMCFastUnderSlow = pMCFast < pMCSlow; + + // + bool isCMCFastOverVerifier = cMCFast > cMCVerifier; + bool isPMCFastOverVerifier = pMCFast > pMCVerifier; + + // + bool isCMCFastUnderVerifier = cMCFast < cMCVerifier; + bool isPMCFastUnderVerifier = pMCFast < pMCVerifier; + + // + bool isCMCSlowOverVerifier = cMCSlow > cMCVerifier; + bool isPMCSlowOverVerifier = pMCSlow > pMCVerifier; + + // + bool isCMCSlowUnderVerifier = cMCSlow < cMCVerifier; + bool isPMCSlowUnderVerifier = pMCSlow < pMCVerifier; + + // + bool isMCFastOverSlow = isCMCFastOverSlow; + bool isMCFastUnderSlow = isCMCFastUnderSlow; + bool isMCFastOverVerifier = isCMCFastOverVerifier; + bool isMCFastUnderVerifier = isCMCFastUnderVerifier; + bool isMCSlowOverVerifier = isCMCSlowOverVerifier; + bool isMCSlowUnderVerifier = isCMCSlowUnderVerifier; + + // + bool isMCFastCrossedOverSlow = + // + isCMCFastOverSlow && + !isPMCFastOverSlow + // + ; + bool isMCFastCrossedUnderSlow = + // + isCMCFastUnderSlow && + !isPMCFastUnderSlow + // + ; + + // + bool isMCFastCrossedOverVerifier = + // + isCMCFastOverVerifier && + !isPMCFastOverVerifier + // + ; + bool isMCFastCrossedUnderVerifier = + // + isCMCFastUnderVerifier && + !isPMCFastUnderVerifier + // + ; + + // + bool isMCSlowCrossedOverVerifier = + // + isCMCSlowOverVerifier && + !isPMCSlowOverVerifier + // + ; + bool isMCSlowCrossedUnderVerifier = + // + isCMCSlowUnderVerifier && + !isPMCSlowUnderVerifier + // + ; + + // + // XMRB ... + + // + double cMRBFast = mrb.GetFast(cIndex); + double pMRBFast = mrb.GetFast(pIndex); + + // + double cMRBSlow = mrb.GetSlow(cIndex); + double pMRBSlow = mrb.GetSlow(pIndex); + + // + bool isCMRBFastOverSlow = cMRBFast > cMRBSlow; + bool isPMRBFastOverSlow = pMRBFast > pMRBSlow; + + // + bool isCMRBFastUnderSlow = cMRBFast < cMRBSlow; + bool isPMRBFastUnderSlow = pMRBFast < pMRBSlow; + + // + bool isMRBFastOverSlow = isCMRBFastOverSlow; + bool isMRBFastUnderSlow = isCMRBFastUnderSlow; + + // + bool isMRBFastCrossedOverSlow = + // + isCMRBFastOverSlow && + !isPMRBFastOverSlow + // + ; + bool isMRBFastCrossedUnderSlow = + // + isCMRBFastUnderSlow && + !isPMRBFastUnderSlow + // + ; + + // + // Combine MRB and MC ... + + // + bool isCMRBFastOverVerifier = cMRBFast > cMCVerifier; + bool isPMRBFastOverVerifier = pMRBFast > pMCVerifier; + + // + bool isCMRBFastUnderVerifier = cMRBFast < cMCVerifier; + bool isPMRBFastUnderVerifier = pMRBFast < pMCVerifier; + + // + bool isCMRBSlowOverVerifier = cMRBSlow > cMCVerifier; + bool isPMRBSlowOverVerifier = pMRBSlow > pMCVerifier; + + // + bool isCMRBSlowUnderVerifier = cMRBSlow < cMCVerifier; + bool isPMRBSlowUnderVerifier = pMRBSlow < pMCVerifier; + + // + bool isMRBFastOverVerifier = isCMRBFastOverVerifier; + bool isMRBFastUnderVerifier = isCMRBFastUnderVerifier; + + // + bool isMRBFastCrossedtOverVerifier = + // + isCMRBFastOverVerifier && + !isPMRBFastOverVerifier + // + ; + + // + bool isMRBFastCrossedUnderVerifier = + // + isCMRBFastUnderVerifier && + !isPMRBFastUnderVerifier + // + ; + + // + bool isMRBSlowOverVerifier = isCMRBSlowOverVerifier; + bool isMRBSlowUnderVerifier = isCMRBSlowUnderVerifier; + + // + bool isMRBSlowCrossedtOverVerifier = + // + isCMRBSlowOverVerifier && + !isPMRBSlowOverVerifier + // + ; + + // + bool isMRBSlowCrossedUnderVerifier = + // + isCMRBSlowUnderVerifier && + !isPMRBSlowUnderVerifier + // + ; + + // + result = + // + (isMRBFastCrossedOverSlow && + (isCHEBullish && + isTrendBullish && + isMCFastOverSlow)) + // + || + // + (isMRBSlowCrossedtOverVerifier && + (isCHEBullish && + isTrendBullish && + isMCFastOverSlow && + isMRBFastOverSlow)) + // + || + // + (isCHESwitchedToBullish && + (isTrendBullish && + isMCFastOverSlow && + isMRBFastOverSlow)) + // + || + // + (isTrendSwitchedToBullish && + (isCHEBullish && + isMCFastOverSlow && + isMRBFastOverSlow)) + // + || + // + (isMCFastCrossedOverSlow && + (isCHEBullish && + isTrendBullish && + isMRBFastOverSlow && + isMCSlowOverVerifier)) + // + ; diff --git a/MQLTestWorkspace/BKPS/X121.Short.Conditions.mq5 b/MQLTestWorkspace/BKPS/X121.Short.Conditions.mq5 new file mode 100644 index 0000000..475d439 --- /dev/null +++ b/MQLTestWorkspace/BKPS/X121.Short.Conditions.mq5 @@ -0,0 +1,356 @@ +// +// X121 Short ... + + // + int zIndex = 0; + int cIndex = zIndex + 1; + int pIndex = cIndex + 1; + + // + XOHCL cBar = GetBar(cIndex); + XOHCL pBar = GetBar(pIndex); + + // + // XSTR ... + + // + ENUM_XSTR_TREND_STATES cStrState = str + .GetState(cIndex); + double cStrTrend = str.GetTrend(cIndex); + bool isCStrBullish = cStrState == X_STR_BULLISH; + bool isCStrBearish = cStrState == X_STR_BEARISH; + + // + ENUM_XSTR_TREND_STATES pStrState = str + .GetState(pIndex); + double pStrTrend = str.GetTrend(pIndex); + bool isPStrBullish = pStrState == X_STR_BULLISH; + bool isPStrBearish = pStrState == X_STR_BEARISH; + + // + bool isTrendBullish = isCStrBullish; + bool isTrendBearish = isCStrBearish; + + // + bool isTrendSwitchedToBullish = + // + isCStrBullish && + !isPStrBullish + // + ; + + // + bool isTrendSwitchedToBearish = + // + isCStrBearish && + !isPStrBearish + // + ; + + // + // XCHE ... + + // + double cCHELongExit1 = che.GetLongExit1(cIndex); + double cCHELongExit2 = che.GetLongExit2(cIndex); + + // + double pCHELongExit1 = che.GetLongExit1(pIndex); + double pCHELongExit2 = che.GetLongExit2(pIndex); + + // + double cCHEShortExit1 = che.GetShortExit1(cIndex); + double cCHEShortExit2 = che.GetShortExit2(cIndex); + + // + double pCHEShortExit1 = che.GetShortExit1(pIndex); + double pCHEShortExit2 = che.GetShortExit2(pIndex); + + // + bool CCHEHasLongExit1 = NotEmpty(cCHELongExit1); + bool CCHEHasLongExit2 = NotEmpty(cCHELongExit2); + + // + bool CCHEHasShortExit1 = NotEmpty(cCHEShortExit1); + bool CCHEHasShortExit2 = NotEmpty(cCHEShortExit2); + + // + bool PCHEHasLongExit1 = NotEmpty(pCHELongExit1); + bool PCHEHasLongExit2 = NotEmpty(pCHELongExit2); + + // + bool PCHEHasShortExit1 = NotEmpty(pCHEShortExit1); + bool PCHEHasShortExit2 = NotEmpty(pCHEShortExit2); + + // + bool isCCHEBullish = + // + CCHEHasLongExit1 && + CCHEHasLongExit2 + // + ; + + // + bool isCCHEBearish = + // + CCHEHasShortExit1 && + CCHEHasShortExit2 + // + ; + + // + bool isPCHEBullish = + // + PCHEHasLongExit1 && + PCHEHasLongExit2 + // + ; + + // + bool isPCHEBearish = + // + PCHEHasShortExit1 && + PCHEHasShortExit2 + // + ; + + // + bool isCHEBullish = isCCHEBullish; + bool isCHEBearish = isCCHEBearish; + bool isCHESwitchedToBullish = + // + isCCHEBullish && + !isPCHEBullish + // + ; + bool isCHESwitchedToBearish = + // + isCCHEBearish && + !isPCHEBearish + // + ; + + // + // XMC ... + + // + double cMCFast = mc.GetFast(cIndex); + double pMCFast = mc.GetFast(pIndex); + + // + double cMCSlow = mc.GetSlow(cIndex); + double pMCSlow = mc.GetSlow(pIndex); + + // + double cMCVerifier = mc.GetVerifier(cIndex); + double pMCVerifier = mc.GetVerifier(pIndex); + + // + bool isCMCFastOverSlow = cMCFast > cMCSlow; + bool isPMCFastOverSlow = pMCFast > pMCSlow; + + // + bool isCMCFastUnderSlow = cMCFast < cMCSlow; + bool isPMCFastUnderSlow = pMCFast < pMCSlow; + + // + bool isCMCFastOverVerifier = cMCFast > cMCVerifier; + bool isPMCFastOverVerifier = pMCFast > pMCVerifier; + + // + bool isCMCFastUnderVerifier = cMCFast < cMCVerifier; + bool isPMCFastUnderVerifier = pMCFast < pMCVerifier; + + // + bool isCMCSlowOverVerifier = cMCSlow > cMCVerifier; + bool isPMCSlowOverVerifier = pMCSlow > pMCVerifier; + + // + bool isCMCSlowUnderVerifier = cMCSlow < cMCVerifier; + bool isPMCSlowUnderVerifier = pMCSlow < pMCVerifier; + + // + bool isMCFastOverSlow = isCMCFastOverSlow; + bool isMCFastUnderSlow = isCMCFastUnderSlow; + bool isMCFastOverVerifier = isCMCFastOverVerifier; + bool isMCFastUnderVerifier = isCMCFastUnderVerifier; + bool isMCSlowOverVerifier = isCMCSlowOverVerifier; + bool isMCSlowUnderVerifier = isCMCSlowUnderVerifier; + + // + bool isMCFastCrossedOverSlow = + // + isCMCFastOverSlow && + !isPMCFastOverSlow + // + ; + bool isMCFastCrossedUnderSlow = + // + isCMCFastUnderSlow && + !isPMCFastUnderSlow + // + ; + + // + bool isMCFastCrossedOverVerifier = + // + isCMCFastOverVerifier && + !isPMCFastOverVerifier + // + ; + bool isMCFastCrossedUnderVerifier = + // + isCMCFastUnderVerifier && + !isPMCFastUnderVerifier + // + ; + + // + bool isMCSlowCrossedOverVerifier = + // + isCMCSlowOverVerifier && + !isPMCSlowOverVerifier + // + ; + bool isMCSlowCrossedUnderVerifier = + // + isCMCSlowUnderVerifier && + !isPMCSlowUnderVerifier + // + ; + + // + // XMRB ... + + // + double cMRBFast = mrb.GetFast(cIndex); + double pMRBFast = mrb.GetFast(pIndex); + + // + double cMRBSlow = mrb.GetSlow(cIndex); + double pMRBSlow = mrb.GetSlow(pIndex); + + // + bool isCMRBFastOverSlow = cMRBFast > cMRBSlow; + bool isPMRBFastOverSlow = pMRBFast > pMRBSlow; + + // + bool isCMRBFastUnderSlow = cMRBFast < cMRBSlow; + bool isPMRBFastUnderSlow = pMRBFast < pMRBSlow; + + // + bool isMRBFastOverSlow = isCMRBFastOverSlow; + bool isMRBFastUnderSlow = isCMRBFastUnderSlow; + + // + bool isMRBFastCrossedOverSlow = + // + isCMRBFastOverSlow && + !isPMRBFastOverSlow + // + ; + bool isMRBFastCrossedUnderSlow = + // + isCMRBFastUnderSlow && + !isPMRBFastUnderSlow + // + ; + + // + // Combine MRB and MC ... + + // + bool isCMRBFastOverVerifier = cMRBFast > cMCVerifier; + bool isPMRBFastOverVerifier = pMRBFast > pMCVerifier; + + // + bool isCMRBFastUnderVerifier = cMRBFast < cMCVerifier; + bool isPMRBFastUnderVerifier = pMRBFast < pMCVerifier; + + // + bool isCMRBSlowOverVerifier = cMRBSlow > cMCVerifier; + bool isPMRBSlowOverVerifier = pMRBSlow > pMCVerifier; + + // + bool isCMRBSlowUnderVerifier = cMRBSlow < cMCVerifier; + bool isPMRBSlowUnderVerifier = pMRBSlow < pMCVerifier; + + // + bool isMRBFastOverVerifier = isCMRBFastOverVerifier; + bool isMRBFastUnderVerifier = isCMRBFastUnderVerifier; + + // + bool isMRBFastCrossedtOverVerifier = + // + isCMRBFastOverVerifier && + !isPMRBFastOverVerifier + // + ; + + // + bool isMRBFastCrossedUnderVerifier = + // + isCMRBFastUnderVerifier && + !isPMRBFastUnderVerifier + // + ; + + // + bool isMRBSlowOverVerifier = isCMRBSlowOverVerifier; + bool isMRBSlowUnderVerifier = isCMRBSlowUnderVerifier; + + // + bool isMRBSlowCrossedtOverVerifier = + // + isCMRBSlowOverVerifier && + !isPMRBSlowOverVerifier + // + ; + + // + bool isMRBSlowCrossedUnderVerifier = + // + isCMRBSlowUnderVerifier && + !isPMRBSlowUnderVerifier + // + ; + + // + result = + // + (isMRBFastCrossedUnderSlow && + (isCHEBearish && + isTrendBearish && + isMCFastUnderSlow)) + // + || + // + (isMRBSlowCrossedUnderVerifier && + (isCHEBearish && + isTrendBearish && + isMCFastUnderSlow && + isMRBFastUnderSlow)) + // + || + // + (isCHESwitchedToBearish && + (isTrendBearish && + isMCFastUnderSlow && + isMRBFastUnderSlow)) + // + || + // + (isTrendSwitchedToBearish && + (isCHEBearish && + isMCFastUnderSlow && + isMRBFastUnderSlow)) + // + || + // + (isMCFastCrossedUnderSlow && + (isCHEBearish && + isTrendBearish && + isMRBFastUnderSlow && + isMCSlowUnderVerifier)) + // + ;