1170 lines
24 KiB
Plaintext
1170 lines
24 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.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;
|
|
|
|
//
|
|
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;
|
|
}
|
|
};
|
|
|
|
//
|
|
// Conditions Structure ...
|
|
struct XSTRCCIConditions
|
|
{
|
|
//
|
|
// Common ...
|
|
string symbol;
|
|
ENUM_TIMEFRAMES period;
|
|
datetime time;
|
|
|
|
//
|
|
// XSTR ...
|
|
|
|
double strBuffer[];
|
|
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;
|
|
|
|
//
|
|
// XOSCS ...
|
|
|
|
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[];
|
|
|
|
//
|
|
// 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);
|
|
}
|
|
};
|
|
|
|
//
|
|
// Helper Class Implementation ...
|
|
class XCXSTRCCIHelper : XCBase
|
|
{
|
|
//
|
|
// Public ...
|
|
public:
|
|
//
|
|
// Props ...
|
|
XCX121XSTRHelper *strHelper;
|
|
XCX121XOCSHelper *ocsHelper;
|
|
|
|
//
|
|
// Constructor ...
|
|
XCXSTRCCIHelper()
|
|
{
|
|
}
|
|
|
|
//
|
|
// Deconstructor ...
|
|
~XCXSTRCCIHelper()
|
|
{
|
|
//
|
|
mInputs.Clean();
|
|
|
|
//
|
|
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 ...
|
|
|
|
//
|
|
// 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(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(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.strMidBuffer,
|
|
conditions.strMidBuffer //
|
|
);
|
|
|
|
//
|
|
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 //
|
|
);
|
|
|
|
//
|
|
Copy(
|
|
xstrConditions.strMidStateBuffer,
|
|
conditions.strMidStateBuffer //
|
|
);
|
|
|
|
//
|
|
// Conditions ...
|
|
|
|
//
|
|
conditions.isStrBullish = xstrConditions.isStrBullish;
|
|
conditions.isStrBearish = xstrConditions.isStrBearish;
|
|
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 ...
|
|
|
|
//
|
|
// 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;
|
|
};
|
|
|
|
// |