3124 lines
80 KiB
Plaintext
3124 lines
80 KiB
Plaintext
///////////////////////////////////////////////////////
|
|
//
|
|
// SaherElm IT Center MQL5 Helper Class Library
|
|
// ----------------------------------------------
|
|
// Name: XCX121Helper
|
|
// 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.x3ma.helper.mq5"
|
|
#include "../Helpers/x-saherelm.x121.xatr.helper.mq5"
|
|
#include "../Helpers/x-saherelm.x121.xcc.helper.mq5"
|
|
#include "../Helpers/x-saherelm.x121.xche.helper.mq5"
|
|
#include "../Helpers/x-saherelm.x121.xhk.helper.mq5"
|
|
#include "../Helpers/x-saherelm.x121.xmas.helper.mq5"
|
|
#include "../Helpers/x-saherelm.x121.xpv.helper.mq5"
|
|
#include "../Helpers/x-saherelm.x121.xstr.helper.mq5"
|
|
#include "../Helpers/x-saherelm.x121.xvwap.helper.mq5"
|
|
|
|
//
|
|
// Inputs ...
|
|
struct X121Inputs
|
|
{
|
|
//
|
|
// Props ...
|
|
bool showRSI;
|
|
X121XCCInputs xccInputs;
|
|
X121XPVInputs xpvInputs;
|
|
X121XHKInputs xhkInputs;
|
|
X121XMASInputs xmasInputs;
|
|
X121XATRInputs xatrInputs;
|
|
X121XSTRInputs xstrInputs;
|
|
X121XCHEInputs xcheInputs;
|
|
X121X3MAInputs x3maInputs;
|
|
X121XVWAPInputs xvwapInputs;
|
|
|
|
//
|
|
// X121XICHInputs xichInputs;
|
|
// X121XDONInputs xdonInputs;
|
|
// X121XDELTAInputs xdeltaInputs;
|
|
// X121XVOLUMEInputs xvolumeInputs;
|
|
|
|
//
|
|
// Constructor ...
|
|
X121Inputs()
|
|
{
|
|
Clean();
|
|
}
|
|
|
|
//
|
|
// Tools ...
|
|
|
|
/**
|
|
* Cleaning Up ...
|
|
*/
|
|
void Clean()
|
|
{
|
|
//
|
|
xccInputs.Clean();
|
|
xpvInputs.Clean();
|
|
xhkInputs.Clean();
|
|
xmasInputs.Clean();
|
|
xatrInputs.Clean();
|
|
xstrInputs.Clean();
|
|
xcheInputs.Clean();
|
|
x3maInputs.Clean();
|
|
xvwapInputs.Clean();
|
|
|
|
//
|
|
ZeroMemory(this);
|
|
}
|
|
|
|
/**
|
|
* Set Default Values ...
|
|
*/
|
|
void Default()
|
|
{
|
|
//
|
|
xccInputs.Default();
|
|
xpvInputs.Default();
|
|
xhkInputs.Default();
|
|
xmasInputs.Default();
|
|
xatrInputs.Default();
|
|
xstrInputs.Default();
|
|
xcheInputs.Default();
|
|
x3maInputs.Default();
|
|
xvwapInputs.Default();
|
|
}
|
|
|
|
/**
|
|
* Validate ...
|
|
*
|
|
* @return ( bool )
|
|
*/
|
|
bool IsValid()
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
result =
|
|
//
|
|
xccInputs.IsValid() &&
|
|
xpvInputs.IsValid() &&
|
|
xhkInputs.IsValid() &&
|
|
xmasInputs.IsValid() &&
|
|
xatrInputs.IsValid() &&
|
|
xstrInputs.IsValid() &&
|
|
xcheInputs.IsValid() &&
|
|
x3maInputs.IsValid() &&
|
|
xvwapInputs.IsValid();
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Extract Max Input Length ...
|
|
*
|
|
* @return ( int )
|
|
*/
|
|
int Max()
|
|
{
|
|
//
|
|
int result = 0;
|
|
|
|
//
|
|
int xpvMax = xpvInputs.Max();
|
|
int xhkMax = xhkInputs.Max();
|
|
int xmasMax = xmasInputs.Max();
|
|
int xatrMax = xatrInputs.Max();
|
|
int xstrMax = xstrInputs.Max();
|
|
int xcheMax = xcheInputs.Max();
|
|
int x3maMax = x3maInputs.Max();
|
|
int xvwapMax = xvwapInputs.Max();
|
|
|
|
//
|
|
result = MathMax(xpvMax, xhkMax);
|
|
result = MathMax(result, xmasMax);
|
|
result = MathMax(result, xatrMax);
|
|
result = MathMax(result, xstrMax);
|
|
result = MathMax(result, xcheMax);
|
|
result = MathMax(result, x3maMax);
|
|
result = MathMax(result, xvwapMax);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
};
|
|
|
|
//
|
|
// Conditions ...
|
|
struct X121Conditions
|
|
{
|
|
//
|
|
// Common ...
|
|
string symbol;
|
|
ENUM_TIMEFRAMES period;
|
|
datetime time;
|
|
|
|
//
|
|
// XCC ...
|
|
|
|
//
|
|
// Buffers ...
|
|
|
|
//
|
|
// Conditions ...
|
|
|
|
//
|
|
// XPV ...
|
|
|
|
//
|
|
// Buffers ...
|
|
|
|
//
|
|
double sarBuffer[];
|
|
double cHHBuffer[];
|
|
double cLLBuffer[];
|
|
double sHHBuffer[];
|
|
double sLLBuffer[];
|
|
double mHHBuffer[];
|
|
double mLLBuffer[];
|
|
double lHHBuffer[];
|
|
double lLLBuffer[];
|
|
double hHHBuffer[];
|
|
double hLLBuffer[];
|
|
double peaksBuffer[];
|
|
double valesBuffer[];
|
|
double supportsBuffer[];
|
|
double peaksGoldenBuffer[];
|
|
double valesGoldenBuffer[];
|
|
double resistancesBuffer[];
|
|
double fractalsUpperBuffer[];
|
|
double fractalsLowerBuffer[];
|
|
|
|
//
|
|
// Conditions ...
|
|
|
|
//
|
|
bool isSarBullish;
|
|
bool isSarBearish;
|
|
|
|
//
|
|
bool isSarSwitchedToBullish;
|
|
bool isSarSwitchedToBearish;
|
|
|
|
//
|
|
bool isNewPeak;
|
|
bool isNewPeakOverLast;
|
|
bool isNewPeakUnderLast;
|
|
|
|
//
|
|
bool isNewVale;
|
|
bool isNewValeOverLast;
|
|
bool isNewValeUnderLast;
|
|
|
|
//
|
|
// XHK ...
|
|
|
|
//
|
|
// Buffers ...
|
|
|
|
//
|
|
double xhkSMLowBuffer[];
|
|
double xhkRawLowBuffer[];
|
|
double xhkSMOpenBuffer[];
|
|
double xhkSMHighBuffer[];
|
|
double xhkRawOpenBuffer[];
|
|
double xhkRawHighBuffer[];
|
|
double xhkSMCloseBuffer[];
|
|
double xhkRawCloseBuffer[];
|
|
|
|
//
|
|
// Conditions ...
|
|
|
|
//
|
|
bool isSMHKBullish;
|
|
bool isRawHKBullish;
|
|
bool isSMHKSwitchedToBullish;
|
|
bool isRawHKSwitchedToBullish;
|
|
|
|
//
|
|
bool isSMHKBearish;
|
|
bool isRawHKBearish;
|
|
bool isSMHKSwitchedToBearish;
|
|
bool isRawHKSwitchedToBearish;
|
|
|
|
//
|
|
bool isClosedOverSMHK;
|
|
bool isClosedUnderSMHK;
|
|
bool isClosedOverRawHK;
|
|
bool isClosedUnderRawHK;
|
|
|
|
//
|
|
bool isRawHKClosedOverSMHK;
|
|
bool isRawHKClosedUnderSMHK;
|
|
|
|
//
|
|
// XMAS ...
|
|
|
|
//
|
|
// Buffers ...
|
|
|
|
//
|
|
double midBuffer[];
|
|
double upperBuffer[];
|
|
double lowerBuffer[];
|
|
|
|
//
|
|
// Conditions ...
|
|
|
|
//
|
|
// XATR ...
|
|
|
|
//
|
|
// Buffers ...
|
|
|
|
//
|
|
double rsiBuffer[];
|
|
double atrBuffer[];
|
|
double atrUpperBuffer[];
|
|
double atrLowerBuffer[];
|
|
double atrUpperSMBuffer[];
|
|
double atrLowerSMBuffer[];
|
|
double rsiChangeBuffer[];
|
|
double rsiChangeSMBuffer[];
|
|
double priceChangeBuffer[];
|
|
double priceChangeSMBuffer[];
|
|
|
|
//
|
|
// Conditions ...
|
|
|
|
//
|
|
bool isRsiInRange;
|
|
bool isRsiOverSold;
|
|
bool isRsiOverBought;
|
|
bool isRsiCrossedOverOverSold;
|
|
bool isRsiCrossedUnderOverSold;
|
|
bool isRsiCrossedOverOverBought;
|
|
bool isRsiCrossedUnderOverBought;
|
|
|
|
//
|
|
bool isRsiSMOverPriceChange;
|
|
bool isRsiSMUnderPriceChange;
|
|
|
|
//
|
|
bool isRsiSMCrossedOverPriceChange;
|
|
bool isRsiSMCrossedUnderPriceChange;
|
|
|
|
//
|
|
bool isPriceChangeSMOverRsi;
|
|
bool isPriceChangeSMUnderRsi;
|
|
|
|
//
|
|
bool isPriceChangeSMCrossedOverRsi;
|
|
bool isPriceChangeSMCrossedUnderRsi;
|
|
|
|
//
|
|
bool isRsiOverRsiSM;
|
|
bool isRsiUnderRsiSM;
|
|
|
|
//
|
|
bool isRsiCrossedOverRsiSM;
|
|
bool isRsiCrossedUnderRsiSM;
|
|
|
|
//
|
|
bool isPriceChangeOverPriceChangeSM;
|
|
bool isPriceChangeUnderPriceChangeSM;
|
|
|
|
//
|
|
bool isPriceChangeCrossedOverPriceChangeSM;
|
|
bool isPriceChangeCrossedUnderPriceChangeSM;
|
|
|
|
//
|
|
// XSTR ...
|
|
|
|
//
|
|
// Buffers ...
|
|
|
|
//
|
|
double strBuffer[];
|
|
double vidyaBuffer[];
|
|
double strUpBuffer[];
|
|
double strMidBuffer[];
|
|
double strDownBuffer[];
|
|
double strPriceBuffer[];
|
|
double strStateBuffer[];
|
|
double strSMLowBuffer[];
|
|
double strSMHighBuffer[];
|
|
double strMidStateBuffer[];
|
|
|
|
//
|
|
// Conditions ...
|
|
|
|
//
|
|
bool isStrBullish;
|
|
bool isStrBearish;
|
|
|
|
//
|
|
bool isStrSwitchedToBullish;
|
|
bool isStrSwitchedToBearish;
|
|
|
|
//
|
|
// XCHE ...
|
|
|
|
//
|
|
// Buffers ...
|
|
|
|
//
|
|
double le1Buffer[];
|
|
double se1Buffer[];
|
|
double le2Buffer[];
|
|
double se2Buffer[];
|
|
double le1StartBuffer[];
|
|
double se1StartBuffer[];
|
|
double le2StartBuffer[];
|
|
double se2StartBuffer[];
|
|
|
|
//
|
|
// Conditions ...
|
|
|
|
//
|
|
bool isChe1Bullish;
|
|
bool isChe1Bearish;
|
|
|
|
//
|
|
bool isChe1SwitchedToBullish;
|
|
bool isChe1SwitchedToBearish;
|
|
|
|
//
|
|
bool isChe2Bullish;
|
|
bool isChe2Bearish;
|
|
|
|
//
|
|
bool isChe2SwitchedToBullish;
|
|
bool isChe2SwitchedToBearish;
|
|
|
|
//
|
|
bool isCheBullish;
|
|
bool isCheBearish;
|
|
|
|
//
|
|
bool isCheSwitchedToBullish;
|
|
bool isCheSwitchedToBearish;
|
|
|
|
//
|
|
// X3MA ...
|
|
|
|
//
|
|
// Buffers ...
|
|
|
|
//
|
|
double x3maMidBuffer[];
|
|
double x3maFastBuffer[];
|
|
double x3maSlowBuffer[];
|
|
double x3maMidStateBuffer[];
|
|
double x3maFastStateBuffer[];
|
|
double x3maSlowStateBuffer[];
|
|
|
|
//
|
|
// Conditions ...
|
|
|
|
//
|
|
bool isX3MaFastBullish;
|
|
bool isX3MaFastBearish;
|
|
bool isX3MaFastNeutural;
|
|
|
|
//
|
|
bool isX3MaMidBullish;
|
|
bool isX3MaMidBearish;
|
|
bool isX3MaMidNeutural;
|
|
|
|
//
|
|
bool isX3MaSlowBullish;
|
|
bool isX3MaSlowBearish;
|
|
bool isX3MaSlowNeutural;
|
|
|
|
//
|
|
bool isX3MaFastOverMid;
|
|
bool isX3MaMidOverSlow;
|
|
|
|
//
|
|
bool isX3MaFastUnderMid;
|
|
bool isX3MaMidUnderSlow;
|
|
|
|
//
|
|
bool isX3MaBullishState;
|
|
bool isX3MaBearishState;
|
|
bool isX3MaNeuturalState;
|
|
|
|
//
|
|
bool isX3MaBullishOrdered;
|
|
bool isX3MaBearishOrdered;
|
|
|
|
//
|
|
bool isX3MaSwitchedToBullishOrdered;
|
|
bool isX3MaSwitchedToBearishOrdered;
|
|
|
|
//
|
|
bool isX3MaSwitchedToBullishState;
|
|
bool isX3MaSwitchedToBearishState;
|
|
bool isX3MaSwitchedToNeuturalState;
|
|
|
|
//
|
|
// XVWAP ...
|
|
|
|
//
|
|
// Buffers ...
|
|
|
|
//
|
|
double vwapMidBuffer[];
|
|
double vwapFastBuffer[];
|
|
double vwapSlowBuffer[];
|
|
double vwapPriceBuffer[];
|
|
double vwapVolumeBuffer[];
|
|
double vwapMidStateBuffer[];
|
|
double vwapFastStateBuffer[];
|
|
double vwapSlowStateBuffer[];
|
|
|
|
//
|
|
// Conditions ...
|
|
|
|
//
|
|
bool isVWapFastBullish;
|
|
bool isVWapFastBearish;
|
|
bool isVWapFastNeutural;
|
|
|
|
//
|
|
bool isVWapMidBullish;
|
|
bool isVWapMidBearish;
|
|
bool isVWapMidNeutural;
|
|
|
|
//
|
|
bool isVWapSlowBullish;
|
|
bool isVWapSlowBearish;
|
|
bool isVWapSlowNeutural;
|
|
|
|
//
|
|
bool isVWapFastOverMid;
|
|
bool isVWapMidOverSlow;
|
|
|
|
//
|
|
bool isVWapFastUnderMid;
|
|
bool isVWapMidUnderSlow;
|
|
|
|
//
|
|
bool isVWapBullishState;
|
|
bool isVWapBearishState;
|
|
bool isVWapNeuturalState;
|
|
|
|
//
|
|
bool isVWapBullishOrdered;
|
|
bool isVWapBearishOrdered;
|
|
|
|
//
|
|
bool isVWapSwitchedToBullishOrdered;
|
|
bool isVWapSwitchedToBearishOrdered;
|
|
|
|
//
|
|
bool isVWapSwitchedToBullishState;
|
|
bool isVWapSwitchedToBearishState;
|
|
bool isVWapSwitchedToNeuturalState;
|
|
|
|
//
|
|
// Constructor ...
|
|
X121Conditions()
|
|
{
|
|
Clean();
|
|
}
|
|
|
|
//
|
|
// Tools ...
|
|
|
|
/**
|
|
* Cleaning Up ...
|
|
*/
|
|
void Clean()
|
|
{
|
|
//
|
|
// Commons ...
|
|
symbol = NULL;
|
|
period = NULL;
|
|
time = NULL;
|
|
|
|
//
|
|
// XPV ...
|
|
|
|
//
|
|
// Buffers ...
|
|
|
|
//
|
|
// Clean ...
|
|
|
|
//
|
|
Clean(sarBuffer);
|
|
Clean(cHHBuffer);
|
|
Clean(cLLBuffer);
|
|
Clean(sHHBuffer);
|
|
Clean(sLLBuffer);
|
|
Clean(mHHBuffer);
|
|
Clean(mLLBuffer);
|
|
Clean(lHHBuffer);
|
|
Clean(lLLBuffer);
|
|
Clean(hHHBuffer);
|
|
Clean(hLLBuffer);
|
|
Clean(peaksBuffer);
|
|
Clean(valesBuffer);
|
|
Clean(supportsBuffer);
|
|
Clean(peaksGoldenBuffer);
|
|
Clean(valesGoldenBuffer);
|
|
Clean(resistancesBuffer);
|
|
Clean(fractalsUpperBuffer);
|
|
Clean(fractalsLowerBuffer);
|
|
|
|
//
|
|
// Set As Series ...
|
|
|
|
//
|
|
ArraySetAsSeries(sarBuffer, true);
|
|
ArraySetAsSeries(cHHBuffer, true);
|
|
ArraySetAsSeries(cLLBuffer, true);
|
|
ArraySetAsSeries(sHHBuffer, true);
|
|
ArraySetAsSeries(sLLBuffer, true);
|
|
ArraySetAsSeries(mHHBuffer, true);
|
|
ArraySetAsSeries(mLLBuffer, true);
|
|
ArraySetAsSeries(lHHBuffer, true);
|
|
ArraySetAsSeries(lLLBuffer, true);
|
|
ArraySetAsSeries(hHHBuffer, true);
|
|
ArraySetAsSeries(hLLBuffer, true);
|
|
ArraySetAsSeries(peaksBuffer, true);
|
|
ArraySetAsSeries(valesBuffer, true);
|
|
ArraySetAsSeries(supportsBuffer, true);
|
|
ArraySetAsSeries(peaksGoldenBuffer, true);
|
|
ArraySetAsSeries(valesGoldenBuffer, true);
|
|
ArraySetAsSeries(resistancesBuffer, true);
|
|
ArraySetAsSeries(fractalsUpperBuffer, true);
|
|
ArraySetAsSeries(fractalsLowerBuffer, true);
|
|
|
|
//
|
|
// Conditions ...
|
|
|
|
//
|
|
isNewPeak = false;
|
|
isNewVale = false;
|
|
isSarBullish = false;
|
|
isSarBearish = false;
|
|
isNewPeakOverLast = false;
|
|
isNewValeOverLast = false;
|
|
isNewPeakUnderLast = false;
|
|
isNewValeUnderLast = false;
|
|
isSarSwitchedToBullish = false;
|
|
isSarSwitchedToBearish = false;
|
|
|
|
//
|
|
// XHK ...
|
|
|
|
//
|
|
// Buffers ...
|
|
|
|
//
|
|
// Clean ...
|
|
|
|
//
|
|
Clean(xhkSMLowBuffer);
|
|
Clean(xhkRawLowBuffer);
|
|
Clean(xhkSMOpenBuffer);
|
|
Clean(xhkSMHighBuffer);
|
|
Clean(xhkRawOpenBuffer);
|
|
Clean(xhkRawHighBuffer);
|
|
Clean(xhkSMCloseBuffer);
|
|
Clean(xhkRawCloseBuffer);
|
|
|
|
//
|
|
// Set As Series ...
|
|
|
|
//
|
|
ArraySetAsSeries(xhkSMLowBuffer, true);
|
|
ArraySetAsSeries(xhkRawLowBuffer, true);
|
|
ArraySetAsSeries(xhkSMOpenBuffer, true);
|
|
ArraySetAsSeries(xhkSMHighBuffer, true);
|
|
ArraySetAsSeries(xhkRawOpenBuffer, true);
|
|
ArraySetAsSeries(xhkRawHighBuffer, true);
|
|
ArraySetAsSeries(xhkSMCloseBuffer, true);
|
|
ArraySetAsSeries(xhkRawCloseBuffer, true);
|
|
|
|
//
|
|
// Conditions ...
|
|
|
|
//
|
|
isSMHKBullish = false;
|
|
isSMHKBearish = false;
|
|
isRawHKBullish = false;
|
|
isRawHKBearish = false;
|
|
isClosedOverSMHK = false;
|
|
isClosedUnderSMHK = false;
|
|
isClosedOverRawHK = false;
|
|
isClosedUnderRawHK = false;
|
|
isRawHKClosedOverSMHK = false;
|
|
isRawHKClosedUnderSMHK = false;
|
|
isSMHKSwitchedToBearish = false;
|
|
isSMHKSwitchedToBullish = false;
|
|
isRawHKSwitchedToBullish = false;
|
|
isRawHKSwitchedToBearish = false;
|
|
|
|
//
|
|
// XMAS ...
|
|
|
|
//
|
|
// Buffers ...
|
|
|
|
//
|
|
// Clean ...
|
|
|
|
//
|
|
Clean(midBuffer);
|
|
Clean(upperBuffer);
|
|
Clean(lowerBuffer);
|
|
|
|
//
|
|
// Set As Series ...
|
|
|
|
//
|
|
ArraySetAsSeries(midBuffer, true);
|
|
ArraySetAsSeries(upperBuffer, true);
|
|
ArraySetAsSeries(lowerBuffer, true);
|
|
|
|
//
|
|
// Conditions ...
|
|
|
|
//
|
|
// XATR ...
|
|
|
|
//
|
|
// Buffers ...
|
|
|
|
//
|
|
// Clean ...
|
|
|
|
//
|
|
Clean(rsiBuffer);
|
|
Clean(atrBuffer);
|
|
Clean(atrUpperBuffer);
|
|
Clean(atrLowerBuffer);
|
|
Clean(rsiChangeBuffer);
|
|
Clean(atrUpperSMBuffer);
|
|
Clean(atrLowerSMBuffer);
|
|
Clean(rsiChangeSMBuffer);
|
|
Clean(priceChangeBuffer);
|
|
Clean(priceChangeSMBuffer);
|
|
|
|
//
|
|
// Set As Series ...
|
|
|
|
//
|
|
ArraySetAsSeries(rsiBuffer, true);
|
|
ArraySetAsSeries(atrBuffer, true);
|
|
ArraySetAsSeries(atrUpperBuffer, true);
|
|
ArraySetAsSeries(atrLowerBuffer, true);
|
|
ArraySetAsSeries(rsiChangeBuffer, true);
|
|
ArraySetAsSeries(atrUpperSMBuffer, true);
|
|
ArraySetAsSeries(atrLowerSMBuffer, true);
|
|
ArraySetAsSeries(rsiChangeSMBuffer, true);
|
|
ArraySetAsSeries(priceChangeBuffer, true);
|
|
ArraySetAsSeries(priceChangeSMBuffer, true);
|
|
|
|
//
|
|
// Conditions ...
|
|
|
|
//
|
|
isRsiInRange = false;
|
|
isRsiOverSold = false;
|
|
isRsiOverRsiSM = false;
|
|
isRsiUnderRsiSM = false;
|
|
isRsiOverBought = false;
|
|
isRsiCrossedOverRsiSM = false;
|
|
isRsiCrossedUnderRsiSM = false;
|
|
isPriceChangeSMOverRsi = false;
|
|
isRsiSMOverPriceChange = false;
|
|
isRsiSMUnderPriceChange = false;
|
|
isPriceChangeSMUnderRsi = false;
|
|
isRsiCrossedOverOverSold = false;
|
|
isRsiCrossedUnderOverSold = false;
|
|
isRsiCrossedOverOverBought = false;
|
|
isRsiCrossedUnderOverBought = false;
|
|
isRsiSMCrossedOverPriceChange = false;
|
|
isPriceChangeSMCrossedOverRsi = false;
|
|
isRsiSMCrossedUnderPriceChange = false;
|
|
isPriceChangeSMCrossedUnderRsi = false;
|
|
isPriceChangeOverPriceChangeSM = false;
|
|
isPriceChangeUnderPriceChangeSM = false;
|
|
isPriceChangeCrossedOverPriceChangeSM = false;
|
|
isPriceChangeCrossedUnderPriceChangeSM = false;
|
|
|
|
//
|
|
// XSTR ...
|
|
|
|
//
|
|
// Buffers ...
|
|
|
|
//
|
|
// Clean ...
|
|
|
|
//
|
|
Clean(strBuffer);
|
|
Clean(vidyaBuffer);
|
|
Clean(strUpBuffer);
|
|
Clean(strMidBuffer);
|
|
Clean(strDownBuffer);
|
|
Clean(strPriceBuffer);
|
|
Clean(strStateBuffer);
|
|
Clean(strSMLowBuffer);
|
|
Clean(strSMHighBuffer);
|
|
Clean(strMidStateBuffer);
|
|
|
|
//
|
|
// Set As Series ...
|
|
|
|
//
|
|
ArraySetAsSeries(strBuffer, true);
|
|
ArraySetAsSeries(vidyaBuffer, true);
|
|
ArraySetAsSeries(strUpBuffer, true);
|
|
ArraySetAsSeries(strMidBuffer, true);
|
|
ArraySetAsSeries(strDownBuffer, true);
|
|
ArraySetAsSeries(strPriceBuffer, true);
|
|
ArraySetAsSeries(strStateBuffer, true);
|
|
ArraySetAsSeries(strSMLowBuffer, true);
|
|
ArraySetAsSeries(strSMHighBuffer, true);
|
|
ArraySetAsSeries(strMidStateBuffer, true);
|
|
|
|
//
|
|
// Conditions ...
|
|
|
|
//
|
|
isStrBullish = false;
|
|
isStrBearish = false;
|
|
isStrSwitchedToBullish = false;
|
|
isStrSwitchedToBearish = false;
|
|
|
|
//
|
|
// XCHE ...
|
|
|
|
//
|
|
// Buffers ...
|
|
|
|
//
|
|
// Clean ...
|
|
|
|
//
|
|
Clean(le1Buffer);
|
|
Clean(se1Buffer);
|
|
Clean(le2Buffer);
|
|
Clean(se2Buffer);
|
|
Clean(le1StartBuffer);
|
|
Clean(se1StartBuffer);
|
|
Clean(le2StartBuffer);
|
|
Clean(se2StartBuffer);
|
|
|
|
//
|
|
// Set As Series ...
|
|
|
|
//
|
|
ArraySetAsSeries(le1Buffer, true);
|
|
ArraySetAsSeries(se1Buffer, true);
|
|
ArraySetAsSeries(le2Buffer, true);
|
|
ArraySetAsSeries(se2Buffer, true);
|
|
ArraySetAsSeries(le1StartBuffer, true);
|
|
ArraySetAsSeries(se1StartBuffer, true);
|
|
ArraySetAsSeries(le2StartBuffer, true);
|
|
ArraySetAsSeries(se2StartBuffer, true);
|
|
|
|
//
|
|
// Conditions ...
|
|
|
|
//
|
|
isCheBullish = false;
|
|
isCheBearish = false;
|
|
isChe1Bullish = false;
|
|
isChe1Bearish = false;
|
|
isChe2Bullish = false;
|
|
isChe2Bearish = false;
|
|
isCheSwitchedToBullish = false;
|
|
isCheSwitchedToBearish = false;
|
|
isChe1SwitchedToBullish = false;
|
|
isChe1SwitchedToBearish = false;
|
|
isChe2SwitchedToBullish = false;
|
|
isChe2SwitchedToBearish = false;
|
|
|
|
//
|
|
// X3MA ...
|
|
|
|
//
|
|
// Buffers ...
|
|
|
|
//
|
|
// Clean ...
|
|
|
|
//
|
|
Clean(x3maMidBuffer);
|
|
Clean(x3maFastBuffer);
|
|
Clean(x3maSlowBuffer);
|
|
Clean(x3maMidStateBuffer);
|
|
Clean(x3maFastStateBuffer);
|
|
Clean(x3maSlowStateBuffer);
|
|
|
|
//
|
|
// Set As Series ...
|
|
|
|
//
|
|
ArraySetAsSeries(x3maMidBuffer, true);
|
|
ArraySetAsSeries(x3maFastBuffer, true);
|
|
ArraySetAsSeries(x3maSlowBuffer, true);
|
|
ArraySetAsSeries(x3maMidStateBuffer, true);
|
|
ArraySetAsSeries(x3maFastStateBuffer, true);
|
|
ArraySetAsSeries(x3maSlowStateBuffer, true);
|
|
|
|
//
|
|
// Conditions ...
|
|
|
|
//
|
|
isX3MaMidBullish = false;
|
|
isX3MaMidBearish = false;
|
|
isX3MaFastBullish = false;
|
|
isX3MaFastBearish = false;
|
|
isX3MaMidNeutural = false;
|
|
isX3MaSlowBullish = false;
|
|
isX3MaSlowBearish = false;
|
|
isX3MaFastOverMid = false;
|
|
isX3MaMidOverSlow = false;
|
|
isX3MaFastNeutural = false;
|
|
isX3MaSlowNeutural = false;
|
|
isX3MaFastUnderMid = false;
|
|
isX3MaMidUnderSlow = false;
|
|
isX3MaBullishState = false;
|
|
isX3MaBearishState = false;
|
|
isX3MaNeuturalState = false;
|
|
isX3MaBullishOrdered = false;
|
|
isX3MaBearishOrdered = false;
|
|
isX3MaSwitchedToBullishState = false;
|
|
isX3MaSwitchedToBearishState = false;
|
|
isX3MaSwitchedToNeuturalState = false;
|
|
isX3MaSwitchedToBullishOrdered = false;
|
|
isX3MaSwitchedToBearishOrdered = false;
|
|
|
|
//
|
|
// XVWAP ...
|
|
|
|
//
|
|
// Buffers ...
|
|
|
|
//
|
|
// Clean ...
|
|
|
|
//
|
|
Clean(vwapMidBuffer);
|
|
Clean(vwapFastBuffer);
|
|
Clean(vwapSlowBuffer);
|
|
Clean(vwapPriceBuffer);
|
|
Clean(vwapVolumeBuffer);
|
|
Clean(vwapMidStateBuffer);
|
|
Clean(vwapFastStateBuffer);
|
|
Clean(vwapSlowStateBuffer);
|
|
|
|
//
|
|
// Set As Series ...
|
|
|
|
//
|
|
ArraySetAsSeries(vwapMidBuffer, true);
|
|
ArraySetAsSeries(vwapFastBuffer, true);
|
|
ArraySetAsSeries(vwapSlowBuffer, true);
|
|
ArraySetAsSeries(vwapPriceBuffer, true);
|
|
ArraySetAsSeries(vwapVolumeBuffer, true);
|
|
ArraySetAsSeries(vwapMidStateBuffer, true);
|
|
ArraySetAsSeries(vwapFastStateBuffer, true);
|
|
ArraySetAsSeries(vwapSlowStateBuffer, true);
|
|
|
|
//
|
|
// Conditions ...
|
|
|
|
//
|
|
isVWapMidBullish = false;
|
|
isVWapMidBearish = false;
|
|
isVWapMidNeutural = false;
|
|
isVWapFastBullish = false;
|
|
isVWapFastBearish = false;
|
|
isVWapSlowBullish = false;
|
|
isVWapSlowBearish = false;
|
|
isVWapFastOverMid = false;
|
|
isVWapMidOverSlow = false;
|
|
isVWapFastNeutural = false;
|
|
isVWapSlowNeutural = false;
|
|
isVWapFastUnderMid = false;
|
|
isVWapMidUnderSlow = false;
|
|
isVWapBullishState = false;
|
|
isVWapBearishState = false;
|
|
isVWapNeuturalState = false;
|
|
isVWapBullishOrdered = false;
|
|
isVWapBearishOrdered = false;
|
|
isVWapSwitchedToBullishState = false;
|
|
isVWapSwitchedToBearishState = false;
|
|
isVWapSwitchedToNeuturalState = false;
|
|
isVWapSwitchedToBullishOrdered = false;
|
|
isVWapSwitchedToBearishOrdered = 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;
|
|
|
|
//
|
|
// XCC ...
|
|
|
|
//
|
|
// XPV ...
|
|
|
|
//
|
|
if (isSarBullish)
|
|
{
|
|
bullishScore += minScore;
|
|
}
|
|
if (isSarSwitchedToBullish)
|
|
{
|
|
bullishScore += score;
|
|
}
|
|
|
|
//
|
|
if (isSarBearish)
|
|
{
|
|
bearishScore += minScore;
|
|
}
|
|
if (isSarSwitchedToBearish)
|
|
{
|
|
bearishScore += score;
|
|
}
|
|
|
|
//
|
|
// XHK ...
|
|
|
|
//
|
|
if (isSMHKBullish)
|
|
{
|
|
bullishScore += minScore;
|
|
}
|
|
if (isRawHKBullish)
|
|
{
|
|
bullishScore += minScore;
|
|
}
|
|
if (isClosedOverSMHK)
|
|
{
|
|
bullishScore += minScore;
|
|
}
|
|
if (isClosedOverRawHK)
|
|
{
|
|
bullishScore += minScore;
|
|
}
|
|
if (isRawHKClosedOverSMHK)
|
|
{
|
|
bullishScore += minScore;
|
|
}
|
|
if (isSMHKSwitchedToBullish)
|
|
{
|
|
bullishScore += highScore;
|
|
}
|
|
if (isRawHKSwitchedToBullish)
|
|
{
|
|
bullishScore += highScore;
|
|
}
|
|
|
|
//
|
|
if (isSMHKBearish)
|
|
{
|
|
bearishScore += minScore;
|
|
}
|
|
if (isRawHKBearish)
|
|
{
|
|
bearishScore += minScore;
|
|
}
|
|
if (isClosedUnderSMHK)
|
|
{
|
|
bearishScore += minScore;
|
|
}
|
|
if (isClosedUnderRawHK)
|
|
{
|
|
bearishScore += minScore;
|
|
}
|
|
if (isRawHKClosedUnderSMHK)
|
|
{
|
|
bearishScore += minScore;
|
|
}
|
|
if (isSMHKSwitchedToBearish)
|
|
{
|
|
bearishScore += highScore;
|
|
}
|
|
if (isRawHKSwitchedToBullish)
|
|
{
|
|
bearishScore += highScore;
|
|
}
|
|
|
|
//
|
|
// XMAS ...
|
|
|
|
//
|
|
// XATR ...
|
|
|
|
//
|
|
if (isRsiOverSold)
|
|
{
|
|
bullishScore += minScore;
|
|
}
|
|
if (isRsiOverRsiSM)
|
|
{
|
|
bullishScore += minScore;
|
|
}
|
|
if (isRsiSMOverPriceChange)
|
|
{
|
|
bullishScore += minScore;
|
|
}
|
|
if (isPriceChangeSMOverRsi)
|
|
{
|
|
bullishScore += minScore;
|
|
}
|
|
if (isPriceChangeOverPriceChangeSM)
|
|
{
|
|
bullishScore += minScore;
|
|
}
|
|
|
|
//
|
|
if (isRsiCrossedOverRsiSM)
|
|
{
|
|
bullishScore += score;
|
|
}
|
|
if (isRsiCrossedOverOverSold)
|
|
{
|
|
bullishScore += score;
|
|
}
|
|
if (isRsiCrossedUnderOverBought)
|
|
{
|
|
bullishScore += score;
|
|
}
|
|
if (isRsiSMCrossedOverPriceChange)
|
|
{
|
|
bullishScore += score;
|
|
}
|
|
if (isPriceChangeSMCrossedOverRsi)
|
|
{
|
|
bullishScore += score;
|
|
}
|
|
if (isPriceChangeCrossedOverPriceChangeSM)
|
|
{
|
|
bullishScore += score;
|
|
}
|
|
|
|
//
|
|
if (isRsiOverBought)
|
|
{
|
|
bearishScore += minScore;
|
|
}
|
|
if (isRsiUnderRsiSM)
|
|
{
|
|
bearishScore += minScore;
|
|
}
|
|
if (isRsiSMUnderPriceChange)
|
|
{
|
|
bearishScore += minScore;
|
|
}
|
|
if (isPriceChangeSMUnderRsi)
|
|
{
|
|
bearishScore += minScore;
|
|
}
|
|
if (isPriceChangeUnderPriceChangeSM)
|
|
{
|
|
bearishScore += minScore;
|
|
}
|
|
|
|
//
|
|
if (isRsiCrossedUnderRsiSM)
|
|
{
|
|
bearishScore += score;
|
|
}
|
|
if (isRsiCrossedUnderOverSold)
|
|
{
|
|
bearishScore += score;
|
|
}
|
|
if (isRsiCrossedOverOverBought)
|
|
{
|
|
bearishScore += score;
|
|
}
|
|
if (isRsiSMCrossedUnderPriceChange)
|
|
{
|
|
bearishScore += score;
|
|
}
|
|
if (isPriceChangeSMCrossedUnderRsi)
|
|
{
|
|
bearishScore += score;
|
|
}
|
|
if (isPriceChangeCrossedUnderPriceChangeSM)
|
|
{
|
|
bearishScore += score;
|
|
}
|
|
|
|
//
|
|
// XSTR ...
|
|
|
|
//
|
|
if (isStrBullish)
|
|
{
|
|
bullishScore += minScore;
|
|
}
|
|
if (isStrSwitchedToBullish)
|
|
{
|
|
bullishScore += score;
|
|
}
|
|
|
|
//
|
|
if (isStrBearish)
|
|
{
|
|
bearishScore += minScore;
|
|
}
|
|
if (isStrSwitchedToBearish)
|
|
{
|
|
bearishScore += score;
|
|
}
|
|
|
|
//
|
|
// XCHE ...
|
|
|
|
//
|
|
if (isCheBullish)
|
|
{
|
|
bullishScore += score;
|
|
}
|
|
if (isCheSwitchedToBullish)
|
|
{
|
|
bullishScore += highScore;
|
|
}
|
|
if (isChe1Bullish &&
|
|
!isCheBullish &&
|
|
!isCheSwitchedToBullish)
|
|
{
|
|
bullishScore += minScore;
|
|
}
|
|
if (isChe1SwitchedToBullish &&
|
|
!isCheBullish &&
|
|
!isCheSwitchedToBullish)
|
|
{
|
|
bullishScore += minScore;
|
|
}
|
|
|
|
//
|
|
if (isCheBearish)
|
|
{
|
|
bearishScore += score;
|
|
}
|
|
if (isCheSwitchedToBearish)
|
|
{
|
|
bearishScore += highScore;
|
|
}
|
|
if (isChe1Bearish &&
|
|
!isCheBearish &&
|
|
!isCheSwitchedToBearish)
|
|
{
|
|
bearishScore += minScore;
|
|
}
|
|
if (isChe1SwitchedToBearish &&
|
|
!isCheBearish &&
|
|
!isCheSwitchedToBearish)
|
|
{
|
|
bearishScore += minScore;
|
|
}
|
|
|
|
//
|
|
// X3MA ...
|
|
|
|
//
|
|
if (isX3MaBullishState)
|
|
{
|
|
bullishScore += score;
|
|
}
|
|
if (isX3MaBullishOrdered)
|
|
{
|
|
bullishScore += score;
|
|
}
|
|
if (isX3MaSwitchedToBullishState)
|
|
{
|
|
bullishScore += highScore;
|
|
}
|
|
if (isX3MaSwitchedToBullishOrdered)
|
|
{
|
|
bullishScore += highScore;
|
|
}
|
|
if (!isX3MaBullishState &&
|
|
!isX3MaSwitchedToBullishState)
|
|
{
|
|
//
|
|
if (isX3MaFastBullish)
|
|
{
|
|
bullishScore += minScore;
|
|
}
|
|
if (isX3MaSlowBullish)
|
|
{
|
|
bullishScore += minScore;
|
|
}
|
|
}
|
|
if (!isX3MaBullishOrdered &&
|
|
!isX3MaSwitchedToBullishOrdered)
|
|
{
|
|
//
|
|
if (isX3MaFastOverMid)
|
|
{
|
|
bullishScore += minScore;
|
|
}
|
|
if (isX3MaMidOverSlow)
|
|
{
|
|
bullishScore += minScore;
|
|
}
|
|
}
|
|
|
|
//
|
|
if (isX3MaBearishState)
|
|
{
|
|
bearishScore += score;
|
|
}
|
|
if (isX3MaBearishOrdered)
|
|
{
|
|
bearishScore += score;
|
|
}
|
|
if (isX3MaSwitchedToBearishState)
|
|
{
|
|
bearishScore += highScore;
|
|
}
|
|
if (isX3MaSwitchedToBearishOrdered)
|
|
{
|
|
bearishScore += highScore;
|
|
}
|
|
if (!isX3MaBearishState &&
|
|
!isX3MaSwitchedToBearishState)
|
|
{
|
|
//
|
|
if (isX3MaFastBearish)
|
|
{
|
|
bearishScore += minScore;
|
|
}
|
|
if (isX3MaSlowBearish)
|
|
{
|
|
bearishScore += minScore;
|
|
}
|
|
}
|
|
if (!isX3MaBearishOrdered &&
|
|
!isX3MaSwitchedToBearishOrdered)
|
|
{
|
|
//
|
|
if (isX3MaFastUnderMid)
|
|
{
|
|
bearishScore += minScore;
|
|
}
|
|
if (isX3MaMidUnderSlow)
|
|
{
|
|
bearishScore += minScore;
|
|
}
|
|
}
|
|
|
|
//
|
|
// XVWAP ...
|
|
|
|
//
|
|
if (isVWapBullishState)
|
|
{
|
|
bullishScore += score;
|
|
}
|
|
if (isVWapBullishOrdered)
|
|
{
|
|
bullishScore += score;
|
|
}
|
|
if (isVWapSwitchedToBullishState)
|
|
{
|
|
bullishScore += highScore;
|
|
}
|
|
if (isVWapSwitchedToBullishOrdered)
|
|
{
|
|
bullishScore += highScore;
|
|
}
|
|
if (!isVWapBullishState &&
|
|
!isVWapSwitchedToBullishState)
|
|
{
|
|
//
|
|
if (isVWapFastBullish)
|
|
{
|
|
bullishScore += minScore;
|
|
}
|
|
if (isVWapSlowBullish)
|
|
{
|
|
bullishScore += minScore;
|
|
}
|
|
}
|
|
if (!isVWapBullishOrdered &&
|
|
!isVWapSwitchedToBullishOrdered)
|
|
{
|
|
//
|
|
if (isVWapFastOverMid)
|
|
{
|
|
bullishScore += minScore;
|
|
}
|
|
if (isVWapMidOverSlow)
|
|
{
|
|
bullishScore += minScore;
|
|
}
|
|
}
|
|
|
|
//
|
|
if (isVWapBearishState)
|
|
{
|
|
bearishScore += score;
|
|
}
|
|
if (isVWapBearishOrdered)
|
|
{
|
|
bearishScore += score;
|
|
}
|
|
if (isVWapSwitchedToBearishState)
|
|
{
|
|
bearishScore += highScore;
|
|
}
|
|
if (isVWapSwitchedToBearishOrdered)
|
|
{
|
|
bearishScore += highScore;
|
|
}
|
|
if (!isVWapBearishState &&
|
|
!isVWapSwitchedToBearishState)
|
|
{
|
|
//
|
|
if (isVWapFastBearish)
|
|
{
|
|
bearishScore += minScore;
|
|
}
|
|
if (isVWapSlowBearish)
|
|
{
|
|
bearishScore += minScore;
|
|
}
|
|
}
|
|
if (!isVWapBearishOrdered &&
|
|
!isVWapSwitchedToBearishOrdered)
|
|
{
|
|
//
|
|
if (isVWapFastUnderMid)
|
|
{
|
|
bearishScore += minScore;
|
|
}
|
|
if (isVWapMidUnderSlow)
|
|
{
|
|
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 //
|
|
);
|
|
|
|
//
|
|
// XCC ...
|
|
|
|
//
|
|
// XPV ...
|
|
|
|
//
|
|
string pvConditionsStr =
|
|
//
|
|
"-----------------------" + separator +
|
|
"XPV: " + separator +
|
|
"-----------------------" + separator +
|
|
ToString("isSarBullish", isSarBullish, ignoreFalseConditions, separator) +
|
|
ToString("isSarBearish", isSarBearish, ignoreFalseConditions, separator) +
|
|
ToString("isSarSwitchedToBullish", isSarSwitchedToBullish, ignoreFalseConditions, separator) +
|
|
ToString("isSarSwitchedToBearish", isSarSwitchedToBearish, ignoreFalseConditions, separator) +
|
|
ToString("isNewPeak", isNewPeak, ignoreFalseConditions, separator) +
|
|
ToString("isNewPeakOverLast", isNewPeakOverLast, ignoreFalseConditions, separator) +
|
|
ToString("isNewPeakUnderLast", isNewPeakUnderLast, ignoreFalseConditions, separator) +
|
|
ToString("isNewVale", isNewVale, ignoreFalseConditions, separator) +
|
|
ToString("isNewValeOverLast", isNewValeOverLast, ignoreFalseConditions, separator) +
|
|
ToString("isNewValeUnderLast", isNewValeUnderLast, ignoreFalseConditions, separator) +
|
|
//
|
|
""
|
|
//
|
|
;
|
|
|
|
//
|
|
// XHK ...
|
|
|
|
//
|
|
string hkConditionsStr =
|
|
//
|
|
"-----------------------" + separator +
|
|
"XHK: " + separator +
|
|
"-----------------------" + separator +
|
|
ToString("isSMHKBullish", isSMHKBullish, ignoreFalseConditions, separator) +
|
|
ToString("isRawHKBullish", isRawHKBullish, ignoreFalseConditions, separator) +
|
|
ToString("isSMHKSwitchedToBullish", isSMHKSwitchedToBullish, ignoreFalseConditions, separator) +
|
|
ToString("isRawHKSwitchedToBullish", isRawHKSwitchedToBullish, ignoreFalseConditions, separator) +
|
|
ToString("isSMHKBearish", isSMHKBearish, ignoreFalseConditions, separator) +
|
|
ToString("isRawHKBearish", isRawHKBearish, ignoreFalseConditions, separator) +
|
|
ToString("isSMHKSwitchedToBearish", isSMHKSwitchedToBearish, ignoreFalseConditions, separator) +
|
|
ToString("isRawHKSwitchedToBearish", isRawHKSwitchedToBearish, ignoreFalseConditions, separator) +
|
|
ToString("isClosedOverSMHK", isClosedOverSMHK, ignoreFalseConditions, separator) +
|
|
ToString("isClosedUnderSMHK", isClosedUnderSMHK, ignoreFalseConditions, separator) +
|
|
ToString("isClosedOverRawHK", isClosedOverRawHK, ignoreFalseConditions, separator) +
|
|
ToString("isClosedUnderRawHK", isClosedUnderRawHK, ignoreFalseConditions, separator) +
|
|
ToString("isRawHKClosedOverSMHK", isRawHKClosedOverSMHK, ignoreFalseConditions, separator) +
|
|
ToString("isRawHKClosedUnderSMHK", isRawHKClosedUnderSMHK, ignoreFalseConditions, separator) +
|
|
//
|
|
""
|
|
//
|
|
;
|
|
|
|
//
|
|
// XMAS ...
|
|
|
|
//
|
|
// XATR ...
|
|
|
|
//
|
|
string atrConditionsStr =
|
|
//
|
|
"-----------------------" + separator +
|
|
"XATR: " + separator +
|
|
"-----------------------" + separator +
|
|
ToString("isRsiInRange", isRsiInRange, ignoreFalseConditions, separator) +
|
|
ToString("isRsiOverSold", isRsiOverSold, ignoreFalseConditions, separator) +
|
|
ToString("isRsiOverBought", isRsiOverBought, ignoreFalseConditions, separator) +
|
|
ToString("isRsiCrossedOverOverSold", isRsiCrossedOverOverSold, ignoreFalseConditions, separator) +
|
|
ToString("isRsiCrossedUnderOverSold", isRsiCrossedUnderOverSold, ignoreFalseConditions, separator) +
|
|
ToString("isRsiCrossedOverOverBought", isRsiCrossedOverOverBought, ignoreFalseConditions, separator) +
|
|
ToString("isRsiCrossedUnderOverBought", isRsiCrossedUnderOverBought, ignoreFalseConditions, separator) +
|
|
//
|
|
ToString("isRsiSMOverPriceChange", isRsiSMOverPriceChange, ignoreFalseConditions, separator) +
|
|
ToString("isRsiSMUnderPriceChange", isRsiSMUnderPriceChange, ignoreFalseConditions, separator) +
|
|
ToString("isRsiSMCrossedOverPriceChange", isRsiSMCrossedOverPriceChange, ignoreFalseConditions, separator) +
|
|
ToString("isRsiSMCrossedUnderPriceChange", isRsiSMCrossedUnderPriceChange, ignoreFalseConditions, separator) +
|
|
ToString("isPriceChangeSMOverRsi", isPriceChangeSMOverRsi, ignoreFalseConditions, separator) +
|
|
ToString("isPriceChangeSMUnderRsi", isPriceChangeSMUnderRsi, ignoreFalseConditions, separator) +
|
|
ToString("isPriceChangeSMCrossedOverRsi", isPriceChangeSMCrossedOverRsi, ignoreFalseConditions, separator) +
|
|
ToString("isPriceChangeSMCrossedUnderRsi", isPriceChangeSMCrossedUnderRsi, ignoreFalseConditions, separator) +
|
|
ToString("isRsiOverRsiSM", isRsiOverRsiSM, ignoreFalseConditions, separator) +
|
|
ToString("isRsiUnderRsiSM", isRsiUnderRsiSM, ignoreFalseConditions, separator) +
|
|
ToString("isRsiCrossedOverRsiSM", isRsiCrossedOverRsiSM, ignoreFalseConditions, separator) +
|
|
ToString("isRsiCrossedUnderRsiSM", isRsiCrossedUnderRsiSM, ignoreFalseConditions, separator) +
|
|
ToString("isPriceChangeOverPriceChangeSM", isPriceChangeOverPriceChangeSM, ignoreFalseConditions, separator) +
|
|
ToString("isPriceChangeUnderPriceChangeSM", isPriceChangeUnderPriceChangeSM, ignoreFalseConditions, separator) +
|
|
ToString("isPriceChangeCrossedOverPriceChangeSM", isPriceChangeCrossedOverPriceChangeSM, ignoreFalseConditions, separator) +
|
|
ToString("isPriceChangeCrossedUnderPriceChangeSM", isPriceChangeCrossedUnderPriceChangeSM, ignoreFalseConditions, separator) +
|
|
//
|
|
""
|
|
//
|
|
;
|
|
|
|
//
|
|
// XSTR ...
|
|
|
|
//
|
|
string strConditionsStr =
|
|
//
|
|
"-----------------------" + separator +
|
|
"XSTR: " + separator +
|
|
"-----------------------" + separator +
|
|
ToString("isStrBullish", isStrBullish, ignoreFalseConditions, separator) +
|
|
ToString("isStrBearish", isStrBearish, ignoreFalseConditions, separator) +
|
|
ToString("isStrSwitchedToBullish", isStrSwitchedToBullish, ignoreFalseConditions, separator) +
|
|
ToString("isStrSwitchedToBearish", isStrSwitchedToBearish, ignoreFalseConditions, separator) +
|
|
//
|
|
""
|
|
//
|
|
;
|
|
|
|
//
|
|
// XCHE ...
|
|
|
|
//
|
|
string cheConditionsStr =
|
|
//
|
|
"-----------------------" + separator +
|
|
"XCHE: " + separator +
|
|
"-----------------------" + separator +
|
|
ToString("isChe1Bullish", isChe1Bullish, ignoreFalseConditions, separator) +
|
|
ToString("isChe1Bearish", isChe1Bearish, ignoreFalseConditions, separator) +
|
|
ToString("isChe1SwitchedToBullish", isChe1SwitchedToBullish, ignoreFalseConditions, separator) +
|
|
ToString("isChe1SwitchedToBearish", isChe1SwitchedToBearish, ignoreFalseConditions, separator) +
|
|
ToString("isChe2Bullish", isChe2Bullish, ignoreFalseConditions, separator) +
|
|
ToString("isChe2Bearish", isChe2Bearish, ignoreFalseConditions, separator) +
|
|
ToString("isChe2SwitchedToBullish", isChe2SwitchedToBullish, ignoreFalseConditions, separator) +
|
|
ToString("isChe2SwitchedToBearish", isChe2SwitchedToBearish, ignoreFalseConditions, separator) +
|
|
ToString("isCheBullish", isCheBullish, ignoreFalseConditions, separator) +
|
|
ToString("isCheBearish", isCheBearish, ignoreFalseConditions, separator) +
|
|
ToString("isCheSwitchedToBullish", isCheSwitchedToBullish, ignoreFalseConditions, separator) +
|
|
ToString("isCheSwitchedToBearish", isCheSwitchedToBearish, ignoreFalseConditions, separator) +
|
|
//
|
|
""
|
|
//
|
|
;
|
|
|
|
//
|
|
// X3MA ...
|
|
|
|
//
|
|
string x3maonditionsStr =
|
|
//
|
|
"-----------------------" + separator +
|
|
"X3MA: " + separator +
|
|
"-----------------------" + separator +
|
|
ToString("isX3MaFastBullish", isX3MaFastBullish, ignoreFalseConditions, separator) +
|
|
ToString("isX3MaFastBearish", isX3MaFastBearish, ignoreFalseConditions, separator) +
|
|
ToString("isX3MaFastNeutural", isX3MaFastNeutural, ignoreFalseConditions, separator) +
|
|
ToString("isX3MaMidBullish", isX3MaMidBullish, ignoreFalseConditions, separator) +
|
|
ToString("isX3MaMidBearish", isX3MaMidBearish, ignoreFalseConditions, separator) +
|
|
ToString("isX3MaMidNeutural", isX3MaMidNeutural, ignoreFalseConditions, separator) +
|
|
ToString("isX3MaSlowBullish", isX3MaSlowBullish, ignoreFalseConditions, separator) +
|
|
ToString("isX3MaSlowBearish", isX3MaSlowBearish, ignoreFalseConditions, separator) +
|
|
ToString("isX3MaSlowNeutural", isX3MaSlowNeutural, ignoreFalseConditions, separator) +
|
|
ToString("isX3MaFastOverMid", isX3MaFastOverMid, ignoreFalseConditions, separator) +
|
|
ToString("isX3MaMidOverSlow", isX3MaMidOverSlow, ignoreFalseConditions, separator) +
|
|
ToString("isX3MaFastUnderMid", isX3MaFastUnderMid, ignoreFalseConditions, separator) +
|
|
ToString("isX3MaMidUnderSlow", isX3MaMidUnderSlow, ignoreFalseConditions, separator) +
|
|
ToString("isX3MaBullishState", isX3MaBullishState, ignoreFalseConditions, separator) +
|
|
ToString("isX3MaBearishState", isX3MaBearishState, ignoreFalseConditions, separator) +
|
|
ToString("isX3MaNeuturalState", isX3MaNeuturalState, ignoreFalseConditions, separator) +
|
|
ToString("isX3MaBullishOrdered", isX3MaBullishOrdered, ignoreFalseConditions, separator) +
|
|
ToString("isX3MaBearishOrdered", isX3MaBearishOrdered, ignoreFalseConditions, separator) +
|
|
ToString("isX3MaSwitchedToBullishOrdered", isX3MaSwitchedToBullishOrdered, ignoreFalseConditions, separator) +
|
|
ToString("isX3MaSwitchedToBearishOrdered", isX3MaSwitchedToBearishOrdered, ignoreFalseConditions, separator) +
|
|
ToString("isX3MaSwitchedToBullishState", isX3MaSwitchedToBullishState, ignoreFalseConditions, separator) +
|
|
ToString("isX3MaSwitchedToBearishState", isX3MaSwitchedToBearishState, ignoreFalseConditions, separator) +
|
|
ToString("isX3MaSwitchedToNeuturalState", isX3MaSwitchedToNeuturalState, ignoreFalseConditions, separator) +
|
|
//
|
|
""
|
|
//
|
|
;
|
|
|
|
//
|
|
// XVWAP ...
|
|
|
|
//
|
|
string vwapConditionsStr =
|
|
//
|
|
"-----------------------" + separator +
|
|
"XVWAP: " + separator +
|
|
"-----------------------" + separator +
|
|
ToString("isVWapFastBullish", isVWapFastBullish, ignoreFalseConditions, separator) +
|
|
ToString("isVWapFastBearish", isVWapFastBearish, ignoreFalseConditions, separator) +
|
|
ToString("isVWapFastNeutural", isVWapFastNeutural, ignoreFalseConditions, separator) +
|
|
ToString("isVWapMidBullish", isVWapMidBullish, ignoreFalseConditions, separator) +
|
|
ToString("isVWapMidBearish", isVWapMidBearish, ignoreFalseConditions, separator) +
|
|
ToString("isVWapMidNeutural", isVWapMidNeutural, ignoreFalseConditions, separator) +
|
|
ToString("isVWapSlowBullish", isVWapSlowBullish, ignoreFalseConditions, separator) +
|
|
ToString("isVWapSlowBearish", isVWapSlowBearish, ignoreFalseConditions, separator) +
|
|
ToString("isVWapSlowNeutural", isVWapSlowNeutural, ignoreFalseConditions, separator) +
|
|
ToString("isVWapFastOverMid", isVWapFastOverMid, ignoreFalseConditions, separator) +
|
|
ToString("isVWapMidOverSlow", isVWapMidOverSlow, ignoreFalseConditions, separator) +
|
|
ToString("isVWapFastUnderMid", isVWapFastUnderMid, ignoreFalseConditions, separator) +
|
|
ToString("isVWapMidUnderSlow", isVWapMidUnderSlow, ignoreFalseConditions, separator) +
|
|
ToString("isVWapBullishState", isVWapBullishState, ignoreFalseConditions, separator) +
|
|
ToString("isVWapBearishState", isVWapBearishState, ignoreFalseConditions, separator) +
|
|
ToString("isVWapNeuturalState", isVWapNeuturalState, ignoreFalseConditions, separator) +
|
|
ToString("isVWapBullishOrdered", isVWapBullishOrdered, ignoreFalseConditions, separator) +
|
|
ToString("isVWapBearishOrdered", isVWapBearishOrdered, ignoreFalseConditions, separator) +
|
|
ToString("isVWapSwitchedToBullishOrdered", isVWapSwitchedToBullishOrdered, ignoreFalseConditions, separator) +
|
|
ToString("isVWapSwitchedToBearishOrdered", isVWapSwitchedToBearishOrdered, ignoreFalseConditions, separator) +
|
|
ToString("isVWapSwitchedToBullishState", isVWapSwitchedToBullishState, ignoreFalseConditions, separator) +
|
|
ToString("isVWapSwitchedToBearishState", isVWapSwitchedToBearishState, ignoreFalseConditions, separator) +
|
|
ToString("isVWapSwitchedToNeuturalState", isVWapSwitchedToNeuturalState, ignoreFalseConditions, separator) +
|
|
//
|
|
""
|
|
//
|
|
;
|
|
|
|
//
|
|
string conditionsStr =
|
|
//
|
|
pvConditionsStr + separator +
|
|
hkConditionsStr + separator +
|
|
atrConditionsStr + separator +
|
|
strConditionsStr + separator +
|
|
cheConditionsStr + separator +
|
|
x3maonditionsStr + separator +
|
|
vwapConditionsStr + separator +
|
|
""
|
|
//
|
|
;
|
|
|
|
//
|
|
result =
|
|
//
|
|
"[" + GetTag() + "]" + separator +
|
|
(onlyConditions
|
|
? ""
|
|
: commonStr) +
|
|
(!includeScores
|
|
? ""
|
|
: scoresStr) +
|
|
" " + separator +
|
|
(onlyCommons
|
|
? ""
|
|
: conditionsStr) +
|
|
""
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Retrieve nique Tag Identifier ...
|
|
*
|
|
* @return ( string )
|
|
*/
|
|
string GetTag()
|
|
{
|
|
return GetTypeName(this);
|
|
}
|
|
|
|
//
|
|
};
|
|
|
|
//
|
|
// Implementation ...
|
|
class XCX121Helper : public XCBase
|
|
{
|
|
//
|
|
public:
|
|
//
|
|
|
|
//
|
|
// Helpers ...
|
|
XCX121XCCHelper *xccHelper;
|
|
XCX121XPVHelper *xpvHelper;
|
|
XCX121XHKHelper *xhkHelper;
|
|
XCX121XMASHelper *xmasHelper;
|
|
XCX121XATRHelper *xatrHelper;
|
|
XCX121XSTRHelper *xstrHelper;
|
|
XCX121XCHEHelper *xcheHelper;
|
|
XCX121X3MAHelper *x3maHelper;
|
|
XCX121XVWAPHelper *xvwapHelper;
|
|
|
|
//
|
|
// Constructors ...
|
|
XCX121Helper()
|
|
{
|
|
}
|
|
|
|
//
|
|
// Deconstructor ...
|
|
~XCX121Helper()
|
|
{
|
|
//
|
|
mInputs.Clean();
|
|
xccInputs.Clean();
|
|
xpvInputs.Clean();
|
|
xhkInputs.Clean();
|
|
xmasInputs.Clean();
|
|
xatrInputs.Clean();
|
|
xstrInputs.Clean();
|
|
xcheInputs.Clean();
|
|
x3maInputs.Clean();
|
|
xvwapInputs.Clean();
|
|
|
|
//
|
|
delete xccHelper;
|
|
delete xpvHelper;
|
|
delete xhkHelper;
|
|
delete xmasHelper;
|
|
delete xatrHelper;
|
|
delete xstrHelper;
|
|
delete xcheHelper;
|
|
delete x3maHelper;
|
|
delete xvwapHelper;
|
|
|
|
//
|
|
ZeroMemory(xccHelper);
|
|
ZeroMemory(xpvHelper);
|
|
ZeroMemory(xhkHelper);
|
|
ZeroMemory(xmasHelper);
|
|
ZeroMemory(xatrHelper);
|
|
ZeroMemory(xstrHelper);
|
|
ZeroMemory(xcheHelper);
|
|
ZeroMemory(x3maHelper);
|
|
ZeroMemory(xvwapHelper);
|
|
}
|
|
|
|
//
|
|
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: X121Inputs instance, Indicator Inputs ...
|
|
*
|
|
* @return ( bool )
|
|
*/
|
|
bool Init(
|
|
string symbol, // Trading Symbol
|
|
ENUM_TIMEFRAMES period, // Trading Period
|
|
X121Inputs &inputs // Inputs
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
result =
|
|
IsValid(symbol) &&
|
|
IsValid(period) &&
|
|
inputs.IsValid();
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
mSymbol = symbol;
|
|
mPeriod = period;
|
|
|
|
//
|
|
// Setting Inputs ...
|
|
|
|
//
|
|
mInputs = inputs;
|
|
xccInputs = inputs.xccInputs;
|
|
xpvInputs = inputs.xpvInputs;
|
|
xhkInputs = inputs.xhkInputs;
|
|
xmasInputs = inputs.xmasInputs;
|
|
xatrInputs = inputs.xatrInputs;
|
|
xstrInputs = inputs.xstrInputs;
|
|
xcheInputs = inputs.xcheInputs;
|
|
x3maInputs = inputs.x3maInputs;
|
|
xvwapInputs = inputs.xvwapInputs;
|
|
|
|
//
|
|
// Initial Helpers ...
|
|
|
|
//
|
|
// XCC ...
|
|
xccHelper = new XCX121XCCHelper();
|
|
result =
|
|
result &&
|
|
xccHelper.Init(
|
|
symbol,
|
|
period,
|
|
xccInputs //
|
|
);
|
|
|
|
//
|
|
// XPV ...
|
|
xpvHelper = new XCX121XPVHelper();
|
|
result =
|
|
result &&
|
|
xpvHelper.Init(
|
|
symbol,
|
|
period,
|
|
xpvInputs //
|
|
);
|
|
|
|
//
|
|
// XHK ...
|
|
xhkHelper = new XCX121XHKHelper();
|
|
result =
|
|
result &&
|
|
xhkHelper.Init(
|
|
symbol,
|
|
period,
|
|
xhkInputs //
|
|
);
|
|
if (!result)
|
|
{
|
|
//
|
|
ZeroMemory(xccHelper);
|
|
ZeroMemory(xpvHelper);
|
|
ZeroMemory(xhkHelper);
|
|
ZeroMemory(xmasHelper);
|
|
ZeroMemory(xatrHelper);
|
|
ZeroMemory(xstrHelper);
|
|
ZeroMemory(xcheHelper);
|
|
ZeroMemory(x3maHelper);
|
|
ZeroMemory(xvwapHelper);
|
|
|
|
//
|
|
// ZeroMemory(xichHelper);
|
|
// ZeroMemory(xdonHelper);
|
|
// ZeroMemory(xdeltaHelper);
|
|
// ZeroMemory(xvolumeHelper);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// XMAS ...
|
|
xmasHelper = new XCX121XMASHelper();
|
|
result =
|
|
result &&
|
|
xmasHelper.Init(
|
|
symbol,
|
|
period,
|
|
xmasInputs //
|
|
);
|
|
|
|
//
|
|
// XATR ...
|
|
xatrHelper = new XCX121XATRHelper();
|
|
result =
|
|
result &&
|
|
xatrHelper.Init(
|
|
symbol,
|
|
period,
|
|
xatrInputs //
|
|
);
|
|
|
|
//
|
|
// XSTR ...
|
|
xstrHelper = new XCX121XSTRHelper();
|
|
result =
|
|
result &&
|
|
xstrHelper.Init(
|
|
symbol,
|
|
period,
|
|
xstrInputs //
|
|
);
|
|
|
|
//
|
|
// XCHE ...
|
|
xcheHelper = new XCX121XCHEHelper();
|
|
result =
|
|
result &&
|
|
xcheHelper.Init(
|
|
symbol,
|
|
period,
|
|
xcheInputs //
|
|
);
|
|
|
|
//
|
|
// X3MA ...
|
|
x3maHelper = new XCX121X3MAHelper();
|
|
result =
|
|
result &&
|
|
x3maHelper.Init(
|
|
symbol,
|
|
period,
|
|
x3maInputs //
|
|
);
|
|
|
|
//
|
|
// XVWAP ...
|
|
xvwapHelper = new XCX121XVWAPHelper();
|
|
result =
|
|
result &&
|
|
xvwapHelper.Init(
|
|
symbol,
|
|
period,
|
|
xvwapInputs //
|
|
);
|
|
|
|
//
|
|
// Show RSI ...
|
|
if (inputs.showRSI)
|
|
{
|
|
//
|
|
ENUM_APPLIED_PRICE rsiAppliedTo = ToAppliedPrice(xatrInputs.rsiPriceType);
|
|
mRSIHandler = iRSI(
|
|
symbol,
|
|
period,
|
|
xatrInputs.rsiLength,
|
|
rsiAppliedTo //
|
|
);
|
|
|
|
//
|
|
result =
|
|
result &&
|
|
mRSIHandler != INVALID_HANDLE;
|
|
}
|
|
|
|
//
|
|
// If Result is False, Cleanup Resources ...
|
|
if (!result)
|
|
{
|
|
//
|
|
mInputs.Clean();
|
|
|
|
//
|
|
xccInputs.Clean();
|
|
xpvInputs.Clean();
|
|
xhkInputs.Clean();
|
|
xmasInputs.Clean();
|
|
xatrInputs.Clean();
|
|
xstrInputs.Clean();
|
|
xcheInputs.Clean();
|
|
x3maInputs.Clean();
|
|
xvwapInputs.Clean();
|
|
|
|
//
|
|
ZeroMemory(xccHelper);
|
|
ZeroMemory(xpvHelper);
|
|
ZeroMemory(xhkHelper);
|
|
ZeroMemory(xmasHelper);
|
|
ZeroMemory(xatrHelper);
|
|
ZeroMemory(xstrHelper);
|
|
ZeroMemory(xcheHelper);
|
|
ZeroMemory(x3maHelper);
|
|
ZeroMemory(xvwapHelper);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Conditions Readers ...
|
|
|
|
//
|
|
// XPV ...
|
|
bool GetPVConditions(
|
|
X121XPVConditions &conditions, //
|
|
int barIndex = 0, //
|
|
int loopback = 5 //
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
result = xpvHelper.GetConditions(
|
|
conditions,
|
|
barIndex,
|
|
loopback //
|
|
);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// XHK ...
|
|
bool GetHKConditions(
|
|
X121XHKConditions &conditions, //
|
|
int barIndex = 0, //
|
|
int loopback = 5 //
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
result = xhkHelper.GetConditions(
|
|
conditions,
|
|
barIndex,
|
|
loopback //
|
|
);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// XMAS ...
|
|
bool GetMASConditions(
|
|
X121XMASConditions &conditions, //
|
|
int barIndex = 0, //
|
|
int loopback = 5 //
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
result = xmasHelper.GetConditions(
|
|
conditions,
|
|
barIndex,
|
|
loopback //
|
|
);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// XATR ...
|
|
bool GetATRConditions(
|
|
X121XATRConditions &conditions, //
|
|
int barIndex = 0, //
|
|
int loopback = 5 //
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
result = xatrHelper.GetConditions(
|
|
conditions,
|
|
barIndex,
|
|
loopback //
|
|
);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// XSTR ...
|
|
bool GetSTRConditions(
|
|
X121XSTRConditions &conditions, //
|
|
int barIndex = 0, //
|
|
int loopback = 5 //
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
result = xstrHelper.GetConditions(
|
|
conditions,
|
|
barIndex,
|
|
loopback //
|
|
);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// XCHE ...
|
|
bool GetCHEConditions(
|
|
X121XCHEConditions &conditions, //
|
|
int barIndex = 0, //
|
|
int loopback = 5 //
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
result = xcheHelper.GetConditions(
|
|
conditions,
|
|
barIndex,
|
|
loopback //
|
|
);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// X3MA ...
|
|
bool Get3MAConditions(
|
|
X121X3MAConditions &conditions, //
|
|
int barIndex = 0, //
|
|
int loopback = 5 //
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
result = x3maHelper.GetConditions(
|
|
conditions,
|
|
barIndex,
|
|
loopback //
|
|
);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// XVWAP ...
|
|
bool GetVWAPConditions(
|
|
X121XVWAPConditions &conditions, //
|
|
int barIndex = 0, //
|
|
int loopback = 5 //
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
result = xvwapHelper.GetConditions(
|
|
conditions,
|
|
barIndex,
|
|
loopback //
|
|
);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
void Free()
|
|
{
|
|
//
|
|
xpvHelper.Free();
|
|
xhkHelper.Free();
|
|
xmasHelper.Free();
|
|
xatrHelper.Free();
|
|
xstrHelper.Free();
|
|
xcheHelper.Free();
|
|
xvwapHelper.Free();
|
|
|
|
//
|
|
// xichHelper.Free();
|
|
// xdonHelper.Free();
|
|
// xdeltaHelper.Free();
|
|
// xvolumeHelper.Free();
|
|
}
|
|
|
|
//
|
|
bool GetConditions(
|
|
X121Conditions &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;
|
|
|
|
//
|
|
X121XPVConditions xpvConditions;
|
|
X121XHKConditions xhkConditions;
|
|
X121XMASConditions xmasConditions;
|
|
X121XATRConditions xatrConditions;
|
|
X121XSTRConditions xstrConditions;
|
|
X121XCHEConditions xcheConditions;
|
|
X121X3MAConditions x3maConditions;
|
|
X121XVWAPConditions xvwapConditions;
|
|
|
|
//
|
|
result = zBar.Init(
|
|
mSymbol,
|
|
mPeriod,
|
|
zIndex //
|
|
);
|
|
result =
|
|
result &&
|
|
zBar.GetPreviousBar(cBar);
|
|
result =
|
|
result &&
|
|
cBar.GetPreviousBar(pBar);
|
|
|
|
//
|
|
// Conditions Retriever ...
|
|
|
|
//
|
|
// XPV ...
|
|
result =
|
|
result &&
|
|
GetPVConditions(
|
|
xpvConditions,
|
|
barIndex,
|
|
loopback //
|
|
);
|
|
|
|
//
|
|
// XHK ...
|
|
result =
|
|
result &&
|
|
GetHKConditions(
|
|
xhkConditions,
|
|
barIndex,
|
|
loopback //
|
|
);
|
|
|
|
//
|
|
// XMAS ...
|
|
result =
|
|
result &&
|
|
GetMASConditions(
|
|
xmasConditions,
|
|
barIndex,
|
|
loopback //
|
|
);
|
|
|
|
//
|
|
// XATR ...
|
|
result =
|
|
result &&
|
|
GetATRConditions(
|
|
xatrConditions,
|
|
barIndex,
|
|
loopback //
|
|
);
|
|
|
|
//
|
|
// XSTR ...
|
|
result =
|
|
result &&
|
|
GetSTRConditions(
|
|
xstrConditions,
|
|
barIndex,
|
|
loopback //
|
|
);
|
|
|
|
//
|
|
// XCHE ...
|
|
result =
|
|
result &&
|
|
GetCHEConditions(
|
|
xcheConditions,
|
|
barIndex,
|
|
loopback //
|
|
);
|
|
|
|
//
|
|
// X3MA ...
|
|
result =
|
|
result &&
|
|
Get3MAConditions(
|
|
x3maConditions,
|
|
barIndex,
|
|
loopback //
|
|
);
|
|
|
|
//
|
|
// XVWAP ...
|
|
result =
|
|
result &&
|
|
GetVWAPConditions(
|
|
xvwapConditions,
|
|
barIndex,
|
|
loopback //
|
|
);
|
|
|
|
//
|
|
// Check Result ...
|
|
if (!result)
|
|
{
|
|
//
|
|
zBar.Clean();
|
|
cBar.Clean();
|
|
pBar.Clean();
|
|
|
|
//
|
|
xpvConditions.Clean();
|
|
xhkConditions.Clean();
|
|
xmasConditions.Clean();
|
|
xatrConditions.Clean();
|
|
xstrConditions.Clean();
|
|
xcheConditions.Clean();
|
|
x3maConditions.Clean();
|
|
xvwapConditions.Clean();
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Fill X121 Conditions Reference by Using
|
|
// Retrieved Conditions ...
|
|
|
|
//
|
|
int cIDX = 1;
|
|
int pIDX = cIDX + 1;
|
|
|
|
//
|
|
// Conditions ...
|
|
|
|
//
|
|
// XCC ...
|
|
|
|
//
|
|
// Buffers ...
|
|
|
|
//
|
|
// Conditions ...
|
|
|
|
//
|
|
// XPV ...
|
|
|
|
//
|
|
// Buffers ...
|
|
|
|
//
|
|
Copy(
|
|
xpvConditions.sarBuffer,
|
|
conditions.sarBuffer //
|
|
);
|
|
|
|
//
|
|
Copy(
|
|
xpvConditions.cHHBuffer,
|
|
conditions.cHHBuffer //
|
|
);
|
|
|
|
//
|
|
Copy(
|
|
xpvConditions.cLLBuffer,
|
|
conditions.cLLBuffer //
|
|
);
|
|
|
|
//
|
|
Copy(
|
|
xpvConditions.sHHBuffer,
|
|
conditions.sHHBuffer //
|
|
);
|
|
|
|
//
|
|
Copy(
|
|
xpvConditions.sLLBuffer,
|
|
conditions.sLLBuffer //
|
|
);
|
|
|
|
//
|
|
Copy(
|
|
xpvConditions.mHHBuffer,
|
|
conditions.mHHBuffer //
|
|
);
|
|
|
|
//
|
|
Copy(
|
|
xpvConditions.mLLBuffer,
|
|
conditions.mLLBuffer //
|
|
);
|
|
|
|
//
|
|
Copy(
|
|
xpvConditions.lHHBuffer,
|
|
conditions.lHHBuffer //
|
|
);
|
|
|
|
//
|
|
Copy(
|
|
xpvConditions.lLLBuffer,
|
|
conditions.lLLBuffer //
|
|
);
|
|
|
|
//
|
|
Copy(
|
|
xpvConditions.hHHBuffer,
|
|
conditions.hHHBuffer //
|
|
);
|
|
|
|
//
|
|
Copy(
|
|
xpvConditions.hLLBuffer,
|
|
conditions.hLLBuffer //
|
|
);
|
|
|
|
//
|
|
Copy(
|
|
xpvConditions.peaksBuffer,
|
|
conditions.peaksBuffer //
|
|
);
|
|
|
|
//
|
|
Copy(
|
|
xpvConditions.valesBuffer,
|
|
conditions.valesBuffer //
|
|
);
|
|
|
|
//
|
|
Copy(
|
|
xpvConditions.supportsBuffer,
|
|
conditions.supportsBuffer //
|
|
);
|
|
|
|
//
|
|
Copy(
|
|
xpvConditions.peaksGoldenBuffer,
|
|
conditions.peaksGoldenBuffer //
|
|
);
|
|
|
|
//
|
|
Copy(
|
|
xpvConditions.valesGoldenBuffer,
|
|
conditions.valesGoldenBuffer //
|
|
);
|
|
|
|
//
|
|
Copy(
|
|
xpvConditions.resistancesBuffer,
|
|
conditions.resistancesBuffer //
|
|
);
|
|
|
|
//
|
|
Copy(
|
|
xpvConditions.fractalsUpperBuffer,
|
|
conditions.fractalsUpperBuffer //
|
|
);
|
|
|
|
//
|
|
Copy(
|
|
xpvConditions.fractalsLowerBuffer,
|
|
conditions.fractalsLowerBuffer //
|
|
);
|
|
|
|
//
|
|
// Conditions ...
|
|
|
|
//
|
|
conditions.isNewPeak = xpvConditions.isNewPeak;
|
|
conditions.isNewVale = xpvConditions.isNewVale;
|
|
conditions.isSarBullish = xpvConditions.isSarBullish;
|
|
conditions.isSarBearish = xpvConditions.isSarBearish;
|
|
conditions.isNewPeakOverLast = xpvConditions.isNewPeakOverLast;
|
|
conditions.isNewValeOverLast = xpvConditions.isNewValeOverLast;
|
|
conditions.isNewPeakUnderLast = xpvConditions.isNewPeakUnderLast;
|
|
conditions.isNewValeUnderLast = xpvConditions.isNewValeUnderLast;
|
|
conditions.isSarSwitchedToBullish = xpvConditions.isSarSwitchedToBullish;
|
|
conditions.isSarSwitchedToBearish = xpvConditions.isSarSwitchedToBearish;
|
|
|
|
//
|
|
// XHK ...
|
|
|
|
//
|
|
// Buffers ...
|
|
|
|
//
|
|
Copy(
|
|
xhkConditions.xhkSMLowBuffer,
|
|
conditions.xhkSMLowBuffer //
|
|
);
|
|
|
|
//
|
|
Copy(
|
|
xhkConditions.xhkRawLowBuffer,
|
|
conditions.xhkRawLowBuffer //
|
|
);
|
|
|
|
//
|
|
Copy(
|
|
xhkConditions.xhkSMOpenBuffer,
|
|
conditions.xhkSMOpenBuffer //
|
|
);
|
|
|
|
//
|
|
Copy(
|
|
xhkConditions.xhkSMHighBuffer,
|
|
conditions.xhkSMHighBuffer //
|
|
);
|
|
|
|
//
|
|
Copy(
|
|
xhkConditions.xhkRawOpenBuffer,
|
|
conditions.xhkRawOpenBuffer //
|
|
);
|
|
|
|
//
|
|
Copy(
|
|
xhkConditions.xhkRawHighBuffer,
|
|
conditions.xhkRawHighBuffer //
|
|
);
|
|
|
|
//
|
|
Copy(
|
|
xhkConditions.xhkSMCloseBuffer,
|
|
conditions.xhkSMCloseBuffer //
|
|
);
|
|
|
|
//
|
|
Copy(
|
|
xhkConditions.xhkRawCloseBuffer,
|
|
conditions.xhkRawCloseBuffer //
|
|
);
|
|
|
|
//
|
|
// Conditions ...
|
|
|
|
//
|
|
conditions.isSMHKBullish = xhkConditions.isSMHKBullish;
|
|
conditions.isSMHKBearish = xhkConditions.isSMHKBearish;
|
|
conditions.isRawHKBullish = xhkConditions.isRawHKBullish;
|
|
conditions.isRawHKBearish = xhkConditions.isRawHKBearish;
|
|
conditions.isClosedOverSMHK = xhkConditions.isClosedOverSMHK;
|
|
conditions.isClosedUnderSMHK = xhkConditions.isClosedUnderSMHK;
|
|
conditions.isClosedOverRawHK = xhkConditions.isClosedOverRawHK;
|
|
conditions.isClosedUnderRawHK = xhkConditions.isClosedUnderRawHK;
|
|
conditions.isRawHKClosedOverSMHK = xhkConditions.isRawHKClosedOverSMHK;
|
|
conditions.isRawHKClosedUnderSMHK = xhkConditions.isRawHKClosedUnderSMHK;
|
|
conditions.isSMHKSwitchedToBearish = xhkConditions.isSMHKSwitchedToBearish;
|
|
conditions.isSMHKSwitchedToBullish = xhkConditions.isSMHKSwitchedToBullish;
|
|
conditions.isRawHKSwitchedToBullish = xhkConditions.isRawHKSwitchedToBullish;
|
|
conditions.isRawHKSwitchedToBearish = xhkConditions.isRawHKSwitchedToBearish;
|
|
|
|
//
|
|
// XMAS ...
|
|
|
|
//
|
|
// Buffers ...
|
|
|
|
//
|
|
Copy(
|
|
xmasConditions.midBuffer,
|
|
conditions.midBuffer //
|
|
);
|
|
|
|
//
|
|
Copy(
|
|
xmasConditions.upperBuffer,
|
|
conditions.upperBuffer //
|
|
);
|
|
|
|
//
|
|
Copy(
|
|
xmasConditions.lowerBuffer,
|
|
conditions.lowerBuffer //
|
|
);
|
|
|
|
//
|
|
// Conditions ...
|
|
|
|
//
|
|
// XATR ...
|
|
|
|
//
|
|
// Buffers ...
|
|
|
|
//
|
|
Copy(
|
|
xatrConditions.rsiBuffer,
|
|
conditions.rsiBuffer //
|
|
);
|
|
|
|
//
|
|
Copy(
|
|
xatrConditions.atrBuffer,
|
|
conditions.atrBuffer //
|
|
);
|
|
|
|
//
|
|
Copy(
|
|
xatrConditions.atrUpperBuffer,
|
|
conditions.atrUpperBuffer //
|
|
);
|
|
|
|
//
|
|
Copy(
|
|
xatrConditions.atrLowerBuffer,
|
|
conditions.atrLowerBuffer //
|
|
);
|
|
|
|
//
|
|
Copy(
|
|
xatrConditions.rsiChangeBuffer,
|
|
conditions.rsiChangeBuffer //
|
|
);
|
|
|
|
//
|
|
Copy(
|
|
xatrConditions.atrUpperSMBuffer,
|
|
conditions.atrUpperSMBuffer //
|
|
);
|
|
|
|
//
|
|
Copy(
|
|
xatrConditions.atrLowerSMBuffer,
|
|
conditions.atrLowerSMBuffer //
|
|
);
|
|
|
|
//
|
|
Copy(
|
|
xatrConditions.rsiChangeSMBuffer,
|
|
conditions.rsiChangeSMBuffer //
|
|
);
|
|
|
|
//
|
|
Copy(
|
|
xatrConditions.priceChangeBuffer,
|
|
conditions.priceChangeBuffer //
|
|
);
|
|
|
|
//
|
|
Copy(
|
|
xatrConditions.priceChangeSMBuffer,
|
|
conditions.priceChangeSMBuffer //
|
|
);
|
|
|
|
//
|
|
// Conditions ...
|
|
|
|
//
|
|
conditions.isRsiInRange = xatrConditions.isRsiInRange;
|
|
conditions.isRsiOverSold = xatrConditions.isRsiOverSold;
|
|
conditions.isRsiOverRsiSM = xatrConditions.isRsiOverRsiSM;
|
|
conditions.isRsiUnderRsiSM = xatrConditions.isRsiUnderRsiSM;
|
|
conditions.isRsiOverBought = xatrConditions.isRsiOverBought;
|
|
conditions.isRsiCrossedOverRsiSM = xatrConditions.isRsiCrossedOverRsiSM;
|
|
conditions.isRsiCrossedUnderRsiSM = xatrConditions.isRsiCrossedUnderRsiSM;
|
|
conditions.isPriceChangeSMOverRsi = xatrConditions.isPriceChangeSMOverRsi;
|
|
conditions.isRsiSMOverPriceChange = xatrConditions.isRsiSMOverPriceChange;
|
|
conditions.isRsiSMUnderPriceChange = xatrConditions.isRsiSMUnderPriceChange;
|
|
conditions.isPriceChangeSMUnderRsi = xatrConditions.isPriceChangeSMUnderRsi;
|
|
conditions.isRsiCrossedOverOverSold = xatrConditions.isRsiCrossedOverOverSold;
|
|
conditions.isRsiCrossedUnderOverSold = xatrConditions.isRsiCrossedUnderOverSold;
|
|
conditions.isRsiCrossedOverOverBought = xatrConditions.isRsiCrossedOverOverBought;
|
|
conditions.isRsiCrossedUnderOverBought = xatrConditions.isRsiCrossedUnderOverBought;
|
|
conditions.isRsiSMCrossedOverPriceChange = xatrConditions.isRsiSMCrossedOverPriceChange;
|
|
conditions.isPriceChangeSMCrossedOverRsi = xatrConditions.isPriceChangeSMCrossedOverRsi;
|
|
conditions.isRsiSMCrossedUnderPriceChange = xatrConditions.isRsiSMCrossedUnderPriceChange;
|
|
conditions.isPriceChangeSMCrossedUnderRsi = xatrConditions.isPriceChangeSMCrossedUnderRsi;
|
|
conditions.isPriceChangeOverPriceChangeSM = xatrConditions.isPriceChangeOverPriceChangeSM;
|
|
conditions.isPriceChangeUnderPriceChangeSM = xatrConditions.isPriceChangeUnderPriceChangeSM;
|
|
conditions.isPriceChangeCrossedOverPriceChangeSM = xatrConditions.isPriceChangeCrossedOverPriceChangeSM;
|
|
conditions.isPriceChangeCrossedUnderPriceChangeSM = xatrConditions.isPriceChangeCrossedUnderPriceChangeSM;
|
|
|
|
//
|
|
// 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.isStrSwitchedToBullish = xstrConditions.isStrSwitchedToBullish;
|
|
conditions.isStrSwitchedToBearish = xstrConditions.isStrSwitchedToBearish;
|
|
|
|
//
|
|
// XCHE ...
|
|
|
|
//
|
|
// Buffers ...
|
|
|
|
//
|
|
Copy(
|
|
xcheConditions.le1Buffer,
|
|
conditions.le1Buffer //
|
|
);
|
|
|
|
//
|
|
Copy(
|
|
xcheConditions.se1Buffer,
|
|
conditions.se1Buffer //
|
|
);
|
|
|
|
//
|
|
Copy(
|
|
xcheConditions.le2Buffer,
|
|
conditions.le2Buffer //
|
|
);
|
|
|
|
//
|
|
Copy(
|
|
xcheConditions.se2Buffer,
|
|
conditions.se2Buffer //
|
|
);
|
|
|
|
//
|
|
Copy(
|
|
xcheConditions.le1StartBuffer,
|
|
conditions.le1StartBuffer //
|
|
);
|
|
|
|
//
|
|
Copy(
|
|
xcheConditions.se1StartBuffer,
|
|
conditions.se1StartBuffer //
|
|
);
|
|
|
|
//
|
|
Copy(
|
|
xcheConditions.le2StartBuffer,
|
|
conditions.le2StartBuffer //
|
|
);
|
|
|
|
//
|
|
Copy(
|
|
xcheConditions.se2StartBuffer,
|
|
conditions.se2StartBuffer //
|
|
);
|
|
|
|
//
|
|
// Conditions ...
|
|
|
|
//
|
|
conditions.isCheBullish = xcheConditions.isCheBullish;
|
|
conditions.isCheBearish = xcheConditions.isCheBearish;
|
|
conditions.isChe1Bullish = xcheConditions.isChe1Bullish;
|
|
conditions.isChe1Bearish = xcheConditions.isChe1Bearish;
|
|
conditions.isChe2Bullish = xcheConditions.isChe2Bullish;
|
|
conditions.isChe2Bearish = xcheConditions.isChe2Bearish;
|
|
conditions.isCheSwitchedToBullish = xcheConditions.isCheSwitchedToBullish;
|
|
conditions.isCheSwitchedToBearish = xcheConditions.isCheSwitchedToBearish;
|
|
conditions.isChe1SwitchedToBullish = xcheConditions.isChe1SwitchedToBullish;
|
|
conditions.isChe1SwitchedToBearish = xcheConditions.isChe1SwitchedToBearish;
|
|
conditions.isChe2SwitchedToBullish = xcheConditions.isChe2SwitchedToBullish;
|
|
conditions.isChe2SwitchedToBearish = xcheConditions.isChe2SwitchedToBearish;
|
|
|
|
//
|
|
// X3MA ...
|
|
|
|
//
|
|
// Buffers ...
|
|
|
|
//
|
|
Copy(
|
|
x3maConditions.x3maMidBuffer,
|
|
conditions.x3maMidBuffer //
|
|
);
|
|
|
|
//
|
|
Copy(
|
|
x3maConditions.x3maFastBuffer,
|
|
conditions.x3maFastBuffer //
|
|
);
|
|
|
|
//
|
|
Copy(
|
|
x3maConditions.x3maSlowBuffer,
|
|
conditions.x3maSlowBuffer //
|
|
);
|
|
|
|
//
|
|
Copy(
|
|
x3maConditions.x3maMidStateBuffer,
|
|
conditions.x3maMidStateBuffer //
|
|
);
|
|
|
|
//
|
|
Copy(
|
|
x3maConditions.x3maFastStateBuffer,
|
|
conditions.x3maFastStateBuffer //
|
|
);
|
|
|
|
//
|
|
Copy(
|
|
x3maConditions.x3maSlowStateBuffer,
|
|
conditions.x3maSlowStateBuffer //
|
|
);
|
|
|
|
//
|
|
// Conditions ...
|
|
|
|
//
|
|
conditions.isX3MaMidBullish = x3maConditions.isX3MaMidBullish;
|
|
conditions.isX3MaMidBearish = x3maConditions.isX3MaMidBearish;
|
|
conditions.isX3MaFastBullish = x3maConditions.isX3MaFastBullish;
|
|
conditions.isX3MaFastBearish = x3maConditions.isX3MaFastBearish;
|
|
conditions.isX3MaMidNeutural = x3maConditions.isX3MaMidNeutural;
|
|
conditions.isX3MaSlowBullish = x3maConditions.isX3MaSlowBullish;
|
|
conditions.isX3MaSlowBearish = x3maConditions.isX3MaSlowBearish;
|
|
conditions.isX3MaFastOverMid = x3maConditions.isX3MaFastOverMid;
|
|
conditions.isX3MaMidOverSlow = x3maConditions.isX3MaMidOverSlow;
|
|
conditions.isX3MaFastNeutural = x3maConditions.isX3MaFastNeutural;
|
|
conditions.isX3MaSlowNeutural = x3maConditions.isX3MaSlowNeutural;
|
|
conditions.isX3MaFastUnderMid = x3maConditions.isX3MaFastUnderMid;
|
|
conditions.isX3MaMidUnderSlow = x3maConditions.isX3MaMidUnderSlow;
|
|
conditions.isX3MaBullishState = x3maConditions.isX3MaBullishState;
|
|
conditions.isX3MaBearishState = x3maConditions.isX3MaBearishState;
|
|
conditions.isX3MaNeuturalState = x3maConditions.isX3MaNeuturalState;
|
|
conditions.isX3MaBullishOrdered = x3maConditions.isX3MaBullishOrdered;
|
|
conditions.isX3MaBearishOrdered = x3maConditions.isX3MaBearishOrdered;
|
|
conditions.isX3MaSwitchedToBullishState = x3maConditions.isX3MaSwitchedToBullishState;
|
|
conditions.isX3MaSwitchedToBearishState = x3maConditions.isX3MaSwitchedToBearishState;
|
|
conditions.isX3MaSwitchedToNeuturalState = x3maConditions.isX3MaSwitchedToNeuturalState;
|
|
conditions.isX3MaSwitchedToBullishOrdered = x3maConditions.isX3MaSwitchedToBullishOrdered;
|
|
conditions.isX3MaSwitchedToBearishOrdered = x3maConditions.isX3MaSwitchedToBearishOrdered;
|
|
|
|
//
|
|
// XVWAP ...
|
|
|
|
//
|
|
// Buffers ...
|
|
|
|
//
|
|
Copy(
|
|
xvwapConditions.vwapMidBuffer,
|
|
conditions.vwapMidBuffer //
|
|
);
|
|
|
|
//
|
|
Copy(
|
|
xvwapConditions.vwapFastBuffer,
|
|
conditions.vwapFastBuffer //
|
|
);
|
|
|
|
//
|
|
Copy(
|
|
xvwapConditions.vwapSlowBuffer,
|
|
conditions.vwapSlowBuffer //
|
|
);
|
|
|
|
//
|
|
Copy(
|
|
xvwapConditions.vwapPriceBuffer,
|
|
conditions.vwapPriceBuffer //
|
|
);
|
|
|
|
//
|
|
Copy(
|
|
xvwapConditions.vwapVolumeBuffer,
|
|
conditions.vwapVolumeBuffer //
|
|
);
|
|
|
|
//
|
|
Copy(
|
|
xvwapConditions.vwapMidStateBuffer,
|
|
conditions.vwapMidStateBuffer //
|
|
);
|
|
|
|
//
|
|
Copy(
|
|
xvwapConditions.vwapFastStateBuffer,
|
|
conditions.vwapFastStateBuffer //
|
|
);
|
|
|
|
//
|
|
Copy(
|
|
xvwapConditions.vwapSlowStateBuffer,
|
|
conditions.vwapSlowStateBuffer //
|
|
);
|
|
|
|
//
|
|
// Conditions ...
|
|
|
|
//
|
|
conditions.isVWapMidBullish = xvwapConditions.isVWapMidBullish;
|
|
conditions.isVWapMidBearish = xvwapConditions.isVWapMidBearish;
|
|
conditions.isVWapMidNeutural = xvwapConditions.isVWapMidNeutural;
|
|
conditions.isVWapFastBullish = xvwapConditions.isVWapFastBullish;
|
|
conditions.isVWapFastBearish = xvwapConditions.isVWapFastBearish;
|
|
conditions.isVWapSlowBullish = xvwapConditions.isVWapSlowBullish;
|
|
conditions.isVWapSlowBearish = xvwapConditions.isVWapSlowBearish;
|
|
conditions.isVWapFastOverMid = xvwapConditions.isVWapFastOverMid;
|
|
conditions.isVWapMidOverSlow = xvwapConditions.isVWapMidOverSlow;
|
|
conditions.isVWapFastNeutural = xvwapConditions.isVWapFastNeutural;
|
|
conditions.isVWapSlowNeutural = xvwapConditions.isVWapSlowNeutural;
|
|
conditions.isVWapFastUnderMid = xvwapConditions.isVWapFastUnderMid;
|
|
conditions.isVWapMidUnderSlow = xvwapConditions.isVWapMidUnderSlow;
|
|
conditions.isVWapBullishState = xvwapConditions.isVWapBullishState;
|
|
conditions.isVWapBearishState = xvwapConditions.isVWapBearishState;
|
|
conditions.isVWapNeuturalState = xvwapConditions.isVWapNeuturalState;
|
|
conditions.isVWapBullishOrdered = xvwapConditions.isVWapBullishOrdered;
|
|
conditions.isVWapBearishOrdered = xvwapConditions.isVWapBearishOrdered;
|
|
conditions.isVWapSwitchedToBullishState = xvwapConditions.isVWapSwitchedToBullishState;
|
|
conditions.isVWapSwitchedToBearishState = xvwapConditions.isVWapSwitchedToBearishState;
|
|
conditions.isVWapSwitchedToNeuturalState = xvwapConditions.isVWapSwitchedToNeuturalState;
|
|
conditions.isVWapSwitchedToBullishOrdered = xvwapConditions.isVWapSwitchedToBullishOrdered;
|
|
conditions.isVWapSwitchedToBearishOrdered = xvwapConditions.isVWapSwitchedToBearishOrdered;
|
|
|
|
//
|
|
// Cleanup Resource ...
|
|
|
|
//
|
|
zBar.Clean();
|
|
cBar.Clean();
|
|
pBar.Clean();
|
|
|
|
//
|
|
xpvConditions.Clean();
|
|
xhkConditions.Clean();
|
|
xmasConditions.Clean();
|
|
xatrConditions.Clean();
|
|
xstrConditions.Clean();
|
|
xcheConditions.Clean();
|
|
x3maConditions.Clean();
|
|
xvwapConditions.Clean();
|
|
|
|
//
|
|
Free();
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
protected:
|
|
//
|
|
|
|
//
|
|
private:
|
|
//
|
|
|
|
//
|
|
string mSymbol; // Trading Symbol
|
|
ENUM_TIMEFRAMES mPeriod; // Trading Period
|
|
|
|
//
|
|
// Inputs ...
|
|
X121Inputs mInputs;
|
|
X121XCCInputs xccInputs;
|
|
X121XPVInputs xpvInputs;
|
|
X121XHKInputs xhkInputs;
|
|
X121XMASInputs xmasInputs;
|
|
X121XATRInputs xatrInputs;
|
|
X121XSTRInputs xstrInputs;
|
|
X121XCHEInputs xcheInputs;
|
|
X121X3MAInputs x3maInputs;
|
|
X121XVWAPInputs xvwapInputs;
|
|
|
|
//
|
|
// X121XICHInputs xichInputs;
|
|
// X121XDONInputs xdonInputs;
|
|
// X121XDELTAInputs xdeltaInputs;
|
|
// X121XVOLUMEInputs xvolumeInputs;
|
|
|
|
//
|
|
int mRSIHandler;
|
|
};
|
|
|
|
//
|