last ...
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -30,7 +30,108 @@
|
||||
struct XSTRCCIInputs
|
||||
{
|
||||
//
|
||||
string tmp;
|
||||
bool showAC;
|
||||
bool showAD;
|
||||
bool showADX;
|
||||
bool showATR;
|
||||
bool showCCI;
|
||||
bool showRSI;
|
||||
bool showMFI;
|
||||
bool showRVI;
|
||||
bool showMACD;
|
||||
bool showMomentum;
|
||||
bool showStochastic;
|
||||
|
||||
//
|
||||
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;
|
||||
|
||||
//
|
||||
strInputs.Clean();
|
||||
oscsInputs.Clean();
|
||||
|
||||
//
|
||||
ZeroMemory(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Default Values ...
|
||||
*/
|
||||
void Default()
|
||||
{
|
||||
//
|
||||
strInputs.Default();
|
||||
oscsInputs.Default();
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool IsValid()
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result =
|
||||
//
|
||||
strInputs.IsValid() &&
|
||||
oscsInputs.IsValid();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract Max Input Length ...
|
||||
*
|
||||
* @return ( int )
|
||||
*/
|
||||
int Max()
|
||||
{
|
||||
//
|
||||
int result = 0;
|
||||
|
||||
//
|
||||
int strMax = strInputs.Max();
|
||||
int ocsMax = oscsInputs.Max();
|
||||
|
||||
//
|
||||
result = MathMax(strMax, ocsMax);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
@@ -38,7 +139,246 @@ struct XSTRCCIInputs
|
||||
struct XSTRCCIConditions
|
||||
{
|
||||
//
|
||||
string tmp;
|
||||
// Common ...
|
||||
string symbol;
|
||||
ENUM_TIMEFRAMES period;
|
||||
datetime time;
|
||||
|
||||
//
|
||||
// XSTR ...
|
||||
|
||||
double strBuffer[];
|
||||
double atrBuffer[];
|
||||
double vidyaBuffer[];
|
||||
double strUpBuffer[];
|
||||
double strMidBuffer[];
|
||||
double strDownBuffer[];
|
||||
double strPriceBuffer[];
|
||||
double strStateBuffer[];
|
||||
double strSMLowBuffer[];
|
||||
double strSMHighBuffer[];
|
||||
double strMidStateBuffer[];
|
||||
|
||||
//
|
||||
bool isStrBullish;
|
||||
bool isStrBearish;
|
||||
|
||||
//
|
||||
bool isStrSwitchedToBullish;
|
||||
bool isStrSwitchedToBearish;
|
||||
|
||||
//
|
||||
// XOCS ...
|
||||
|
||||
//
|
||||
// Constructor ...
|
||||
XSTRCCIConditions()
|
||||
{
|
||||
Clean();
|
||||
}
|
||||
|
||||
//
|
||||
// Tools ...
|
||||
|
||||
/**
|
||||
* Cleaning Up ...
|
||||
*/
|
||||
void Clean()
|
||||
{
|
||||
//
|
||||
// Commons ...
|
||||
symbol = NULL;
|
||||
period = NULL;
|
||||
time = NULL;
|
||||
|
||||
//
|
||||
// XSTR ...
|
||||
|
||||
//
|
||||
Clean(strBuffer);
|
||||
Clean(atrBuffer);
|
||||
Clean(vidyaBuffer);
|
||||
Clean(strUpBuffer);
|
||||
Clean(strMidBuffer);
|
||||
Clean(strDownBuffer);
|
||||
Clean(strPriceBuffer);
|
||||
Clean(strStateBuffer);
|
||||
Clean(strSMLowBuffer);
|
||||
Clean(strSMHighBuffer);
|
||||
Clean(strMidStateBuffer);
|
||||
|
||||
//
|
||||
ArraySetAsSeries(strBuffer, true);
|
||||
ArraySetAsSeries(atrBuffer, 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;
|
||||
|
||||
//
|
||||
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 (isStrBearish)
|
||||
{
|
||||
bearishScore += minScore;
|
||||
}
|
||||
if (isStrSwitchedToBearish)
|
||||
{
|
||||
bearishScore += score;
|
||||
}
|
||||
|
||||
//
|
||||
// XOCS ...
|
||||
}
|
||||
|
||||
/**
|
||||
* 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) +
|
||||
"-----------------------" + separator +
|
||||
"XOCS: " + separator +
|
||||
"-----------------------" + separator +
|
||||
//
|
||||
""
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
result =
|
||||
//
|
||||
"[" + GetTag() + "]" + separator +
|
||||
(onlyConditions
|
||||
? ""
|
||||
: commonStr) +
|
||||
(!includeScores
|
||||
? ""
|
||||
: scoresStr) +
|
||||
" " + separator +
|
||||
(onlyCommons
|
||||
? ""
|
||||
: conditionsStr) +
|
||||
""
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve nique Tag Identifier ...
|
||||
*
|
||||
* @return ( string )
|
||||
*/
|
||||
string GetTag()
|
||||
{
|
||||
return GetTypeName(this);
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
@@ -50,6 +390,8 @@ class XCXSTRCCIHelper : XCBase
|
||||
public:
|
||||
//
|
||||
// Props ...
|
||||
XCX121XSTRHelper *strHelper;
|
||||
XCX121XOCSHelper *ocsHelper;
|
||||
|
||||
//
|
||||
// Constructor ...
|
||||
@@ -69,6 +411,30 @@ class XCXSTRCCIHelper : XCBase
|
||||
//
|
||||
// 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;
|
||||
};
|
||||
|
||||
//
|
||||
Reference in New Issue
Block a user