From dc50f29932b16b24e382cfbdbda21ad8004bcccf Mon Sep 17 00:00:00 2001 From: Hadi Khazaee Asl Date: Sun, 8 Jun 2025 18:26:13 +0330 Subject: [PATCH] last works ... --- Documents/BKP/tmp.codes.mq5 | 352 ++++++++++++++ Indicators/x-saherelm.x121.xma.mq5 | 728 +++++++++++++++-------------- 2 files changed, 740 insertions(+), 340 deletions(-) create mode 100644 Documents/BKP/tmp.codes.mq5 diff --git a/Documents/BKP/tmp.codes.mq5 b/Documents/BKP/tmp.codes.mq5 new file mode 100644 index 00000000..a343086d --- /dev/null +++ b/Documents/BKP/tmp.codes.mq5 @@ -0,0 +1,352 @@ + // + int minRequiredRange = 20; + if (barIndex > maxBarIndex - minRequiredRange - 4) + { + return; + } + + // + double iP2SCLL = sLLBuffer[barIndex + 2]; + double iP2SCHH = sHHBuffer[barIndex + 2]; + + // + double iP3SCLL = sLLBuffer[barIndex + 3]; + double iP3SCHH = sHHBuffer[barIndex + 3]; + + // + double iP4SCLL = sLLBuffer[barIndex + 4]; + double iP4SCHH = sHHBuffer[barIndex + 4]; + + // + double iP2MCLL = mLLBuffer[barIndex + 2]; + double iP2MCHH = mHHBuffer[barIndex + 2]; + + // + double iP3MCLL = mLLBuffer[barIndex + 3]; + double iP3MCHH = mHHBuffer[barIndex + 3]; + + // + double iP4MCLL = mLLBuffer[barIndex + 4]; + double iP4MCHH = mHHBuffer[barIndex + 4]; + + // + double iP2LCLL = lLLBuffer[barIndex + 2]; + double iP2LCHH = lHHBuffer[barIndex + 2]; + + // + double iP3LCLL = lLLBuffer[barIndex + 3]; + double iP3LCHH = lHHBuffer[barIndex + 3]; + + // + double iP4LCLL = lLLBuffer[barIndex + 4]; + double iP4LCHH = lHHBuffer[barIndex + 4]; + + // + double iP2HCLL = hLLBuffer[barIndex + 2]; + double iP2HCHH = hHHBuffer[barIndex + 2]; + + // + double iP3HCLL = hLLBuffer[barIndex + 3]; + double iP3HCHH = hHHBuffer[barIndex + 3]; + + // + double iP4HCLL = hLLBuffer[barIndex + 4]; + double iP4HCHH = hHHBuffer[barIndex + 4]; + + // + // Cycle States ... + + // + // Create Conditions ... + + // + bool isSCMaOverMCMa = iSCMa > iMCMa; + bool isPSCMaOverMCMa = iPSCMa > iPMCMa; + + // + bool isSCMaUnderMCMa = iSCMa < iMCMa; + bool isPSCMaUnderMCMa = iPSCMa < iPMCMa; + + // + bool isSCMaCrossedOverMCMa = + isSCMaOverMCMa && + !isPSCMaOverMCMa; + + // + bool isSCMaCrossedUnderMCMa = + isSCMaUnderMCMa && + !isPSCMaUnderMCMa; + + // + bool isLCMaOverHCMa = iLCMa > iHCMa; + bool isPLCMaOverHCMa = iPLCMa > iPHCMa; + + // + bool isLCMaUnderHCMa = iLCMa < iHCMa; + bool isPLCMaUnderHCMa = iPLCMa < iPHCMa; + + // + bool isLCMaCrossedOverHCMa = + isLCMaOverHCMa && + !isPLCMaOverHCMa; + + // + bool isLCMaCrossedUnderHCMa = + isLCMaUnderHCMa && + !isPLCMaUnderHCMa; + + // + // SC State ... + + // + bool isSCMaBullish = + iSCMaState == bullishState; + bool isPSCMaBullish = + iPSCMaState == bullishState; + + // + bool isSCMaBearish = + iSCMaState == bearishState; + bool isPSCMaBearish = + iPSCMaState == bearishState; + + // + bool isSCMaSwitchedToBullish = + isSCMaBullish && + !isPSCMaBullish; + + // + bool isSCMaSwitchedToBearish = + isSCMaBearish && + !isPSCMaBearish; + + // + bool isSCLLOverMCLL = + iSCLL > iMCLL; + bool isPSCLLOverMCLL = + iPSCLL > iPMCLL; + bool isP2SCLLOverMCLL = + iP2SCLL > iP2MCLL; + bool isP3SCLLOverMCLL = + iP3SCLL > iP3MCLL; + bool isP4SCLLOverMCLL = + iP4SCLL > iP4MCLL; + + // + bool isSCHHUnderMCHH = + iSCHH < iMCHH; + bool isPSCHHUnderMCHH = + iPSCHH < iPMCHH; + bool isP2SCHHUnderMCHH = + iP2SCHH < iP2MCHH; + bool isP3SCHHUnderMCHH = + iP3SCHH < iP3MCHH; + bool isP4SCHHUnderMCHH = + iP4SCHH < iP4MCHH; + + // + bool isSCLLCrossedOverMCLL = + isSCLLOverMCLL && + !isPSCLLOverMCLL; + bool isPSCLLCrossedOverMCLL = + isPSCLLOverMCLL && + !isP2SCLLOverMCLL; + bool isP2SCLLCrossedOverMCLL = + isP2SCLLOverMCLL && + !isP3SCLLOverMCLL; + bool isP3SCLLCrossedOverMCLL = + isP3SCLLOverMCLL && + !isP4SCLLOverMCLL; + + // + bool isSCHHCrossedUnderMCHH = + isSCHHUnderMCHH && + !isPSCHHUnderMCHH; + bool isPSCHHCrossedUnderMCHH = + isPSCHHUnderMCHH && + !isP2SCHHUnderMCHH; + bool isP2SCHHCrossedUnderMCHH = + isP2SCHHUnderMCHH && + !isP3SCHHUnderMCHH; + bool isP3SCHHCrossedUnderMCHH = + isP3SCHHUnderMCHH && + !isP4SCHHUnderMCHH; + + // + // MC State ... + + // + bool isMCMaBullish = + iMCMaState == bullishState; + bool isPMCMaBullish = + iPMCMaState == bullishState; + + // + bool isMCMaBearish = + iMCMaState == bearishState; + bool isPMCMaBearish = + iPMCMaState == bearishState; + + // + bool isMCMaSwitchedToBullish = + isMCMaBullish && + !isPMCMaBullish; + + // + bool isMCMaSwitchedToBearish = + isMCMaBearish && + !isPMCMaBearish; + + // + bool isMCLLOverLCLL = + iMCLL > iLCLL; + bool isPMCLLOverLCLL = + iPMCLL > iPLCLL; + bool isP2MCLLOverLCLL = + iP2MCLL > iP2LCLL; + bool isP3MCLLOverLCLL = + iP3MCLL > iP3LCLL; + bool isP4MCLLOverLCLL = + iP4MCLL > iP4LCLL; + + // + bool isMCHHUnderLCHH = + iMCHH < iLCHH; + bool isPMCHHUnderLCHH = + iPMCHH < iPLCHH; + bool isP2MCHHUnderLCHH = + iP2MCHH < iP2LCHH; + bool isP3MCHHUnderLCHH = + iP3MCHH < iP3LCHH; + bool isP4MCHHUnderLCHH = + iP4MCHH < iP4LCHH; + + // + bool isMCLLCrossedOverLCLL = + isMCLLOverLCLL && + !isPMCLLOverLCLL; + bool isPMCLLCrossedOverLCLL = + isPMCLLOverLCLL && + !isP2MCLLOverLCLL; + bool isP2MCLLCrossedOverLCLL = + isP2MCLLOverLCLL && + !isP3MCLLOverLCLL; + bool isP3MCLLCrossedOverLCLL = + isP3MCLLOverLCLL && + !isP4MCLLOverLCLL; + + // + bool isMCHHCrossedUnderLCHH = + isMCHHUnderLCHH && + !isPMCHHUnderLCHH; + bool isPMCHHCrossedUnderLCHH = + isPMCHHUnderLCHH && + !isP2MCHHUnderLCHH; + bool isP2MCHHCrossedUnderLCHH = + isP2MCHHUnderLCHH && + !isP3MCHHUnderLCHH; + bool isP3MCHHCrossedUnderLCHH = + isP3MCHHUnderLCHH && + !isP4MCHHUnderLCHH; + + // + // LC State ... + + // + bool isLCMaBullish = + iLCMaState == bullishState; + bool isPLCMaBullish = + iPLCMaState == bullishState; + + // + bool isLCMaBearish = + iLCMaState == bearishState; + bool isPLCMaBearish = + iPLCMaState == bearishState; + + // + bool isLCMaSwitchedToBullish = + isLCMaBullish && + !isPLCMaBullish; + + // + bool isLCMaSwitchedToBearish = + isLCMaBearish && + !isPLCMaBearish; + + // + bool isLCLLOverHCLL = + iLCLL > iHCLL; + bool isPLCLLOverHCLL = + iPLCLL > iPHCLL; + bool isP2LCLLOverHCLL = + iP2LCLL > iP2HCLL; + bool isP3LCLLOverHCLL = + iP3LCLL > iP3HCLL; + bool isP4LCLLOverHCLL = + iP4LCLL > iP4HCLL; + + // + bool isLCHHUnderHCHH = + iLCHH < iHCHH; + bool isPLCHHUnderHCHH = + iPLCHH < iPHCHH; + bool isP2LCHHUnderHCHH = + iP2LCHH < iP2HCHH; + bool isP3LCHHUnderHCHH = + iP3LCHH < iP3HCHH; + bool isP4LCHHUnderHCHH = + iP4LCHH < iP4HCHH; + + // + bool isLCLLCrossedOverHCLL = + isLCLLOverHCLL && + !isPLCLLOverHCLL; + bool isPLCLLCrossedOverHCLL = + isPLCLLOverHCLL && + !isP2LCLLOverHCLL; + bool isP2LCLLCrossedOverHCLL = + isP2LCLLOverHCLL && + !isP3LCLLOverHCLL; + bool isP3LCLLCrossedOverHCLL = + isP3LCLLOverHCLL && + !isP4LCLLOverHCLL; + + // + bool isLCHHCrossedUnderHCHH = + isLCHHUnderHCHH && + !isPLCHHUnderHCHH; + bool isPLCHHCrossedUnderHCHH = + isPLCHHUnderHCHH && + !isP2LCHHUnderHCHH; + bool isP2LCHHCrossedUnderHCHH = + isP2LCHHUnderHCHH && + !isP3LCHHUnderHCHH; + bool isP3LCHHCrossedUnderHCHH = + isP3LCHHUnderHCHH && + !isP4LCHHUnderHCHH; + + // + // HC State ... + + // + bool isHCMaBullish = + iHCMaState == bullishState; + bool isPHCMaBullish = + iPHCMaState == bullishState; + + // + bool isHCMaBearish = + iHCMaState == bearishState; + bool isPHCMaBearish = + iPHCMaState == bearishState; + + // + bool isHCMaSwitchedToBullish = + isHCMaBullish && + !isPHCMaBullish; + + // + bool isHCMaSwitchedToBearish = + isHCMaBearish && + !isPHCMaBearish; diff --git a/Indicators/x-saherelm.x121.xma.mq5 b/Indicators/x-saherelm.x121.xma.mq5 index 5a5d8620..b003e335 100644 --- a/Indicators/x-saherelm.x121.xma.mq5 +++ b/Indicators/x-saherelm.x121.xma.mq5 @@ -1591,7 +1591,7 @@ void DoProcess( // int minRequiredRange = 20; - if (barIndex > maxBarIndex + minRequiredRange + 4) + if (barIndex > maxBarIndex - 1) { return; } @@ -1615,6 +1615,9 @@ void DoProcess( // // Reading Values ... + // + // Bars Info ... + // double iLow = low[barIndex]; double iHigh = high[barIndex]; @@ -1628,19 +1631,7 @@ void DoProcess( double iPClose = close[barIndex + 1]; // - double iSCMa = scMaBuffer[barIndex]; - double iMCMa = mcMaBuffer[barIndex]; - double iLCMa = lcMaBuffer[barIndex]; - double iHCMa = hcMaBuffer[barIndex]; - - // - double iPSCMa = scMaBuffer[barIndex + 1]; - double iPMCMa = mcMaBuffer[barIndex + 1]; - double iPLCMa = lcMaBuffer[barIndex + 1]; - double iPHCMa = hcMaBuffer[barIndex + 1]; - - // - // SC Range ... + // SC ... // double iSCLL = sLLBuffer[barIndex]; @@ -1651,136 +1642,28 @@ void DoProcess( double iPSCHH = sHHBuffer[barIndex + 1]; // - double iP2SCLL = sLLBuffer[barIndex + 2]; - double iP2SCHH = sHHBuffer[barIndex + 2]; - - // - double iP3SCLL = sLLBuffer[barIndex + 3]; - double iP3SCHH = sHHBuffer[barIndex + 3]; - - // - double iP4SCLL = sLLBuffer[barIndex + 4]; - double iP4SCHH = sHHBuffer[barIndex + 4]; - - // - // MC Range ... - - // - double iMCLL = mLLBuffer[barIndex]; - double iMCHH = mHHBuffer[barIndex]; - - // - double iPMCLL = mLLBuffer[barIndex + 1]; - double iPMCHH = mHHBuffer[barIndex + 1]; - - // - double iP2MCLL = mLLBuffer[barIndex + 2]; - double iP2MCHH = mHHBuffer[barIndex + 2]; - - // - double iP3MCLL = mLLBuffer[barIndex + 3]; - double iP3MCHH = mHHBuffer[barIndex + 3]; - - // - double iP4MCLL = mLLBuffer[barIndex + 4]; - double iP4MCHH = mHHBuffer[barIndex + 4]; - - // - // LC Range ... - - // - double iLCLL = lLLBuffer[barIndex]; - double iLCHH = lHHBuffer[barIndex]; - - // - double iPLCLL = lLLBuffer[barIndex + 1]; - double iPLCHH = lHHBuffer[barIndex + 1]; - - // - double iP2LCLL = lLLBuffer[barIndex + 2]; - double iP2LCHH = lHHBuffer[barIndex + 2]; - - // - double iP3LCLL = lLLBuffer[barIndex + 3]; - double iP3LCHH = lHHBuffer[barIndex + 3]; - - // - double iP4LCLL = lLLBuffer[barIndex + 4]; - double iP4LCHH = lHHBuffer[barIndex + 4]; - - // - // HC Range ... - - // - double iHCLL = hLLBuffer[barIndex]; - double iHCHH = hHHBuffer[barIndex]; - - // - double iPHCLL = hLLBuffer[barIndex + 1]; - double iPHCHH = hHHBuffer[barIndex + 1]; - - // - double iP2HCLL = hLLBuffer[barIndex + 2]; - double iP2HCHH = hHHBuffer[barIndex + 2]; - - // - double iP3HCLL = hLLBuffer[barIndex + 3]; - double iP3HCHH = hHHBuffer[barIndex + 3]; - - // - double iP4HCLL = hLLBuffer[barIndex + 4]; - double iP4HCHH = hHHBuffer[barIndex + 4]; - - // - // Cycle States ... + double iSCMa = scMaBuffer[barIndex]; + double iPSCMa = scMaBuffer[barIndex + 1]; // double iSCMaState = scMaStateBuffer[barIndex]; - double iMCMaState = mcMaStateBuffer[barIndex]; - double iLCMaState = lcMaStateBuffer[barIndex]; - double iHCMaState = hcMaStateBuffer[barIndex]; - - // double iPSCMaState = scMaStateBuffer[barIndex + 1]; - double iPMCMaState = mcMaStateBuffer[barIndex + 1]; - double iPLCMaState = lcMaStateBuffer[barIndex + 1]; - double iPHCMaState = hcMaStateBuffer[barIndex + 1]; // - // Create Conditions ... - // - bool isLCMaOverHCMa = iMCMa > iHCMa; - bool isPLCMaOverHCMa = iPMCMa > iPHCMa; - // - bool isLCMaUnderHCMa = iMCMa < iHCMa; - bool isPLCMaUnderHCMa = iPMCMa < iPHCMa; - - // - bool isLCMaCrossedOverHCMa = - isLCMaOverHCMa && - !isPLCMaOverHCMa; - - // - bool isLCMaCrossedUnderHCMa = - isLCMaUnderHCMa && - !isPLCMaUnderHCMa; - - // - // SC State ... // bool isSCMaBullish = - iSCMaState == bullishState; + iSCMaState > 0; bool isPSCMaBullish = - iPSCMaState == bullishState; + iPSCMaState > 0; // bool isSCMaBearish = - iSCMaState == bearishState; + iSCMaState < 0; bool isPSCMaBearish = - iPSCMaState == bearishState; + iPSCMaState < 0; // bool isSCMaSwitchedToBullish = @@ -1793,71 +1676,39 @@ void DoProcess( !isPSCMaBearish; // - bool isSCLLOverMCLL = - iSCLL > iMCLL; - bool isPSCLLOverMCLL = - iPSCLL > iPMCLL; - bool isP2SCLLOverMCLL = - iP2SCLL > iP2MCLL; - bool isP3SCLLOverMCLL = - iP3SCLL > iP3MCLL; - bool isP4SCLLOverMCLL = - iP4SCLL > iP4MCLL; + // MC ... // - bool isSCHHUnderMCHH = - iSCHH < iMCHH; - bool isPSCHHUnderMCHH = - iPSCHH < iPMCHH; - bool isP2SCHHUnderMCHH = - iP2SCHH < iP2MCHH; - bool isP3SCHHUnderMCHH = - iP3SCHH < iP3MCHH; - bool isP4SCHHUnderMCHH = - iP4SCHH < iP4MCHH; + double iMCLL = mLLBuffer[barIndex]; + double iMCHH = mHHBuffer[barIndex]; // - bool isSCLLCrossedOverMCLL = - isSCLLOverMCLL && - !isPSCLLOverMCLL; - bool isPSCLLCrossedOverMCLL = - isPSCLLOverMCLL && - !isP2SCLLOverMCLL; - bool isP2SCLLCrossedOverMCLL = - isP2SCLLOverMCLL && - !isP3SCLLOverMCLL; - bool isP3SCLLCrossedOverMCLL = - isP3SCLLOverMCLL && - !isP4SCLLOverMCLL; + double iPMCLL = mLLBuffer[barIndex + 1]; + double iPMCHH = mHHBuffer[barIndex + 1]; // - bool isSCHHCrossedUnderMCHH = - isSCHHUnderMCHH && - !isPSCHHUnderMCHH; - bool isPSCHHCrossedUnderMCHH = - isPSCHHUnderMCHH && - !isP2SCHHUnderMCHH; - bool isP2SCHHCrossedUnderMCHH = - isP2SCHHUnderMCHH && - !isP3SCHHUnderMCHH; - bool isP3SCHHCrossedUnderMCHH = - isP3SCHHUnderMCHH && - !isP4SCHHUnderMCHH; + double iMCMa = mcMaBuffer[barIndex]; + double iPMCMa = mcMaBuffer[barIndex + 1]; // - // MC State ... + double iMCMaState = mcMaStateBuffer[barIndex]; + double iPMCMaState = mcMaStateBuffer[barIndex + 1]; + + // + // + // // bool isMCMaBullish = - iMCMaState == bullishState; + iMCMaState > 0; bool isPMCMaBullish = - iPMCMaState == bullishState; + iPMCMaState > 0; // bool isMCMaBearish = - iMCMaState == bearishState; + iMCMaState < 0; bool isPMCMaBearish = - iPMCMaState == bearishState; + iPMCMaState < 0; // bool isMCMaSwitchedToBullish = @@ -1870,71 +1721,113 @@ void DoProcess( !isPMCMaBearish; // - bool isMCLLOverLCLL = - iMCLL > iLCLL; - bool isPMCLLOverLCLL = - iPMCLL > iPLCLL; - bool isP2MCLLOverLCLL = - iP2MCLL > iP2LCLL; - bool isP3MCLLOverLCLL = - iP3MCLL > iP3LCLL; - bool isP4MCLLOverLCLL = - iP4MCLL > iP4LCLL; + // + // // - bool isMCHHUnderLCHH = - iMCHH < iLCHH; - bool isPMCHHUnderLCHH = - iPMCHH < iPLCHH; - bool isP2MCHHUnderLCHH = - iP2MCHH < iP2LCHH; - bool isP3MCHHUnderLCHH = - iP3MCHH < iP3LCHH; - bool isP4MCHHUnderLCHH = - iP4MCHH < iP4LCHH; + bool isSCMaOverMC = + iSCMa > iMCMa; + bool isPSCMaOverMC = + iPSCMa > iPMCMa; // - bool isMCLLCrossedOverLCLL = - isMCLLOverLCLL && - !isPMCLLOverLCLL; - bool isPMCLLCrossedOverLCLL = - isPMCLLOverLCLL && - !isP2MCLLOverLCLL; - bool isP2MCLLCrossedOverLCLL = - isP2MCLLOverLCLL && - !isP3MCLLOverLCLL; - bool isP3MCLLCrossedOverLCLL = - isP3MCLLOverLCLL && - !isP4MCLLOverLCLL; + bool isSCMaUnderMC = + iSCMa < iMCMa; + bool isPSCMaUnderMC = + iPSCMa < iPMCMa; // - bool isMCHHCrossedUnderLCHH = - isMCHHUnderLCHH && - !isPMCHHUnderLCHH; - bool isPMCHHCrossedUnderLCHH = - isPMCHHUnderLCHH && - !isP2MCHHUnderLCHH; - bool isP2MCHHCrossedUnderLCHH = - isP2MCHHUnderLCHH && - !isP3MCHHUnderLCHH; - bool isP3MCHHCrossedUnderLCHH = - isP3MCHHUnderLCHH && - !isP4MCHHUnderLCHH; + bool isSCMaCrossedOverMC = + isSCMaOverMC && + !isPSCMaOverMC; // - // LC State ... + bool isSCMaCrossedUnderMC = + isSCMaUnderMC && + !isPSCMaUnderMC; + + // + // + // + + // + bool isSCLLOverMCLL = + iSCLL > iMCLL; + bool isPSCLLOverMCLL = + iPSCLL > iPMCLL; + + // + bool isSCLLUnderMCLL = + iSCLL < iMCLL; + bool isPSCLLUnderMCLL = + iPSCLL < iPMCLL; + + // + bool isSCHHOverMCHH = + iSCHH > iMCHH; + bool isPSCHHOverMCHH = + iPSCHH > iPMCHH; + + // + bool isSCHHUnderMCHH = + iSCHH < iMCHH; + bool isPSCHHUnderMCHH = + iPSCHH < iPMCHH; + + // + bool isSCLLCrossedOverMCLL = + isSCLLOverMCLL && + !isPSCLLOverMCLL; + + // + bool isSCLLCrossedUnderMCLL = + isSCLLUnderMCLL && + !isPSCLLUnderMCLL; + + // + bool isSCHHCrossedOverMCHH = + isSCHHOverMCHH && + !isPSCHHOverMCHH; + + // + bool isSCHHCrossedUnderMCHH = + isSCHHUnderMCHH && + !isPSCHHUnderMCHH; + + // + // LC ... + + // + double iLCLL = lLLBuffer[barIndex]; + double iLCHH = lHHBuffer[barIndex]; + + // + double iPLCLL = lLLBuffer[barIndex + 1]; + double iPLCHH = lHHBuffer[barIndex + 1]; + + // + double iLCMa = lcMaBuffer[barIndex]; + double iPLCMa = lcMaBuffer[barIndex + 1]; + + // + double iLCMaState = lcMaStateBuffer[barIndex]; + double iPLCMaState = lcMaStateBuffer[barIndex + 1]; + + // + // + // // bool isLCMaBullish = - iLCMaState == bullishState; + iLCMaState > 0; bool isPLCMaBullish = - iPLCMaState == bullishState; + iPLCMaState > 0; // bool isLCMaBearish = - iLCMaState == bearishState; + iLCMaState < 0; bool isPLCMaBearish = - iPLCMaState == bearishState; + iPLCMaState < 0; // bool isLCMaSwitchedToBullish = @@ -1947,71 +1840,113 @@ void DoProcess( !isPLCMaBearish; // - bool isLCLLOverHCLL = - iLCLL > iHCLL; - bool isPLCLLOverHCLL = - iPLCLL > iPHCLL; - bool isP2LCLLOverHCLL = - iP2LCLL > iP2HCLL; - bool isP3LCLLOverHCLL = - iP3LCLL > iP3HCLL; - bool isP4LCLLOverHCLL = - iP4LCLL > iP4HCLL; + // + // // - bool isLCHHUnderHCHH = - iLCHH < iHCHH; - bool isPLCHHUnderHCHH = - iPLCHH < iPHCHH; - bool isP2LCHHUnderHCHH = - iP2LCHH < iP2HCHH; - bool isP3LCHHUnderHCHH = - iP3LCHH < iP3HCHH; - bool isP4LCHHUnderHCHH = - iP4LCHH < iP4HCHH; + bool isMCMaOverLC = + iMCMa > iLCMa; + bool isPMCMaOverLC = + iPMCMa > iPLCMa; // - bool isLCLLCrossedOverHCLL = - isLCLLOverHCLL && - !isPLCLLOverHCLL; - bool isPLCLLCrossedOverHCLL = - isPLCLLOverHCLL && - !isP2LCLLOverHCLL; - bool isP2LCLLCrossedOverHCLL = - isP2LCLLOverHCLL && - !isP3LCLLOverHCLL; - bool isP3LCLLCrossedOverHCLL = - isP3LCLLOverHCLL && - !isP4LCLLOverHCLL; + bool isMCMaUnderLC = + iMCMa < iLCMa; + bool isPMCMaUnderLC = + iPMCMa < iPLCMa; // - bool isLCHHCrossedUnderHCHH = - isLCHHUnderHCHH && - !isPLCHHUnderHCHH; - bool isPLCHHCrossedUnderHCHH = - isPLCHHUnderHCHH && - !isP2LCHHUnderHCHH; - bool isP2LCHHCrossedUnderHCHH = - isP2LCHHUnderHCHH && - !isP3LCHHUnderHCHH; - bool isP3LCHHCrossedUnderHCHH = - isP3LCHHUnderHCHH && - !isP4LCHHUnderHCHH; + bool isMCMaCrossedOverLC = + isMCMaOverLC && + !isPMCMaOverLC; // - // HC State ... + bool isMCMaCrossedUnderLC = + isMCMaUnderLC && + !isPMCMaUnderLC; + + // + // + // + + // + bool isMCLLOverLCLL = + iMCLL > iLCLL; + bool isPMCLLOverLCLL = + iPMCLL > iPLCLL; + + // + bool isMCLLUnderLCLL = + iMCLL < iLCLL; + bool isPMCLLUnderLCLL = + iPMCLL < iPLCLL; + + // + bool isMCHHOverLCHH = + iMCHH > iLCHH; + bool isPMCHHOverLCHH = + iPMCHH > iPLCHH; + + // + bool isMCHHUnderLCHH = + iMCHH < iLCHH; + bool isPMCHHUnderLCHH = + iPMCHH < iPLCHH; + + // + bool isMCLLCrossedOverLCLL = + isMCLLOverLCLL && + !isPMCLLOverLCLL; + + // + bool isMCLLCrossedUnderLCLL = + isMCLLUnderLCLL && + !isPMCLLUnderLCLL; + + // + bool isMCHHCrossedOverLCHH = + isMCHHOverLCHH && + !isPMCHHOverLCHH; + + // + bool isMCHHCrossedUnderLCHH = + isMCHHUnderLCHH && + !isPMCHHUnderLCHH; + + // + // HC ... + + // + double iHCLL = hLLBuffer[barIndex]; + double iHCHH = hHHBuffer[barIndex]; + + // + double iPHCLL = hLLBuffer[barIndex + 1]; + double iPHCHH = hHHBuffer[barIndex + 1]; + + // + double iHCMa = hcMaBuffer[barIndex]; + double iPHCMa = hcMaBuffer[barIndex + 1]; + + // + double iHCMaState = hcMaStateBuffer[barIndex]; + double iPHCMaState = hcMaStateBuffer[barIndex + 1]; + + // + // + // // bool isHCMaBullish = - iHCMaState == bullishState; + iHCMaState > 0; bool isPHCMaBullish = - iPHCMaState == bullishState; + iPHCMaState > 0; // bool isHCMaBearish = - iHCMaState == bearishState; + iHCMaState < 0; bool isPHCMaBearish = - iPHCMaState == bearishState; + iPHCMaState < 0; // bool isHCMaSwitchedToBullish = @@ -2023,6 +1958,80 @@ void DoProcess( isHCMaBearish && !isPHCMaBearish; + // + // + // + + // + bool isLCMaOverHC = + iLCMa > iHCMa; + bool isPLCMaOverHC = + iPLCMa > iPHCMa; + + // + bool isLCMaUnderHC = + iLCMa < iHCMa; + bool isPLCMaUnderHC = + iPLCMa < iPHCMa; + + // + bool isLCMaCrossedOverHC = + isLCMaOverHC && + !isPLCMaOverHC; + + // + bool isLCMaCrossedUnderHC = + isLCMaUnderHC && + !isPLCMaUnderHC; + + // + // + // + + // + bool isLCLLOverHCLL = + iLCLL > iHCLL; + bool isPLCLLOverHCLL = + iPLCLL > iPHCLL; + + // + bool isLCLLUnderHCLL = + iLCLL < iHCLL; + bool isPLCLLUnderHCLL = + iPLCLL < iPHCLL; + + // + bool isLCHHOverHCHH = + iLCHH > iHCHH; + bool isPLCHHOverHCHH = + iPLCHH > iPHCHH; + + // + bool isLCHHUnderHCHH = + iLCHH < iHCHH; + bool isPLCHHUnderHCHH = + iPLCHH < iPHCHH; + + // + bool isLCLLCrossedOverHCLL = + isLCLLOverHCLL && + !isPLCLLOverHCLL; + + // + bool isLCLLCrossedUnderHCLL = + isLCLLUnderHCLL && + !isPLCLLUnderHCLL; + + // + bool isLCHHCrossedOverHCHH = + isLCHHOverHCHH && + !isPLCHHOverHCHH; + + // + bool isLCHHCrossedUnderHCHH = + isLCHHUnderHCHH && + !isPLCHHUnderHCHH; + // // Check Price Inside Cloud Zone ... @@ -2030,10 +2039,102 @@ void DoProcess( double iCloudZoneUpper = MathMax(iLCMa, iHCMa); double iCloudZoneLower = MathMin(iLCMa, iHCMa); + // + bool isICloudZoneUpperBullish = + iCloudZoneUpper == iLCMa + ? isLCMaBullish + : isHCMaBullish; + bool isICloudZoneLowerBullish = + iCloudZoneLower == iLCMa + ? isLCMaBullish + : isHCMaBullish; + + // + bool isICloudZoneUpperBearish = + iCloudZoneUpper == iLCMa + ? isLCMaBearish + : isHCMaBearish; + bool isICloudZoneLowerBearish = + iCloudZoneLower == iLCMa + ? isLCMaBearish + : isHCMaBearish; + // double iPCloudZoneUpper = MathMax(iPLCMa, iPHCMa); double iPCloudZoneLower = MathMin(iPLCMa, iPHCMa); + // + bool isIPCloudZoneUpperBullish = + iPCloudZoneUpper == iPLCMa + ? isPLCMaBullish + : isPHCMaBullish; + bool isIPCloudZoneLowerBullish = + iPCloudZoneLower == iPLCMa + ? isPLCMaBullish + : isPHCMaBullish; + + // + bool isIPCloudZoneUpperBearish = + iPCloudZoneUpper == iPLCMa + ? isPLCMaBearish + : isPHCMaBearish; + bool isIPCloudZoneLowerBearish = + iPCloudZoneLower == iPLCMa + ? isPLCMaBearish + : isPHCMaBearish; + + // + double iPressureZoneUpper = MathMax(iSCMa, iMCMa); + double iPressureZoneLower = MathMin(iSCMa, iMCMa); + + // + bool isIPressureZoneUpperBullish = + iPressureZoneUpper == iSCMa + ? isSCMaBullish + : isMCMaBullish; + bool isIPressureZoneLowerBullish = + iPressureZoneLower == iSCMa + ? isSCMaBullish + : isMCMaBullish; + + // + bool isIPressureZoneUpperBearish = + iPressureZoneUpper == iSCMa + ? isSCMaBearish + : isMCMaBearish; + bool isIPressureZoneLowerBearish = + iPressureZoneLower == iSCMa + ? isSCMaBearish + : isMCMaBearish; + + // + double iPPressureZoneUpper = MathMax(iPSCMa, iPMCMa); + double iPPressureZoneLower = MathMin(iPSCMa, iPMCMa); + + // + bool isIPPressureZoneUpperBullish = + iPPressureZoneUpper == iPSCMa + ? isPSCMaBullish + : isPMCMaBullish; + bool isIPPressureZoneLowerBullish = + iPPressureZoneLower == iPSCMa + ? isPSCMaBullish + : isPMCMaBullish; + + // + bool isIPPressureZoneUpperBearish = + iPPressureZoneUpper == iPSCMa + ? isPSCMaBearish + : isPMCMaBearish; + bool isIPPressureZoneLowerBearish = + iPPressureZoneLower == iPSCMa + ? isPSCMaBearish + : isPMCMaBearish; + + // + // + // + // bool isBullishPriceInsideCloudZone = iLow < iCloudZoneUpper && @@ -2064,79 +2165,26 @@ void DoProcess( isBearishPriceInsideCloudZone && !isPBearishPriceInsideCloudZone; + // + bool hasBullishPressure = + iLow > iPressureZoneUpper; + + // + bool hasBearishPressure = + iHigh < iPressureZoneLower; + // // Detect Cloud Direction ... - // - bool isLLBullish = - // - isSCLLCrossedOverMCLL && - isLCLLCrossedOverHCLL && - iHCLL < iCloudZoneUpper && - iHCLL < iCloudZoneLower - // - ; - - // - bool isHHBearish = - // - isSCHHCrossedUnderMCHH && - isLCHHCrossedUnderHCHH && - iHCHH > iCloudZoneUpper && - iHCHH > iCloudZoneLower - // - ; - // bool isBullish = - isLLBullish; + hasBullishPressure && + isBullishPriceInsideCloudZone; // bool isBearish = - isHHBearish; - - // - // false; - // (isLCMaUnderHCMa - // ? isLCMaBullish - // : isLCMaOverHCMa - // ? isHCMaBullish - // : false) && - // iHCLL < iCloudZoneLower; - - // - // false; - // (isLCMaOverHCMa - // ? isLCMaBearish - // : isLCMaUnderHCMa - // ? isHCMaBearish - // : false) && - // iHCHH > iCloudZoneUpper; - - // - // Filter Bullish / Berish Directons ... - - // // - // isBullish = - // false - // // isBullish && - // // isBullishPriceInsideCloudZone - // // isSCMaBullish && - // // isMCMaBullish && - // // (isLCMaBullish || - // // isHCMaBullish) - // ; - - // // - // isBearish = - // false - // // isBearish && - // // isBearishPriceInsideCloudZone - // // isSCMaBearish && - // // isMCMaBearish && - // // (isLCMaBearish || - // // isHCMaBearish) - // ; + hasBearishPressure && + isBearishPriceInsideCloudZone; // has = isBullish ||