4467 lines
116 KiB
Plaintext
4467 lines
116 KiB
Plaintext
///////////////////////////////////////////////////////
|
|
//
|
|
// SaherElm IT Center MQL5 Helper Class Library
|
|
// ----------------------------------------------
|
|
// Name: XSCXCHMAHelper
|
|
// Description: provides all Indicator
|
|
// Helper requirements ...
|
|
//
|
|
//
|
|
// Maintainer:
|
|
// ------------
|
|
// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com)
|
|
//
|
|
//////////////////////////////////////////////////////
|
|
//
|
|
// Global Properties ...
|
|
#property library
|
|
#property copyright "Copyright 2023, SaherElm IT Center"
|
|
#property link "https://www.saherelm.ir"
|
|
#property version "1.00"
|
|
#property strict
|
|
|
|
//
|
|
// Imports ...
|
|
#include "../Classes/x-saherelm.xhelper.class.mq5"
|
|
|
|
//
|
|
// Definitions ...
|
|
|
|
//
|
|
enum ENUM_XCHMA_BUFFERS
|
|
{
|
|
//
|
|
// Main ...
|
|
XCHMA_FAST_LINE = 0,
|
|
XCHMA_SLOW_LINE = 1,
|
|
//
|
|
// Current ...
|
|
XCHMA_CFAST_LINE = 2,
|
|
XCHMA_CSLOW_LINE = 3,
|
|
//
|
|
// Short ...
|
|
XCHMA_SFAST_LINE = 4,
|
|
XCHMA_SSLOW_LINE = 5,
|
|
//
|
|
// Medium ...
|
|
XCHMA_MFAST_LINE = 6,
|
|
XCHMA_MSLOW_LINE = 7,
|
|
//
|
|
// Long ...
|
|
XCHMA_LFAST_LINE = 8,
|
|
XCHMA_LSLOW_LINE = 9,
|
|
//
|
|
// Hind ...
|
|
XCHMA_HFAST_LINE = 10,
|
|
XCHMA_HSLOW_LINE = 11,
|
|
};
|
|
|
|
//
|
|
// Input Models ...
|
|
struct XCHMAInputs
|
|
{
|
|
//
|
|
// Props ...
|
|
|
|
//
|
|
// Market ...
|
|
int fastLength; // Fast Length
|
|
int slowLength; // Slow Length
|
|
ENUM_MA_METHOD method; // Mode
|
|
ENUM_APPLIED_PRICE appliedTo; // Applied To
|
|
|
|
//
|
|
// Cycles ...
|
|
|
|
//
|
|
// Short ...
|
|
ENUM_X_PERIOD_METHOD scMethod; // How to Find Period
|
|
ENUM_TIMEFRAMES scPeriod; // Time Period
|
|
|
|
//
|
|
// Medium ...
|
|
ENUM_X_PERIOD_METHOD mcMethod; // How to Find Period
|
|
ENUM_TIMEFRAMES mcPeriod; // Time Period
|
|
|
|
//
|
|
// Long ...
|
|
ENUM_X_PERIOD_METHOD lcMethod; // How to Find Period
|
|
ENUM_TIMEFRAMES lcPeriod; // Time Period
|
|
|
|
//
|
|
// Hind ...
|
|
ENUM_X_PERIOD_METHOD hcMethod; // How to Find Period
|
|
ENUM_TIMEFRAMES hcPeriod; // Time Period
|
|
|
|
//
|
|
// Presentation ...
|
|
bool showFast; // Show Fast
|
|
bool showSlow; // Show Slow
|
|
bool showCCFast; // Show Current Cycle Fast
|
|
bool showCCSlow; // Show Current Cycle Slow
|
|
bool showSCFast; // Show Short Cycle Fast
|
|
bool showSCSlow; // Show Short Cycle Slow
|
|
bool showMCFast; // Show Medium Cycle Fast
|
|
bool showMCSlow; // Show Medium Cycle Slow
|
|
bool showLCFast; // Show Long Cycle Fast
|
|
bool showLCSlow; // Show Long Cycle Slow
|
|
bool showHCFast; // Show Hind Cycle Fast
|
|
bool showHCSlow; // Show Hind Cycle Slow
|
|
|
|
//
|
|
// Constructor(s) ...
|
|
XCHMAInputs()
|
|
{
|
|
//
|
|
Clean();
|
|
}
|
|
|
|
//
|
|
// Tools ...
|
|
|
|
//
|
|
// Clean ...
|
|
void Clean()
|
|
{
|
|
//
|
|
fastLength = 0;
|
|
slowLength = 0;
|
|
method = MODE_EMA;
|
|
appliedTo = PRICE_CLOSE;
|
|
|
|
//
|
|
scMethod = X_PERIOD_AUTO;
|
|
scPeriod = NULL;
|
|
mcMethod = X_PERIOD_AUTO;
|
|
mcPeriod = NULL;
|
|
lcMethod = X_PERIOD_AUTO;
|
|
lcPeriod = NULL;
|
|
hcMethod = X_PERIOD_AUTO;
|
|
hcPeriod = NULL;
|
|
|
|
//
|
|
showFast = false;
|
|
showSlow = false;
|
|
showCCFast = false;
|
|
showCCSlow = false;
|
|
showSCFast = false;
|
|
showSCSlow = false;
|
|
showMCFast = false;
|
|
showMCSlow = false;
|
|
showLCFast = false;
|
|
showLCSlow = false;
|
|
showHCFast = false;
|
|
showHCSlow = false;
|
|
}
|
|
|
|
//
|
|
// Default ...
|
|
void Default()
|
|
{
|
|
//
|
|
fastLength = 9;
|
|
slowLength = 18;
|
|
method = MODE_EMA;
|
|
appliedTo = PRICE_CLOSE;
|
|
|
|
//
|
|
scMethod = X_PERIOD_AUTO;
|
|
scPeriod = NULL;
|
|
mcMethod = X_PERIOD_AUTO;
|
|
mcPeriod = NULL;
|
|
lcMethod = X_PERIOD_AUTO;
|
|
lcPeriod = NULL;
|
|
hcMethod = X_PERIOD_AUTO;
|
|
hcPeriod = NULL;
|
|
|
|
//
|
|
showFast = true;
|
|
showSlow = true;
|
|
showCCFast = true;
|
|
showCCSlow = true;
|
|
showSCFast = true;
|
|
showSCSlow = true;
|
|
showMCFast = true;
|
|
showMCSlow = true;
|
|
showLCFast = true;
|
|
showLCSlow = true;
|
|
showHCFast = true;
|
|
showHCSlow = true;
|
|
}
|
|
|
|
//
|
|
// Validate ...
|
|
bool IsValid()
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
result =
|
|
//
|
|
fastLength > 2 &&
|
|
slowLength > fastLength &&
|
|
//
|
|
(IsValid(scMethod, scPeriod) &&
|
|
IsValid(mcMethod, mcPeriod) &&
|
|
IsValid(lcMethod, lcPeriod) &&
|
|
IsValid(hcMethod, hcPeriod))
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Retrieve MAx Length ...
|
|
int Max()
|
|
{
|
|
//
|
|
int result = 0;
|
|
|
|
//
|
|
result =
|
|
//
|
|
MathMax(fastLength, slowLength)
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
};
|
|
|
|
//
|
|
// Define Conditions ...
|
|
struct XCHMAConditions
|
|
{
|
|
//
|
|
// Common ...
|
|
string symbol;
|
|
ENUM_TIMEFRAMES period;
|
|
datetime time;
|
|
|
|
//
|
|
// Buffers ...
|
|
|
|
//
|
|
double fast[];
|
|
double slow[];
|
|
|
|
//
|
|
// Current ...
|
|
double cFast[];
|
|
double cSlow[];
|
|
|
|
//
|
|
// Short ...
|
|
double sFast[];
|
|
double sSlow[];
|
|
|
|
//
|
|
// Medium ...
|
|
double mFast[];
|
|
double mSlow[];
|
|
|
|
//
|
|
// Long ...
|
|
double lFast[];
|
|
double lSlow[];
|
|
|
|
//
|
|
// Hind ...
|
|
double hFast[];
|
|
double hSlow[];
|
|
|
|
//
|
|
// Conditions ...
|
|
|
|
//
|
|
// AVG ...
|
|
|
|
//
|
|
bool isFastOverSlow;
|
|
bool isFastUnderSlow;
|
|
|
|
//
|
|
bool isFastCrossedOverSlow;
|
|
bool isFastCrossedUnderSlow;
|
|
|
|
//
|
|
bool isCLoseOverFast;
|
|
bool isCloseCrossedOverFast;
|
|
|
|
//
|
|
bool isCloseUnderFast;
|
|
bool isCloseCrossedUnderFast;
|
|
|
|
//
|
|
bool isCloseOverSlow;
|
|
bool isCloseCrossedOverSlow;
|
|
|
|
//
|
|
bool isCloseUnderSlow;
|
|
bool isCloseCrossedUnderSlow;
|
|
|
|
//
|
|
bool isRetestFastSlow;
|
|
|
|
//
|
|
bool isFastSupport;
|
|
bool isSlowSupport;
|
|
|
|
//
|
|
bool isFastResistance;
|
|
bool isSlowResistance;
|
|
|
|
//
|
|
bool isRejectedFastAsResistance;
|
|
bool isRejectedSlowAsResistance;
|
|
|
|
//
|
|
bool isRejectedFastAsSupport;
|
|
bool isRejectedSlowAsSupport;
|
|
|
|
//
|
|
bool isBreakedFastAsResistance;
|
|
bool isBreakedSlowAsResistance;
|
|
|
|
//
|
|
bool isBreakedFastAsSupport;
|
|
bool isBreakedSlowAsSupport;
|
|
|
|
//
|
|
bool isFastOverMax;
|
|
bool isFastUnderMax;
|
|
|
|
//
|
|
bool isFastOverMin;
|
|
bool isFastUnderMin;
|
|
|
|
//
|
|
bool isFastCrossedOverMax;
|
|
bool isFastCrossedUnderMax;
|
|
|
|
//
|
|
bool isFastCrossedOverMin;
|
|
bool isFastCrossedUnderMin;
|
|
|
|
//
|
|
bool isSlowOverMax;
|
|
bool isSlowUnderMax;
|
|
|
|
//
|
|
bool isSlowOverMin;
|
|
bool isSlowUnderMin;
|
|
|
|
//
|
|
bool isSlowCrossedOverMax;
|
|
bool isSlowCrossedUnderMax;
|
|
|
|
//
|
|
bool isSlowCrossedOverMin;
|
|
bool isSlowCrossedUnderMin;
|
|
|
|
//
|
|
// Current ...
|
|
|
|
//
|
|
bool isCFastOverSlow;
|
|
bool isCFastUnderSlow;
|
|
|
|
//
|
|
bool isCFastCrossedOverSlow;
|
|
bool isCFastCrossedUnderSlow;
|
|
|
|
//
|
|
bool isCLoseOverCFast;
|
|
bool isCloseCrossedOverCFast;
|
|
|
|
//
|
|
bool isCloseUnderCFast;
|
|
bool isCloseCrossedUnderCFast;
|
|
|
|
//
|
|
bool isCloseOverCSlow;
|
|
bool isCloseCrossedOverCSlow;
|
|
|
|
//
|
|
bool isCloseUnderCSlow;
|
|
bool isCloseCrossedUnderCSlow;
|
|
|
|
//
|
|
bool isRetestCFastSlow;
|
|
|
|
//
|
|
bool isCFastOverMax;
|
|
bool isCFastUnderMax;
|
|
|
|
//
|
|
bool isCFastOverMin;
|
|
bool isCFastUnderMin;
|
|
|
|
//
|
|
bool isCFastCrossedOverMax;
|
|
bool isCFastCrossedUnderMax;
|
|
|
|
//
|
|
bool isCFastCrossedOverMin;
|
|
bool isCFastCrossedUnderMin;
|
|
|
|
//
|
|
bool isCSlowOverMax;
|
|
bool isCSlowUnderMax;
|
|
|
|
//
|
|
bool isCSlowOverMin;
|
|
bool isCSlowUnderMin;
|
|
|
|
//
|
|
bool isCSlowCrossedOverMax;
|
|
bool isCSlowCrossedUnderMax;
|
|
|
|
//
|
|
bool isCSlowCrossedOverMin;
|
|
bool isCSlowCrossedUnderMin;
|
|
|
|
//
|
|
// Short ...
|
|
|
|
//
|
|
bool isSFastOverSlow;
|
|
bool isSFastUnderSlow;
|
|
|
|
//
|
|
bool isSFastCrossedOverSlow;
|
|
bool isSFastCrossedUnderSlow;
|
|
|
|
//
|
|
bool isCLoseOverSFast;
|
|
bool isCloseCrossedOverSFast;
|
|
|
|
//
|
|
bool isCloseUnderSFast;
|
|
bool isCloseCrossedUnderSFast;
|
|
|
|
//
|
|
bool isCloseOverSSlow;
|
|
bool isCloseCrossedOverSSlow;
|
|
|
|
//
|
|
bool isCloseUnderSSlow;
|
|
bool isCloseCrossedUnderSSlow;
|
|
|
|
//
|
|
bool isRetestSFastSlow;
|
|
|
|
//
|
|
bool isSFastOverMax;
|
|
bool isSFastUnderMax;
|
|
|
|
//
|
|
bool isSFastOverMin;
|
|
bool isSFastUnderMin;
|
|
|
|
//
|
|
bool isSFastCrossedOverMax;
|
|
bool isSFastCrossedUnderMax;
|
|
|
|
//
|
|
bool isSFastCrossedOverMin;
|
|
bool isSFastCrossedUnderMin;
|
|
|
|
//
|
|
bool isSSlowOverMax;
|
|
bool isSSlowUnderMax;
|
|
|
|
//
|
|
bool isSSlowOverMin;
|
|
bool isSSlowUnderMin;
|
|
|
|
//
|
|
bool isSSlowCrossedOverMax;
|
|
bool isSSlowCrossedUnderMax;
|
|
|
|
//
|
|
bool isSSlowCrossedOverMin;
|
|
bool isSSlowCrossedUnderMin;
|
|
|
|
//
|
|
// Medium ...
|
|
|
|
//
|
|
bool isMFastOverSlow;
|
|
bool isMFastUnderSlow;
|
|
|
|
//
|
|
bool isMFastCrossedOverSlow;
|
|
bool isMFastCrossedUnderSlow;
|
|
|
|
//
|
|
bool isCLoseOverMFast;
|
|
bool isCloseCrossedOverMFast;
|
|
|
|
//
|
|
bool isCloseUnderMFast;
|
|
bool isCloseCrossedUnderMFast;
|
|
|
|
//
|
|
bool isCloseOverMSlow;
|
|
bool isCloseCrossedOverMSlow;
|
|
|
|
//
|
|
bool isCloseUnderMSlow;
|
|
bool isCloseCrossedUnderMSlow;
|
|
|
|
//
|
|
bool isRetestMFastSlow;
|
|
|
|
//
|
|
bool isMFastOverMax;
|
|
bool isMFastUnderMax;
|
|
|
|
//
|
|
bool isMFastOverMin;
|
|
bool isMFastUnderMin;
|
|
|
|
//
|
|
bool isMFastCrossedOverMax;
|
|
bool isMFastCrossedUnderMax;
|
|
|
|
//
|
|
bool isMFastCrossedOverMin;
|
|
bool isMFastCrossedUnderMin;
|
|
|
|
//
|
|
bool isMSlowOverMax;
|
|
bool isMSlowUnderMax;
|
|
|
|
//
|
|
bool isMSlowOverMin;
|
|
bool isMSlowUnderMin;
|
|
|
|
//
|
|
bool isMSlowCrossedOverMax;
|
|
bool isMSlowCrossedUnderMax;
|
|
|
|
//
|
|
bool isMSlowCrossedOverMin;
|
|
bool isMSlowCrossedUnderMin;
|
|
|
|
//
|
|
// Long ...
|
|
|
|
//
|
|
bool isLFastOverSlow;
|
|
bool isLFastUnderSlow;
|
|
|
|
//
|
|
bool isLFastCrossedOverSlow;
|
|
bool isLFastCrossedUnderSlow;
|
|
|
|
//
|
|
bool isCLoseOverLFast;
|
|
bool isCloseCrossedOverLFast;
|
|
|
|
//
|
|
bool isCloseUnderLFast;
|
|
bool isCloseCrossedUnderLFast;
|
|
|
|
//
|
|
bool isCloseOverLSlow;
|
|
bool isCloseCrossedOverLSlow;
|
|
|
|
//
|
|
bool isCloseUnderLSlow;
|
|
bool isCloseCrossedUnderLSlow;
|
|
|
|
//
|
|
bool isRetestLFastSlow;
|
|
|
|
//
|
|
bool isLFastOverMax;
|
|
bool isLFastUnderMax;
|
|
|
|
//
|
|
bool isLFastOverMin;
|
|
bool isLFastUnderMin;
|
|
|
|
//
|
|
bool isLFastCrossedOverMax;
|
|
bool isLFastCrossedUnderMax;
|
|
|
|
//
|
|
bool isLFastCrossedOverMin;
|
|
bool isLFastCrossedUnderMin;
|
|
|
|
//
|
|
bool isLSlowOverMax;
|
|
bool isLSlowUnderMax;
|
|
|
|
//
|
|
bool isLSlowOverMin;
|
|
bool isLSlowUnderMin;
|
|
|
|
//
|
|
bool isLSlowCrossedOverMax;
|
|
bool isLSlowCrossedUnderMax;
|
|
|
|
//
|
|
bool isLSlowCrossedOverMin;
|
|
bool isLSlowCrossedUnderMin;
|
|
|
|
//
|
|
// Hind ...
|
|
|
|
//
|
|
bool isHFastOverSlow;
|
|
bool isHFastUnderSlow;
|
|
|
|
//
|
|
bool isHFastCrossedOverSlow;
|
|
bool isHFastCrossedUnderSlow;
|
|
|
|
//
|
|
bool isCLoseOverHFast;
|
|
bool isCloseCrossedOverHFast;
|
|
|
|
//
|
|
bool isCloseUnderHFast;
|
|
bool isCloseCrossedUnderHFast;
|
|
|
|
//
|
|
bool isCloseOverHSlow;
|
|
bool isCloseCrossedOverHSlow;
|
|
|
|
//
|
|
bool isCloseUnderHSlow;
|
|
bool isCloseCrossedUnderHSlow;
|
|
|
|
//
|
|
bool isRetestHFastSlow;
|
|
|
|
//
|
|
bool isHFastOverMax;
|
|
bool isHFastUnderMax;
|
|
|
|
//
|
|
bool isHFastOverMin;
|
|
bool isHFastUnderMin;
|
|
|
|
//
|
|
bool isHFastCrossedOverMax;
|
|
bool isHFastCrossedUnderMax;
|
|
|
|
//
|
|
bool isHFastCrossedOverMin;
|
|
bool isHFastCrossedUnderMin;
|
|
|
|
//
|
|
bool isHSlowOverMax;
|
|
bool isHSlowUnderMax;
|
|
|
|
//
|
|
bool isHSlowOverMin;
|
|
bool isHSlowUnderMin;
|
|
|
|
//
|
|
bool isHSlowCrossedOverMax;
|
|
bool isHSlowCrossedUnderMax;
|
|
|
|
//
|
|
bool isHSlowCrossedOverMin;
|
|
bool isHSlowCrossedUnderMin;
|
|
|
|
//
|
|
void Clean()
|
|
{
|
|
//
|
|
Clean(fast);
|
|
Clean(slow);
|
|
Clean(cFast);
|
|
Clean(cSlow);
|
|
Clean(sFast);
|
|
Clean(sSlow);
|
|
Clean(mFast);
|
|
Clean(mSlow);
|
|
Clean(lFast);
|
|
Clean(lSlow);
|
|
Clean(hFast);
|
|
Clean(hSlow);
|
|
|
|
//
|
|
ArraySetAsSeries(fast, true);
|
|
ArraySetAsSeries(slow, true);
|
|
ArraySetAsSeries(cFast, true);
|
|
ArraySetAsSeries(cSlow, true);
|
|
ArraySetAsSeries(sFast, true);
|
|
ArraySetAsSeries(sSlow, true);
|
|
ArraySetAsSeries(mFast, true);
|
|
ArraySetAsSeries(mSlow, true);
|
|
ArraySetAsSeries(lFast, true);
|
|
ArraySetAsSeries(lSlow, true);
|
|
ArraySetAsSeries(hFast, true);
|
|
ArraySetAsSeries(hSlow, true);
|
|
|
|
//
|
|
// AVG ...
|
|
isFastOverSlow = false;
|
|
isFastUnderSlow = false;
|
|
isFastCrossedOverSlow = false;
|
|
isFastCrossedUnderSlow = false;
|
|
isCLoseOverFast = false;
|
|
isCloseCrossedOverFast = false;
|
|
isCloseUnderFast = false;
|
|
isCloseCrossedUnderFast = false;
|
|
isCloseOverSlow = false;
|
|
isCloseCrossedOverSlow = false;
|
|
isCloseUnderSlow = false;
|
|
isCloseCrossedUnderSlow = false;
|
|
isRetestFastSlow = false;
|
|
isFastSupport = false;
|
|
isSlowSupport = false;
|
|
isFastResistance = false;
|
|
isSlowResistance = false;
|
|
isRejectedFastAsResistance = false;
|
|
isRejectedSlowAsResistance = false;
|
|
isRejectedFastAsSupport = false;
|
|
isRejectedSlowAsSupport = false;
|
|
isBreakedFastAsResistance = false;
|
|
isBreakedSlowAsResistance = false;
|
|
isBreakedFastAsSupport = false;
|
|
isBreakedSlowAsSupport = false;
|
|
isFastOverMax = false;
|
|
isFastUnderMax = false;
|
|
isFastOverMin = false;
|
|
isFastUnderMin = false;
|
|
isFastCrossedOverMax = false;
|
|
isFastCrossedUnderMax = false;
|
|
isFastCrossedOverMin = false;
|
|
isFastCrossedUnderMin = false;
|
|
isSlowOverMax = false;
|
|
isSlowUnderMax = false;
|
|
isSlowOverMin = false;
|
|
isSlowUnderMin = false;
|
|
isSlowCrossedOverMax = false;
|
|
isSlowCrossedUnderMax = false;
|
|
isSlowCrossedOverMin = false;
|
|
isSlowCrossedUnderMin = false;
|
|
|
|
//
|
|
// Current ...
|
|
isCFastOverSlow = false;
|
|
isCFastUnderSlow = false;
|
|
isCFastCrossedOverSlow = false;
|
|
isCFastCrossedUnderSlow = false;
|
|
isCLoseOverCFast = false;
|
|
isCloseCrossedOverCFast = false;
|
|
isCloseUnderCFast = false;
|
|
isCloseCrossedUnderCFast = false;
|
|
isCloseOverCSlow = false;
|
|
isCloseCrossedOverCSlow = false;
|
|
isCloseUnderCSlow = false;
|
|
isCloseCrossedUnderCSlow = false;
|
|
isRetestCFastSlow = false;
|
|
isCFastOverMax = false;
|
|
isCFastUnderMax = false;
|
|
isCFastOverMin = false;
|
|
isCFastUnderMin = false;
|
|
isCFastCrossedOverMax = false;
|
|
isCFastCrossedUnderMax = false;
|
|
isCFastCrossedOverMin = false;
|
|
isCFastCrossedUnderMin = false;
|
|
isCSlowOverMax = false;
|
|
isCSlowUnderMax = false;
|
|
isCSlowOverMin = false;
|
|
isCSlowUnderMin = false;
|
|
isCSlowCrossedOverMax = false;
|
|
isCSlowCrossedUnderMax = false;
|
|
isCSlowCrossedOverMin = false;
|
|
isCSlowCrossedUnderMin = false;
|
|
|
|
//
|
|
// Short ...
|
|
isSFastOverSlow = false;
|
|
isSFastUnderSlow = false;
|
|
isSFastCrossedOverSlow = false;
|
|
isSFastCrossedUnderSlow = false;
|
|
isCLoseOverSFast = false;
|
|
isCloseCrossedOverSFast = false;
|
|
isCloseUnderSFast = false;
|
|
isCloseCrossedUnderSFast = false;
|
|
isCloseOverSSlow = false;
|
|
isCloseCrossedOverSSlow = false;
|
|
isCloseUnderSSlow = false;
|
|
isCloseCrossedUnderSSlow = false;
|
|
isRetestSFastSlow = false;
|
|
isSFastOverMax = false;
|
|
isSFastUnderMax = false;
|
|
isSFastOverMin = false;
|
|
isSFastUnderMin = false;
|
|
isSFastCrossedOverMax = false;
|
|
isSFastCrossedUnderMax = false;
|
|
isSFastCrossedOverMin = false;
|
|
isSFastCrossedUnderMin = false;
|
|
isSSlowOverMax = false;
|
|
isSSlowUnderMax = false;
|
|
isSSlowOverMin = false;
|
|
isSSlowUnderMin = false;
|
|
isSSlowCrossedOverMax = false;
|
|
isSSlowCrossedUnderMax = false;
|
|
isSSlowCrossedOverMin = false;
|
|
isSSlowCrossedUnderMin = false;
|
|
|
|
//
|
|
// Medium ...
|
|
isMFastOverSlow = false;
|
|
isMFastUnderSlow = false;
|
|
isMFastCrossedOverSlow = false;
|
|
isMFastCrossedUnderSlow = false;
|
|
isCLoseOverMFast = false;
|
|
isCloseCrossedOverMFast = false;
|
|
isCloseUnderMFast = false;
|
|
isCloseCrossedUnderMFast = false;
|
|
isCloseOverMSlow = false;
|
|
isCloseCrossedOverMSlow = false;
|
|
isCloseUnderMSlow = false;
|
|
isCloseCrossedUnderMSlow = false;
|
|
isRetestMFastSlow = false;
|
|
isMFastOverMax = false;
|
|
isMFastUnderMax = false;
|
|
isMFastOverMin = false;
|
|
isMFastUnderMin = false;
|
|
isMFastCrossedOverMax = false;
|
|
isMFastCrossedUnderMax = false;
|
|
isMFastCrossedOverMin = false;
|
|
isMFastCrossedUnderMin = false;
|
|
isMSlowOverMax = false;
|
|
isMSlowUnderMax = false;
|
|
isMSlowOverMin = false;
|
|
isMSlowUnderMin = false;
|
|
isMSlowCrossedOverMax = false;
|
|
isMSlowCrossedUnderMax = false;
|
|
isMSlowCrossedOverMin = false;
|
|
isMSlowCrossedUnderMin = false;
|
|
|
|
//
|
|
// Long ...
|
|
isLFastOverSlow = false;
|
|
isLFastUnderSlow = false;
|
|
isLFastCrossedOverSlow = false;
|
|
isLFastCrossedUnderSlow = false;
|
|
isCLoseOverLFast = false;
|
|
isCloseCrossedOverLFast = false;
|
|
isCloseUnderLFast = false;
|
|
isCloseCrossedUnderLFast = false;
|
|
isCloseOverLSlow = false;
|
|
isCloseCrossedOverLSlow = false;
|
|
isCloseUnderLSlow = false;
|
|
isCloseCrossedUnderLSlow = false;
|
|
isRetestLFastSlow = false;
|
|
isLFastOverMax = false;
|
|
isLFastUnderMax = false;
|
|
isLFastOverMin = false;
|
|
isLFastUnderMin = false;
|
|
isLFastCrossedOverMax = false;
|
|
isLFastCrossedUnderMax = false;
|
|
isLFastCrossedOverMin = false;
|
|
isLFastCrossedUnderMin = false;
|
|
isLSlowOverMax = false;
|
|
isLSlowUnderMax = false;
|
|
isLSlowOverMin = false;
|
|
isLSlowUnderMin = false;
|
|
isLSlowCrossedOverMax = false;
|
|
isLSlowCrossedUnderMax = false;
|
|
isLSlowCrossedOverMin = false;
|
|
isLSlowCrossedUnderMin = false;
|
|
|
|
//
|
|
// Hind ...
|
|
isHFastOverSlow = false;
|
|
isHFastUnderSlow = false;
|
|
isHFastCrossedOverSlow = false;
|
|
isHFastCrossedUnderSlow = false;
|
|
isCLoseOverHFast = false;
|
|
isCloseCrossedOverHFast = false;
|
|
isCloseUnderHFast = false;
|
|
isCloseCrossedUnderHFast = false;
|
|
isCloseOverHSlow = false;
|
|
isCloseCrossedOverHSlow = false;
|
|
isCloseUnderHSlow = false;
|
|
isCloseCrossedUnderHSlow = false;
|
|
isRetestHFastSlow = false;
|
|
isHFastOverMax = false;
|
|
isHFastUnderMax = false;
|
|
isHFastOverMin = false;
|
|
isHFastUnderMin = false;
|
|
isHFastCrossedOverMax = false;
|
|
isHFastCrossedUnderMax = false;
|
|
isHFastCrossedOverMin = false;
|
|
isHFastCrossedUnderMin = false;
|
|
isHSlowOverMax = false;
|
|
isHSlowUnderMax = false;
|
|
isHSlowOverMin = false;
|
|
isHSlowUnderMin = false;
|
|
isHSlowCrossedOverMax = false;
|
|
isHSlowCrossedUnderMax = false;
|
|
isHSlowCrossedOverMin = false;
|
|
isHSlowCrossedUnderMin = false;
|
|
}
|
|
|
|
//
|
|
void GenerateScore(
|
|
double &bullishScore,
|
|
double &bearishScore //
|
|
)
|
|
{
|
|
//
|
|
bullishScore = 0;
|
|
bearishScore = 0;
|
|
|
|
//
|
|
// Since We have to Use this
|
|
// Only for Filtering Signals ...
|
|
// We Can Ignore Scoring ...
|
|
// or Complete this later ...
|
|
|
|
//
|
|
// AVG ...
|
|
if (isFastOverSlow)
|
|
{
|
|
}
|
|
if (isFastUnderSlow)
|
|
{
|
|
}
|
|
if (isFastCrossedOverSlow)
|
|
{
|
|
}
|
|
if (isFastCrossedUnderSlow)
|
|
{
|
|
}
|
|
if (isCLoseOverFast)
|
|
{
|
|
}
|
|
if (isCloseCrossedOverFast)
|
|
{
|
|
}
|
|
if (isCloseUnderFast)
|
|
{
|
|
}
|
|
if (isCloseCrossedUnderFast)
|
|
{
|
|
}
|
|
if (isCloseOverSlow)
|
|
{
|
|
}
|
|
if (isCloseCrossedOverSlow)
|
|
{
|
|
}
|
|
if (isCloseUnderSlow)
|
|
{
|
|
}
|
|
if (isCloseCrossedUnderSlow)
|
|
{
|
|
}
|
|
if (isRetestFastSlow)
|
|
{
|
|
}
|
|
if (isFastSupport)
|
|
{
|
|
}
|
|
if (isSlowSupport)
|
|
{
|
|
}
|
|
if (isFastResistance)
|
|
{
|
|
}
|
|
if (isSlowResistance)
|
|
{
|
|
}
|
|
if (isRejectedFastAsResistance)
|
|
{
|
|
}
|
|
if (isRejectedSlowAsResistance)
|
|
{
|
|
}
|
|
if (isRejectedFastAsSupport)
|
|
{
|
|
}
|
|
if (isRejectedSlowAsSupport)
|
|
{
|
|
}
|
|
if (isBreakedFastAsResistance)
|
|
{
|
|
}
|
|
if (isBreakedSlowAsResistance)
|
|
{
|
|
}
|
|
if (isBreakedFastAsSupport)
|
|
{
|
|
}
|
|
if (isBreakedSlowAsSupport)
|
|
{
|
|
}
|
|
if (isFastOverMax)
|
|
{
|
|
}
|
|
if (isFastUnderMax)
|
|
{
|
|
}
|
|
if (isFastOverMin)
|
|
{
|
|
}
|
|
if (isFastUnderMin)
|
|
{
|
|
}
|
|
if (isFastCrossedOverMax)
|
|
{
|
|
}
|
|
if (isFastCrossedUnderMax)
|
|
{
|
|
}
|
|
if (isFastCrossedOverMin)
|
|
{
|
|
}
|
|
if (isFastCrossedUnderMin)
|
|
{
|
|
}
|
|
if (isSlowOverMax)
|
|
{
|
|
}
|
|
if (isSlowUnderMax)
|
|
{
|
|
}
|
|
if (isSlowOverMin)
|
|
{
|
|
}
|
|
if (isSlowUnderMin)
|
|
{
|
|
}
|
|
if (isSlowCrossedOverMax)
|
|
{
|
|
}
|
|
if (isSlowCrossedUnderMax)
|
|
{
|
|
}
|
|
if (isSlowCrossedOverMin)
|
|
{
|
|
}
|
|
if (isSlowCrossedUnderMin)
|
|
{
|
|
}
|
|
|
|
//
|
|
// Current ...
|
|
if (isCFastOverSlow)
|
|
{
|
|
}
|
|
if (isCFastUnderSlow)
|
|
{
|
|
}
|
|
if (isCFastCrossedOverSlow)
|
|
{
|
|
}
|
|
if (isCFastCrossedUnderSlow)
|
|
{
|
|
}
|
|
if (isCLoseOverCFast)
|
|
{
|
|
}
|
|
if (isCloseCrossedOverCFast)
|
|
{
|
|
}
|
|
if (isCloseUnderCFast)
|
|
{
|
|
}
|
|
if (isCloseCrossedUnderCFast)
|
|
{
|
|
}
|
|
if (isCloseOverCSlow)
|
|
{
|
|
}
|
|
if (isCloseCrossedOverCSlow)
|
|
{
|
|
}
|
|
if (isCloseUnderCSlow)
|
|
{
|
|
}
|
|
if (isCloseCrossedUnderCSlow)
|
|
{
|
|
}
|
|
if (isRetestCFastSlow)
|
|
{
|
|
}
|
|
if (isCFastOverMax)
|
|
{
|
|
}
|
|
if (isCFastUnderMax)
|
|
{
|
|
}
|
|
if (isCFastOverMin)
|
|
{
|
|
}
|
|
if (isCFastUnderMin)
|
|
{
|
|
}
|
|
if (isCFastCrossedOverMax)
|
|
{
|
|
}
|
|
if (isCFastCrossedUnderMax)
|
|
{
|
|
}
|
|
if (isCFastCrossedOverMin)
|
|
{
|
|
}
|
|
if (isCFastCrossedUnderMin)
|
|
{
|
|
}
|
|
if (isCSlowOverMax)
|
|
{
|
|
}
|
|
if (isCSlowUnderMax)
|
|
{
|
|
}
|
|
if (isCSlowOverMin)
|
|
{
|
|
}
|
|
if (isCSlowUnderMin)
|
|
{
|
|
}
|
|
if (isCSlowCrossedOverMax)
|
|
{
|
|
}
|
|
if (isCSlowCrossedUnderMax)
|
|
{
|
|
}
|
|
if (isCSlowCrossedOverMin)
|
|
{
|
|
}
|
|
if (isCSlowCrossedUnderMin)
|
|
{
|
|
}
|
|
|
|
//
|
|
// Short ...
|
|
if (isSFastOverSlow)
|
|
{
|
|
}
|
|
if (isSFastUnderSlow)
|
|
{
|
|
}
|
|
if (isSFastCrossedOverSlow)
|
|
{
|
|
}
|
|
if (isSFastCrossedUnderSlow)
|
|
{
|
|
}
|
|
if (isCLoseOverSFast)
|
|
{
|
|
}
|
|
if (isCloseCrossedOverSFast)
|
|
{
|
|
}
|
|
if (isCloseUnderSFast)
|
|
{
|
|
}
|
|
if (isCloseCrossedUnderSFast)
|
|
{
|
|
}
|
|
if (isCloseOverSSlow)
|
|
{
|
|
}
|
|
if (isCloseCrossedOverSSlow)
|
|
{
|
|
}
|
|
if (isCloseUnderSSlow)
|
|
{
|
|
}
|
|
if (isCloseCrossedUnderSSlow)
|
|
{
|
|
}
|
|
if (isRetestSFastSlow)
|
|
{
|
|
}
|
|
if (isSFastOverMax)
|
|
{
|
|
}
|
|
if (isSFastUnderMax)
|
|
{
|
|
}
|
|
if (isSFastOverMin)
|
|
{
|
|
}
|
|
if (isSFastUnderMin)
|
|
{
|
|
}
|
|
if (isSFastCrossedOverMax)
|
|
{
|
|
}
|
|
if (isSFastCrossedUnderMax)
|
|
{
|
|
}
|
|
if (isSFastCrossedOverMin)
|
|
{
|
|
}
|
|
if (isSFastCrossedUnderMin)
|
|
{
|
|
}
|
|
if (isSSlowOverMax)
|
|
{
|
|
}
|
|
if (isSSlowUnderMax)
|
|
{
|
|
}
|
|
if (isSSlowOverMin)
|
|
{
|
|
}
|
|
if (isSSlowUnderMin)
|
|
{
|
|
}
|
|
if (isSSlowCrossedOverMax)
|
|
{
|
|
}
|
|
if (isSSlowCrossedUnderMax)
|
|
{
|
|
}
|
|
if (isSSlowCrossedOverMin)
|
|
{
|
|
}
|
|
if (isSSlowCrossedUnderMin)
|
|
{
|
|
}
|
|
|
|
//
|
|
// Medium ...
|
|
if (isMFastOverSlow)
|
|
{
|
|
}
|
|
if (isMFastUnderSlow)
|
|
{
|
|
}
|
|
if (isMFastCrossedOverSlow)
|
|
{
|
|
}
|
|
if (isMFastCrossedUnderSlow)
|
|
{
|
|
}
|
|
if (isCLoseOverMFast)
|
|
{
|
|
}
|
|
if (isCloseCrossedOverMFast)
|
|
{
|
|
}
|
|
if (isCloseUnderMFast)
|
|
{
|
|
}
|
|
if (isCloseCrossedUnderMFast)
|
|
{
|
|
}
|
|
if (isCloseOverMSlow)
|
|
{
|
|
}
|
|
if (isCloseCrossedOverMSlow)
|
|
{
|
|
}
|
|
if (isCloseUnderMSlow)
|
|
{
|
|
}
|
|
if (isCloseCrossedUnderMSlow)
|
|
{
|
|
}
|
|
if (isRetestMFastSlow)
|
|
{
|
|
}
|
|
if (isMFastOverMax)
|
|
{
|
|
}
|
|
if (isMFastUnderMax)
|
|
{
|
|
}
|
|
if (isMFastOverMin)
|
|
{
|
|
}
|
|
if (isMFastUnderMin)
|
|
{
|
|
}
|
|
if (isMFastCrossedOverMax)
|
|
{
|
|
}
|
|
if (isMFastCrossedUnderMax)
|
|
{
|
|
}
|
|
if (isMFastCrossedOverMin)
|
|
{
|
|
}
|
|
if (isMFastCrossedUnderMin)
|
|
{
|
|
}
|
|
if (isMSlowOverMax)
|
|
{
|
|
}
|
|
if (isMSlowUnderMax)
|
|
{
|
|
}
|
|
if (isMSlowOverMin)
|
|
{
|
|
}
|
|
if (isMSlowUnderMin)
|
|
{
|
|
}
|
|
if (isMSlowCrossedOverMax)
|
|
{
|
|
}
|
|
if (isMSlowCrossedUnderMax)
|
|
{
|
|
}
|
|
if (isMSlowCrossedOverMin)
|
|
{
|
|
}
|
|
if (isMSlowCrossedUnderMin)
|
|
{
|
|
}
|
|
|
|
//
|
|
// Long ...
|
|
if (isLFastOverSlow)
|
|
{
|
|
}
|
|
if (isLFastUnderSlow)
|
|
{
|
|
}
|
|
if (isLFastCrossedOverSlow)
|
|
{
|
|
}
|
|
if (isLFastCrossedUnderSlow)
|
|
{
|
|
}
|
|
if (isCLoseOverLFast)
|
|
{
|
|
}
|
|
if (isCloseCrossedOverLFast)
|
|
{
|
|
}
|
|
if (isCloseUnderLFast)
|
|
{
|
|
}
|
|
if (isCloseCrossedUnderLFast)
|
|
{
|
|
}
|
|
if (isCloseOverLSlow)
|
|
{
|
|
}
|
|
if (isCloseCrossedOverLSlow)
|
|
{
|
|
}
|
|
if (isCloseUnderLSlow)
|
|
{
|
|
}
|
|
if (isCloseCrossedUnderLSlow)
|
|
{
|
|
}
|
|
if (isRetestLFastSlow)
|
|
{
|
|
}
|
|
if (isLFastOverMax)
|
|
{
|
|
}
|
|
if (isLFastUnderMax)
|
|
{
|
|
}
|
|
if (isLFastOverMin)
|
|
{
|
|
}
|
|
if (isLFastUnderMin)
|
|
{
|
|
}
|
|
if (isLFastCrossedOverMax)
|
|
{
|
|
}
|
|
if (isLFastCrossedUnderMax)
|
|
{
|
|
}
|
|
if (isLFastCrossedOverMin)
|
|
{
|
|
}
|
|
if (isLFastCrossedUnderMin)
|
|
{
|
|
}
|
|
if (isLSlowOverMax)
|
|
{
|
|
}
|
|
if (isLSlowUnderMax)
|
|
{
|
|
}
|
|
if (isLSlowOverMin)
|
|
{
|
|
}
|
|
if (isLSlowUnderMin)
|
|
{
|
|
}
|
|
if (isLSlowCrossedOverMax)
|
|
{
|
|
}
|
|
if (isLSlowCrossedUnderMax)
|
|
{
|
|
}
|
|
if (isLSlowCrossedOverMin)
|
|
{
|
|
}
|
|
if (isLSlowCrossedUnderMin)
|
|
{
|
|
}
|
|
|
|
//
|
|
// Hind ...
|
|
if (isHFastOverSlow)
|
|
{
|
|
}
|
|
if (isHFastUnderSlow)
|
|
{
|
|
}
|
|
if (isHFastCrossedOverSlow)
|
|
{
|
|
}
|
|
if (isHFastCrossedUnderSlow)
|
|
{
|
|
}
|
|
if (isCLoseOverHFast)
|
|
{
|
|
}
|
|
if (isCloseCrossedOverHFast)
|
|
{
|
|
}
|
|
if (isCloseUnderHFast)
|
|
{
|
|
}
|
|
if (isCloseCrossedUnderHFast)
|
|
{
|
|
}
|
|
if (isCloseOverHSlow)
|
|
{
|
|
}
|
|
if (isCloseCrossedOverHSlow)
|
|
{
|
|
}
|
|
if (isCloseUnderHSlow)
|
|
{
|
|
}
|
|
if (isCloseCrossedUnderHSlow)
|
|
{
|
|
}
|
|
if (isRetestHFastSlow)
|
|
{
|
|
}
|
|
if (isHFastOverMax)
|
|
{
|
|
}
|
|
if (isHFastUnderMax)
|
|
{
|
|
}
|
|
if (isHFastOverMin)
|
|
{
|
|
}
|
|
if (isHFastUnderMin)
|
|
{
|
|
}
|
|
if (isHFastCrossedOverMax)
|
|
{
|
|
}
|
|
if (isHFastCrossedUnderMax)
|
|
{
|
|
}
|
|
if (isHFastCrossedOverMin)
|
|
{
|
|
}
|
|
if (isHFastCrossedUnderMin)
|
|
{
|
|
}
|
|
if (isHSlowOverMax)
|
|
{
|
|
}
|
|
if (isHSlowUnderMax)
|
|
{
|
|
}
|
|
if (isHSlowOverMin)
|
|
{
|
|
}
|
|
if (isHSlowUnderMin)
|
|
{
|
|
}
|
|
if (isHSlowCrossedOverMax)
|
|
{
|
|
}
|
|
if (isHSlowCrossedUnderMax)
|
|
{
|
|
}
|
|
if (isHSlowCrossedOverMin)
|
|
{
|
|
}
|
|
if (isHSlowCrossedUnderMin)
|
|
{
|
|
}
|
|
}
|
|
|
|
//
|
|
string GenerateSummary(
|
|
bool onlyCommons = false,
|
|
bool onlyConditions = false,
|
|
bool includeScores = true,
|
|
bool ignoreFalseConditions = true,
|
|
string separator = "\n" //
|
|
)
|
|
{
|
|
//
|
|
string result = NULL;
|
|
|
|
//
|
|
double bullishScore = 0;
|
|
double bearishScore = 0;
|
|
GenerateScore(
|
|
bullishScore,
|
|
bearishScore //
|
|
);
|
|
|
|
//
|
|
string scoresStr =
|
|
//
|
|
"Scores: " + separator +
|
|
"---------------" + separator +
|
|
"Bullish: " + ToString(bullishScore) + separator +
|
|
"Bearish: " + ToString(bearishScore) + separator +
|
|
""
|
|
//
|
|
;
|
|
|
|
//
|
|
string commonStr = GenerateSpecifiedCommonSummary(
|
|
this,
|
|
separator,
|
|
includeScores //
|
|
);
|
|
|
|
//
|
|
string conditionsStr =
|
|
//
|
|
// AVG ...
|
|
ToString("isFastOverSlow", isFastOverSlow, ignoreFalseConditions, separator) +
|
|
ToString("isFastUnderSlow", isFastUnderSlow, ignoreFalseConditions, separator) +
|
|
ToString("isFastCrossedOverSlow", isFastCrossedOverSlow, ignoreFalseConditions, separator) +
|
|
ToString("isFastCrossedUnderSlow", isFastCrossedUnderSlow, ignoreFalseConditions, separator) +
|
|
ToString("isCLoseOverFast", isCLoseOverFast, ignoreFalseConditions, separator) +
|
|
ToString("isCloseCrossedOverFast", isCloseCrossedOverFast, ignoreFalseConditions, separator) +
|
|
ToString("isCloseUnderFast", isCloseUnderFast, ignoreFalseConditions, separator) +
|
|
ToString("isCloseCrossedUnderFast", isCloseCrossedUnderFast, ignoreFalseConditions, separator) +
|
|
ToString("isCloseOverSlow", isCloseOverSlow, ignoreFalseConditions, separator) +
|
|
ToString("isCloseCrossedOverSlow", isCloseCrossedOverSlow, ignoreFalseConditions, separator) +
|
|
ToString("isCloseUnderSlow", isCloseUnderSlow, ignoreFalseConditions, separator) +
|
|
ToString("isCloseCrossedUnderSlow", isCloseCrossedUnderSlow, ignoreFalseConditions, separator) +
|
|
ToString("isRetestFastSlow", isRetestFastSlow, ignoreFalseConditions, separator) +
|
|
ToString("isFastSupport", isFastSupport, ignoreFalseConditions, separator) +
|
|
ToString("isSlowSupport", isSlowSupport, ignoreFalseConditions, separator) +
|
|
ToString("isFastResistance", isFastResistance, ignoreFalseConditions, separator) +
|
|
ToString("isSlowResistance", isSlowResistance, ignoreFalseConditions, separator) +
|
|
ToString("isRejectedFastAsResistance", isRejectedFastAsResistance, ignoreFalseConditions, separator) +
|
|
ToString("isRejectedSlowAsResistance", isRejectedSlowAsResistance, ignoreFalseConditions, separator) +
|
|
ToString("isRejectedFastAsSupport", isRejectedFastAsSupport, ignoreFalseConditions, separator) +
|
|
ToString("isRejectedSlowAsSupport", isRejectedSlowAsSupport, ignoreFalseConditions, separator) +
|
|
ToString("isBreakedFastAsResistance", isBreakedFastAsResistance, ignoreFalseConditions, separator) +
|
|
ToString("isBreakedSlowAsResistance", isBreakedSlowAsResistance, ignoreFalseConditions, separator) +
|
|
ToString("isBreakedFastAsSupport", isBreakedFastAsSupport, ignoreFalseConditions, separator) +
|
|
ToString("isBreakedSlowAsSupport", isBreakedSlowAsSupport, ignoreFalseConditions, separator) +
|
|
ToString("isFastOverMax", isFastOverMax, ignoreFalseConditions, separator) +
|
|
ToString("isFastUnderMax", isFastUnderMax, ignoreFalseConditions, separator) +
|
|
ToString("isFastOverMin", isFastOverMin, ignoreFalseConditions, separator) +
|
|
ToString("isFastUnderMin", isFastUnderMin, ignoreFalseConditions, separator) +
|
|
ToString("isFastCrossedOverMax", isFastCrossedOverMax, ignoreFalseConditions, separator) +
|
|
ToString("isFastCrossedUnderMax", isFastCrossedUnderMax, ignoreFalseConditions, separator) +
|
|
ToString("isFastCrossedOverMin", isFastCrossedOverMin, ignoreFalseConditions, separator) +
|
|
ToString("isFastCrossedUnderMin", isFastCrossedUnderMin, ignoreFalseConditions, separator) +
|
|
ToString("isSlowOverMax", isSlowOverMax, ignoreFalseConditions, separator) +
|
|
ToString("isSlowUnderMax", isSlowUnderMax, ignoreFalseConditions, separator) +
|
|
ToString("isSlowOverMin", isSlowOverMin, ignoreFalseConditions, separator) +
|
|
ToString("isSlowUnderMin", isSlowUnderMin, ignoreFalseConditions, separator) +
|
|
ToString("isSlowCrossedOverMax", isSlowCrossedOverMax, ignoreFalseConditions, separator) +
|
|
ToString("isSlowCrossedUnderMax", isSlowCrossedUnderMax, ignoreFalseConditions, separator) +
|
|
ToString("isSlowCrossedOverMin", isSlowCrossedOverMin, ignoreFalseConditions, separator) +
|
|
ToString("isSlowCrossedUnderMin", isSlowCrossedUnderMin, ignoreFalseConditions, separator) +
|
|
//
|
|
// Current ...
|
|
ToString("isCFastOverSlow", isCFastOverSlow, ignoreFalseConditions, separator) +
|
|
ToString("isCFastUnderSlow", isCFastUnderSlow, ignoreFalseConditions, separator) +
|
|
ToString("isCFastCrossedOverSlow", isCFastCrossedOverSlow, ignoreFalseConditions, separator) +
|
|
ToString("isCFastCrossedUnderSlow", isCFastCrossedUnderSlow, ignoreFalseConditions, separator) +
|
|
ToString("isCLoseOverCFast", isCLoseOverCFast, ignoreFalseConditions, separator) +
|
|
ToString("isCloseCrossedOverCFast", isCloseCrossedOverCFast, ignoreFalseConditions, separator) +
|
|
ToString("isCloseUnderCFast", isCloseUnderCFast, ignoreFalseConditions, separator) +
|
|
ToString("isCloseCrossedUnderCFast", isCloseCrossedUnderCFast, ignoreFalseConditions, separator) +
|
|
ToString("isCloseOverCSlow", isCloseOverCSlow, ignoreFalseConditions, separator) +
|
|
ToString("isCloseCrossedOverCSlow", isCloseCrossedOverCSlow, ignoreFalseConditions, separator) +
|
|
ToString("isCloseUnderCSlow", isCloseUnderCSlow, ignoreFalseConditions, separator) +
|
|
ToString("isCloseCrossedUnderCSlow", isCloseCrossedUnderCSlow, ignoreFalseConditions, separator) +
|
|
ToString("isRetestCFastSlow", isRetestCFastSlow, ignoreFalseConditions, separator) +
|
|
ToString("isCFastOverMax", isCFastOverMax, ignoreFalseConditions, separator) +
|
|
ToString("isCFastUnderMax", isCFastUnderMax, ignoreFalseConditions, separator) +
|
|
ToString("isCFastOverMin", isCFastOverMin, ignoreFalseConditions, separator) +
|
|
ToString("isCFastUnderMin", isCFastUnderMin, ignoreFalseConditions, separator) +
|
|
ToString("isCFastCrossedOverMax", isCFastCrossedOverMax, ignoreFalseConditions, separator) +
|
|
ToString("isCFastCrossedUnderMax", isCFastCrossedUnderMax, ignoreFalseConditions, separator) +
|
|
ToString("isCFastCrossedOverMin", isCFastCrossedOverMin, ignoreFalseConditions, separator) +
|
|
ToString("isCFastCrossedUnderMin", isCFastCrossedUnderMin, ignoreFalseConditions, separator) +
|
|
ToString("isCSlowOverMax", isCSlowOverMax, ignoreFalseConditions, separator) +
|
|
ToString("isCSlowUnderMax", isCSlowUnderMax, ignoreFalseConditions, separator) +
|
|
ToString("isCSlowOverMin", isCSlowOverMin, ignoreFalseConditions, separator) +
|
|
ToString("isCSlowUnderMin", isCSlowUnderMin, ignoreFalseConditions, separator) +
|
|
ToString("isCSlowCrossedOverMax", isCSlowCrossedOverMax, ignoreFalseConditions, separator) +
|
|
ToString("isCSlowCrossedUnderMax", isCSlowCrossedUnderMax, ignoreFalseConditions, separator) +
|
|
ToString("isCSlowCrossedOverMin", isCSlowCrossedOverMin, ignoreFalseConditions, separator) +
|
|
ToString("isCSlowCrossedUnderMin", isCSlowCrossedUnderMin, ignoreFalseConditions, separator) +
|
|
//
|
|
// Short ...
|
|
ToString("isSFastOverSlow", isSFastOverSlow, ignoreFalseConditions, separator) +
|
|
ToString("isSFastUnderSlow", isSFastUnderSlow, ignoreFalseConditions, separator) +
|
|
ToString("isSFastCrossedOverSlow", isSFastCrossedOverSlow, ignoreFalseConditions, separator) +
|
|
ToString("isSFastCrossedUnderSlow", isSFastCrossedUnderSlow, ignoreFalseConditions, separator) +
|
|
ToString("isCLoseOverSFast", isCLoseOverSFast, ignoreFalseConditions, separator) +
|
|
ToString("isCloseCrossedOverSFast", isCloseCrossedOverSFast, ignoreFalseConditions, separator) +
|
|
ToString("isCloseUnderSFast", isCloseUnderSFast, ignoreFalseConditions, separator) +
|
|
ToString("isCloseCrossedUnderSFast", isCloseCrossedUnderSFast, ignoreFalseConditions, separator) +
|
|
ToString("isCloseOverSSlow", isCloseOverSSlow, ignoreFalseConditions, separator) +
|
|
ToString("isCloseCrossedOverSSlow", isCloseCrossedOverSSlow, ignoreFalseConditions, separator) +
|
|
ToString("isCloseUnderSSlow", isCloseUnderSSlow, ignoreFalseConditions, separator) +
|
|
ToString("isCloseCrossedUnderSSlow", isCloseCrossedUnderSSlow, ignoreFalseConditions, separator) +
|
|
ToString("isRetestSFastSlow", isRetestSFastSlow, ignoreFalseConditions, separator) +
|
|
ToString("isSFastOverMax", isSFastOverMax, ignoreFalseConditions, separator) +
|
|
ToString("isSFastUnderMax", isSFastUnderMax, ignoreFalseConditions, separator) +
|
|
ToString("isSFastOverMin", isSFastOverMin, ignoreFalseConditions, separator) +
|
|
ToString("isSFastUnderMin", isSFastUnderMin, ignoreFalseConditions, separator) +
|
|
ToString("isSFastCrossedOverMax", isSFastCrossedOverMax, ignoreFalseConditions, separator) +
|
|
ToString("isSFastCrossedUnderMax", isSFastCrossedUnderMax, ignoreFalseConditions, separator) +
|
|
ToString("isSFastCrossedOverMin", isSFastCrossedOverMin, ignoreFalseConditions, separator) +
|
|
ToString("isSFastCrossedUnderMin", isSFastCrossedUnderMin, ignoreFalseConditions, separator) +
|
|
ToString("isSSlowOverMax", isSSlowOverMax, ignoreFalseConditions, separator) +
|
|
ToString("isSSlowUnderMax", isSSlowUnderMax, ignoreFalseConditions, separator) +
|
|
ToString("isSSlowOverMin", isSSlowOverMin, ignoreFalseConditions, separator) +
|
|
ToString("isSSlowUnderMin", isSSlowUnderMin, ignoreFalseConditions, separator) +
|
|
ToString("isSSlowCrossedOverMax", isSSlowCrossedOverMax, ignoreFalseConditions, separator) +
|
|
ToString("isSSlowCrossedUnderMax", isSSlowCrossedUnderMax, ignoreFalseConditions, separator) +
|
|
ToString("isSSlowCrossedOverMin", isSSlowCrossedOverMin, ignoreFalseConditions, separator) +
|
|
ToString("isSSlowCrossedUnderMin", isSSlowCrossedUnderMin, ignoreFalseConditions, separator) +
|
|
//
|
|
// Medium ...
|
|
ToString("isMFastOverSlow", isMFastOverSlow, ignoreFalseConditions, separator) +
|
|
ToString("isMFastUnderSlow", isMFastUnderSlow, ignoreFalseConditions, separator) +
|
|
ToString("isMFastCrossedOverSlow", isMFastCrossedOverSlow, ignoreFalseConditions, separator) +
|
|
ToString("isMFastCrossedUnderSlow", isMFastCrossedUnderSlow, ignoreFalseConditions, separator) +
|
|
ToString("isCLoseOverMFast", isCLoseOverMFast, ignoreFalseConditions, separator) +
|
|
ToString("isCloseCrossedOverMFast", isCloseCrossedOverMFast, ignoreFalseConditions, separator) +
|
|
ToString("isCloseUnderMFast", isCloseUnderMFast, ignoreFalseConditions, separator) +
|
|
ToString("isCloseCrossedUnderMFast", isCloseCrossedUnderMFast, ignoreFalseConditions, separator) +
|
|
ToString("isCloseOverMSlow", isCloseOverMSlow, ignoreFalseConditions, separator) +
|
|
ToString("isCloseCrossedOverMSlow", isCloseCrossedOverMSlow, ignoreFalseConditions, separator) +
|
|
ToString("isCloseUnderMSlow", isCloseUnderMSlow, ignoreFalseConditions, separator) +
|
|
ToString("isCloseCrossedUnderMSlow", isCloseCrossedUnderMSlow, ignoreFalseConditions, separator) +
|
|
ToString("isRetestMFastSlow", isRetestMFastSlow, ignoreFalseConditions, separator) +
|
|
ToString("isMFastOverMax", isMFastOverMax, ignoreFalseConditions, separator) +
|
|
ToString("isMFastUnderMax", isMFastUnderMax, ignoreFalseConditions, separator) +
|
|
ToString("isMFastOverMin", isMFastOverMin, ignoreFalseConditions, separator) +
|
|
ToString("isMFastUnderMin", isMFastUnderMin, ignoreFalseConditions, separator) +
|
|
ToString("isMFastCrossedOverMax", isMFastCrossedOverMax, ignoreFalseConditions, separator) +
|
|
ToString("isMFastCrossedUnderMax", isMFastCrossedUnderMax, ignoreFalseConditions, separator) +
|
|
ToString("isMFastCrossedOverMin", isMFastCrossedOverMin, ignoreFalseConditions, separator) +
|
|
ToString("isMFastCrossedUnderMin", isMFastCrossedUnderMin, ignoreFalseConditions, separator) +
|
|
ToString("isMSlowOverMax", isMSlowOverMax, ignoreFalseConditions, separator) +
|
|
ToString("isMSlowUnderMax", isMSlowUnderMax, ignoreFalseConditions, separator) +
|
|
ToString("isMSlowOverMin", isMSlowOverMin, ignoreFalseConditions, separator) +
|
|
ToString("isMSlowUnderMin", isMSlowUnderMin, ignoreFalseConditions, separator) +
|
|
ToString("isMSlowCrossedOverMax", isMSlowCrossedOverMax, ignoreFalseConditions, separator) +
|
|
ToString("isMSlowCrossedUnderMax", isMSlowCrossedUnderMax, ignoreFalseConditions, separator) +
|
|
ToString("isMSlowCrossedOverMin", isMSlowCrossedOverMin, ignoreFalseConditions, separator) +
|
|
ToString("isMSlowCrossedUnderMin", isMSlowCrossedUnderMin, ignoreFalseConditions, separator) +
|
|
//
|
|
// Long ...
|
|
ToString("isLFastOverSlow", isLFastOverSlow, ignoreFalseConditions, separator) +
|
|
ToString("isLFastUnderSlow", isLFastUnderSlow, ignoreFalseConditions, separator) +
|
|
ToString("isLFastCrossedOverSlow", isLFastCrossedOverSlow, ignoreFalseConditions, separator) +
|
|
ToString("isLFastCrossedUnderSlow", isLFastCrossedUnderSlow, ignoreFalseConditions, separator) +
|
|
ToString("isCLoseOverLFast", isCLoseOverLFast, ignoreFalseConditions, separator) +
|
|
ToString("isCloseCrossedOverLFast", isCloseCrossedOverLFast, ignoreFalseConditions, separator) +
|
|
ToString("isCloseUnderLFast", isCloseUnderLFast, ignoreFalseConditions, separator) +
|
|
ToString("isCloseCrossedUnderLFast", isCloseCrossedUnderLFast, ignoreFalseConditions, separator) +
|
|
ToString("isCloseOverLSlow", isCloseOverLSlow, ignoreFalseConditions, separator) +
|
|
ToString("isCloseCrossedOverLSlow", isCloseCrossedOverLSlow, ignoreFalseConditions, separator) +
|
|
ToString("isCloseUnderLSlow", isCloseUnderLSlow, ignoreFalseConditions, separator) +
|
|
ToString("isCloseCrossedUnderLSlow", isCloseCrossedUnderLSlow, ignoreFalseConditions, separator) +
|
|
ToString("isRetestLFastSlow", isRetestLFastSlow, ignoreFalseConditions, separator) +
|
|
ToString("isLFastOverMax", isLFastOverMax, ignoreFalseConditions, separator) +
|
|
ToString("isLFastUnderMax", isLFastUnderMax, ignoreFalseConditions, separator) +
|
|
ToString("isLFastOverMin", isLFastOverMin, ignoreFalseConditions, separator) +
|
|
ToString("isLFastUnderMin", isLFastUnderMin, ignoreFalseConditions, separator) +
|
|
ToString("isLFastCrossedOverMax", isLFastCrossedOverMax, ignoreFalseConditions, separator) +
|
|
ToString("isLFastCrossedUnderMax", isLFastCrossedUnderMax, ignoreFalseConditions, separator) +
|
|
ToString("isLFastCrossedOverMin", isLFastCrossedOverMin, ignoreFalseConditions, separator) +
|
|
ToString("isLFastCrossedUnderMin", isLFastCrossedUnderMin, ignoreFalseConditions, separator) +
|
|
ToString("isLSlowOverMax", isLSlowOverMax, ignoreFalseConditions, separator) +
|
|
ToString("isLSlowUnderMax", isLSlowUnderMax, ignoreFalseConditions, separator) +
|
|
ToString("isLSlowOverMin", isLSlowOverMin, ignoreFalseConditions, separator) +
|
|
ToString("isLSlowUnderMin", isLSlowUnderMin, ignoreFalseConditions, separator) +
|
|
ToString("isLSlowCrossedOverMax", isLSlowCrossedOverMax, ignoreFalseConditions, separator) +
|
|
ToString("isLSlowCrossedUnderMax", isLSlowCrossedUnderMax, ignoreFalseConditions, separator) +
|
|
ToString("isLSlowCrossedOverMin", isLSlowCrossedOverMin, ignoreFalseConditions, separator) +
|
|
ToString("isLSlowCrossedUnderMin", isLSlowCrossedUnderMin, ignoreFalseConditions, separator) +
|
|
//
|
|
// Hind ...
|
|
ToString("isHFastOverSlow", isHFastOverSlow, ignoreFalseConditions, separator) +
|
|
ToString("isHFastUnderSlow", isHFastUnderSlow, ignoreFalseConditions, separator) +
|
|
ToString("isHFastCrossedOverSlow", isHFastCrossedOverSlow, ignoreFalseConditions, separator) +
|
|
ToString("isHFastCrossedUnderSlow", isHFastCrossedUnderSlow, ignoreFalseConditions, separator) +
|
|
ToString("isCLoseOverHFast", isCLoseOverHFast, ignoreFalseConditions, separator) +
|
|
ToString("isCloseCrossedOverHFast", isCloseCrossedOverHFast, ignoreFalseConditions, separator) +
|
|
ToString("isCloseUnderHFast", isCloseUnderHFast, ignoreFalseConditions, separator) +
|
|
ToString("isCloseCrossedUnderHFast", isCloseCrossedUnderHFast, ignoreFalseConditions, separator) +
|
|
ToString("isCloseOverHSlow", isCloseOverHSlow, ignoreFalseConditions, separator) +
|
|
ToString("isCloseCrossedOverHSlow", isCloseCrossedOverHSlow, ignoreFalseConditions, separator) +
|
|
ToString("isCloseUnderHSlow", isCloseUnderHSlow, ignoreFalseConditions, separator) +
|
|
ToString("isCloseCrossedUnderHSlow", isCloseCrossedUnderHSlow, ignoreFalseConditions, separator) +
|
|
ToString("isRetestHFastSlow", isRetestHFastSlow, ignoreFalseConditions, separator) +
|
|
ToString("isHFastOverMax", isHFastOverMax, ignoreFalseConditions, separator) +
|
|
ToString("isHFastUnderMax", isHFastUnderMax, ignoreFalseConditions, separator) +
|
|
ToString("isHFastOverMin", isHFastOverMin, ignoreFalseConditions, separator) +
|
|
ToString("isHFastUnderMin", isHFastUnderMin, ignoreFalseConditions, separator) +
|
|
ToString("isHFastCrossedOverMax", isHFastCrossedOverMax, ignoreFalseConditions, separator) +
|
|
ToString("isHFastCrossedUnderMax", isHFastCrossedUnderMax, ignoreFalseConditions, separator) +
|
|
ToString("isHFastCrossedOverMin", isHFastCrossedOverMin, ignoreFalseConditions, separator) +
|
|
ToString("isHFastCrossedUnderMin", isHFastCrossedUnderMin, ignoreFalseConditions, separator) +
|
|
ToString("isHSlowOverMax", isHSlowOverMax, ignoreFalseConditions, separator) +
|
|
ToString("isHSlowUnderMax", isHSlowUnderMax, ignoreFalseConditions, separator) +
|
|
ToString("isHSlowOverMin", isHSlowOverMin, ignoreFalseConditions, separator) +
|
|
ToString("isHSlowUnderMin", isHSlowUnderMin, ignoreFalseConditions, separator) +
|
|
ToString("isHSlowCrossedOverMax", isHSlowCrossedOverMax, ignoreFalseConditions, separator) +
|
|
ToString("isHSlowCrossedUnderMax", isHSlowCrossedUnderMax, ignoreFalseConditions, separator) +
|
|
ToString("isHSlowCrossedOverMin", isHSlowCrossedOverMin, ignoreFalseConditions, separator) +
|
|
ToString("isHSlowCrossedUnderMin", isHSlowCrossedUnderMin, ignoreFalseConditions, separator) +
|
|
//
|
|
""
|
|
//
|
|
;
|
|
|
|
//
|
|
result =
|
|
//
|
|
"[" + GetTag() + "]" + separator +
|
|
(onlyConditions
|
|
? ""
|
|
: commonStr) +
|
|
(!includeScores
|
|
? ""
|
|
: scoresStr) +
|
|
" " + separator +
|
|
(onlyCommons
|
|
? ""
|
|
: conditionsStr) +
|
|
""
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
string GetTag()
|
|
{
|
|
return "XCHMA";
|
|
}
|
|
};
|
|
|
|
//
|
|
enum ENUM_XCHMA_VALUES
|
|
{
|
|
XCHMA_ALL = 0,
|
|
XCHMA_NONE = 1,
|
|
XCHMA_ALL_BUT_AVG = 2,
|
|
XCHMA_ALL_BUT_CURRENT = 3,
|
|
XCHMA_ALL_BUT_SHORT = 4,
|
|
XCHMA_ALL_BUT_MEDIUM = 5,
|
|
XCHMA_ALL_BUT_LONG = 6,
|
|
XCHMA_ALL_BUT_HIND = 7,
|
|
};
|
|
|
|
//
|
|
void FillCHMAValues(
|
|
double &result[], //
|
|
XCHMAConditions &conditions, //
|
|
ENUM_XCHMA_VALUES method, //
|
|
int index = 1 //
|
|
)
|
|
{
|
|
//
|
|
// Cleaning Result ...
|
|
Clean(result);
|
|
|
|
//
|
|
if (method == XCHMA_NONE)
|
|
{
|
|
return;
|
|
}
|
|
|
|
//
|
|
// AVG ...
|
|
double iFast = conditions.fast[index];
|
|
double iSlow = conditions.slow[index];
|
|
|
|
//
|
|
// Current ...
|
|
double iCFast = conditions.cFast[index];
|
|
double iCSlow = conditions.cSlow[index];
|
|
|
|
//
|
|
// Short ...
|
|
double iSFast = conditions.sFast[index];
|
|
double iSSlow = conditions.sSlow[index];
|
|
|
|
//
|
|
// Medium ...
|
|
double iMFast = conditions.mFast[index];
|
|
double iMSlow = conditions.mSlow[index];
|
|
|
|
//
|
|
// Long ...
|
|
double iLFast = conditions.lFast[index];
|
|
double iLSlow = conditions.lSlow[index];
|
|
|
|
//
|
|
// Hind ...
|
|
double iHFast = conditions.hFast[index];
|
|
double iHSlow = conditions.hSlow[index];
|
|
|
|
//
|
|
if (method == XCHMA_ALL)
|
|
{
|
|
//
|
|
// AVG ...
|
|
|
|
//
|
|
Add(
|
|
iFast,
|
|
result //
|
|
);
|
|
|
|
//
|
|
Add(
|
|
iSlow,
|
|
result //
|
|
);
|
|
|
|
//
|
|
// Current ...
|
|
|
|
//
|
|
Add(
|
|
iCFast,
|
|
result //
|
|
);
|
|
|
|
//
|
|
Add(
|
|
iCSlow,
|
|
result //
|
|
);
|
|
|
|
//
|
|
// Short ...
|
|
|
|
//
|
|
Add(
|
|
iSFast,
|
|
result //
|
|
);
|
|
|
|
//
|
|
Add(
|
|
iSSlow,
|
|
result //
|
|
);
|
|
|
|
//
|
|
// Medium ...
|
|
|
|
//
|
|
Add(
|
|
iMFast,
|
|
result //
|
|
);
|
|
|
|
//
|
|
Add(
|
|
iMSlow,
|
|
result //
|
|
);
|
|
|
|
//
|
|
// Long ...
|
|
|
|
//
|
|
Add(
|
|
iLFast,
|
|
result //
|
|
);
|
|
|
|
//
|
|
Add(
|
|
iLSlow,
|
|
result //
|
|
);
|
|
|
|
//
|
|
// Hind ...
|
|
|
|
//
|
|
Add(
|
|
iHFast,
|
|
result //
|
|
);
|
|
|
|
//
|
|
Add(
|
|
iHSlow,
|
|
result //
|
|
);
|
|
|
|
//
|
|
return;
|
|
}
|
|
|
|
//
|
|
// AVG ...
|
|
if (method != XCHMA_ALL_BUT_AVG)
|
|
{
|
|
//
|
|
Add(
|
|
iFast,
|
|
result //
|
|
);
|
|
|
|
//
|
|
Add(
|
|
iSlow,
|
|
result //
|
|
);
|
|
}
|
|
|
|
//
|
|
// Current ...
|
|
if (method != XCHMA_ALL_BUT_CURRENT)
|
|
{
|
|
//
|
|
Add(
|
|
iCFast,
|
|
result //
|
|
);
|
|
|
|
//
|
|
Add(
|
|
iCSlow,
|
|
result //
|
|
);
|
|
}
|
|
|
|
//
|
|
// Short ...
|
|
if (method != XCHMA_ALL_BUT_SHORT)
|
|
{
|
|
//
|
|
Add(
|
|
iSFast,
|
|
result //
|
|
);
|
|
|
|
//
|
|
Add(
|
|
iSSlow,
|
|
result //
|
|
);
|
|
}
|
|
|
|
//
|
|
// Medium ...
|
|
if (method != XCHMA_ALL_BUT_MEDIUM)
|
|
{
|
|
//
|
|
Add(
|
|
iMFast,
|
|
result //
|
|
);
|
|
|
|
//
|
|
Add(
|
|
iMSlow,
|
|
result //
|
|
);
|
|
}
|
|
|
|
//
|
|
// Long ...
|
|
if (method != XCHMA_ALL_BUT_LONG)
|
|
{
|
|
//
|
|
Add(
|
|
iLFast,
|
|
result //
|
|
);
|
|
|
|
//
|
|
Add(
|
|
iLSlow,
|
|
result //
|
|
);
|
|
}
|
|
|
|
//
|
|
// Hind ...
|
|
if (method != XCHMA_ALL_BUT_HIND)
|
|
{
|
|
//
|
|
Add(
|
|
iHFast,
|
|
result //
|
|
);
|
|
|
|
//
|
|
Add(
|
|
iHSlow,
|
|
result //
|
|
);
|
|
}
|
|
|
|
//
|
|
}
|
|
|
|
//
|
|
// Calculate Specific Cycle Conditions ...
|
|
void CalculateCycleConditions(
|
|
int barIndex,
|
|
double &fast[],
|
|
double &slow[],
|
|
XOHCL &cBar,
|
|
XOHCL &pBar,
|
|
double hhValue,
|
|
double llValue,
|
|
double minValue,
|
|
double minValuePrev,
|
|
double maxValue,
|
|
double maxValuePrev,
|
|
bool &isFastOverSlow,
|
|
bool &isFastCrossedOverSlow,
|
|
bool &isFastUnderSlow,
|
|
bool &isFastCrossedUnderSlow,
|
|
bool &isFastOverMax,
|
|
bool &isFastCrossedOverMax,
|
|
bool &isFastUnderMax,
|
|
bool &isFastCrossedUnderMax,
|
|
bool &isFastOverMin,
|
|
bool &isFastCrossedOverMin,
|
|
bool &isFastUnderMin,
|
|
bool &isFastCrossedUnderMin,
|
|
bool &isSlowOverMax,
|
|
bool &isSlowCrossedOverMax,
|
|
bool &isSlowUnderMax,
|
|
bool &isSlowCrossedUnderMax,
|
|
bool &isSlowOverMin,
|
|
bool &isSlowCrossedOverMin,
|
|
bool &isSlowUnderMin,
|
|
bool &isSlowCrossedUnderMin,
|
|
bool &isRetestFastSlow,
|
|
bool &isCLoseOverFast,
|
|
bool &isCloseCrossedOverFast,
|
|
bool &isCloseUnderFast,
|
|
bool &isCloseCrossedUnderFast,
|
|
bool &isCloseOverSlow,
|
|
bool &isCloseCrossedOverSlow,
|
|
bool &isCloseUnderSlow,
|
|
bool &isCloseCrossedUnderSlow //
|
|
)
|
|
{
|
|
//
|
|
int zIndex = barIndex;
|
|
int cIndex = zIndex + 1;
|
|
int pIndex = cIndex + 1;
|
|
int ppIndex = pIndex + 1;
|
|
|
|
//
|
|
isFastOverSlow = fast[cIndex] > slow[cIndex];
|
|
bool isFastOverSlowPrev = fast[pIndex] > slow[pIndex];
|
|
isFastCrossedOverSlow = isFastOverSlow &&
|
|
!isFastOverSlowPrev;
|
|
|
|
//
|
|
isFastUnderSlow = fast[cIndex] < slow[cIndex];
|
|
bool isFastUnderSlowPrev = fast[pIndex] < slow[pIndex];
|
|
isFastCrossedUnderSlow = isFastUnderSlow &&
|
|
!isFastUnderSlowPrev;
|
|
|
|
//
|
|
isFastOverMax = fast[cIndex] > maxValue;
|
|
bool isFastOverMaxPrev = fast[pIndex] > maxValuePrev;
|
|
isFastCrossedOverMax = isFastOverMax &&
|
|
!isFastOverMaxPrev;
|
|
|
|
//
|
|
isFastUnderMax = fast[cIndex] < maxValue;
|
|
bool isFastUnderMaxPrev = fast[pIndex] < maxValuePrev;
|
|
isFastCrossedUnderMax = isFastUnderMax &&
|
|
!isFastUnderMaxPrev;
|
|
|
|
//
|
|
isFastOverMin = fast[cIndex] > minValue;
|
|
bool isFastOverMinPrev = fast[pIndex] > minValuePrev;
|
|
isFastCrossedOverMin = isFastOverMin &&
|
|
!isFastOverMinPrev;
|
|
|
|
//
|
|
isFastUnderMin = fast[cIndex] > minValue;
|
|
bool isFastUnderMinPrev = fast[pIndex] > minValuePrev;
|
|
isFastCrossedUnderMin = isFastUnderMin &&
|
|
!isFastUnderMinPrev;
|
|
|
|
//
|
|
isSlowOverMax = slow[cIndex] > maxValue;
|
|
bool isSlowOverMaxPrev = slow[pIndex] > maxValuePrev;
|
|
isSlowCrossedOverMax = isSlowOverMax &&
|
|
!isSlowOverMaxPrev;
|
|
|
|
//
|
|
isSlowUnderMax = slow[cIndex] < maxValue;
|
|
bool isSlowUnderMaxPrev = slow[pIndex] < maxValuePrev;
|
|
isSlowCrossedUnderMax = isSlowUnderMax &&
|
|
!isSlowUnderMaxPrev;
|
|
|
|
//
|
|
isSlowOverMin = slow[cIndex] > minValue;
|
|
bool isSlowOverMinPrev = slow[pIndex] > minValuePrev;
|
|
isSlowCrossedOverMin = isSlowOverMin &&
|
|
!isSlowOverMinPrev;
|
|
|
|
//
|
|
isSlowUnderMin = slow[cIndex] < minValue;
|
|
bool isSlowUnderMinPrev = slow[pIndex] < minValuePrev;
|
|
isSlowCrossedUnderMin = isSlowUnderMin &&
|
|
!isSlowUnderMinPrev;
|
|
|
|
//
|
|
isRetestFastSlow =
|
|
//
|
|
// HH (s) ...
|
|
(
|
|
//
|
|
hhValue > MathMax(fast[1], slow[1]) ||
|
|
hhValue > MathMax(fast[2], slow[2]) ||
|
|
hhValue > MathMax(fast[3], slow[3]) ||
|
|
hhValue > MathMax(fast[4], slow[4])
|
|
//
|
|
)
|
|
//
|
|
&&
|
|
//
|
|
// LL (s) ...
|
|
(
|
|
//
|
|
llValue > MathMin(fast[1], slow[1]) ||
|
|
llValue > MathMin(fast[2], slow[2]) ||
|
|
llValue > MathMin(fast[3], slow[3]) ||
|
|
llValue > MathMin(fast[4], slow[4])
|
|
//
|
|
)
|
|
//
|
|
;
|
|
|
|
//
|
|
isCLoseOverFast = cBar.close > fast[cIndex];
|
|
bool isCLoseOverFastPrev = pBar.close > fast[pIndex];
|
|
isCloseCrossedOverFast = isCLoseOverFast &&
|
|
!isCLoseOverFastPrev;
|
|
|
|
//
|
|
isCloseUnderFast = cBar.close < fast[cIndex];
|
|
bool isCloseUnderFastPrev = pBar.close < fast[pIndex];
|
|
isCloseCrossedUnderFast = isCloseUnderFast &&
|
|
!isCloseUnderFastPrev;
|
|
|
|
//
|
|
isCloseOverSlow = cBar.close > slow[cIndex];
|
|
bool isCloseOverSlowPrev = pBar.close > slow[pIndex];
|
|
isCloseCrossedOverSlow = isCloseOverSlow &&
|
|
!isCloseOverSlowPrev;
|
|
|
|
//
|
|
isCloseUnderSlow = cBar.close < slow[cIndex];
|
|
bool isCloseUnderSlowPrev = pBar.close < slow[pIndex];
|
|
isCloseCrossedUnderSlow = isCloseUnderSlow &&
|
|
!isCloseUnderSlowPrev;
|
|
}
|
|
|
|
//
|
|
// Class ...
|
|
class XSCXCHMAHelper : public XSCBaseHelper
|
|
{
|
|
//
|
|
// Public ...
|
|
public:
|
|
//
|
|
// Props ...
|
|
|
|
//
|
|
// Constructors ...
|
|
XSCXCHMAHelper() : XSCBaseHelper(_Symbol, _Period)
|
|
{
|
|
}
|
|
|
|
//
|
|
// Deconstructor ...
|
|
~XSCXCHMAHelper()
|
|
{
|
|
//
|
|
Clean(fastBuffer);
|
|
Clean(slowBuffer);
|
|
Clean(cFastBuffer);
|
|
Clean(cSlowBuffer);
|
|
Clean(sFastBuffer);
|
|
Clean(sSlowBuffer);
|
|
Clean(mFastBuffer);
|
|
Clean(mSlowBuffer);
|
|
Clean(lFastBuffer);
|
|
Clean(lSlowBuffer);
|
|
Clean(hFastBuffer);
|
|
Clean(hSlowBuffer);
|
|
}
|
|
|
|
//
|
|
// Tools ...
|
|
bool Init(
|
|
string symbol, // Trading Symbol
|
|
ENUM_TIMEFRAMES period, // Trading Period
|
|
XCHMAInputs &inputs // Inputs
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
mSymbol = symbol;
|
|
mPeriod = period;
|
|
|
|
//
|
|
result = inputs.IsValid();
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
mInputs = inputs;
|
|
|
|
//
|
|
ArraySetAsSeries(fastBuffer, true);
|
|
ArraySetAsSeries(slowBuffer, true);
|
|
ArraySetAsSeries(cFastBuffer, true);
|
|
ArraySetAsSeries(cSlowBuffer, true);
|
|
ArraySetAsSeries(sFastBuffer, true);
|
|
ArraySetAsSeries(sSlowBuffer, true);
|
|
ArraySetAsSeries(mFastBuffer, true);
|
|
ArraySetAsSeries(mSlowBuffer, true);
|
|
ArraySetAsSeries(lFastBuffer, true);
|
|
ArraySetAsSeries(lSlowBuffer, true);
|
|
ArraySetAsSeries(hFastBuffer, true);
|
|
ArraySetAsSeries(hSlowBuffer, true);
|
|
|
|
//
|
|
mHandler = iCustom(
|
|
mSymbol,
|
|
mPeriod,
|
|
"x-saherelm.xchma",
|
|
//
|
|
// Inputs ...
|
|
//
|
|
// Market ...
|
|
"",
|
|
mInputs.fastLength,
|
|
mInputs.slowLength,
|
|
mInputs.method,
|
|
mInputs.appliedTo,
|
|
//
|
|
// Cycles ...
|
|
"",
|
|
//
|
|
// Short ...
|
|
"",
|
|
mInputs.scMethod,
|
|
mInputs.scPeriod,
|
|
//
|
|
// Medium ...
|
|
"",
|
|
mInputs.mcMethod,
|
|
mInputs.mcPeriod,
|
|
//
|
|
// Long ...
|
|
"",
|
|
mInputs.lcMethod,
|
|
mInputs.lcPeriod,
|
|
//
|
|
// Hind ...
|
|
"",
|
|
mInputs.hcMethod,
|
|
mInputs.hcPeriod,
|
|
//
|
|
// Presentation ...
|
|
"",
|
|
mInputs.showFast,
|
|
mInputs.showSlow,
|
|
//
|
|
mInputs.showCCFast,
|
|
mInputs.showCCSlow,
|
|
mInputs.showSCFast,
|
|
mInputs.showSCSlow,
|
|
mInputs.showMCFast,
|
|
mInputs.showMCSlow,
|
|
mInputs.showLCFast,
|
|
mInputs.showLCSlow,
|
|
mInputs.showHCFast,
|
|
mInputs.showHCSlow
|
|
//
|
|
);
|
|
result = mHandler != INVALID_HANDLE;
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Inputs ...
|
|
|
|
//
|
|
XCHMAInputs GetInputs()
|
|
{
|
|
return mInputs;
|
|
}
|
|
|
|
//
|
|
bool SetInputs(
|
|
XCHMAInputs &inputs // Configs
|
|
)
|
|
{
|
|
//
|
|
return Init(
|
|
mSymbol,
|
|
mPeriod,
|
|
inputs
|
|
//
|
|
);
|
|
}
|
|
|
|
//
|
|
// Buffers ...
|
|
|
|
//
|
|
// AVG ...
|
|
|
|
//
|
|
double GetFast(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
if (barIndex < 0)
|
|
{
|
|
barIndex = 0;
|
|
}
|
|
|
|
//
|
|
Calculate();
|
|
|
|
//
|
|
int count = ArraySize(fastBuffer);
|
|
if (barIndex >= count)
|
|
{
|
|
barIndex = count - 1;
|
|
}
|
|
|
|
//
|
|
return fastBuffer[barIndex];
|
|
}
|
|
|
|
//
|
|
// Copy Required Items ...
|
|
int CopyFast(
|
|
int start, // Start
|
|
int count, // Number of Items for read
|
|
double &buffer[], // Dest Buffer
|
|
bool forceClean = true // Force To Clean buffer
|
|
)
|
|
{
|
|
//
|
|
// Update Calculations ...
|
|
Calculate();
|
|
|
|
//
|
|
// Copy Items ...
|
|
return Copy(
|
|
start,
|
|
count,
|
|
fastBuffer,
|
|
buffer,
|
|
forceClean
|
|
//
|
|
);
|
|
}
|
|
|
|
//
|
|
double GetSlow(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
if (barIndex < 0)
|
|
{
|
|
barIndex = 0;
|
|
}
|
|
|
|
//
|
|
Calculate();
|
|
|
|
//
|
|
int count = ArraySize(slowBuffer);
|
|
if (barIndex >= count)
|
|
{
|
|
barIndex = count - 1;
|
|
}
|
|
|
|
//
|
|
return slowBuffer[barIndex];
|
|
}
|
|
|
|
//
|
|
// Copy Required Items ...
|
|
int CopySlow(
|
|
int start, // Start
|
|
int count, // Number of Items for read
|
|
double &buffer[], // Dest Buffer
|
|
bool forceClean = true // Force To Clean buffer
|
|
)
|
|
{
|
|
//
|
|
// Update Calculations ...
|
|
Calculate();
|
|
|
|
//
|
|
// Copy Items ...
|
|
return Copy(
|
|
start,
|
|
count,
|
|
slowBuffer,
|
|
buffer,
|
|
forceClean
|
|
//
|
|
);
|
|
}
|
|
|
|
//
|
|
// Current ...
|
|
|
|
//
|
|
double GetCFast(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
if (barIndex < 0)
|
|
{
|
|
barIndex = 0;
|
|
}
|
|
|
|
//
|
|
Calculate();
|
|
|
|
//
|
|
int count = ArraySize(cFastBuffer);
|
|
if (barIndex >= count)
|
|
{
|
|
barIndex = count - 1;
|
|
}
|
|
|
|
//
|
|
return cFastBuffer[barIndex];
|
|
}
|
|
|
|
//
|
|
// Copy Required Items ...
|
|
int CopyCFast(
|
|
int start, // Start
|
|
int count, // Number of Items for read
|
|
double &buffer[], // Dest Buffer
|
|
bool forceClean = true // Force To Clean buffer
|
|
)
|
|
{
|
|
//
|
|
// Update Calculations ...
|
|
Calculate();
|
|
|
|
//
|
|
// Copy Items ...
|
|
return Copy(
|
|
start,
|
|
count,
|
|
cFastBuffer,
|
|
buffer,
|
|
forceClean
|
|
//
|
|
);
|
|
}
|
|
|
|
//
|
|
double GetCSlow(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
if (barIndex < 0)
|
|
{
|
|
barIndex = 0;
|
|
}
|
|
|
|
//
|
|
Calculate();
|
|
|
|
//
|
|
int count = ArraySize(cSlowBuffer);
|
|
if (barIndex >= count)
|
|
{
|
|
barIndex = count - 1;
|
|
}
|
|
|
|
//
|
|
return cSlowBuffer[barIndex];
|
|
}
|
|
|
|
//
|
|
// Copy Required Items ...
|
|
int CopyCSlow(
|
|
int start, // Start
|
|
int count, // Number of Items for read
|
|
double &buffer[], // Dest Buffer
|
|
bool forceClean = true // Force To Clean buffer
|
|
)
|
|
{
|
|
//
|
|
// Update Calculations ...
|
|
Calculate();
|
|
|
|
//
|
|
// Copy Items ...
|
|
return Copy(
|
|
start,
|
|
count,
|
|
cSlowBuffer,
|
|
buffer,
|
|
forceClean
|
|
//
|
|
);
|
|
}
|
|
|
|
//
|
|
// Short ...
|
|
|
|
//
|
|
double GetSFast(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
if (barIndex < 0)
|
|
{
|
|
barIndex = 0;
|
|
}
|
|
|
|
//
|
|
Calculate();
|
|
|
|
//
|
|
int count = ArraySize(sFastBuffer);
|
|
if (barIndex >= count)
|
|
{
|
|
barIndex = count - 1;
|
|
}
|
|
|
|
//
|
|
return sFastBuffer[barIndex];
|
|
}
|
|
|
|
//
|
|
// Copy Required Items ...
|
|
int CopySFast(
|
|
int start, // Start
|
|
int count, // Number of Items for read
|
|
double &buffer[], // Dest Buffer
|
|
bool forceClean = true // Force To Clean buffer
|
|
)
|
|
{
|
|
//
|
|
// Update Calculations ...
|
|
Calculate();
|
|
|
|
//
|
|
// Copy Items ...
|
|
return Copy(
|
|
start,
|
|
count,
|
|
sFastBuffer,
|
|
buffer,
|
|
forceClean
|
|
//
|
|
);
|
|
}
|
|
|
|
//
|
|
double GetSSlow(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
if (barIndex < 0)
|
|
{
|
|
barIndex = 0;
|
|
}
|
|
|
|
//
|
|
Calculate();
|
|
|
|
//
|
|
int count = ArraySize(sSlowBuffer);
|
|
if (barIndex >= count)
|
|
{
|
|
barIndex = count - 1;
|
|
}
|
|
|
|
//
|
|
return sSlowBuffer[barIndex];
|
|
}
|
|
|
|
//
|
|
// Copy Required Items ...
|
|
int CopySSlow(
|
|
int start, // Start
|
|
int count, // Number of Items for read
|
|
double &buffer[], // Dest Buffer
|
|
bool forceClean = true // Force To Clean buffer
|
|
)
|
|
{
|
|
//
|
|
// Update Calculations ...
|
|
Calculate();
|
|
|
|
//
|
|
// Copy Items ...
|
|
return Copy(
|
|
start,
|
|
count,
|
|
sSlowBuffer,
|
|
buffer,
|
|
forceClean
|
|
//
|
|
);
|
|
}
|
|
|
|
//
|
|
// Medium ...
|
|
|
|
//
|
|
double GetMFast(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
if (barIndex < 0)
|
|
{
|
|
barIndex = 0;
|
|
}
|
|
|
|
//
|
|
Calculate();
|
|
|
|
//
|
|
int count = ArraySize(mFastBuffer);
|
|
if (barIndex >= count)
|
|
{
|
|
barIndex = count - 1;
|
|
}
|
|
|
|
//
|
|
return mFastBuffer[barIndex];
|
|
}
|
|
|
|
//
|
|
// Copy Required Items ...
|
|
int CopyMFast(
|
|
int start, // Start
|
|
int count, // Number of Items for read
|
|
double &buffer[], // Dest Buffer
|
|
bool forceClean = true // Force To Clean buffer
|
|
)
|
|
{
|
|
//
|
|
// Update Calculations ...
|
|
Calculate();
|
|
|
|
//
|
|
// Copy Items ...
|
|
return Copy(
|
|
start,
|
|
count,
|
|
mFastBuffer,
|
|
buffer,
|
|
forceClean
|
|
//
|
|
);
|
|
}
|
|
|
|
//
|
|
double GetMSlow(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
if (barIndex < 0)
|
|
{
|
|
barIndex = 0;
|
|
}
|
|
|
|
//
|
|
Calculate();
|
|
|
|
//
|
|
int count = ArraySize(mSlowBuffer);
|
|
if (barIndex >= count)
|
|
{
|
|
barIndex = count - 1;
|
|
}
|
|
|
|
//
|
|
return mSlowBuffer[barIndex];
|
|
}
|
|
|
|
//
|
|
// Copy Required Items ...
|
|
int CopyMSlow(
|
|
int start, // Start
|
|
int count, // Number of Items for read
|
|
double &buffer[], // Dest Buffer
|
|
bool forceClean = true // Force To Clean buffer
|
|
)
|
|
{
|
|
//
|
|
// Update Calculations ...
|
|
Calculate();
|
|
|
|
//
|
|
// Copy Items ...
|
|
return Copy(
|
|
start,
|
|
count,
|
|
mSlowBuffer,
|
|
buffer,
|
|
forceClean
|
|
//
|
|
);
|
|
}
|
|
|
|
//
|
|
// Long ...
|
|
|
|
//
|
|
double GetLFast(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
if (barIndex < 0)
|
|
{
|
|
barIndex = 0;
|
|
}
|
|
|
|
//
|
|
Calculate();
|
|
|
|
//
|
|
int count = ArraySize(lFastBuffer);
|
|
if (barIndex >= count)
|
|
{
|
|
barIndex = count - 1;
|
|
}
|
|
|
|
//
|
|
return lFastBuffer[barIndex];
|
|
}
|
|
|
|
//
|
|
// Copy Required Items ...
|
|
int CopyLFast(
|
|
int start, // Start
|
|
int count, // Number of Items for read
|
|
double &buffer[], // Dest Buffer
|
|
bool forceClean = true // Force To Clean buffer
|
|
)
|
|
{
|
|
//
|
|
// Update Calculations ...
|
|
Calculate();
|
|
|
|
//
|
|
// Copy Items ...
|
|
return Copy(
|
|
start,
|
|
count,
|
|
lFastBuffer,
|
|
buffer,
|
|
forceClean
|
|
//
|
|
);
|
|
}
|
|
|
|
//
|
|
double GetLSlow(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
if (barIndex < 0)
|
|
{
|
|
barIndex = 0;
|
|
}
|
|
|
|
//
|
|
Calculate();
|
|
|
|
//
|
|
int count = ArraySize(lSlowBuffer);
|
|
if (barIndex >= count)
|
|
{
|
|
barIndex = count - 1;
|
|
}
|
|
|
|
//
|
|
return lSlowBuffer[barIndex];
|
|
}
|
|
|
|
//
|
|
// Copy Required Items ...
|
|
int CopyLSlow(
|
|
int start, // Start
|
|
int count, // Number of Items for read
|
|
double &buffer[], // Dest Buffer
|
|
bool forceClean = true // Force To Clean buffer
|
|
)
|
|
{
|
|
//
|
|
// Update Calculations ...
|
|
Calculate();
|
|
|
|
//
|
|
// Copy Items ...
|
|
return Copy(
|
|
start,
|
|
count,
|
|
lSlowBuffer,
|
|
buffer,
|
|
forceClean
|
|
//
|
|
);
|
|
}
|
|
|
|
//
|
|
// Hind ...
|
|
|
|
//
|
|
double GetHFast(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
if (barIndex < 0)
|
|
{
|
|
barIndex = 0;
|
|
}
|
|
|
|
//
|
|
Calculate();
|
|
|
|
//
|
|
int count = ArraySize(hFastBuffer);
|
|
if (barIndex >= count)
|
|
{
|
|
barIndex = count - 1;
|
|
}
|
|
|
|
//
|
|
return hFastBuffer[barIndex];
|
|
}
|
|
|
|
//
|
|
// Copy Required Items ...
|
|
int CopyHFast(
|
|
int start, // Start
|
|
int count, // Number of Items for read
|
|
double &buffer[], // Dest Buffer
|
|
bool forceClean = true // Force To Clean buffer
|
|
)
|
|
{
|
|
//
|
|
// Update Calculations ...
|
|
Calculate();
|
|
|
|
//
|
|
// Copy Items ...
|
|
return Copy(
|
|
start,
|
|
count,
|
|
hFastBuffer,
|
|
buffer,
|
|
forceClean
|
|
//
|
|
);
|
|
}
|
|
|
|
//
|
|
double GetHSlow(
|
|
int barIndex // Bar Index
|
|
)
|
|
{
|
|
//
|
|
if (barIndex < 0)
|
|
{
|
|
barIndex = 0;
|
|
}
|
|
|
|
//
|
|
Calculate();
|
|
|
|
//
|
|
int count = ArraySize(hSlowBuffer);
|
|
if (barIndex >= count)
|
|
{
|
|
barIndex = count - 1;
|
|
}
|
|
|
|
//
|
|
return hSlowBuffer[barIndex];
|
|
}
|
|
|
|
//
|
|
// Copy Required Items ...
|
|
int CopyHSlow(
|
|
int start, // Start
|
|
int count, // Number of Items for read
|
|
double &buffer[], // Dest Buffer
|
|
bool forceClean = true // Force To Clean buffer
|
|
)
|
|
{
|
|
//
|
|
// Update Calculations ...
|
|
Calculate();
|
|
|
|
//
|
|
// Copy Items ...
|
|
return Copy(
|
|
start,
|
|
count,
|
|
hSlowBuffer,
|
|
buffer,
|
|
forceClean
|
|
//
|
|
);
|
|
}
|
|
|
|
//
|
|
bool GetConditions(
|
|
XCHMAConditions &conditions, //
|
|
int barIndex = 0, //
|
|
int loopback = 3 //
|
|
)
|
|
{
|
|
//
|
|
bool result = true;
|
|
|
|
//
|
|
if (loopback < 3)
|
|
{
|
|
loopback = 3;
|
|
}
|
|
|
|
//
|
|
conditions.Clean();
|
|
|
|
//
|
|
conditions.symbol = mSymbol;
|
|
conditions.period = mPeriod;
|
|
conditions.time = TimeCurrent();
|
|
|
|
//
|
|
int zIndex = barIndex;
|
|
int cIndex = zIndex + 1;
|
|
int pIndex = cIndex + 1;
|
|
int ppIndex = pIndex + 1;
|
|
|
|
//
|
|
// Buffers ...
|
|
|
|
//
|
|
// AVG ...
|
|
|
|
//
|
|
// Fast ...
|
|
CopyFast(
|
|
zIndex,
|
|
loopback,
|
|
conditions.fast //
|
|
);
|
|
|
|
//
|
|
// Slow ...
|
|
CopySlow(
|
|
zIndex,
|
|
loopback,
|
|
conditions.slow //
|
|
);
|
|
|
|
//
|
|
// Current ...
|
|
|
|
//
|
|
// Fast ...
|
|
CopyCFast(
|
|
zIndex,
|
|
loopback,
|
|
conditions.cFast //
|
|
);
|
|
|
|
//
|
|
// Slow ...
|
|
CopyCSlow(
|
|
zIndex,
|
|
loopback,
|
|
conditions.cSlow //
|
|
);
|
|
|
|
//
|
|
// Short ...
|
|
|
|
//
|
|
// Fast ...
|
|
CopySFast(
|
|
zIndex,
|
|
loopback,
|
|
conditions.sFast //
|
|
);
|
|
|
|
//
|
|
// Slow ...
|
|
CopySSlow(
|
|
zIndex,
|
|
loopback,
|
|
conditions.sSlow //
|
|
);
|
|
|
|
//
|
|
// Medium ...
|
|
|
|
//
|
|
// Fast ...
|
|
CopyMFast(
|
|
zIndex,
|
|
loopback,
|
|
conditions.mFast //
|
|
);
|
|
|
|
//
|
|
// Slow ...
|
|
CopyMSlow(
|
|
zIndex,
|
|
loopback,
|
|
conditions.mSlow //
|
|
);
|
|
|
|
//
|
|
// Long ...
|
|
|
|
//
|
|
// Fast ...
|
|
CopyLFast(
|
|
zIndex,
|
|
loopback,
|
|
conditions.lFast //
|
|
);
|
|
|
|
//
|
|
// Slow ...
|
|
CopyLSlow(
|
|
zIndex,
|
|
loopback,
|
|
conditions.lSlow //
|
|
);
|
|
|
|
//
|
|
// Hind ...
|
|
|
|
//
|
|
// Fast ...
|
|
CopyHFast(
|
|
zIndex,
|
|
loopback,
|
|
conditions.hFast //
|
|
);
|
|
|
|
//
|
|
// Slow ...
|
|
CopyHSlow(
|
|
zIndex,
|
|
loopback,
|
|
conditions.hSlow //
|
|
);
|
|
|
|
//
|
|
// Conditions ...
|
|
|
|
//
|
|
XOHCL cBar;
|
|
result = cBar.Init(
|
|
mSymbol,
|
|
mPeriod,
|
|
cIndex //
|
|
);
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
XOHCL pBar;
|
|
result = pBar.Init(
|
|
mSymbol,
|
|
mPeriod,
|
|
pIndex //
|
|
);
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
double hhValue = pBar.FindHighest(
|
|
loopback,
|
|
MODE_HIGH //
|
|
);
|
|
double llValue = pBar.FindLowest(
|
|
loopback,
|
|
MODE_LOW //
|
|
);
|
|
|
|
//
|
|
XOHCL ppBar;
|
|
result = ppBar.Init(
|
|
mSymbol,
|
|
mPeriod,
|
|
ppIndex //
|
|
);
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
double phhValue = ppBar.FindHighest(
|
|
loopback * 2,
|
|
MODE_HIGH //
|
|
);
|
|
double pllValue = ppBar.FindLowest(
|
|
loopback * 2,
|
|
MODE_LOW //
|
|
);
|
|
|
|
//
|
|
double allValues[];
|
|
double maxValue = 0;
|
|
double minValue = 0;
|
|
double maxValuePrev = 0;
|
|
double minValuePrev = 0;
|
|
|
|
//
|
|
// AVG ...
|
|
|
|
//
|
|
FillCHMAValues(
|
|
allValues,
|
|
conditions,
|
|
XCHMA_ALL_BUT_AVG,
|
|
cIndex //
|
|
);
|
|
minValue = GetMin(allValues);
|
|
maxValue = GetMax(allValues);
|
|
|
|
//
|
|
FillCHMAValues(
|
|
allValues,
|
|
conditions,
|
|
XCHMA_ALL_BUT_AVG,
|
|
pIndex //
|
|
);
|
|
minValuePrev = GetMin(allValues);
|
|
maxValuePrev = GetMax(allValues);
|
|
|
|
//
|
|
bool isFastOverSlow = false;
|
|
bool isFastCrossedOverSlow = false;
|
|
bool isFastUnderSlow = false;
|
|
bool isFastCrossedUnderSlow = false;
|
|
bool isFastOverMax = false;
|
|
bool isFastCrossedOverMax = false;
|
|
bool isFastUnderMax = false;
|
|
bool isFastCrossedUnderMax = false;
|
|
bool isFastOverMin = false;
|
|
bool isFastCrossedOverMin = false;
|
|
bool isFastUnderMin = false;
|
|
bool isFastCrossedUnderMin = false;
|
|
bool isSlowOverMax = false;
|
|
bool isSlowCrossedOverMax = false;
|
|
bool isSlowUnderMax = false;
|
|
bool isSlowCrossedUnderMax = false;
|
|
bool isSlowOverMin = false;
|
|
bool isSlowCrossedOverMin = false;
|
|
bool isSlowUnderMin = false;
|
|
bool isSlowCrossedUnderMin = false;
|
|
bool isRetestFastSlow = false;
|
|
bool isCLoseOverFast = false;
|
|
bool isCloseCrossedOverFast = false;
|
|
bool isCloseUnderFast = false;
|
|
bool isCloseCrossedUnderFast = false;
|
|
bool isCloseOverSlow = false;
|
|
bool isCloseCrossedOverSlow = false;
|
|
bool isCloseUnderSlow = false;
|
|
bool isCloseCrossedUnderSlow = false;
|
|
|
|
//
|
|
CalculateCycleConditions(
|
|
barIndex,
|
|
conditions.fast,
|
|
conditions.slow,
|
|
cBar,
|
|
pBar,
|
|
hhValue,
|
|
llValue,
|
|
minValue,
|
|
minValuePrev,
|
|
maxValue,
|
|
maxValuePrev,
|
|
isFastOverSlow,
|
|
isFastCrossedOverSlow,
|
|
isFastUnderSlow,
|
|
isFastCrossedUnderSlow,
|
|
isFastOverMax,
|
|
isFastCrossedOverMax,
|
|
isFastUnderMax,
|
|
isFastCrossedUnderMax,
|
|
isFastOverMin,
|
|
isFastCrossedOverMin,
|
|
isFastUnderMin,
|
|
isFastCrossedUnderMin,
|
|
isSlowOverMax,
|
|
isSlowCrossedOverMax,
|
|
isSlowUnderMax,
|
|
isSlowCrossedUnderMax,
|
|
isSlowOverMin,
|
|
isSlowCrossedOverMin,
|
|
isSlowUnderMin,
|
|
isSlowCrossedUnderMin,
|
|
isRetestFastSlow,
|
|
isCLoseOverFast,
|
|
isCloseCrossedOverFast,
|
|
isCloseUnderFast,
|
|
isCloseCrossedUnderFast,
|
|
isCloseOverSlow,
|
|
isCloseCrossedOverSlow,
|
|
isCloseUnderSlow,
|
|
isCloseCrossedUnderSlow
|
|
//
|
|
);
|
|
|
|
//
|
|
// Calculate Support and Resistance Behaviour for Fast and Slow ...
|
|
|
|
//
|
|
// Supports Happens when Lowest Low of atleast n Number of Bars
|
|
// are above line ...
|
|
bool isFastSupport = pllValue > conditions.fast[ppIndex];
|
|
bool isSlowSupport = pllValue > conditions.slow[ppIndex];
|
|
|
|
//
|
|
// Resistance Happens when Highest High of atleast n NUmber of Bars
|
|
// are below line ...
|
|
bool isFastResistance = phhValue < conditions.fast[ppIndex];
|
|
bool isSlowResistance = phhValue < conditions.slow[ppIndex];
|
|
|
|
//
|
|
// Rejection occure by Shaddows ...
|
|
// this mean Previous Bar Shadows breaked Line but Close doesnt make sense ...
|
|
// price rejected ...
|
|
|
|
//
|
|
bool isRejectedFastAsSupport =
|
|
//
|
|
!isFastSupport
|
|
? false
|
|
: (
|
|
//
|
|
// Check Bar State ...
|
|
(ppBar.low > conditions.fast[ppIndex])
|
|
//
|
|
&&
|
|
//
|
|
// Check Shadow Break ...
|
|
(pBar.high > conditions.fast[pIndex] &&
|
|
//
|
|
// Touch ...
|
|
pBar.low < conditions.fast[pIndex])
|
|
//
|
|
&&
|
|
//
|
|
// Check Close Bar for Rejection ...
|
|
(cBar.close > conditions.fast[cIndex] &&
|
|
cBar.IsBullish())
|
|
//
|
|
)
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isRejectedSlowAsSupport =
|
|
//
|
|
!isSlowSupport
|
|
? false
|
|
: (
|
|
//
|
|
// Check Bar State ...
|
|
(ppBar.low > conditions.slow[ppIndex])
|
|
//
|
|
&&
|
|
//
|
|
// Check Shadow Break ...
|
|
(pBar.high > conditions.slow[pIndex] &&
|
|
//
|
|
// Touch ...
|
|
pBar.low < conditions.slow[pIndex])
|
|
//
|
|
&&
|
|
//
|
|
// Check Close Bar for Rejection ...
|
|
(cBar.close > conditions.slow[cIndex] &&
|
|
cBar.IsBullish())
|
|
//
|
|
)
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isRejectedFastAsResistance =
|
|
//
|
|
!isFastResistance
|
|
? false
|
|
: (
|
|
//
|
|
// Check Bar State ...
|
|
(ppBar.high < conditions.fast[ppIndex])
|
|
//
|
|
&&
|
|
//
|
|
// Check Shadow Break ...
|
|
(pBar.low < conditions.fast[pIndex] &&
|
|
//
|
|
// Touch ...
|
|
pBar.high > conditions.fast[pIndex])
|
|
//
|
|
&&
|
|
//
|
|
// Check Close Bar for Rejection ...
|
|
(cBar.close < conditions.fast[cIndex] &&
|
|
cBar.IsBearish())
|
|
//
|
|
)
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isRejectedSlowAsResistance =
|
|
//
|
|
!isSlowResistance
|
|
? false
|
|
: (
|
|
//
|
|
// Check Bar State ...
|
|
(ppBar.high < conditions.slow[ppIndex])
|
|
//
|
|
&&
|
|
//
|
|
// Check Shadow Break ...
|
|
(pBar.low < conditions.slow[pIndex] &&
|
|
//
|
|
// Touch ...
|
|
pBar.high > conditions.slow[pIndex])
|
|
//
|
|
&&
|
|
//
|
|
// Check Close Bar for Rejection ...
|
|
(cBar.close < conditions.slow[cIndex] &&
|
|
cBar.IsBearish())
|
|
//
|
|
)
|
|
//
|
|
;
|
|
|
|
//
|
|
// Breakes occures by Price Close ...
|
|
// this means Previous Bar Close in One Side of line and next Close on another Side ...
|
|
// also Fibo 0.5 of Candle Body appears on opposit side ...
|
|
|
|
//
|
|
bool isBreakedFastAsSupport =
|
|
//
|
|
!isFastSupport
|
|
? false
|
|
: (
|
|
//
|
|
// Check Bar State ...
|
|
(ppBar.low > conditions.fast[ppIndex])
|
|
//
|
|
&&
|
|
//
|
|
// Check Shadow Break ...
|
|
(pBar.high > conditions.fast[pIndex] &&
|
|
//
|
|
// Touch ...
|
|
pBar.low < conditions.fast[pIndex] &&
|
|
//
|
|
// Calculate 50% ...
|
|
(conditions.fast[pIndex] - pBar.GetDown() > (pBar.GetBody() / 100) * 50))
|
|
//
|
|
&&
|
|
//
|
|
// Check Close Bar for Breakout ...
|
|
(cBar.close < conditions.fast[cIndex] &&
|
|
cBar.IsBearish())
|
|
//
|
|
)
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isBreakedSlowAsSupport =
|
|
//
|
|
!isSlowSupport
|
|
? false
|
|
: (
|
|
//
|
|
// Check Bar State ...
|
|
(ppBar.low > conditions.slow[ppIndex])
|
|
//
|
|
&&
|
|
//
|
|
// Check Shadow Break ...
|
|
(pBar.high > conditions.slow[pIndex] &&
|
|
//
|
|
// Touch ...
|
|
pBar.low < conditions.slow[pIndex] &&
|
|
//
|
|
// Calculate 50% ...
|
|
(conditions.slow[pIndex] - pBar.GetDown() > (pBar.GetBody() / 100) * 50))
|
|
//
|
|
&&
|
|
//
|
|
// Check Close Bar for Breakout ...
|
|
(cBar.close < conditions.slow[cIndex] &&
|
|
cBar.IsBearish())
|
|
//
|
|
)
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isBreakedFastAsResistance =
|
|
//
|
|
!isFastResistance
|
|
? false
|
|
: (
|
|
//
|
|
// Check Bar State ...
|
|
(ppBar.high < conditions.fast[ppIndex])
|
|
//
|
|
&&
|
|
//
|
|
// Check Shadow Break ...
|
|
(pBar.low < conditions.fast[pIndex] &&
|
|
//
|
|
// Touch ...
|
|
pBar.high > conditions.fast[pIndex] &&
|
|
//
|
|
// Calculate 50% ...
|
|
(pBar.GetUp() - conditions.fast[pIndex] > (pBar.GetBody() / 100) * 50))
|
|
//
|
|
&&
|
|
//
|
|
// Check Close Bar for Breakout ...
|
|
(cBar.close > conditions.fast[cIndex] &&
|
|
cBar.IsBullish())
|
|
//
|
|
)
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isBreakedSlowAsResistance =
|
|
//
|
|
!isSlowResistance
|
|
? false
|
|
: (
|
|
//
|
|
// Check Bar State ...
|
|
(ppBar.high < conditions.slow[ppIndex])
|
|
//
|
|
&&
|
|
//
|
|
// Check Shadow Break ...
|
|
(pBar.low < conditions.slow[pIndex] &&
|
|
//
|
|
// Touch ...
|
|
pBar.high > conditions.slow[pIndex] &&
|
|
//
|
|
// Calculate 50% ...
|
|
(pBar.GetUp() - conditions.slow[pIndex] > (pBar.GetBody() / 100) * 50))
|
|
//
|
|
&&
|
|
//
|
|
// Check Close Bar for Breakout ...
|
|
(cBar.close > conditions.slow[cIndex] &&
|
|
cBar.IsBullish())
|
|
//
|
|
)
|
|
//
|
|
;
|
|
|
|
//
|
|
// Current ...
|
|
|
|
//
|
|
FillCHMAValues(
|
|
allValues,
|
|
conditions,
|
|
XCHMA_ALL_BUT_CURRENT,
|
|
cIndex //
|
|
);
|
|
minValue = GetMin(allValues);
|
|
maxValue = GetMax(allValues);
|
|
|
|
//
|
|
FillCHMAValues(
|
|
allValues,
|
|
conditions,
|
|
XCHMA_ALL_BUT_CURRENT,
|
|
pIndex //
|
|
);
|
|
minValuePrev = GetMin(allValues);
|
|
maxValuePrev = GetMax(allValues);
|
|
|
|
//
|
|
bool isCFastOverSlow = false;
|
|
bool isCFastCrossedOverSlow = false;
|
|
bool isCFastUnderSlow = false;
|
|
bool isCFastCrossedUnderSlow = false;
|
|
bool isCFastOverMax = false;
|
|
bool isCFastCrossedOverMax = false;
|
|
bool isCFastUnderMax = false;
|
|
bool isCFastCrossedUnderMax = false;
|
|
bool isCFastOverMin = false;
|
|
bool isCFastCrossedOverMin = false;
|
|
bool isCFastUnderMin = false;
|
|
bool isCFastCrossedUnderMin = false;
|
|
bool isCSlowOverMax = false;
|
|
bool isCSlowCrossedOverMax = false;
|
|
bool isCSlowUnderMax = false;
|
|
bool isCSlowCrossedUnderMax = false;
|
|
bool isCSlowOverMin = false;
|
|
bool isCSlowCrossedOverMin = false;
|
|
bool isCSlowUnderMin = false;
|
|
bool isCSlowCrossedUnderMin = false;
|
|
bool isRetestCFastSlow = false;
|
|
bool isCLoseOverCFast = false;
|
|
bool isCloseCrossedOverCFast = false;
|
|
bool isCloseUnderCFast = false;
|
|
bool isCloseCrossedUnderCFast = false;
|
|
bool isCloseOverCSlow = false;
|
|
bool isCloseCrossedOverCSlow = false;
|
|
bool isCloseUnderCSlow = false;
|
|
bool isCloseCrossedUnderCSlow = false;
|
|
|
|
//
|
|
CalculateCycleConditions(
|
|
barIndex,
|
|
conditions.cFast,
|
|
conditions.cSlow,
|
|
cBar,
|
|
pBar,
|
|
hhValue,
|
|
llValue,
|
|
minValue,
|
|
minValuePrev,
|
|
maxValue,
|
|
maxValuePrev,
|
|
isCFastOverSlow,
|
|
isCFastCrossedOverSlow,
|
|
isCFastUnderSlow,
|
|
isCFastCrossedUnderSlow,
|
|
isCFastOverMax,
|
|
isCFastCrossedOverMax,
|
|
isCFastUnderMax,
|
|
isCFastCrossedUnderMax,
|
|
isCFastOverMin,
|
|
isCFastCrossedOverMin,
|
|
isCFastUnderMin,
|
|
isCFastCrossedUnderMin,
|
|
isCSlowOverMax,
|
|
isCSlowCrossedOverMax,
|
|
isCSlowUnderMax,
|
|
isCSlowCrossedUnderMax,
|
|
isCSlowOverMin,
|
|
isCSlowCrossedOverMin,
|
|
isCSlowUnderMin,
|
|
isCSlowCrossedUnderMin,
|
|
isRetestCFastSlow,
|
|
isCLoseOverCFast,
|
|
isCloseCrossedOverCFast,
|
|
isCloseUnderCFast,
|
|
isCloseCrossedUnderCFast,
|
|
isCloseOverCSlow,
|
|
isCloseCrossedOverCSlow,
|
|
isCloseUnderCSlow,
|
|
isCloseCrossedUnderCSlow
|
|
//
|
|
);
|
|
|
|
//
|
|
// Short ...
|
|
|
|
//
|
|
FillCHMAValues(
|
|
allValues,
|
|
conditions,
|
|
XCHMA_ALL_BUT_SHORT,
|
|
cIndex //
|
|
);
|
|
minValue = GetMin(allValues);
|
|
maxValue = GetMax(allValues);
|
|
|
|
//
|
|
FillCHMAValues(
|
|
allValues,
|
|
conditions,
|
|
XCHMA_ALL_BUT_SHORT,
|
|
pIndex //
|
|
);
|
|
minValuePrev = GetMin(allValues);
|
|
maxValuePrev = GetMax(allValues);
|
|
|
|
//
|
|
bool isSFastOverSlow = false;
|
|
bool isSFastCrossedOverSlow = false;
|
|
bool isSFastUnderSlow = false;
|
|
bool isSFastCrossedUnderSlow = false;
|
|
bool isSFastOverMax = false;
|
|
bool isSFastCrossedOverMax = false;
|
|
bool isSFastUnderMax = false;
|
|
bool isSFastCrossedUnderMax = false;
|
|
bool isSFastOverMin = false;
|
|
bool isSFastCrossedOverMin = false;
|
|
bool isSFastUnderMin = false;
|
|
bool isSFastCrossedUnderMin = false;
|
|
bool isSSlowOverMax = false;
|
|
bool isSSlowCrossedOverMax = false;
|
|
bool isSSlowUnderMax = false;
|
|
bool isSSlowCrossedUnderMax = false;
|
|
bool isSSlowOverMin = false;
|
|
bool isSSlowCrossedOverMin = false;
|
|
bool isSSlowUnderMin = false;
|
|
bool isSSlowCrossedUnderMin = false;
|
|
bool isRetestSFastSlow = false;
|
|
bool isCLoseOverSFast = false;
|
|
bool isCloseCrossedOverSFast = false;
|
|
bool isCloseUnderSFast = false;
|
|
bool isCloseCrossedUnderSFast = false;
|
|
bool isCloseOverSSlow = false;
|
|
bool isCloseCrossedOverSSlow = false;
|
|
bool isCloseUnderSSlow = false;
|
|
bool isCloseCrossedUnderSSlow = false;
|
|
|
|
//
|
|
CalculateCycleConditions(
|
|
barIndex,
|
|
conditions.sFast,
|
|
conditions.sSlow,
|
|
cBar,
|
|
pBar,
|
|
hhValue,
|
|
llValue,
|
|
minValue,
|
|
minValuePrev,
|
|
maxValue,
|
|
maxValuePrev,
|
|
isSFastOverSlow,
|
|
isSFastCrossedOverSlow,
|
|
isSFastUnderSlow,
|
|
isSFastCrossedUnderSlow,
|
|
isSFastOverMax,
|
|
isSFastCrossedOverMax,
|
|
isSFastUnderMax,
|
|
isSFastCrossedUnderMax,
|
|
isSFastOverMin,
|
|
isSFastCrossedOverMin,
|
|
isSFastUnderMin,
|
|
isSFastCrossedUnderMin,
|
|
isSSlowOverMax,
|
|
isSSlowCrossedOverMax,
|
|
isSSlowUnderMax,
|
|
isSSlowCrossedUnderMax,
|
|
isSSlowOverMin,
|
|
isSSlowCrossedOverMin,
|
|
isSSlowUnderMin,
|
|
isSSlowCrossedUnderMin,
|
|
isRetestSFastSlow,
|
|
isCLoseOverSFast,
|
|
isCloseCrossedOverSFast,
|
|
isCloseUnderSFast,
|
|
isCloseCrossedUnderSFast,
|
|
isCloseOverSSlow,
|
|
isCloseCrossedOverSSlow,
|
|
isCloseUnderSSlow,
|
|
isCloseCrossedUnderSSlow
|
|
//
|
|
);
|
|
|
|
//
|
|
// Medium ...
|
|
|
|
//
|
|
FillCHMAValues(
|
|
allValues,
|
|
conditions,
|
|
XCHMA_ALL_BUT_MEDIUM,
|
|
cIndex //
|
|
);
|
|
minValue = GetMin(allValues);
|
|
maxValue = GetMax(allValues);
|
|
|
|
//
|
|
FillCHMAValues(
|
|
allValues,
|
|
conditions,
|
|
XCHMA_ALL_BUT_MEDIUM,
|
|
pIndex //
|
|
);
|
|
minValuePrev = GetMin(allValues);
|
|
maxValuePrev = GetMax(allValues);
|
|
|
|
//
|
|
bool isMFastOverSlow = false;
|
|
bool isMFastCrossedOverSlow = false;
|
|
bool isMFastUnderSlow = false;
|
|
bool isMFastCrossedUnderSlow = false;
|
|
bool isMFastOverMax = false;
|
|
bool isMFastCrossedOverMax = false;
|
|
bool isMFastUnderMax = false;
|
|
bool isMFastCrossedUnderMax = false;
|
|
bool isMFastOverMin = false;
|
|
bool isMFastCrossedOverMin = false;
|
|
bool isMFastUnderMin = false;
|
|
bool isMFastCrossedUnderMin = false;
|
|
bool isMSlowOverMax = false;
|
|
bool isMSlowCrossedOverMax = false;
|
|
bool isMSlowUnderMax = false;
|
|
bool isMSlowCrossedUnderMax = false;
|
|
bool isMSlowOverMin = false;
|
|
bool isMSlowCrossedOverMin = false;
|
|
bool isMSlowUnderMin = false;
|
|
bool isMSlowCrossedUnderMin = false;
|
|
bool isRetestMFastSlow = false;
|
|
bool isCLoseOverMFast = false;
|
|
bool isCloseCrossedOverMFast = false;
|
|
bool isCloseUnderMFast = false;
|
|
bool isCloseCrossedUnderMFast = false;
|
|
bool isCloseOverMSlow = false;
|
|
bool isCloseCrossedOverMSlow = false;
|
|
bool isCloseUnderMSlow = false;
|
|
bool isCloseCrossedUnderMSlow = false;
|
|
|
|
//
|
|
CalculateCycleConditions(
|
|
barIndex,
|
|
conditions.mFast,
|
|
conditions.mSlow,
|
|
cBar,
|
|
pBar,
|
|
hhValue,
|
|
llValue,
|
|
minValue,
|
|
minValuePrev,
|
|
maxValue,
|
|
maxValuePrev,
|
|
isMFastOverSlow,
|
|
isMFastCrossedOverSlow,
|
|
isMFastUnderSlow,
|
|
isMFastCrossedUnderSlow,
|
|
isMFastOverMax,
|
|
isMFastCrossedOverMax,
|
|
isMFastUnderMax,
|
|
isMFastCrossedUnderMax,
|
|
isMFastOverMin,
|
|
isMFastCrossedOverMin,
|
|
isMFastUnderMin,
|
|
isMFastCrossedUnderMin,
|
|
isMSlowOverMax,
|
|
isMSlowCrossedOverMax,
|
|
isMSlowUnderMax,
|
|
isMSlowCrossedUnderMax,
|
|
isMSlowOverMin,
|
|
isMSlowCrossedOverMin,
|
|
isMSlowUnderMin,
|
|
isMSlowCrossedUnderMin,
|
|
isRetestMFastSlow,
|
|
isCLoseOverMFast,
|
|
isCloseCrossedOverMFast,
|
|
isCloseUnderMFast,
|
|
isCloseCrossedUnderMFast,
|
|
isCloseOverMSlow,
|
|
isCloseCrossedOverMSlow,
|
|
isCloseUnderMSlow,
|
|
isCloseCrossedUnderMSlow
|
|
//
|
|
);
|
|
|
|
//
|
|
// Long ...
|
|
|
|
//
|
|
FillCHMAValues(
|
|
allValues,
|
|
conditions,
|
|
XCHMA_ALL_BUT_LONG,
|
|
cIndex //
|
|
);
|
|
minValue = GetMin(allValues);
|
|
maxValue = GetMax(allValues);
|
|
|
|
//
|
|
FillCHMAValues(
|
|
allValues,
|
|
conditions,
|
|
XCHMA_ALL_BUT_LONG,
|
|
pIndex //
|
|
);
|
|
minValuePrev = GetMin(allValues);
|
|
maxValuePrev = GetMax(allValues);
|
|
|
|
//
|
|
bool isLFastOverSlow = false;
|
|
bool isLFastCrossedOverSlow = false;
|
|
bool isLFastUnderSlow = false;
|
|
bool isLFastCrossedUnderSlow = false;
|
|
bool isLFastOverMax = false;
|
|
bool isLFastCrossedOverMax = false;
|
|
bool isLFastUnderMax = false;
|
|
bool isLFastCrossedUnderMax = false;
|
|
bool isLFastOverMin = false;
|
|
bool isLFastCrossedOverMin = false;
|
|
bool isLFastUnderMin = false;
|
|
bool isLFastCrossedUnderMin = false;
|
|
bool isLSlowOverMax = false;
|
|
bool isLSlowCrossedOverMax = false;
|
|
bool isLSlowUnderMax = false;
|
|
bool isLSlowCrossedUnderMax = false;
|
|
bool isLSlowOverMin = false;
|
|
bool isLSlowCrossedOverMin = false;
|
|
bool isLSlowUnderMin = false;
|
|
bool isLSlowCrossedUnderMin = false;
|
|
bool isRetestLFastSlow = false;
|
|
bool isCLoseOverLFast = false;
|
|
bool isCloseCrossedOverLFast = false;
|
|
bool isCloseUnderLFast = false;
|
|
bool isCloseCrossedUnderLFast = false;
|
|
bool isCloseOverLSlow = false;
|
|
bool isCloseCrossedOverLSlow = false;
|
|
bool isCloseUnderLSlow = false;
|
|
bool isCloseCrossedUnderLSlow = false;
|
|
|
|
//
|
|
CalculateCycleConditions(
|
|
barIndex,
|
|
conditions.lFast,
|
|
conditions.lSlow,
|
|
cBar,
|
|
pBar,
|
|
hhValue,
|
|
llValue,
|
|
minValue,
|
|
minValuePrev,
|
|
maxValue,
|
|
maxValuePrev,
|
|
isLFastOverSlow,
|
|
isLFastCrossedOverSlow,
|
|
isLFastUnderSlow,
|
|
isLFastCrossedUnderSlow,
|
|
isLFastOverMax,
|
|
isLFastCrossedOverMax,
|
|
isLFastUnderMax,
|
|
isLFastCrossedUnderMax,
|
|
isLFastOverMin,
|
|
isLFastCrossedOverMin,
|
|
isLFastUnderMin,
|
|
isLFastCrossedUnderMin,
|
|
isLSlowOverMax,
|
|
isLSlowCrossedOverMax,
|
|
isLSlowUnderMax,
|
|
isLSlowCrossedUnderMax,
|
|
isLSlowOverMin,
|
|
isLSlowCrossedOverMin,
|
|
isLSlowUnderMin,
|
|
isLSlowCrossedUnderMin,
|
|
isRetestLFastSlow,
|
|
isCLoseOverLFast,
|
|
isCloseCrossedOverLFast,
|
|
isCloseUnderLFast,
|
|
isCloseCrossedUnderLFast,
|
|
isCloseOverLSlow,
|
|
isCloseCrossedOverLSlow,
|
|
isCloseUnderLSlow,
|
|
isCloseCrossedUnderLSlow
|
|
//
|
|
);
|
|
|
|
//
|
|
// Hind ...
|
|
|
|
//
|
|
FillCHMAValues(
|
|
allValues,
|
|
conditions,
|
|
XCHMA_ALL_BUT_HIND,
|
|
cIndex //
|
|
);
|
|
minValue = GetMin(allValues);
|
|
maxValue = GetMax(allValues);
|
|
|
|
//
|
|
FillCHMAValues(
|
|
allValues,
|
|
conditions,
|
|
XCHMA_ALL_BUT_HIND,
|
|
pIndex //
|
|
);
|
|
minValuePrev = GetMin(allValues);
|
|
maxValuePrev = GetMax(allValues);
|
|
|
|
//
|
|
bool isHFastOverSlow = false;
|
|
bool isHFastCrossedOverSlow = false;
|
|
bool isHFastUnderSlow = false;
|
|
bool isHFastCrossedUnderSlow = false;
|
|
bool isHFastOverMax = false;
|
|
bool isHFastCrossedOverMax = false;
|
|
bool isHFastUnderMax = false;
|
|
bool isHFastCrossedUnderMax = false;
|
|
bool isHFastOverMin = false;
|
|
bool isHFastCrossedOverMin = false;
|
|
bool isHFastUnderMin = false;
|
|
bool isHFastCrossedUnderMin = false;
|
|
bool isHSlowOverMax = false;
|
|
bool isHSlowCrossedOverMax = false;
|
|
bool isHSlowUnderMax = false;
|
|
bool isHSlowCrossedUnderMax = false;
|
|
bool isHSlowOverMin = false;
|
|
bool isHSlowCrossedOverMin = false;
|
|
bool isHSlowUnderMin = false;
|
|
bool isHSlowCrossedUnderMin = false;
|
|
bool isRetestHFastSlow = false;
|
|
bool isCLoseOverHFast = false;
|
|
bool isCloseCrossedOverHFast = false;
|
|
bool isCloseUnderHFast = false;
|
|
bool isCloseCrossedUnderHFast = false;
|
|
bool isCloseOverHSlow = false;
|
|
bool isCloseCrossedOverHSlow = false;
|
|
bool isCloseUnderHSlow = false;
|
|
bool isCloseCrossedUnderHSlow = false;
|
|
|
|
//
|
|
CalculateCycleConditions(
|
|
barIndex,
|
|
conditions.hFast,
|
|
conditions.hSlow,
|
|
cBar,
|
|
pBar,
|
|
hhValue,
|
|
llValue,
|
|
minValue,
|
|
minValuePrev,
|
|
maxValue,
|
|
maxValuePrev,
|
|
isHFastOverSlow,
|
|
isHFastCrossedOverSlow,
|
|
isHFastUnderSlow,
|
|
isHFastCrossedUnderSlow,
|
|
isHFastOverMax,
|
|
isHFastCrossedOverMax,
|
|
isHFastUnderMax,
|
|
isHFastCrossedUnderMax,
|
|
isHFastOverMin,
|
|
isHFastCrossedOverMin,
|
|
isHFastUnderMin,
|
|
isHFastCrossedUnderMin,
|
|
isHSlowOverMax,
|
|
isHSlowCrossedOverMax,
|
|
isHSlowUnderMax,
|
|
isHSlowCrossedUnderMax,
|
|
isHSlowOverMin,
|
|
isHSlowCrossedOverMin,
|
|
isHSlowUnderMin,
|
|
isHSlowCrossedUnderMin,
|
|
isRetestHFastSlow,
|
|
isCLoseOverHFast,
|
|
isCloseCrossedOverHFast,
|
|
isCloseUnderHFast,
|
|
isCloseCrossedUnderHFast,
|
|
isCloseOverHSlow,
|
|
isCloseCrossedOverHSlow,
|
|
isCloseUnderHSlow,
|
|
isCloseCrossedUnderHSlow
|
|
//
|
|
);
|
|
|
|
//
|
|
// Setting Conditions Variables to Conditions Object ...
|
|
|
|
//
|
|
// AVG ...
|
|
conditions.isFastOverSlow = isFastOverSlow;
|
|
conditions.isFastUnderSlow = isFastUnderSlow;
|
|
conditions.isFastCrossedOverSlow = isFastCrossedOverSlow;
|
|
conditions.isFastCrossedUnderSlow = isFastCrossedUnderSlow;
|
|
conditions.isCLoseOverFast = isCLoseOverFast;
|
|
conditions.isCloseCrossedOverFast = isCloseCrossedOverFast;
|
|
conditions.isCloseUnderFast = isCloseUnderFast;
|
|
conditions.isCloseCrossedUnderFast = isCloseCrossedUnderFast;
|
|
conditions.isCloseOverSlow = isCloseOverSlow;
|
|
conditions.isCloseCrossedOverSlow = isCloseCrossedOverSlow;
|
|
conditions.isCloseUnderSlow = isCloseUnderSlow;
|
|
conditions.isCloseCrossedUnderSlow = isCloseCrossedUnderSlow;
|
|
conditions.isRetestFastSlow = isRetestFastSlow;
|
|
conditions.isFastSupport = isFastSupport;
|
|
conditions.isSlowSupport = isSlowSupport;
|
|
conditions.isFastResistance = isFastResistance;
|
|
conditions.isSlowResistance = isSlowResistance;
|
|
conditions.isRejectedFastAsResistance = isRejectedFastAsResistance;
|
|
conditions.isRejectedSlowAsResistance = isRejectedSlowAsResistance;
|
|
conditions.isRejectedFastAsSupport = isRejectedFastAsSupport;
|
|
conditions.isRejectedSlowAsSupport = isRejectedSlowAsSupport;
|
|
conditions.isBreakedFastAsResistance = isBreakedFastAsResistance;
|
|
conditions.isBreakedSlowAsResistance = isBreakedSlowAsResistance;
|
|
conditions.isBreakedFastAsSupport = isBreakedFastAsSupport;
|
|
conditions.isBreakedSlowAsSupport = isBreakedSlowAsSupport;
|
|
conditions.isFastOverMax = isFastOverMax;
|
|
conditions.isFastUnderMax = isFastUnderMax;
|
|
conditions.isFastOverMin = isFastOverMin;
|
|
conditions.isFastUnderMin = isFastUnderMin;
|
|
conditions.isFastCrossedOverMax = isFastCrossedOverMax;
|
|
conditions.isFastCrossedUnderMax = isFastCrossedUnderMax;
|
|
conditions.isFastCrossedOverMin = isFastCrossedOverMin;
|
|
conditions.isFastCrossedUnderMin = isFastCrossedUnderMin;
|
|
conditions.isSlowOverMax = isSlowOverMax;
|
|
conditions.isSlowUnderMax = isSlowUnderMax;
|
|
conditions.isSlowOverMin = isSlowOverMin;
|
|
conditions.isSlowUnderMin = isSlowUnderMin;
|
|
conditions.isSlowCrossedOverMax = isSlowCrossedOverMax;
|
|
conditions.isSlowCrossedUnderMax = isSlowCrossedUnderMax;
|
|
conditions.isSlowCrossedOverMin = isSlowCrossedOverMin;
|
|
conditions.isSlowCrossedUnderMin = isSlowCrossedUnderMin;
|
|
|
|
//
|
|
// Current ...
|
|
conditions.isCFastOverSlow = isCFastOverSlow;
|
|
conditions.isCFastUnderSlow = isCFastUnderSlow;
|
|
conditions.isCFastCrossedOverSlow = isCFastCrossedOverSlow;
|
|
conditions.isCFastCrossedUnderSlow = isCFastCrossedUnderSlow;
|
|
conditions.isCLoseOverCFast = isCLoseOverCFast;
|
|
conditions.isCloseCrossedOverCFast = isCloseCrossedOverCFast;
|
|
conditions.isCloseUnderCFast = isCloseUnderCFast;
|
|
conditions.isCloseCrossedUnderCFast = isCloseCrossedUnderCFast;
|
|
conditions.isCloseOverCSlow = isCloseOverCSlow;
|
|
conditions.isCloseCrossedOverCSlow = isCloseCrossedOverCSlow;
|
|
conditions.isCloseUnderCSlow = isCloseUnderCSlow;
|
|
conditions.isCloseCrossedUnderCSlow = isCloseCrossedUnderCSlow;
|
|
conditions.isRetestCFastSlow = isRetestCFastSlow;
|
|
conditions.isCFastOverMax = isCFastOverMax;
|
|
conditions.isCFastUnderMax = isCFastUnderMax;
|
|
conditions.isCFastOverMin = isCFastOverMin;
|
|
conditions.isCFastUnderMin = isCFastUnderMin;
|
|
conditions.isCFastCrossedOverMax = isCFastCrossedOverMax;
|
|
conditions.isCFastCrossedUnderMax = isCFastCrossedUnderMax;
|
|
conditions.isCFastCrossedOverMin = isCFastCrossedOverMin;
|
|
conditions.isCFastCrossedUnderMin = isCFastCrossedUnderMin;
|
|
conditions.isCSlowOverMax = isCSlowOverMax;
|
|
conditions.isCSlowUnderMax = isCSlowUnderMax;
|
|
conditions.isCSlowOverMin = isCSlowOverMin;
|
|
conditions.isCSlowUnderMin = isCSlowUnderMin;
|
|
conditions.isCSlowCrossedOverMax = isCSlowCrossedOverMax;
|
|
conditions.isCSlowCrossedUnderMax = isCSlowCrossedUnderMax;
|
|
conditions.isCSlowCrossedOverMin = isCSlowCrossedOverMin;
|
|
conditions.isCSlowCrossedUnderMin = isCSlowCrossedUnderMin;
|
|
|
|
//
|
|
// Short ...
|
|
conditions.isSFastOverSlow = isSFastOverSlow;
|
|
conditions.isSFastUnderSlow = isSFastUnderSlow;
|
|
conditions.isSFastCrossedOverSlow = isSFastCrossedOverSlow;
|
|
conditions.isSFastCrossedUnderSlow = isSFastCrossedUnderSlow;
|
|
conditions.isCLoseOverSFast = isCLoseOverSFast;
|
|
conditions.isCloseCrossedOverSFast = isCloseCrossedOverSFast;
|
|
conditions.isCloseUnderSFast = isCloseUnderSFast;
|
|
conditions.isCloseCrossedUnderSFast = isCloseCrossedUnderSFast;
|
|
conditions.isCloseOverSSlow = isCloseOverSSlow;
|
|
conditions.isCloseCrossedOverSSlow = isCloseCrossedOverSSlow;
|
|
conditions.isCloseUnderSSlow = isCloseUnderSSlow;
|
|
conditions.isCloseCrossedUnderSSlow = isCloseCrossedUnderSSlow;
|
|
conditions.isRetestSFastSlow = isRetestSFastSlow;
|
|
conditions.isSFastOverMax = isSFastOverMax;
|
|
conditions.isSFastUnderMax = isSFastUnderMax;
|
|
conditions.isSFastOverMin = isSFastOverMin;
|
|
conditions.isSFastUnderMin = isSFastUnderMin;
|
|
conditions.isSFastCrossedOverMax = isSFastCrossedOverMax;
|
|
conditions.isSFastCrossedUnderMax = isSFastCrossedUnderMax;
|
|
conditions.isSFastCrossedOverMin = isSFastCrossedOverMin;
|
|
conditions.isSFastCrossedUnderMin = isSFastCrossedUnderMin;
|
|
conditions.isSSlowOverMax = isSSlowOverMax;
|
|
conditions.isSSlowUnderMax = isSSlowUnderMax;
|
|
conditions.isSSlowOverMin = isSSlowOverMin;
|
|
conditions.isSSlowUnderMin = isSSlowUnderMin;
|
|
conditions.isSSlowCrossedOverMax = isSSlowCrossedOverMax;
|
|
conditions.isSSlowCrossedUnderMax = isSSlowCrossedUnderMax;
|
|
conditions.isSSlowCrossedOverMin = isSSlowCrossedOverMin;
|
|
conditions.isSSlowCrossedUnderMin = isSSlowCrossedUnderMin;
|
|
|
|
//
|
|
// Medium ...
|
|
conditions.isMFastOverSlow = isMFastOverSlow;
|
|
conditions.isMFastUnderSlow = isMFastUnderSlow;
|
|
conditions.isMFastCrossedOverSlow = isMFastCrossedOverSlow;
|
|
conditions.isMFastCrossedUnderSlow = isMFastCrossedUnderSlow;
|
|
conditions.isCLoseOverMFast = isCLoseOverMFast;
|
|
conditions.isCloseCrossedOverMFast = isCloseCrossedOverMFast;
|
|
conditions.isCloseUnderMFast = isCloseUnderMFast;
|
|
conditions.isCloseCrossedUnderMFast = isCloseCrossedUnderMFast;
|
|
conditions.isCloseOverMSlow = isCloseOverMSlow;
|
|
conditions.isCloseCrossedOverMSlow = isCloseCrossedOverMSlow;
|
|
conditions.isCloseUnderMSlow = isCloseUnderMSlow;
|
|
conditions.isCloseCrossedUnderMSlow = isCloseCrossedUnderMSlow;
|
|
conditions.isRetestMFastSlow = isRetestMFastSlow;
|
|
conditions.isMFastOverMax = isMFastOverMax;
|
|
conditions.isMFastUnderMax = isMFastUnderMax;
|
|
conditions.isMFastOverMin = isMFastOverMin;
|
|
conditions.isMFastUnderMin = isMFastUnderMin;
|
|
conditions.isMFastCrossedOverMax = isMFastCrossedOverMax;
|
|
conditions.isMFastCrossedUnderMax = isMFastCrossedUnderMax;
|
|
conditions.isMFastCrossedOverMin = isMFastCrossedOverMin;
|
|
conditions.isMFastCrossedUnderMin = isMFastCrossedUnderMin;
|
|
conditions.isMSlowOverMax = isMSlowOverMax;
|
|
conditions.isMSlowUnderMax = isMSlowUnderMax;
|
|
conditions.isMSlowOverMin = isMSlowOverMin;
|
|
conditions.isMSlowUnderMin = isMSlowUnderMin;
|
|
conditions.isMSlowCrossedOverMax = isMSlowCrossedOverMax;
|
|
conditions.isMSlowCrossedUnderMax = isMSlowCrossedUnderMax;
|
|
conditions.isMSlowCrossedOverMin = isMSlowCrossedOverMin;
|
|
conditions.isMSlowCrossedUnderMin = isMSlowCrossedUnderMin;
|
|
|
|
//
|
|
// Long ...
|
|
conditions.isLFastOverSlow = isLFastOverSlow;
|
|
conditions.isLFastUnderSlow = isLFastUnderSlow;
|
|
conditions.isLFastCrossedOverSlow = isLFastCrossedOverSlow;
|
|
conditions.isLFastCrossedUnderSlow = isLFastCrossedUnderSlow;
|
|
conditions.isCLoseOverLFast = isCLoseOverLFast;
|
|
conditions.isCloseCrossedOverLFast = isCloseCrossedOverLFast;
|
|
conditions.isCloseUnderLFast = isCloseUnderLFast;
|
|
conditions.isCloseCrossedUnderLFast = isCloseCrossedUnderLFast;
|
|
conditions.isCloseOverLSlow = isCloseOverLSlow;
|
|
conditions.isCloseCrossedOverLSlow = isCloseCrossedOverLSlow;
|
|
conditions.isCloseUnderLSlow = isCloseUnderLSlow;
|
|
conditions.isCloseCrossedUnderLSlow = isCloseCrossedUnderLSlow;
|
|
conditions.isRetestLFastSlow = isRetestLFastSlow;
|
|
conditions.isLFastOverMax = isLFastOverMax;
|
|
conditions.isLFastUnderMax = isLFastUnderMax;
|
|
conditions.isLFastOverMin = isLFastOverMin;
|
|
conditions.isLFastUnderMin = isLFastUnderMin;
|
|
conditions.isLFastCrossedOverMax = isLFastCrossedOverMax;
|
|
conditions.isLFastCrossedUnderMax = isLFastCrossedUnderMax;
|
|
conditions.isLFastCrossedOverMin = isLFastCrossedOverMin;
|
|
conditions.isLFastCrossedUnderMin = isLFastCrossedUnderMin;
|
|
conditions.isLSlowOverMax = isLSlowOverMax;
|
|
conditions.isLSlowUnderMax = isLSlowUnderMax;
|
|
conditions.isLSlowOverMin = isLSlowOverMin;
|
|
conditions.isLSlowUnderMin = isLSlowUnderMin;
|
|
conditions.isLSlowCrossedOverMax = isLSlowCrossedOverMax;
|
|
conditions.isLSlowCrossedUnderMax = isLSlowCrossedUnderMax;
|
|
conditions.isLSlowCrossedOverMin = isLSlowCrossedOverMin;
|
|
conditions.isLSlowCrossedUnderMin = isLSlowCrossedUnderMin;
|
|
|
|
//
|
|
// Hind ...
|
|
conditions.isHFastOverSlow = isHFastOverSlow;
|
|
conditions.isHFastUnderSlow = isHFastUnderSlow;
|
|
conditions.isHFastCrossedOverSlow = isHFastCrossedOverSlow;
|
|
conditions.isHFastCrossedUnderSlow = isHFastCrossedUnderSlow;
|
|
conditions.isCLoseOverHFast = isCLoseOverHFast;
|
|
conditions.isCloseCrossedOverHFast = isCloseCrossedOverHFast;
|
|
conditions.isCloseUnderHFast = isCloseUnderHFast;
|
|
conditions.isCloseCrossedUnderHFast = isCloseCrossedUnderHFast;
|
|
conditions.isCloseOverHSlow = isCloseOverHSlow;
|
|
conditions.isCloseCrossedOverHSlow = isCloseCrossedOverHSlow;
|
|
conditions.isCloseUnderHSlow = isCloseUnderHSlow;
|
|
conditions.isCloseCrossedUnderHSlow = isCloseCrossedUnderHSlow;
|
|
conditions.isRetestHFastSlow = isRetestHFastSlow;
|
|
conditions.isHFastOverMax = isHFastOverMax;
|
|
conditions.isHFastUnderMax = isHFastUnderMax;
|
|
conditions.isHFastOverMin = isHFastOverMin;
|
|
conditions.isHFastUnderMin = isHFastUnderMin;
|
|
conditions.isHFastCrossedOverMax = isHFastCrossedOverMax;
|
|
conditions.isHFastCrossedUnderMax = isHFastCrossedUnderMax;
|
|
conditions.isHFastCrossedOverMin = isHFastCrossedOverMin;
|
|
conditions.isHFastCrossedUnderMin = isHFastCrossedUnderMin;
|
|
conditions.isHSlowOverMax = isHSlowOverMax;
|
|
conditions.isHSlowUnderMax = isHSlowUnderMax;
|
|
conditions.isHSlowOverMin = isHSlowOverMin;
|
|
conditions.isHSlowUnderMin = isHSlowUnderMin;
|
|
conditions.isHSlowCrossedOverMax = isHSlowCrossedOverMax;
|
|
conditions.isHSlowCrossedUnderMax = isHSlowCrossedUnderMax;
|
|
conditions.isHSlowCrossedOverMin = isHSlowCrossedOverMin;
|
|
conditions.isHSlowCrossedUnderMin = isHSlowCrossedUnderMin;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Protected ...
|
|
protected:
|
|
//
|
|
// Private ...
|
|
private:
|
|
//
|
|
// Props ...
|
|
XCHMAInputs mInputs; // Inputs ...
|
|
|
|
//
|
|
// Buffers ...
|
|
|
|
//
|
|
// AVG ...
|
|
double fastBuffer[];
|
|
double slowBuffer[];
|
|
|
|
//
|
|
// Current ...
|
|
double cFastBuffer[];
|
|
double cSlowBuffer[];
|
|
|
|
//
|
|
// Short ...
|
|
double sFastBuffer[];
|
|
double sSlowBuffer[];
|
|
|
|
//
|
|
// Medium ...
|
|
double mFastBuffer[];
|
|
double mSlowBuffer[];
|
|
|
|
//
|
|
// Long ...
|
|
double lFastBuffer[];
|
|
double lSlowBuffer[];
|
|
|
|
//
|
|
// Hind ...
|
|
double hFastBuffer[];
|
|
double hSlowBuffer[];
|
|
|
|
//
|
|
// Tools ...
|
|
|
|
//
|
|
// Calculate Values Until Now ...
|
|
void Calculate()
|
|
{
|
|
//
|
|
int totalBars = CountBars();
|
|
if (totalBars > 1000)
|
|
{
|
|
totalBars = 1000;
|
|
}
|
|
|
|
//
|
|
// Fast ...
|
|
CopyBuffer(
|
|
mHandler,
|
|
XCHMA_FAST_LINE,
|
|
0,
|
|
totalBars,
|
|
fastBuffer
|
|
//
|
|
);
|
|
|
|
//
|
|
// Slow ...
|
|
CopyBuffer(
|
|
mHandler,
|
|
XCHMA_SLOW_LINE,
|
|
0,
|
|
totalBars,
|
|
slowBuffer
|
|
//
|
|
);
|
|
|
|
//
|
|
// Current ...
|
|
|
|
//
|
|
// Fast ...
|
|
CopyBuffer(
|
|
mHandler,
|
|
XCHMA_CFAST_LINE,
|
|
0,
|
|
totalBars,
|
|
cFastBuffer
|
|
//
|
|
);
|
|
|
|
//
|
|
// Slow ...
|
|
CopyBuffer(
|
|
mHandler,
|
|
XCHMA_CSLOW_LINE,
|
|
0,
|
|
totalBars,
|
|
cSlowBuffer
|
|
//
|
|
);
|
|
|
|
//
|
|
// Short ...
|
|
|
|
//
|
|
// Fast ...
|
|
CopyBuffer(
|
|
mHandler,
|
|
XCHMA_SFAST_LINE,
|
|
0,
|
|
totalBars,
|
|
sFastBuffer
|
|
//
|
|
);
|
|
|
|
//
|
|
// Slow ...
|
|
CopyBuffer(
|
|
mHandler,
|
|
XCHMA_SSLOW_LINE,
|
|
0,
|
|
totalBars,
|
|
sSlowBuffer
|
|
//
|
|
);
|
|
|
|
//
|
|
// Medium ...
|
|
|
|
//
|
|
// Fast ...
|
|
CopyBuffer(
|
|
mHandler,
|
|
XCHMA_MFAST_LINE,
|
|
0,
|
|
totalBars,
|
|
mFastBuffer
|
|
//
|
|
);
|
|
|
|
//
|
|
// Slow ...
|
|
CopyBuffer(
|
|
mHandler,
|
|
XCHMA_MSLOW_LINE,
|
|
0,
|
|
totalBars,
|
|
mSlowBuffer
|
|
//
|
|
);
|
|
|
|
//
|
|
// Long ...
|
|
|
|
//
|
|
// Fast ...
|
|
CopyBuffer(
|
|
mHandler,
|
|
XCHMA_LFAST_LINE,
|
|
0,
|
|
totalBars,
|
|
lFastBuffer
|
|
//
|
|
);
|
|
|
|
//
|
|
// Slow ...
|
|
CopyBuffer(
|
|
mHandler,
|
|
XCHMA_LSLOW_LINE,
|
|
0,
|
|
totalBars,
|
|
lSlowBuffer
|
|
//
|
|
);
|
|
|
|
//
|
|
// Hind ...
|
|
|
|
//
|
|
// Fast ...
|
|
CopyBuffer(
|
|
mHandler,
|
|
XCHMA_HFAST_LINE,
|
|
0,
|
|
totalBars,
|
|
hFastBuffer
|
|
//
|
|
);
|
|
|
|
//
|
|
// Slow ...
|
|
CopyBuffer(
|
|
mHandler,
|
|
XCHMA_HSLOW_LINE,
|
|
0,
|
|
totalBars,
|
|
hSlowBuffer
|
|
//
|
|
);
|
|
}
|
|
};
|
|
|
|
// |