353 lines
7.7 KiB
Plaintext
353 lines
7.7 KiB
Plaintext
//
|
|
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;
|