2541 lines
66 KiB
Plaintext
2541 lines
66 KiB
Plaintext
///////////////////////////////////////////////////////
|
|
//
|
|
// SaherElm IT Center MQL5 Helper Class Library
|
|
// ----------------------------------------------
|
|
// Name: XCXSTRCCIHelper
|
|
// 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 "../../Helpers/x-saherelm.x121.xcc.helper.mq5"
|
|
#include "../../Helpers/x-saherelm.x121.xct.helper.mq5"
|
|
#include "../../Helpers/x-saherelm.x121.xoscs.helper.mq5"
|
|
#include "../../Helpers/x-saherelm.x121.xstr.helper.mq5"
|
|
|
|
//
|
|
// Input Structure ...
|
|
struct XSTRCCIInputs
|
|
{
|
|
//
|
|
bool showAC;
|
|
bool showAD;
|
|
bool showADX;
|
|
bool showATR;
|
|
bool showCCI;
|
|
bool showRSI;
|
|
bool showMFI;
|
|
bool showRVI;
|
|
bool showMACD;
|
|
bool showMomentum;
|
|
bool showStochastic;
|
|
|
|
//
|
|
X121XCTInputs ctInputs;
|
|
X121XCCInputs ccInputs;
|
|
X121XSTRInputs strInputs;
|
|
X121XOCSInputs oscsInputs;
|
|
|
|
//
|
|
// Constructor ...
|
|
XSTRCCIInputs()
|
|
{
|
|
Clean();
|
|
}
|
|
|
|
//
|
|
// Tools ...
|
|
|
|
/**
|
|
* Cleaning Up ...
|
|
*/
|
|
void Clean()
|
|
{
|
|
//
|
|
showAC = false;
|
|
showAD = false;
|
|
showADX = false;
|
|
showATR = false;
|
|
showCCI = false;
|
|
showRSI = false;
|
|
showMFI = false;
|
|
showRVI = false;
|
|
showMACD = false;
|
|
showMomentum = false;
|
|
showStochastic = false;
|
|
|
|
//
|
|
ctInputs.Clean();
|
|
ccInputs.Clean();
|
|
strInputs.Clean();
|
|
oscsInputs.Clean();
|
|
|
|
//
|
|
ZeroMemory(this);
|
|
}
|
|
|
|
/**
|
|
* Set Default Values ...
|
|
*/
|
|
void Default()
|
|
{
|
|
//
|
|
ctInputs.Default();
|
|
ccInputs.Default();
|
|
strInputs.Default();
|
|
oscsInputs.Default();
|
|
}
|
|
|
|
/**
|
|
* Validate ...
|
|
*
|
|
* @return ( bool )
|
|
*/
|
|
bool IsValid()
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
result =
|
|
//
|
|
ctInputs.IsValid() &&
|
|
ccInputs.IsValid() &&
|
|
strInputs.IsValid() &&
|
|
oscsInputs.IsValid()
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Extract Max Input Length ...
|
|
*
|
|
* @return ( int )
|
|
*/
|
|
int Max()
|
|
{
|
|
//
|
|
int result = 0;
|
|
|
|
//
|
|
int ctMax = ctInputs.Max();
|
|
int ccMax = ccInputs.Max();
|
|
int strMax = strInputs.Max();
|
|
int ocsMax = oscsInputs.Max();
|
|
|
|
//
|
|
result = MathMax(strMax, ocsMax);
|
|
result = MathMax(result, ccMax);
|
|
result = MathMax(result, ctMax);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
};
|
|
|
|
//
|
|
// Conditions Structure ...
|
|
struct XSTRCCIConditions
|
|
{
|
|
//
|
|
// Common ...
|
|
string symbol;
|
|
ENUM_TIMEFRAMES period;
|
|
datetime time;
|
|
|
|
//
|
|
// XSTR ...
|
|
|
|
//
|
|
// Buffers ...
|
|
|
|
//
|
|
double strBuffer[];
|
|
double vidyaBuffer[];
|
|
double strUpBuffer[];
|
|
double strDownBuffer[];
|
|
double strPriceBuffer[];
|
|
double strStateBuffer[];
|
|
double strSMLowBuffer[];
|
|
double strSMHighBuffer[];
|
|
|
|
//
|
|
// Conditions ...
|
|
|
|
//
|
|
// STR ...
|
|
|
|
//
|
|
bool isStrBullish;
|
|
bool isStrBearish;
|
|
|
|
//
|
|
bool isStrSwitchedToBullish;
|
|
bool isStrSwitchedToBearish;
|
|
|
|
//
|
|
// VIDYA ...
|
|
|
|
//
|
|
bool isRejectUpVidya;
|
|
bool isClosedOverVidya;
|
|
bool isCrossedOverVidya;
|
|
|
|
//
|
|
bool isRejectDownVidya;
|
|
bool isCloseUnderVidya;
|
|
bool isCrossedUnderVidya;
|
|
|
|
//
|
|
// HMS ...
|
|
|
|
//
|
|
bool isRejectUpLSM;
|
|
bool isCloseOverLSM;
|
|
bool isCrossedOverLSM;
|
|
|
|
//
|
|
bool isRejectDownLSM;
|
|
bool isCloseUnderLSM;
|
|
bool isCrossedUnderLSM;
|
|
|
|
//
|
|
// HSM ..
|
|
|
|
//
|
|
bool isRejectUpHSM;
|
|
bool isCloseOverHSM;
|
|
bool isCrossedOverHSM;
|
|
|
|
//
|
|
bool isRejectDownHSM;
|
|
bool isCloseUnderHSM;
|
|
bool isCrossedUnderHSM;
|
|
|
|
//
|
|
// STR ...
|
|
|
|
//
|
|
bool isRejectUpStr;
|
|
bool isCloseOverStr;
|
|
bool isCrossedOverStr;
|
|
|
|
//
|
|
bool isRejectDownStr;
|
|
bool isCloseUnderStr;
|
|
bool isCrossedUnderStr;
|
|
|
|
//
|
|
// HSM / ViDYA ...
|
|
|
|
//
|
|
bool isVidyaOverHSM;
|
|
bool isVidyaCrossedOverHSM;
|
|
|
|
//
|
|
bool isVidyaUnderHSM;
|
|
bool isVidyaCrossedUnderHSM;
|
|
|
|
//
|
|
// LSM / VIDYA ...
|
|
|
|
//
|
|
bool isVidyaOverLSM;
|
|
bool isVidyaCrossedOverLSM;
|
|
|
|
//
|
|
bool isVidyaUnderLSM;
|
|
bool isVidyaCrossedUnderLSM;
|
|
|
|
//
|
|
// STR / VIDYA ...
|
|
|
|
//
|
|
bool isVidyaOverStr;
|
|
bool isVidyaCrossedOverStr;
|
|
|
|
//
|
|
bool isVidyaUnderStr;
|
|
bool isVidyaCrossedUnderStr;
|
|
|
|
//
|
|
// XOSCS ...
|
|
|
|
//
|
|
// Buffers ...
|
|
|
|
//
|
|
double acBuffer[];
|
|
double adBuffer[];
|
|
double atrBuffer[];
|
|
double cciBuffer[];
|
|
double rsiBuffer[];
|
|
double mfiBuffer[];
|
|
double rviBuffer[];
|
|
double adxBuffer[];
|
|
double adxpBuffer[];
|
|
double adxnBuffer[];
|
|
double macdBuffer[];
|
|
double momentumBuffer[];
|
|
double rviSignalBuffer[];
|
|
double macdSignalBuffer[];
|
|
double stochasticBuffer[];
|
|
double stochasticSignalBuffer[];
|
|
|
|
//
|
|
// Conditions ...
|
|
|
|
//
|
|
// AC ...
|
|
|
|
//
|
|
bool isACBullish;
|
|
bool isACBearish;
|
|
|
|
//
|
|
bool isACSwitchedToBullish;
|
|
bool isACSwitchedToBearish;
|
|
|
|
//
|
|
bool isACOverMax;
|
|
bool isACUnderMin;
|
|
|
|
//
|
|
// AD ...
|
|
|
|
//
|
|
bool isADBiggerLast;
|
|
bool isADLesserLast;
|
|
|
|
//
|
|
bool isADOverMax;
|
|
bool isADUnderMin;
|
|
|
|
//
|
|
// ADX ...
|
|
|
|
//
|
|
bool isADXBiggerLast;
|
|
bool isADXLesserLast;
|
|
|
|
//
|
|
bool isADXOverThreshold;
|
|
bool isADXUnderThreshold;
|
|
|
|
//
|
|
bool isDXPBiggerThanDXN;
|
|
bool isDXNBiggerThanDXP;
|
|
|
|
//
|
|
bool isADXBullish;
|
|
bool isADXBearish;
|
|
|
|
//
|
|
bool isADXSwitchedToBullish;
|
|
bool isADXSwitchedToBearish;
|
|
|
|
//
|
|
// ATR ...
|
|
|
|
bool isATROverLast;
|
|
bool isATRUnderLast;
|
|
|
|
//
|
|
// CCI ...
|
|
|
|
//
|
|
bool isCCIBullish;
|
|
bool isCCIBearish;
|
|
|
|
//
|
|
bool isCCISwitchedToBullish;
|
|
bool isCCISwitchedToBearish;
|
|
|
|
//
|
|
bool isCCIOB;
|
|
bool isCCIOS;
|
|
|
|
//
|
|
bool isCCICrossedOverOB;
|
|
bool isCCICrossedOverOS;
|
|
|
|
//
|
|
bool isCCICrossedUnderOB;
|
|
bool isCCICrossedUnderOS;
|
|
|
|
//
|
|
// RSI ...
|
|
|
|
//
|
|
bool isRSIBullish;
|
|
bool isRSIBearish;
|
|
|
|
//
|
|
bool isRSISwitchedToBullish;
|
|
bool isRSISwitchedToBearish;
|
|
|
|
//
|
|
bool isRSIOB;
|
|
bool isRSIOS;
|
|
|
|
//
|
|
bool isRSICrossedOverOB;
|
|
bool isRSICrossedOverOS;
|
|
|
|
//
|
|
bool isRSICrossedUnderOB;
|
|
bool isRSICrossedUnderOS;
|
|
|
|
//
|
|
// MFI ...
|
|
|
|
//
|
|
bool isMFIBullish;
|
|
bool isMFIBearish;
|
|
|
|
//
|
|
bool isMFISwitchedToBullish;
|
|
bool isMFISwitchedToBearish;
|
|
|
|
//
|
|
bool isMFIOB;
|
|
bool isMFIOS;
|
|
|
|
//
|
|
bool isMFICrossedOverOB;
|
|
bool isMFICrossedOverOS;
|
|
|
|
//
|
|
bool isMFICrossedUnderOB;
|
|
bool isMFICrossedUnderOS;
|
|
|
|
//
|
|
// RVI ...
|
|
|
|
//
|
|
bool isRVIBullish;
|
|
bool isRVIBearish;
|
|
|
|
//
|
|
bool isRVISwitchedToBullish;
|
|
bool isRVISwitchedToBearish;
|
|
|
|
//
|
|
bool isRVIOverSignal;
|
|
bool isRVIUnderSignal;
|
|
|
|
//
|
|
bool isRVICrossedOverSignal;
|
|
bool isRVICrossedUnderSignal;
|
|
|
|
//
|
|
// MACD ...
|
|
|
|
//
|
|
bool isMACDBullish;
|
|
bool isMACDBearish;
|
|
|
|
//
|
|
bool isMACDSwitchedToBullish;
|
|
bool isMACDSwitchedToBearish;
|
|
|
|
//
|
|
bool isMACDOverSignal;
|
|
bool isMACDUnderSignal;
|
|
|
|
//
|
|
bool isMACDCrossedOverSignal;
|
|
bool isMACDCrossedUnderSignal;
|
|
|
|
//
|
|
// MOMENTUM ...
|
|
|
|
//
|
|
bool isMomentumBullish;
|
|
bool isMomentumBearish;
|
|
|
|
//
|
|
bool isMomentumSwitchedToBullish;
|
|
bool isMomentumSwitchedToBearish;
|
|
|
|
//
|
|
// STOCHASTIC ...
|
|
|
|
//
|
|
bool isStochasticBullish;
|
|
bool isStochasticBearish;
|
|
|
|
//
|
|
bool isStochasticSwitchedToBullish;
|
|
bool isStochasticSwitchedToBearish;
|
|
|
|
//
|
|
bool isStochasticOverSignal;
|
|
bool isStochasticUnderSignal;
|
|
|
|
//
|
|
bool isStochasticCrossedOverSignal;
|
|
bool isStochasticCrossedUnderSignal;
|
|
|
|
//
|
|
bool isStochasticOB;
|
|
bool isStochasticOS;
|
|
|
|
//
|
|
bool isStochasticCrossedOverOB;
|
|
bool isStochasticCrossedOverOS;
|
|
|
|
//
|
|
bool isStochasticCrossedUnderOB;
|
|
bool isStochasticCrossedUnderOS;
|
|
|
|
//
|
|
// Specified Conditions ...
|
|
|
|
//
|
|
|
|
//
|
|
// Constructor ...
|
|
XSTRCCIConditions()
|
|
{
|
|
Clean();
|
|
}
|
|
|
|
//
|
|
// Tools ...
|
|
|
|
/**
|
|
* Cleaning Up ...
|
|
*/
|
|
void Clean()
|
|
{
|
|
//
|
|
// Commons ...
|
|
symbol = NULL;
|
|
period = NULL;
|
|
time = NULL;
|
|
|
|
//
|
|
// XSTR ...
|
|
|
|
//
|
|
// Buffers ...
|
|
|
|
//
|
|
Clean(strBuffer);
|
|
Clean(atrBuffer);
|
|
Clean(vidyaBuffer);
|
|
Clean(strUpBuffer);
|
|
Clean(strDownBuffer);
|
|
Clean(strPriceBuffer);
|
|
Clean(strStateBuffer);
|
|
Clean(strSMLowBuffer);
|
|
Clean(strSMHighBuffer);
|
|
|
|
//
|
|
ArraySetAsSeries(strBuffer, true);
|
|
ArraySetAsSeries(atrBuffer, true);
|
|
ArraySetAsSeries(vidyaBuffer, true);
|
|
ArraySetAsSeries(strUpBuffer, true);
|
|
ArraySetAsSeries(strDownBuffer, true);
|
|
ArraySetAsSeries(strPriceBuffer, true);
|
|
ArraySetAsSeries(strStateBuffer, true);
|
|
ArraySetAsSeries(strSMLowBuffer, true);
|
|
ArraySetAsSeries(strSMHighBuffer, true);
|
|
|
|
//
|
|
// Conditions ...
|
|
|
|
//
|
|
isStrBullish = false;
|
|
isStrBearish = false;
|
|
isRejectUpLSM = false;
|
|
isRejectUpHSM = false;
|
|
isRejectUpStr = false;
|
|
isCloseOverHSM = false;
|
|
isCloseOverLSM = false;
|
|
isCloseOverStr = false;
|
|
isVidyaOverHSM = false;
|
|
isVidyaOverLSM = false;
|
|
isVidyaOverStr = false;
|
|
isRejectDownLSM = false;
|
|
isRejectDownHSM = false;
|
|
isVidyaUnderStr = false;
|
|
isVidyaUnderHSM = false;
|
|
isVidyaUnderLSM = false;
|
|
isCloseUnderStr = false;
|
|
isRejectDownStr = false;
|
|
isRejectUpVidya = false;
|
|
isCloseUnderHSM = false;
|
|
isCloseUnderLSM = false;
|
|
isCrossedOverLSM = false;
|
|
isCrossedOverHSM = false;
|
|
isCrossedOverStr = false;
|
|
isCrossedUnderHSM = false;
|
|
isCrossedUnderLSM = false;
|
|
isCrossedUnderStr = false;
|
|
isClosedOverVidya = false;
|
|
isRejectDownVidya = false;
|
|
isCloseUnderVidya = false;
|
|
isCrossedOverVidya = false;
|
|
isCrossedUnderVidya = false;
|
|
isVidyaCrossedOverHSM = false;
|
|
isVidyaCrossedOverStr = false;
|
|
isVidyaCrossedOverLSM = false;
|
|
isVidyaCrossedUnderHSM = false;
|
|
isVidyaCrossedUnderLSM = false;
|
|
isVidyaCrossedUnderStr = false;
|
|
isStrSwitchedToBullish = false;
|
|
isStrSwitchedToBearish = false;
|
|
|
|
//
|
|
// XOSCS ...
|
|
|
|
//
|
|
// Buffers ...
|
|
|
|
//
|
|
Clean(acBuffer);
|
|
Clean(adBuffer);
|
|
Clean(atrBuffer);
|
|
Clean(cciBuffer);
|
|
Clean(rsiBuffer);
|
|
Clean(mfiBuffer);
|
|
Clean(rviBuffer);
|
|
Clean(adxBuffer);
|
|
Clean(adxpBuffer);
|
|
Clean(adxnBuffer);
|
|
Clean(macdBuffer);
|
|
Clean(momentumBuffer);
|
|
Clean(rviSignalBuffer);
|
|
Clean(macdSignalBuffer);
|
|
Clean(stochasticBuffer);
|
|
Clean(stochasticSignalBuffer);
|
|
|
|
//
|
|
ArraySetAsSeries(acBuffer, true);
|
|
ArraySetAsSeries(adBuffer, true);
|
|
ArraySetAsSeries(atrBuffer, true);
|
|
ArraySetAsSeries(cciBuffer, true);
|
|
ArraySetAsSeries(rsiBuffer, true);
|
|
ArraySetAsSeries(mfiBuffer, true);
|
|
ArraySetAsSeries(rviBuffer, true);
|
|
ArraySetAsSeries(adxBuffer, true);
|
|
ArraySetAsSeries(adxpBuffer, true);
|
|
ArraySetAsSeries(adxnBuffer, true);
|
|
ArraySetAsSeries(macdBuffer, true);
|
|
ArraySetAsSeries(momentumBuffer, true);
|
|
ArraySetAsSeries(rviSignalBuffer, true);
|
|
ArraySetAsSeries(macdSignalBuffer, true);
|
|
ArraySetAsSeries(stochasticBuffer, true);
|
|
ArraySetAsSeries(stochasticSignalBuffer, true);
|
|
|
|
//
|
|
// Conditions ...
|
|
|
|
//
|
|
// AC ...
|
|
|
|
//
|
|
isACBullish = false;
|
|
isACBearish = false;
|
|
isACSwitchedToBullish = false;
|
|
isACSwitchedToBearish = false;
|
|
isACOverMax = false;
|
|
isACUnderMin = false;
|
|
|
|
//
|
|
// AD ...
|
|
|
|
//
|
|
isADBiggerLast = false;
|
|
isADLesserLast = false;
|
|
isADOverMax = false;
|
|
isADUnderMin = false;
|
|
|
|
//
|
|
// ADX ...
|
|
|
|
//
|
|
isADXBiggerLast = false;
|
|
isADXLesserLast = false;
|
|
isADXOverThreshold = false;
|
|
isADXUnderThreshold = false;
|
|
isDXPBiggerThanDXN = false;
|
|
isDXNBiggerThanDXP = false;
|
|
isADXBullish = false;
|
|
isADXBearish = false;
|
|
isADXSwitchedToBullish = false;
|
|
isADXSwitchedToBearish = false;
|
|
|
|
//
|
|
// ATR ...
|
|
|
|
//
|
|
isATROverLast = false;
|
|
isATRUnderLast = false;
|
|
|
|
//
|
|
// CCI ...
|
|
|
|
//
|
|
isCCIBullish = false;
|
|
isCCIBearish = false;
|
|
isCCISwitchedToBullish = false;
|
|
isCCISwitchedToBearish = false;
|
|
isCCIOB = false;
|
|
isCCIOS = false;
|
|
isCCICrossedOverOB = false;
|
|
isCCICrossedOverOS = false;
|
|
isCCICrossedUnderOB = false;
|
|
isCCICrossedUnderOS = false;
|
|
|
|
//
|
|
// RSI ...
|
|
|
|
//
|
|
isRSIBullish = false;
|
|
isRSIBearish = false;
|
|
isRSISwitchedToBullish = false;
|
|
isRSISwitchedToBearish = false;
|
|
isRSIOB = false;
|
|
isRSIOS = false;
|
|
isRSICrossedOverOB = false;
|
|
isRSICrossedOverOS = false;
|
|
isRSICrossedUnderOB = false;
|
|
isRSICrossedUnderOS = false;
|
|
|
|
//
|
|
// MFI ...
|
|
|
|
//
|
|
isMFIBullish = false;
|
|
isMFIBearish = false;
|
|
isMFISwitchedToBullish = false;
|
|
isMFISwitchedToBearish = false;
|
|
isMFIOB = false;
|
|
isMFIOS = false;
|
|
isMFICrossedOverOB = false;
|
|
isMFICrossedOverOS = false;
|
|
isMFICrossedUnderOB = false;
|
|
isMFICrossedUnderOS = false;
|
|
|
|
//
|
|
// RVI ...
|
|
|
|
//
|
|
isRVIBullish = false;
|
|
isRVIBearish = false;
|
|
isRVISwitchedToBullish = false;
|
|
isRVISwitchedToBearish = false;
|
|
isRVIOverSignal = false;
|
|
isRVIUnderSignal = false;
|
|
isRVICrossedOverSignal = false;
|
|
isRVICrossedUnderSignal = false;
|
|
|
|
//
|
|
// MACD ...
|
|
|
|
//
|
|
isMACDBullish = false;
|
|
isMACDBearish = false;
|
|
isMACDSwitchedToBullish = false;
|
|
isMACDSwitchedToBearish = false;
|
|
isMACDOverSignal = false;
|
|
isMACDUnderSignal = false;
|
|
isMACDCrossedOverSignal = false;
|
|
isMACDCrossedUnderSignal = false;
|
|
|
|
//
|
|
// MOMENTUM ...
|
|
|
|
//
|
|
isMomentumBullish = false;
|
|
isMomentumBearish = false;
|
|
isMomentumSwitchedToBullish = false;
|
|
isMomentumSwitchedToBearish = false;
|
|
|
|
//
|
|
// STOCHASTIC ...
|
|
|
|
//
|
|
isStochasticBullish = false;
|
|
isStochasticBearish = false;
|
|
isStochasticSwitchedToBullish = false;
|
|
isStochasticSwitchedToBearish = false;
|
|
isStochasticOverSignal = false;
|
|
isStochasticUnderSignal = false;
|
|
isStochasticCrossedOverSignal = false;
|
|
isStochasticCrossedUnderSignal = false;
|
|
isStochasticOB = false;
|
|
isStochasticOS = false;
|
|
isStochasticCrossedOverOB = false;
|
|
isStochasticCrossedOverOS = false;
|
|
isStochasticCrossedUnderOB = false;
|
|
isStochasticCrossedUnderOS = false;
|
|
|
|
//
|
|
ZeroMemory(this);
|
|
}
|
|
|
|
/**
|
|
* Generate Conditions Scores ...
|
|
*
|
|
* @param bullishScore: Double, Directional Scores Reference ...
|
|
* @param bearishScore: Double, Directional Scores Reference ...
|
|
*/
|
|
void GenerateScore(
|
|
double &bullishScore,
|
|
double &bearishScore //
|
|
)
|
|
{
|
|
//
|
|
bullishScore = 0;
|
|
bearishScore = 0;
|
|
|
|
//
|
|
double score = 1;
|
|
double minScore = 0.5;
|
|
double highScore = 1.5;
|
|
|
|
//
|
|
// XSTR ...
|
|
|
|
//
|
|
if (isStrBullish)
|
|
{
|
|
bullishScore += minScore;
|
|
}
|
|
if (isStrSwitchedToBullish)
|
|
{
|
|
bullishScore += score;
|
|
}
|
|
if (isRejectUpVidya)
|
|
{
|
|
bullishScore += minScore;
|
|
}
|
|
if (isClosedOverVidya)
|
|
{
|
|
bullishScore += minScore;
|
|
}
|
|
if (isCrossedOverVidya)
|
|
{
|
|
bullishScore += minScore;
|
|
}
|
|
if (isRejectUpLSM)
|
|
{
|
|
bullishScore += minScore;
|
|
}
|
|
if (isCloseOverLSM)
|
|
{
|
|
bullishScore += minScore;
|
|
}
|
|
if (isCrossedOverLSM)
|
|
{
|
|
bullishScore += minScore;
|
|
}
|
|
if (isRejectUpHSM)
|
|
{
|
|
bullishScore += minScore;
|
|
}
|
|
if (isCloseOverHSM)
|
|
{
|
|
bullishScore += minScore;
|
|
}
|
|
if (isCrossedOverHSM)
|
|
{
|
|
bullishScore += minScore;
|
|
}
|
|
if (isRejectUpStr)
|
|
{
|
|
bullishScore += minScore;
|
|
}
|
|
if (isCloseOverStr)
|
|
{
|
|
bullishScore += minScore;
|
|
}
|
|
if (isCrossedOverStr)
|
|
{
|
|
bullishScore += minScore;
|
|
}
|
|
if (isVidyaOverHSM)
|
|
{
|
|
bullishScore += minScore;
|
|
}
|
|
if (isVidyaCrossedOverHSM)
|
|
{
|
|
bullishScore += minScore;
|
|
}
|
|
if (isVidyaOverLSM)
|
|
{
|
|
bullishScore += minScore;
|
|
}
|
|
if (isVidyaCrossedOverLSM)
|
|
{
|
|
bullishScore += minScore;
|
|
}
|
|
if (isVidyaOverStr)
|
|
{
|
|
bullishScore += minScore;
|
|
}
|
|
if (isVidyaCrossedOverStr)
|
|
{
|
|
bullishScore += minScore;
|
|
}
|
|
|
|
//
|
|
if (isStrBearish)
|
|
{
|
|
bearishScore += minScore;
|
|
}
|
|
if (isStrSwitchedToBearish)
|
|
{
|
|
bearishScore += score;
|
|
}
|
|
if (isRejectDownVidya)
|
|
{
|
|
bearishScore += minScore;
|
|
}
|
|
if (isCloseUnderVidya)
|
|
{
|
|
bearishScore += minScore;
|
|
}
|
|
if (isCrossedUnderVidya)
|
|
{
|
|
bearishScore += minScore;
|
|
}
|
|
if (isRejectDownLSM)
|
|
{
|
|
bearishScore += minScore;
|
|
}
|
|
if (isCloseUnderLSM)
|
|
{
|
|
bearishScore += minScore;
|
|
}
|
|
if (isCrossedUnderLSM)
|
|
{
|
|
bearishScore += minScore;
|
|
}
|
|
if (isRejectDownHSM)
|
|
{
|
|
bearishScore += minScore;
|
|
}
|
|
if (isCloseUnderHSM)
|
|
{
|
|
bearishScore += minScore;
|
|
}
|
|
if (isCrossedUnderHSM)
|
|
{
|
|
bearishScore += minScore;
|
|
}
|
|
if (isRejectDownStr)
|
|
{
|
|
bearishScore += minScore;
|
|
}
|
|
if (isCloseUnderStr)
|
|
{
|
|
bearishScore += minScore;
|
|
}
|
|
if (isCrossedUnderStr)
|
|
{
|
|
bearishScore += minScore;
|
|
}
|
|
if (isVidyaUnderHSM)
|
|
{
|
|
bearishScore += minScore;
|
|
}
|
|
if (isVidyaCrossedUnderHSM)
|
|
{
|
|
bearishScore += minScore;
|
|
}
|
|
if (isVidyaUnderLSM)
|
|
{
|
|
bearishScore += minScore;
|
|
}
|
|
if (isVidyaCrossedUnderLSM)
|
|
{
|
|
bearishScore += minScore;
|
|
}
|
|
if (isVidyaUnderStr)
|
|
{
|
|
bearishScore += minScore;
|
|
}
|
|
if (isVidyaCrossedUnderStr)
|
|
{
|
|
bearishScore += minScore;
|
|
}
|
|
|
|
//
|
|
// XOCS ...
|
|
//
|
|
// AC ...
|
|
|
|
//
|
|
if (isACBullish)
|
|
{
|
|
bullishScore += minScore;
|
|
}
|
|
if (isACOverMax)
|
|
{
|
|
bullishScore += minScore;
|
|
}
|
|
if (isACSwitchedToBullish)
|
|
{
|
|
bullishScore += minScore;
|
|
}
|
|
|
|
//
|
|
if (isACBearish)
|
|
{
|
|
bearishScore += minScore;
|
|
}
|
|
if (isACUnderMin)
|
|
{
|
|
bearishScore += minScore;
|
|
}
|
|
if (isACSwitchedToBearish)
|
|
{
|
|
bearishScore += minScore;
|
|
}
|
|
|
|
//
|
|
// AD ...
|
|
|
|
//
|
|
if (isADOverMax)
|
|
{
|
|
bullishScore += minScore;
|
|
}
|
|
if (isADBiggerLast)
|
|
{
|
|
bullishScore += minScore;
|
|
}
|
|
|
|
//
|
|
if (isADUnderMin)
|
|
{
|
|
bearishScore += minScore;
|
|
}
|
|
if (isADLesserLast)
|
|
{
|
|
bearishScore += minScore;
|
|
}
|
|
|
|
//
|
|
// ADX ...
|
|
|
|
//
|
|
if (isADXBullish)
|
|
{
|
|
bullishScore += minScore;
|
|
}
|
|
if (isADXBiggerLast)
|
|
{
|
|
bullishScore += minScore;
|
|
}
|
|
if (isADXOverThreshold)
|
|
{
|
|
bullishScore += minScore;
|
|
}
|
|
if (isDXPBiggerThanDXN)
|
|
{
|
|
bullishScore += minScore;
|
|
}
|
|
if (isADXSwitchedToBullish)
|
|
{
|
|
bullishScore += minScore;
|
|
}
|
|
|
|
//
|
|
if (isADXBearish)
|
|
{
|
|
bearishScore += minScore;
|
|
}
|
|
if (isADXLesserLast)
|
|
{
|
|
bearishScore += minScore;
|
|
}
|
|
if (isDXNBiggerThanDXP)
|
|
{
|
|
bearishScore += minScore;
|
|
}
|
|
if (isADXUnderThreshold)
|
|
{
|
|
bearishScore += minScore;
|
|
}
|
|
if (isADXSwitchedToBearish)
|
|
{
|
|
bearishScore += minScore;
|
|
}
|
|
|
|
//
|
|
// ATR ...
|
|
|
|
//
|
|
if (isATROverLast)
|
|
{
|
|
bullishScore += minScore;
|
|
}
|
|
|
|
//
|
|
if (isATRUnderLast)
|
|
{
|
|
bearishScore += minScore;
|
|
}
|
|
|
|
//
|
|
// CCI ...
|
|
|
|
//
|
|
if (isCCIOS)
|
|
{
|
|
bullishScore += minScore;
|
|
}
|
|
if (isCCIBullish)
|
|
{
|
|
bullishScore += minScore;
|
|
}
|
|
if (isCCICrossedOverOS)
|
|
{
|
|
bullishScore += minScore;
|
|
}
|
|
if (isCCICrossedOverOB)
|
|
{
|
|
bullishScore += minScore;
|
|
}
|
|
if (isCCISwitchedToBullish)
|
|
{
|
|
bullishScore += minScore;
|
|
}
|
|
|
|
//
|
|
if (isCCIOB)
|
|
{
|
|
bearishScore += minScore;
|
|
}
|
|
if (isCCIBearish)
|
|
{
|
|
bearishScore += minScore;
|
|
}
|
|
if (isCCICrossedUnderOS)
|
|
{
|
|
bearishScore += minScore;
|
|
}
|
|
if (isCCICrossedUnderOB)
|
|
{
|
|
bearishScore += minScore;
|
|
}
|
|
if (isCCISwitchedToBearish)
|
|
{
|
|
bearishScore += minScore;
|
|
}
|
|
|
|
//
|
|
// RSI ...
|
|
|
|
//
|
|
if (isRSIOS)
|
|
{
|
|
bullishScore += minScore;
|
|
}
|
|
if (isRSIBullish)
|
|
{
|
|
bullishScore += minScore;
|
|
}
|
|
if (isRSICrossedOverOB)
|
|
{
|
|
bullishScore += minScore;
|
|
}
|
|
if (isRSICrossedOverOS)
|
|
{
|
|
bullishScore += minScore;
|
|
}
|
|
if (isRSISwitchedToBullish)
|
|
{
|
|
bullishScore += minScore;
|
|
}
|
|
|
|
//
|
|
if (isRSIOB)
|
|
{
|
|
bearishScore += minScore;
|
|
}
|
|
if (isRSIBearish)
|
|
{
|
|
bearishScore += minScore;
|
|
}
|
|
if (isRSICrossedUnderOB)
|
|
{
|
|
bearishScore += minScore;
|
|
}
|
|
if (isRSICrossedUnderOS)
|
|
{
|
|
bearishScore += minScore;
|
|
}
|
|
if (isRSISwitchedToBearish)
|
|
{
|
|
bearishScore += minScore;
|
|
}
|
|
|
|
//
|
|
// MFI ...
|
|
|
|
//
|
|
if (isMFIOS)
|
|
{
|
|
bullishScore += minScore;
|
|
}
|
|
if (isMFIBullish)
|
|
{
|
|
bullishScore += minScore;
|
|
}
|
|
if (isMFICrossedOverOB)
|
|
{
|
|
bullishScore += minScore;
|
|
}
|
|
if (isMFICrossedOverOS)
|
|
{
|
|
bullishScore += minScore;
|
|
}
|
|
if (isMFISwitchedToBullish)
|
|
{
|
|
bullishScore += minScore;
|
|
}
|
|
|
|
//
|
|
if (isMFIOB)
|
|
{
|
|
bearishScore += minScore;
|
|
}
|
|
if (isMFIBearish)
|
|
{
|
|
bearishScore += minScore;
|
|
}
|
|
if (isMFICrossedUnderOB)
|
|
{
|
|
bearishScore += minScore;
|
|
}
|
|
if (isMFICrossedUnderOS)
|
|
{
|
|
bearishScore += minScore;
|
|
}
|
|
if (isMFISwitchedToBearish)
|
|
{
|
|
bearishScore += minScore;
|
|
}
|
|
|
|
//
|
|
// RVI ...
|
|
|
|
//
|
|
if (isRVIBullish)
|
|
{
|
|
bullishScore += minScore;
|
|
}
|
|
if (isRVIOverSignal)
|
|
{
|
|
bullishScore += minScore;
|
|
}
|
|
if (isRVISwitchedToBullish)
|
|
{
|
|
bullishScore += minScore;
|
|
}
|
|
if (isRVICrossedOverSignal)
|
|
{
|
|
bullishScore += minScore;
|
|
}
|
|
|
|
//
|
|
if (isRVIBearish)
|
|
{
|
|
bearishScore += minScore;
|
|
}
|
|
if (isRVIUnderSignal)
|
|
{
|
|
bearishScore += minScore;
|
|
}
|
|
if (isRVISwitchedToBearish)
|
|
{
|
|
bearishScore += minScore;
|
|
}
|
|
if (isRVICrossedUnderSignal)
|
|
{
|
|
bearishScore += minScore;
|
|
}
|
|
|
|
//
|
|
// MACD ...
|
|
|
|
//
|
|
if (isMACDBullish)
|
|
{
|
|
bullishScore += minScore;
|
|
}
|
|
if (isMACDOverSignal)
|
|
{
|
|
bullishScore += minScore;
|
|
}
|
|
if (isMACDSwitchedToBullish)
|
|
{
|
|
bullishScore += minScore;
|
|
}
|
|
if (isMACDCrossedOverSignal)
|
|
{
|
|
bullishScore += minScore;
|
|
}
|
|
|
|
//
|
|
if (isMACDBearish)
|
|
{
|
|
bearishScore += minScore;
|
|
}
|
|
if (isMACDUnderSignal)
|
|
{
|
|
bearishScore += minScore;
|
|
}
|
|
if (isMACDSwitchedToBearish)
|
|
{
|
|
bearishScore += minScore;
|
|
}
|
|
if (isMACDCrossedUnderSignal)
|
|
{
|
|
bearishScore += minScore;
|
|
}
|
|
|
|
//
|
|
// MOMENTUM ...
|
|
|
|
//
|
|
if (isMomentumBullish)
|
|
{
|
|
bullishScore += minScore;
|
|
}
|
|
if (isMomentumSwitchedToBullish)
|
|
{
|
|
bullishScore += minScore;
|
|
}
|
|
|
|
//
|
|
if (isMomentumBearish)
|
|
{
|
|
bearishScore += minScore;
|
|
}
|
|
if (isMomentumSwitchedToBearish)
|
|
{
|
|
bearishScore += minScore;
|
|
}
|
|
|
|
//
|
|
// STOCHASTIC ...
|
|
|
|
//
|
|
if (isStochasticOS)
|
|
{
|
|
bullishScore += minScore;
|
|
}
|
|
if (isStochasticOverSignal)
|
|
{
|
|
bullishScore += minScore;
|
|
}
|
|
if (isStochasticBullish)
|
|
{
|
|
bullishScore += minScore;
|
|
}
|
|
if (isStochasticCrossedOverSignal)
|
|
{
|
|
bullishScore += minScore;
|
|
}
|
|
if (isStochasticCrossedOverOB)
|
|
{
|
|
bullishScore += minScore;
|
|
}
|
|
if (isStochasticCrossedOverOS)
|
|
{
|
|
bullishScore += minScore;
|
|
}
|
|
if (isStochasticSwitchedToBullish)
|
|
{
|
|
bullishScore += minScore;
|
|
}
|
|
|
|
//
|
|
if (isStochasticOB)
|
|
{
|
|
bearishScore += minScore;
|
|
}
|
|
if (isStochasticUnderSignal)
|
|
{
|
|
bearishScore += minScore;
|
|
}
|
|
if (isStochasticBearish)
|
|
{
|
|
bearishScore += minScore;
|
|
}
|
|
if (isStochasticCrossedUnderSignal)
|
|
{
|
|
bearishScore += minScore;
|
|
}
|
|
if (isStochasticCrossedUnderOB)
|
|
{
|
|
bearishScore += minScore;
|
|
}
|
|
if (isStochasticCrossedUnderOS)
|
|
{
|
|
bearishScore += minScore;
|
|
}
|
|
if (isStochasticSwitchedToBearish)
|
|
{
|
|
bearishScore += minScore;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Generate Summary String for Represent Conditions State ...
|
|
*
|
|
* @param onlyCommons: Boolean, Just Generate Only Commons Conditions ...
|
|
* @param onlyConditions: Boolean, Just Generate Only Conditions ...
|
|
* @param includeScores: Boolean, Attach Scores Representations on Result ...
|
|
* @param ignoreFalseConditions: Boolean, Ignore False Conditions on Result ...
|
|
* @param separator: String, Separate Lines ...
|
|
*
|
|
* @return ( string )
|
|
*/
|
|
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 =
|
|
//
|
|
"-----------------------" + separator +
|
|
"XSTR: " + separator +
|
|
"-----------------------" + separator +
|
|
ToString("isStrBullish", isStrBullish, ignoreFalseConditions, separator) +
|
|
ToString("isStrBearish", isStrBearish, ignoreFalseConditions, separator) +
|
|
ToString("isStrSwitchedToBullish", isStrSwitchedToBullish, ignoreFalseConditions, separator) +
|
|
ToString("isStrSwitchedToBearish", isStrSwitchedToBearish, ignoreFalseConditions, separator) +
|
|
ToString("isRejectUpVidya", isRejectUpVidya, ignoreFalseConditions, separator) +
|
|
ToString("isClosedOverVidya", isClosedOverVidya, ignoreFalseConditions, separator) +
|
|
ToString("isCrossedOverVidya", isCrossedOverVidya, ignoreFalseConditions, separator) +
|
|
ToString("isRejectDownVidya", isRejectDownVidya, ignoreFalseConditions, separator) +
|
|
ToString("isCloseUnderVidya", isCloseUnderVidya, ignoreFalseConditions, separator) +
|
|
ToString("isCrossedUnderVidya", isCrossedUnderVidya, ignoreFalseConditions, separator) +
|
|
ToString("isRejectUpLSM", isRejectUpLSM, ignoreFalseConditions, separator) +
|
|
ToString("isCloseOverLSM", isCloseOverLSM, ignoreFalseConditions, separator) +
|
|
ToString("isCrossedOverLSM", isCrossedOverLSM, ignoreFalseConditions, separator) +
|
|
ToString("isRejectDownLSM", isRejectDownLSM, ignoreFalseConditions, separator) +
|
|
ToString("isCloseUnderLSM", isCloseUnderLSM, ignoreFalseConditions, separator) +
|
|
ToString("isCrossedUnderLSM", isCrossedUnderLSM, ignoreFalseConditions, separator) +
|
|
ToString("isRejectUpHSM", isRejectUpHSM, ignoreFalseConditions, separator) +
|
|
ToString("isCloseOverHSM", isCloseOverHSM, ignoreFalseConditions, separator) +
|
|
ToString("isCrossedOverHSM", isCrossedOverHSM, ignoreFalseConditions, separator) +
|
|
ToString("isRejectDownHSM", isRejectDownHSM, ignoreFalseConditions, separator) +
|
|
ToString("isCloseUnderHSM", isCloseUnderHSM, ignoreFalseConditions, separator) +
|
|
ToString("isCrossedUnderHSM", isCrossedUnderHSM, ignoreFalseConditions, separator) +
|
|
ToString("isRejectUpStr", isRejectUpStr, ignoreFalseConditions, separator) +
|
|
ToString("isCloseOverStr", isCloseOverStr, ignoreFalseConditions, separator) +
|
|
ToString("isCrossedOverStr", isCrossedOverStr, ignoreFalseConditions, separator) +
|
|
ToString("isRejectDownStr", isRejectDownStr, ignoreFalseConditions, separator) +
|
|
ToString("isCloseUnderStr", isCloseUnderStr, ignoreFalseConditions, separator) +
|
|
ToString("isCrossedUnderStr", isCrossedUnderStr, ignoreFalseConditions, separator) +
|
|
ToString("isVidyaOverHSM", isVidyaOverHSM, ignoreFalseConditions, separator) +
|
|
ToString("isVidyaCrossedOverHSM", isVidyaCrossedOverHSM, ignoreFalseConditions, separator) +
|
|
ToString("isVidyaUnderHSM", isVidyaUnderHSM, ignoreFalseConditions, separator) +
|
|
ToString("isVidyaCrossedUnderHSM", isVidyaCrossedUnderHSM, ignoreFalseConditions, separator) +
|
|
ToString("isVidyaOverLSM", isVidyaOverLSM, ignoreFalseConditions, separator) +
|
|
ToString("isVidyaCrossedOverLSM", isVidyaCrossedOverLSM, ignoreFalseConditions, separator) +
|
|
ToString("isVidyaUnderLSM", isVidyaUnderLSM, ignoreFalseConditions, separator) +
|
|
ToString("isVidyaCrossedUnderLSM", isVidyaCrossedUnderLSM, ignoreFalseConditions, separator) +
|
|
ToString("isVidyaOverStr", isVidyaOverStr, ignoreFalseConditions, separator) +
|
|
ToString("isVidyaCrossedOverStr", isVidyaCrossedOverStr, ignoreFalseConditions, separator) +
|
|
ToString("isVidyaUnderStr", isVidyaUnderStr, ignoreFalseConditions, separator) +
|
|
ToString("isVidyaCrossedUnderStr", isVidyaCrossedUnderStr, ignoreFalseConditions, separator) +
|
|
"-----------------------" + separator +
|
|
"XOCS: " + separator +
|
|
"-----------------------" + separator +
|
|
ToString("isACBullish", isACBullish, ignoreFalseConditions, separator) +
|
|
ToString("isACBearish", isACBearish, ignoreFalseConditions, separator) +
|
|
ToString("isACSwitchedToBullish", isACSwitchedToBullish, ignoreFalseConditions, separator) +
|
|
ToString("isACSwitchedToBearish", isACSwitchedToBearish, ignoreFalseConditions, separator) +
|
|
ToString("isACOverMax", isACOverMax, ignoreFalseConditions, separator) +
|
|
ToString("isACUnderMin", isACUnderMin, ignoreFalseConditions, separator) +
|
|
ToString("isADBiggerLast", isADBiggerLast, ignoreFalseConditions, separator) +
|
|
ToString("isADLesserLast", isADLesserLast, ignoreFalseConditions, separator) +
|
|
ToString("isADOverMax", isADOverMax, ignoreFalseConditions, separator) +
|
|
ToString("isADUnderMin", isADUnderMin, ignoreFalseConditions, separator) +
|
|
ToString("isADXBiggerLast", isADXBiggerLast, ignoreFalseConditions, separator) +
|
|
ToString("isADXLesserLast", isADXLesserLast, ignoreFalseConditions, separator) +
|
|
ToString("isADXOverThreshold", isADXOverThreshold, ignoreFalseConditions, separator) +
|
|
ToString("isADXUnderThreshold", isADXUnderThreshold, ignoreFalseConditions, separator) +
|
|
ToString("isDXPBiggerThanDXN", isDXPBiggerThanDXN, ignoreFalseConditions, separator) +
|
|
ToString("isDXNBiggerThanDXP", isDXNBiggerThanDXP, ignoreFalseConditions, separator) +
|
|
ToString("isADXBullish", isADXBullish, ignoreFalseConditions, separator) +
|
|
ToString("isADXBearish", isADXBearish, ignoreFalseConditions, separator) +
|
|
ToString("isADXSwitchedToBullish", isADXSwitchedToBullish, ignoreFalseConditions, separator) +
|
|
ToString("isADXSwitchedToBearish", isADXSwitchedToBearish, ignoreFalseConditions, separator) +
|
|
ToString("isATROverLast", isATROverLast, ignoreFalseConditions, separator) +
|
|
ToString("isATRUnderLast", isATRUnderLast, ignoreFalseConditions, separator) +
|
|
ToString("isCCIBullish", isCCIBullish, ignoreFalseConditions, separator) +
|
|
ToString("isCCIBearish", isCCIBearish, ignoreFalseConditions, separator) +
|
|
ToString("isCCISwitchedToBullish", isCCISwitchedToBullish, ignoreFalseConditions, separator) +
|
|
ToString("isCCISwitchedToBearish", isCCISwitchedToBearish, ignoreFalseConditions, separator) +
|
|
ToString("isCCIOB", isCCIOB, ignoreFalseConditions, separator) +
|
|
ToString("isCCIOS", isCCIOS, ignoreFalseConditions, separator) +
|
|
ToString("isCCICrossedOverOB", isCCICrossedOverOB, ignoreFalseConditions, separator) +
|
|
ToString("isCCICrossedOverOS", isCCICrossedOverOS, ignoreFalseConditions, separator) +
|
|
ToString("isCCICrossedUnderOB", isCCICrossedUnderOB, ignoreFalseConditions, separator) +
|
|
ToString("isCCICrossedUnderOS", isCCICrossedUnderOS, ignoreFalseConditions, separator) +
|
|
ToString("isRSIBullish", isRSIBullish, ignoreFalseConditions, separator) +
|
|
ToString("isRSIBearish", isRSIBearish, ignoreFalseConditions, separator) +
|
|
ToString("isRSISwitchedToBullish", isRSISwitchedToBullish, ignoreFalseConditions, separator) +
|
|
ToString("isRSISwitchedToBearish", isRSISwitchedToBearish, ignoreFalseConditions, separator) +
|
|
ToString("isRSIOB", isRSIOB, ignoreFalseConditions, separator) +
|
|
ToString("isRSIOS", isRSIOS, ignoreFalseConditions, separator) +
|
|
ToString("isRSICrossedOverOB", isRSICrossedOverOB, ignoreFalseConditions, separator) +
|
|
ToString("isRSICrossedOverOS", isRSICrossedOverOS, ignoreFalseConditions, separator) +
|
|
ToString("isRSICrossedUnderOB", isRSICrossedUnderOB, ignoreFalseConditions, separator) +
|
|
ToString("isRSICrossedUnderOS", isRSICrossedUnderOS, ignoreFalseConditions, separator) +
|
|
ToString("isMFIBullish", isMFIBullish, ignoreFalseConditions, separator) +
|
|
ToString("isMFIBearish", isMFIBearish, ignoreFalseConditions, separator) +
|
|
ToString("isMFISwitchedToBullish", isMFISwitchedToBullish, ignoreFalseConditions, separator) +
|
|
ToString("isMFISwitchedToBearish", isMFISwitchedToBearish, ignoreFalseConditions, separator) +
|
|
ToString("isMFIOB", isMFIOB, ignoreFalseConditions, separator) +
|
|
ToString("isMFIOS", isMFIOS, ignoreFalseConditions, separator) +
|
|
ToString("isMFICrossedOverOB", isMFICrossedOverOB, ignoreFalseConditions, separator) +
|
|
ToString("isMFICrossedOverOS", isMFICrossedOverOS, ignoreFalseConditions, separator) +
|
|
ToString("isMFICrossedUnderOB", isMFICrossedUnderOB, ignoreFalseConditions, separator) +
|
|
ToString("isMFICrossedUnderOS", isMFICrossedUnderOS, ignoreFalseConditions, separator) +
|
|
ToString("isRVIBullish", isRVIBullish, ignoreFalseConditions, separator) +
|
|
ToString("isRVIBearish", isRVIBearish, ignoreFalseConditions, separator) +
|
|
ToString("isRVISwitchedToBullish", isRVISwitchedToBullish, ignoreFalseConditions, separator) +
|
|
ToString("isRVISwitchedToBearish", isRVISwitchedToBearish, ignoreFalseConditions, separator) +
|
|
ToString("isRVIOverSignal", isRVIOverSignal, ignoreFalseConditions, separator) +
|
|
ToString("isRVIUnderSignal", isRVIUnderSignal, ignoreFalseConditions, separator) +
|
|
ToString("isRVICrossedOverSignal", isRVICrossedOverSignal, ignoreFalseConditions, separator) +
|
|
ToString("isRVICrossedUnderSignal", isRVICrossedUnderSignal, ignoreFalseConditions, separator) +
|
|
ToString("isMACDBullish", isMACDBullish, ignoreFalseConditions, separator) +
|
|
ToString("isMACDBearish", isMACDBearish, ignoreFalseConditions, separator) +
|
|
ToString("isMACDSwitchedToBullish", isMACDSwitchedToBullish, ignoreFalseConditions, separator) +
|
|
ToString("isMACDSwitchedToBearish", isMACDSwitchedToBearish, ignoreFalseConditions, separator) +
|
|
ToString("isMACDOverSignal", isMACDOverSignal, ignoreFalseConditions, separator) +
|
|
ToString("isMACDUnderSignal", isMACDUnderSignal, ignoreFalseConditions, separator) +
|
|
ToString("isMACDCrossedOverSignal", isMACDCrossedOverSignal, ignoreFalseConditions, separator) +
|
|
ToString("isMACDCrossedUnderSignal", isMACDCrossedUnderSignal, ignoreFalseConditions, separator) +
|
|
ToString("isMomentumBullish", isMomentumBullish, ignoreFalseConditions, separator) +
|
|
ToString("isMomentumBearish", isMomentumBearish, ignoreFalseConditions, separator) +
|
|
ToString("isMomentumSwitchedToBullish", isMomentumSwitchedToBullish, ignoreFalseConditions, separator) +
|
|
ToString("isMomentumSwitchedToBearish", isMomentumSwitchedToBearish, ignoreFalseConditions, separator) +
|
|
ToString("isStochasticBullish", isStochasticBullish, ignoreFalseConditions, separator) +
|
|
ToString("isStochasticBearish", isStochasticBearish, ignoreFalseConditions, separator) +
|
|
ToString("isStochasticSwitchedToBullish", isStochasticSwitchedToBullish, ignoreFalseConditions, separator) +
|
|
ToString("isStochasticSwitchedToBearish", isStochasticSwitchedToBearish, ignoreFalseConditions, separator) +
|
|
ToString("isStochasticOverSignal", isStochasticOverSignal, ignoreFalseConditions, separator) +
|
|
ToString("isStochasticUnderSignal", isStochasticUnderSignal, ignoreFalseConditions, separator) +
|
|
ToString("isStochasticCrossedOverSignal", isStochasticCrossedOverSignal, ignoreFalseConditions, separator) +
|
|
ToString("isStochasticCrossedUnderSignal", isStochasticCrossedUnderSignal, ignoreFalseConditions, separator) +
|
|
ToString("isStochasticOB", isStochasticOB, ignoreFalseConditions, separator) +
|
|
ToString("isStochasticOS", isStochasticOS, ignoreFalseConditions, separator) +
|
|
ToString("isStochasticCrossedOverOB", isStochasticCrossedOverOB, ignoreFalseConditions, separator) +
|
|
ToString("isStochasticCrossedOverOS", isStochasticCrossedOverOS, ignoreFalseConditions, separator) +
|
|
ToString("isStochasticCrossedUnderOB", isStochasticCrossedUnderOB, ignoreFalseConditions, separator) +
|
|
ToString("isStochasticCrossedUnderOS", isStochasticCrossedUnderOS, ignoreFalseConditions, separator) +
|
|
//
|
|
""
|
|
//
|
|
;
|
|
|
|
//
|
|
result =
|
|
//
|
|
"[" + GetTag() + "]" + separator +
|
|
(onlyConditions
|
|
? ""
|
|
: commonStr) +
|
|
(!includeScores
|
|
? ""
|
|
: scoresStr) +
|
|
" " + separator +
|
|
(onlyCommons
|
|
? ""
|
|
: conditionsStr) +
|
|
""
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Retrieve nique Tag Identifier ...
|
|
*
|
|
* @return ( string )
|
|
*/
|
|
string GetTag()
|
|
{
|
|
return GetTypeName(this);
|
|
}
|
|
};
|
|
|
|
//
|
|
// Helper Class Implementation ...
|
|
class XCXSTRCCIHelper : XCBase
|
|
{
|
|
//
|
|
// Public ...
|
|
public:
|
|
//
|
|
// Props ...
|
|
XCX121XCCHelper *ccHelper;
|
|
XCX121XCTHelper *ctHelper;
|
|
XCX121XSTRHelper *strHelper;
|
|
XCX121XOCSHelper *ocsHelper;
|
|
|
|
//
|
|
// Constructor ...
|
|
XCXSTRCCIHelper()
|
|
{
|
|
}
|
|
|
|
//
|
|
// Deconstructor ...
|
|
~XCXSTRCCIHelper()
|
|
{
|
|
//
|
|
mInputs.Clean();
|
|
|
|
//
|
|
ZeroMemory(ccHelper);
|
|
ZeroMemory(ctHelper);
|
|
ZeroMemory(strHelper);
|
|
ZeroMemory(ocsHelper);
|
|
|
|
//
|
|
IndicatorRelease(acHandler);
|
|
IndicatorRelease(adHandler);
|
|
IndicatorRelease(adxHandler);
|
|
IndicatorRelease(atrHandler);
|
|
IndicatorRelease(cciHandler);
|
|
IndicatorRelease(rsiHandler);
|
|
IndicatorRelease(mfiHandler);
|
|
IndicatorRelease(rviHandler);
|
|
IndicatorRelease(macdHandler);
|
|
IndicatorRelease(momentumHandler);
|
|
IndicatorRelease(stochasticHandler);
|
|
}
|
|
|
|
//
|
|
string GetSymbol()
|
|
{
|
|
return mSymbol;
|
|
}
|
|
|
|
//
|
|
ENUM_TIMEFRAMES GetPeriod()
|
|
{
|
|
return mPeriod;
|
|
}
|
|
|
|
//
|
|
// Tools ...
|
|
|
|
/**
|
|
* Initialize Indicator Helper ...
|
|
*
|
|
* @param symbol: String, Symbol ...
|
|
* @param period: ENUM_TIMEFRAMES member, Period ...
|
|
* @param inputs: XSTRCCIInputs instance, Indicator Inputs ...
|
|
*
|
|
* @return ( bool )
|
|
*/
|
|
bool Init(
|
|
string symbol, // Trading Symbol
|
|
ENUM_TIMEFRAMES period, // Trading Period
|
|
XSTRCCIInputs &inputs // Inputs
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
result =
|
|
IsValid(symbol) &&
|
|
IsValid(period) &&
|
|
inputs.IsValid();
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
mSymbol = symbol;
|
|
mPeriod = period;
|
|
|
|
//
|
|
// Setting Inputs ...
|
|
|
|
//
|
|
mInputs = inputs;
|
|
|
|
//
|
|
// Initial Helpers ...
|
|
|
|
//
|
|
// XCT ...
|
|
ctHelper = new XCX121XCTHelper();
|
|
result =
|
|
result &&
|
|
ctHelper.Init(
|
|
symbol,
|
|
period,
|
|
mInputs.ctInputs //
|
|
);
|
|
|
|
//
|
|
// XCC ...
|
|
ccHelper = new XCX121XCCHelper();
|
|
result =
|
|
result &&
|
|
ccHelper.Init(
|
|
symbol,
|
|
period,
|
|
mInputs.ccInputs //
|
|
);
|
|
|
|
//
|
|
// XSTR ...
|
|
strHelper = new XCX121XSTRHelper();
|
|
result =
|
|
result &&
|
|
strHelper.Init(
|
|
symbol,
|
|
period,
|
|
mInputs.strInputs //
|
|
);
|
|
|
|
//
|
|
// XOSC ...
|
|
ocsHelper = new XCX121XOCSHelper();
|
|
result =
|
|
result &&
|
|
ocsHelper.Init(
|
|
symbol,
|
|
period,
|
|
mInputs.oscsInputs //
|
|
);
|
|
|
|
//
|
|
if (!result)
|
|
{
|
|
//
|
|
ZeroMemory(ccHelper);
|
|
ZeroMemory(ctHelper);
|
|
ZeroMemory(strHelper);
|
|
ZeroMemory(ocsHelper);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// OSCILLATORS Viewers ...
|
|
|
|
//
|
|
// AC ...
|
|
if (mInputs.showAC)
|
|
{
|
|
//
|
|
acHandler = iAC(
|
|
symbol,
|
|
period //
|
|
);
|
|
|
|
//
|
|
result =
|
|
result &&
|
|
acHandler != INVALID_HANDLE;
|
|
}
|
|
|
|
//
|
|
// AD ...
|
|
if (mInputs.showAD)
|
|
{
|
|
//
|
|
adHandler = iAD(
|
|
symbol,
|
|
period,
|
|
mInputs.oscsInputs.adAppliedTo //
|
|
);
|
|
|
|
//
|
|
result =
|
|
result &&
|
|
adHandler != INVALID_HANDLE;
|
|
}
|
|
|
|
//
|
|
// ADX ...
|
|
if (mInputs.showADX)
|
|
{
|
|
//
|
|
adxHandler = iADX(
|
|
symbol,
|
|
period,
|
|
mInputs.oscsInputs.adxLength //
|
|
);
|
|
|
|
//
|
|
result =
|
|
result &&
|
|
adxHandler != INVALID_HANDLE;
|
|
}
|
|
|
|
//
|
|
// ATR ...
|
|
if (mInputs.showATR)
|
|
{
|
|
//
|
|
atrHandler = iATR(
|
|
symbol,
|
|
period,
|
|
mInputs.oscsInputs.atrLength //
|
|
);
|
|
|
|
//
|
|
result =
|
|
result &&
|
|
atrHandler != INVALID_HANDLE;
|
|
}
|
|
|
|
//
|
|
// CCI ...
|
|
if (mInputs.showCCI)
|
|
{
|
|
//
|
|
cciHandler = iCCI(
|
|
symbol,
|
|
period,
|
|
mInputs.oscsInputs.cciLength,
|
|
mInputs.oscsInputs.cciAppliedTo //
|
|
);
|
|
|
|
//
|
|
result =
|
|
result &&
|
|
cciHandler != INVALID_HANDLE;
|
|
}
|
|
|
|
//
|
|
// RSI ...
|
|
if (mInputs.showRSI)
|
|
{
|
|
//
|
|
rsiHandler = iRSI(
|
|
symbol,
|
|
period,
|
|
mInputs.oscsInputs.rsiLength,
|
|
mInputs.oscsInputs.rsiAppliedTo //
|
|
);
|
|
|
|
//
|
|
result =
|
|
result &&
|
|
rsiHandler != INVALID_HANDLE;
|
|
}
|
|
|
|
//
|
|
// MFI ...
|
|
if (mInputs.showMFI)
|
|
{
|
|
//
|
|
mfiHandler = iMFI(
|
|
symbol,
|
|
period,
|
|
mInputs.oscsInputs.mfiLength,
|
|
mInputs.oscsInputs.mfiAppliedTo //
|
|
);
|
|
|
|
//
|
|
result =
|
|
result &&
|
|
mfiHandler != INVALID_HANDLE;
|
|
}
|
|
|
|
//
|
|
// RVI ...
|
|
if (mInputs.showRVI)
|
|
{
|
|
//
|
|
rviHandler = iRVI(
|
|
symbol,
|
|
period,
|
|
mInputs.oscsInputs.rviLength //
|
|
);
|
|
|
|
//
|
|
result =
|
|
result &&
|
|
rviHandler != INVALID_HANDLE;
|
|
}
|
|
|
|
//
|
|
// MACD ...
|
|
if (mInputs.showMACD)
|
|
{
|
|
//
|
|
macdHandler = iMACD(
|
|
symbol,
|
|
period,
|
|
mInputs.oscsInputs.macdFastLength,
|
|
mInputs.oscsInputs.macdSlowLength,
|
|
mInputs.oscsInputs.macdSignalLength,
|
|
mInputs.oscsInputs.macdAppliedTo //
|
|
);
|
|
|
|
//
|
|
result =
|
|
result &&
|
|
macdHandler != INVALID_HANDLE;
|
|
}
|
|
|
|
//
|
|
// Momentum ...
|
|
if (mInputs.showMomentum)
|
|
{
|
|
//
|
|
momentumHandler = iMomentum(
|
|
symbol,
|
|
period,
|
|
mInputs.oscsInputs.momentumLength,
|
|
mInputs.oscsInputs.momentumAppliedTo //
|
|
);
|
|
|
|
//
|
|
result =
|
|
result &&
|
|
momentumHandler != INVALID_HANDLE;
|
|
}
|
|
|
|
//
|
|
// Stochastic ...
|
|
if (mInputs.showStochastic)
|
|
{
|
|
//
|
|
stochasticHandler = iStochastic(
|
|
symbol,
|
|
period,
|
|
mInputs.oscsInputs.stochasticKLength,
|
|
mInputs.oscsInputs.stochasticDLength,
|
|
mInputs.oscsInputs.stochasticSmoothingLength,
|
|
mInputs.oscsInputs.stochasticSmoothingMethod,
|
|
mInputs.oscsInputs.stochasticAppliedTo //
|
|
);
|
|
|
|
//
|
|
result =
|
|
result &&
|
|
stochasticHandler != INVALID_HANDLE;
|
|
}
|
|
|
|
//
|
|
// If Result is False, Cleanup Resources ...
|
|
if (!result)
|
|
{
|
|
//
|
|
mInputs.Clean();
|
|
|
|
//
|
|
ZeroMemory(ccHelper);
|
|
ZeroMemory(ctHelper);
|
|
ZeroMemory(strHelper);
|
|
ZeroMemory(ocsHelper);
|
|
|
|
//
|
|
IndicatorRelease(acHandler);
|
|
IndicatorRelease(adHandler);
|
|
IndicatorRelease(adxHandler);
|
|
IndicatorRelease(atrHandler);
|
|
IndicatorRelease(cciHandler);
|
|
IndicatorRelease(rsiHandler);
|
|
IndicatorRelease(mfiHandler);
|
|
IndicatorRelease(rviHandler);
|
|
IndicatorRelease(macdHandler);
|
|
IndicatorRelease(momentumHandler);
|
|
IndicatorRelease(stochasticHandler);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Conditions Readers ...
|
|
|
|
/**
|
|
* Retrieve Conditions ...
|
|
*
|
|
* @param conditions: Argument 1
|
|
* @param barIndex: int, Specified Bar Index ...
|
|
* @param loopback: int, Loopback looking for others ...
|
|
*
|
|
* @return ( bool )
|
|
*/
|
|
bool GetSTRConditions(
|
|
X121XSTRConditions &conditions, //
|
|
int barIndex = 0, //
|
|
int loopback = 5 //
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
result = strHelper.GetConditions(
|
|
conditions,
|
|
barIndex,
|
|
loopback //
|
|
);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Retrieve Conditions ...
|
|
*
|
|
* @param conditions: Argument 1
|
|
* @param barIndex: int, Specified Bar Index ...
|
|
* @param loopback: int, Loopback looking for others ...
|
|
*
|
|
* @return ( bool )
|
|
*/
|
|
bool GetOSCSConditions(
|
|
X121XOCSConditions &conditions, //
|
|
int barIndex = 0, //
|
|
int loopback = 5 //
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
result = ocsHelper.GetConditions(
|
|
conditions,
|
|
barIndex,
|
|
loopback //
|
|
);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Others ...
|
|
|
|
//
|
|
void Free()
|
|
{
|
|
//
|
|
strHelper.Free();
|
|
ocsHelper.Free();
|
|
}
|
|
|
|
//
|
|
bool GetConditions(
|
|
XSTRCCIConditions &conditions, //
|
|
int barIndex = 0, //
|
|
int loopback = 5 //
|
|
)
|
|
{
|
|
//
|
|
bool result = true;
|
|
|
|
//
|
|
if (loopback < 5)
|
|
{
|
|
loopback = 5;
|
|
}
|
|
|
|
//
|
|
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;
|
|
|
|
//
|
|
XOHCL zBar;
|
|
XOHCL cBar;
|
|
XOHCL pBar;
|
|
|
|
//
|
|
X121XSTRConditions xstrConditions;
|
|
X121XOCSConditions xocsConditions;
|
|
|
|
//
|
|
result = zBar.Init(
|
|
mSymbol,
|
|
mPeriod,
|
|
zIndex //
|
|
);
|
|
result =
|
|
result &&
|
|
zBar.GetPreviousBar(cBar);
|
|
result =
|
|
result &&
|
|
cBar.GetPreviousBar(pBar);
|
|
|
|
//
|
|
// Conditions Retriever ...
|
|
|
|
//
|
|
// XSTR ...
|
|
result =
|
|
result &&
|
|
GetSTRConditions(
|
|
xstrConditions,
|
|
barIndex,
|
|
loopback //
|
|
);
|
|
|
|
//
|
|
// XOSCS ...
|
|
result =
|
|
result &&
|
|
GetOSCSConditions(
|
|
xocsConditions,
|
|
barIndex,
|
|
loopback //
|
|
);
|
|
|
|
//
|
|
// Check Result ...
|
|
if (!result)
|
|
{
|
|
//
|
|
zBar.Clean();
|
|
cBar.Clean();
|
|
pBar.Clean();
|
|
|
|
//
|
|
xocsConditions.Clean();
|
|
xstrConditions.Clean();
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Fill X121 Conditions Reference by Using
|
|
// Retrieved Conditions ...
|
|
|
|
//
|
|
int cIDX = 1;
|
|
int pIDX = cIDX + 1;
|
|
|
|
//
|
|
// Conditions ...
|
|
|
|
//
|
|
// XSTR ...
|
|
|
|
//
|
|
// Buffers ...
|
|
|
|
//
|
|
Copy(
|
|
xstrConditions.vidyaBuffer,
|
|
conditions.vidyaBuffer //
|
|
);
|
|
|
|
//
|
|
Copy(
|
|
xstrConditions.strBuffer,
|
|
conditions.strBuffer //
|
|
);
|
|
|
|
//
|
|
Copy(
|
|
xstrConditions.strUpBuffer,
|
|
conditions.strUpBuffer //
|
|
);
|
|
|
|
//
|
|
Copy(
|
|
xstrConditions.strDownBuffer,
|
|
conditions.strDownBuffer //
|
|
);
|
|
|
|
//
|
|
Copy(
|
|
xstrConditions.strPriceBuffer,
|
|
conditions.strPriceBuffer //
|
|
);
|
|
|
|
//
|
|
Copy(
|
|
xstrConditions.strStateBuffer,
|
|
conditions.strStateBuffer //
|
|
);
|
|
|
|
//
|
|
Copy(
|
|
xstrConditions.strSMLowBuffer,
|
|
conditions.strSMLowBuffer //
|
|
);
|
|
|
|
//
|
|
Copy(
|
|
xstrConditions.strSMHighBuffer,
|
|
conditions.strSMHighBuffer //
|
|
);
|
|
|
|
//
|
|
// Conditions ...
|
|
|
|
//
|
|
conditions.isStrBullish = xstrConditions.isStrBullish;
|
|
conditions.isStrBearish = xstrConditions.isStrBearish;
|
|
conditions.isRejectUpLSM = xstrConditions.isRejectUpLSM;
|
|
conditions.isRejectUpHSM = xstrConditions.isRejectUpHSM;
|
|
conditions.isRejectUpStr = xstrConditions.isRejectUpStr;
|
|
conditions.isCloseOverHSM = xstrConditions.isCloseOverHSM;
|
|
conditions.isCloseOverLSM = xstrConditions.isCloseOverLSM;
|
|
conditions.isCloseOverStr = xstrConditions.isCloseOverStr;
|
|
conditions.isVidyaOverHSM = xstrConditions.isVidyaOverHSM;
|
|
conditions.isVidyaOverLSM = xstrConditions.isVidyaOverLSM;
|
|
conditions.isVidyaOverStr = xstrConditions.isVidyaOverStr;
|
|
conditions.isRejectDownLSM = xstrConditions.isRejectDownLSM;
|
|
conditions.isRejectDownHSM = xstrConditions.isRejectDownHSM;
|
|
conditions.isVidyaUnderStr = xstrConditions.isVidyaUnderStr;
|
|
conditions.isVidyaUnderHSM = xstrConditions.isVidyaUnderHSM;
|
|
conditions.isVidyaUnderLSM = xstrConditions.isVidyaUnderLSM;
|
|
conditions.isCloseUnderStr = xstrConditions.isCloseUnderStr;
|
|
conditions.isRejectDownStr = xstrConditions.isRejectDownStr;
|
|
conditions.isRejectUpVidya = xstrConditions.isRejectUpVidya;
|
|
conditions.isCloseUnderHSM = xstrConditions.isCloseUnderHSM;
|
|
conditions.isCloseUnderLSM = xstrConditions.isCloseUnderLSM;
|
|
conditions.isCrossedOverLSM = xstrConditions.isCrossedOverLSM;
|
|
conditions.isCrossedOverHSM = xstrConditions.isCrossedOverHSM;
|
|
conditions.isCrossedOverStr = xstrConditions.isCrossedOverStr;
|
|
conditions.isCrossedUnderHSM = xstrConditions.isCrossedUnderHSM;
|
|
conditions.isCrossedUnderLSM = xstrConditions.isCrossedUnderLSM;
|
|
conditions.isCrossedUnderStr = xstrConditions.isCrossedUnderStr;
|
|
conditions.isClosedOverVidya = xstrConditions.isClosedOverVidya;
|
|
conditions.isRejectDownVidya = xstrConditions.isRejectDownVidya;
|
|
conditions.isCloseUnderVidya = xstrConditions.isCloseUnderVidya;
|
|
conditions.isCrossedOverVidya = xstrConditions.isCrossedOverVidya;
|
|
conditions.isCrossedUnderVidya = xstrConditions.isCrossedUnderVidya;
|
|
conditions.isVidyaCrossedOverHSM = xstrConditions.isVidyaCrossedOverHSM;
|
|
conditions.isVidyaCrossedOverStr = xstrConditions.isVidyaCrossedOverStr;
|
|
conditions.isVidyaCrossedOverLSM = xstrConditions.isVidyaCrossedOverLSM;
|
|
conditions.isVidyaCrossedUnderHSM = xstrConditions.isVidyaCrossedUnderHSM;
|
|
conditions.isVidyaCrossedUnderLSM = xstrConditions.isVidyaCrossedUnderLSM;
|
|
conditions.isVidyaCrossedUnderStr = xstrConditions.isVidyaCrossedUnderStr;
|
|
conditions.isStrSwitchedToBullish = xstrConditions.isStrSwitchedToBullish;
|
|
conditions.isStrSwitchedToBearish = xstrConditions.isStrSwitchedToBearish;
|
|
|
|
//
|
|
// XOSCS ...
|
|
|
|
//
|
|
// Buffers ...
|
|
|
|
//
|
|
Copy(
|
|
xocsConditions.acBuffer,
|
|
conditions.acBuffer //
|
|
);
|
|
|
|
//
|
|
Copy(
|
|
xocsConditions.adBuffer,
|
|
conditions.adBuffer //
|
|
);
|
|
|
|
//
|
|
Copy(
|
|
xocsConditions.atrBuffer,
|
|
conditions.atrBuffer //
|
|
);
|
|
|
|
//
|
|
Copy(
|
|
xocsConditions.cciBuffer,
|
|
conditions.cciBuffer //
|
|
);
|
|
|
|
//
|
|
Copy(
|
|
xocsConditions.rsiBuffer,
|
|
conditions.rsiBuffer //
|
|
);
|
|
|
|
//
|
|
Copy(
|
|
xocsConditions.mfiBuffer,
|
|
conditions.mfiBuffer //
|
|
);
|
|
|
|
//
|
|
Copy(
|
|
xocsConditions.rviBuffer,
|
|
conditions.rviBuffer //
|
|
);
|
|
|
|
//
|
|
Copy(
|
|
xocsConditions.adxBuffer,
|
|
conditions.adxBuffer //
|
|
);
|
|
|
|
//
|
|
Copy(
|
|
xocsConditions.adxpBuffer,
|
|
conditions.adxpBuffer //
|
|
);
|
|
|
|
//
|
|
Copy(
|
|
xocsConditions.adxnBuffer,
|
|
conditions.adxnBuffer //
|
|
);
|
|
|
|
//
|
|
Copy(
|
|
xocsConditions.macdBuffer,
|
|
conditions.macdBuffer //
|
|
);
|
|
|
|
//
|
|
Copy(
|
|
xocsConditions.momentumBuffer,
|
|
conditions.momentumBuffer //
|
|
);
|
|
|
|
//
|
|
Copy(
|
|
xocsConditions.rviSignalBuffer,
|
|
conditions.rviSignalBuffer //
|
|
);
|
|
|
|
//
|
|
Copy(
|
|
xocsConditions.macdSignalBuffer,
|
|
conditions.macdSignalBuffer //
|
|
);
|
|
|
|
//
|
|
Copy(
|
|
xocsConditions.stochasticBuffer,
|
|
conditions.stochasticBuffer //
|
|
);
|
|
|
|
//
|
|
Copy(
|
|
xocsConditions.stochasticSignalBuffer,
|
|
conditions.stochasticSignalBuffer //
|
|
);
|
|
|
|
//
|
|
// Conditions ...
|
|
//
|
|
conditions.isCCIOB = xocsConditions.isCCIOB;
|
|
conditions.isCCIOS = xocsConditions.isCCIOS;
|
|
conditions.isRSIOB = xocsConditions.isRSIOB;
|
|
conditions.isRSIOS = xocsConditions.isRSIOS;
|
|
conditions.isMFIOB = xocsConditions.isMFIOB;
|
|
conditions.isMFIOS = xocsConditions.isMFIOS;
|
|
conditions.isACBullish = xocsConditions.isACBullish;
|
|
conditions.isACBearish = xocsConditions.isACBearish;
|
|
conditions.isACOverMax = xocsConditions.isACOverMax;
|
|
conditions.isADOverMax = xocsConditions.isADOverMax;
|
|
conditions.isACUnderMin = xocsConditions.isACUnderMin;
|
|
conditions.isADUnderMin = xocsConditions.isADUnderMin;
|
|
conditions.isADXBullish = xocsConditions.isADXBullish;
|
|
conditions.isADXBearish = xocsConditions.isADXBearish;
|
|
conditions.isCCIBullish = xocsConditions.isCCIBullish;
|
|
conditions.isCCIBearish = xocsConditions.isCCIBearish;
|
|
conditions.isRSIBullish = xocsConditions.isRSIBullish;
|
|
conditions.isRSIBearish = xocsConditions.isRSIBearish;
|
|
conditions.isMFIBullish = xocsConditions.isMFIBullish;
|
|
conditions.isMFIBearish = xocsConditions.isMFIBearish;
|
|
conditions.isRVIBullish = xocsConditions.isRVIBullish;
|
|
conditions.isRVIBearish = xocsConditions.isRVIBearish;
|
|
conditions.isATROverLast = xocsConditions.isATROverLast;
|
|
conditions.isMACDBullish = xocsConditions.isMACDBullish;
|
|
conditions.isMACDBearish = xocsConditions.isMACDBearish;
|
|
conditions.isATRUnderLast = xocsConditions.isATRUnderLast;
|
|
conditions.isADBiggerLast = xocsConditions.isADBiggerLast;
|
|
conditions.isADLesserLast = xocsConditions.isADLesserLast;
|
|
conditions.isStochasticOB = xocsConditions.isStochasticOB;
|
|
conditions.isStochasticOS = xocsConditions.isStochasticOS;
|
|
conditions.isADXBiggerLast = xocsConditions.isADXBiggerLast;
|
|
conditions.isADXLesserLast = xocsConditions.isADXLesserLast;
|
|
conditions.isRVIOverSignal = xocsConditions.isRVIOverSignal;
|
|
conditions.isRVIUnderSignal = xocsConditions.isRVIUnderSignal;
|
|
conditions.isMACDOverSignal = xocsConditions.isMACDOverSignal;
|
|
conditions.isMACDUnderSignal = xocsConditions.isMACDUnderSignal;
|
|
conditions.isMomentumBullish = xocsConditions.isMomentumBullish;
|
|
conditions.isMomentumBearish = xocsConditions.isMomentumBearish;
|
|
conditions.isADXOverThreshold = xocsConditions.isADXOverThreshold;
|
|
conditions.isDXPBiggerThanDXN = xocsConditions.isDXPBiggerThanDXN;
|
|
conditions.isDXNBiggerThanDXP = xocsConditions.isDXNBiggerThanDXP;
|
|
conditions.isCCICrossedOverOB = xocsConditions.isCCICrossedOverOB;
|
|
conditions.isCCICrossedOverOS = xocsConditions.isCCICrossedOverOS;
|
|
conditions.isRSICrossedOverOB = xocsConditions.isRSICrossedOverOB;
|
|
conditions.isRSICrossedOverOS = xocsConditions.isRSICrossedOverOS;
|
|
conditions.isMFICrossedOverOB = xocsConditions.isMFICrossedOverOB;
|
|
conditions.isMFICrossedOverOS = xocsConditions.isMFICrossedOverOS;
|
|
conditions.isADXUnderThreshold = xocsConditions.isADXUnderThreshold;
|
|
conditions.isCCICrossedUnderOB = xocsConditions.isCCICrossedUnderOB;
|
|
conditions.isCCICrossedUnderOS = xocsConditions.isCCICrossedUnderOS;
|
|
conditions.isRSICrossedUnderOB = xocsConditions.isRSICrossedUnderOB;
|
|
conditions.isRSICrossedUnderOS = xocsConditions.isRSICrossedUnderOS;
|
|
conditions.isMFICrossedUnderOB = xocsConditions.isMFICrossedUnderOB;
|
|
conditions.isMFICrossedUnderOS = xocsConditions.isMFICrossedUnderOS;
|
|
conditions.isStochasticBullish = xocsConditions.isStochasticBullish;
|
|
conditions.isStochasticBearish = xocsConditions.isStochasticBearish;
|
|
conditions.isACSwitchedToBullish = xocsConditions.isACSwitchedToBullish;
|
|
conditions.isACSwitchedToBearish = xocsConditions.isACSwitchedToBearish;
|
|
conditions.isADXSwitchedToBullish = xocsConditions.isADXSwitchedToBullish;
|
|
conditions.isADXSwitchedToBearish = xocsConditions.isADXSwitchedToBearish;
|
|
conditions.isCCISwitchedToBullish = xocsConditions.isCCISwitchedToBullish;
|
|
conditions.isCCISwitchedToBearish = xocsConditions.isCCISwitchedToBearish;
|
|
conditions.isRSISwitchedToBullish = xocsConditions.isRSISwitchedToBullish;
|
|
conditions.isRSISwitchedToBearish = xocsConditions.isRSISwitchedToBearish;
|
|
conditions.isMFISwitchedToBullish = xocsConditions.isMFISwitchedToBullish;
|
|
conditions.isMFISwitchedToBearish = xocsConditions.isMFISwitchedToBearish;
|
|
conditions.isRVISwitchedToBullish = xocsConditions.isRVISwitchedToBullish;
|
|
conditions.isRVISwitchedToBearish = xocsConditions.isRVISwitchedToBearish;
|
|
conditions.isRVICrossedOverSignal = xocsConditions.isRVICrossedOverSignal;
|
|
conditions.isStochasticOverSignal = xocsConditions.isStochasticOverSignal;
|
|
conditions.isStochasticUnderSignal = xocsConditions.isStochasticUnderSignal;
|
|
conditions.isRVICrossedUnderSignal = xocsConditions.isRVICrossedUnderSignal;
|
|
conditions.isMACDSwitchedToBullish = xocsConditions.isMACDSwitchedToBullish;
|
|
conditions.isMACDSwitchedToBearish = xocsConditions.isMACDSwitchedToBearish;
|
|
conditions.isMACDCrossedOverSignal = xocsConditions.isMACDCrossedOverSignal;
|
|
conditions.isMACDCrossedUnderSignal = xocsConditions.isMACDCrossedUnderSignal;
|
|
conditions.isStochasticCrossedOverOB = xocsConditions.isStochasticCrossedOverOB;
|
|
conditions.isStochasticCrossedOverOS = xocsConditions.isStochasticCrossedOverOS;
|
|
conditions.isStochasticCrossedUnderOB = xocsConditions.isStochasticCrossedUnderOB;
|
|
conditions.isStochasticCrossedUnderOS = xocsConditions.isStochasticCrossedUnderOS;
|
|
conditions.isMomentumSwitchedToBullish = xocsConditions.isMomentumSwitchedToBullish;
|
|
conditions.isMomentumSwitchedToBearish = xocsConditions.isMomentumSwitchedToBearish;
|
|
conditions.isStochasticSwitchedToBullish = xocsConditions.isStochasticSwitchedToBullish;
|
|
conditions.isStochasticSwitchedToBearish = xocsConditions.isStochasticSwitchedToBearish;
|
|
conditions.isStochasticCrossedOverSignal = xocsConditions.isStochasticCrossedOverSignal;
|
|
conditions.isStochasticCrossedUnderSignal = xocsConditions.isStochasticCrossedUnderSignal;
|
|
|
|
//
|
|
// Cleanup Resource ...
|
|
|
|
//
|
|
zBar.Clean();
|
|
cBar.Clean();
|
|
pBar.Clean();
|
|
|
|
//
|
|
xstrConditions.Clean();
|
|
xocsConditions.Clean();
|
|
|
|
//
|
|
Free();
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Protected ...
|
|
protected:
|
|
//
|
|
// Private ...
|
|
private:
|
|
//
|
|
// Props ...
|
|
|
|
//
|
|
string mSymbol; // Trading Symbol
|
|
ENUM_TIMEFRAMES mPeriod; // Trading Period
|
|
|
|
//
|
|
// Inputs ...
|
|
XSTRCCIInputs mInputs;
|
|
|
|
//
|
|
// Handlers ...
|
|
int acHandler;
|
|
int adHandler;
|
|
int adxHandler;
|
|
int atrHandler;
|
|
int cciHandler;
|
|
int rsiHandler;
|
|
int mfiHandler;
|
|
int rviHandler;
|
|
int macdHandler;
|
|
int momentumHandler;
|
|
int stochasticHandler;
|
|
};
|
|
|
|
// |