Files
xMQL5/MQLTestWorkspace/BKPS/X121.Long.Conditions.mq5
2024-05-31 22:17:36 +03:30

357 lines
9.0 KiB
Plaintext

//
// 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))
//
;