test x5 provider reading Buffers correctly and also CanIgnoreProcess works properly ...
This commit is contained in:
@@ -109,7 +109,8 @@ public:
|
||||
|
||||
//
|
||||
result = tsInputs.IsValid();
|
||||
if (!result) {
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -258,12 +259,108 @@ public:
|
||||
// X5 Provider Market Conditions ...
|
||||
class X5MarketConditions : public XSCBaseProviderMarketConditions
|
||||
{
|
||||
|
||||
//
|
||||
// Public ...
|
||||
public:
|
||||
//
|
||||
// Buffers ...
|
||||
|
||||
//
|
||||
// XTS ...
|
||||
double tsCurrents[];
|
||||
double tsNearests[];
|
||||
double tsMediests[];
|
||||
double tsFarests[];
|
||||
|
||||
//
|
||||
// XFI ...
|
||||
double fis[];
|
||||
|
||||
//
|
||||
// XTD ...
|
||||
double tdBullishs[];
|
||||
double tdBearishs[];
|
||||
double tdSignals[];
|
||||
|
||||
//
|
||||
// XLH ...
|
||||
double lhHhs[];
|
||||
double lhLls[];
|
||||
double lhSignals[];
|
||||
|
||||
//
|
||||
// XTM ...
|
||||
double tms[];
|
||||
|
||||
//
|
||||
// XAMA ...
|
||||
double amas[];
|
||||
|
||||
//
|
||||
// XOBD ...
|
||||
double obds[];
|
||||
|
||||
//
|
||||
// XRSI ...
|
||||
double rsis[];
|
||||
|
||||
//
|
||||
// XCHMA ...
|
||||
double chmaScFasts[];
|
||||
double chmaScSlows[];
|
||||
double chmaMcFasts[];
|
||||
double chmaMcSlows[];
|
||||
double chmaLcFasts[];
|
||||
double chmaLcSlows[];
|
||||
double chmaHotStates[];
|
||||
|
||||
//
|
||||
// XCHLH ...
|
||||
double chlhScHHs[];
|
||||
double chlhScLLs[];
|
||||
double chlhMcHHs[];
|
||||
double chlhMcLLs[];
|
||||
double chlhLcHHs[];
|
||||
double chlhLcLLs[];
|
||||
double chlhHotStates[];
|
||||
|
||||
//
|
||||
|
||||
//
|
||||
// Conditions ...
|
||||
void Clear()
|
||||
{
|
||||
//
|
||||
Clean(tsCurrents);
|
||||
Clean(tsNearests);
|
||||
Clean(tsMediests);
|
||||
Clean(tsFarests);
|
||||
Clean(fis);
|
||||
Clean(tdBullishs);
|
||||
Clean(tdBearishs);
|
||||
Clean(tdSignals);
|
||||
Clean(lhHhs);
|
||||
Clean(lhLls);
|
||||
Clean(lhSignals);
|
||||
Clean(tms);
|
||||
Clean(amas);
|
||||
Clean(obds);
|
||||
Clean(rsis);
|
||||
Clean(chmaScFasts);
|
||||
Clean(chmaScSlows);
|
||||
Clean(chmaMcFasts);
|
||||
Clean(chmaMcSlows);
|
||||
Clean(chmaLcFasts);
|
||||
Clean(chmaLcSlows);
|
||||
Clean(chmaHotStates);
|
||||
Clean(chlhScHHs);
|
||||
Clean(chlhScLLs);
|
||||
Clean(chlhMcHHs);
|
||||
Clean(chlhMcLLs);
|
||||
Clean(chlhLcHHs);
|
||||
Clean(chlhLcLLs);
|
||||
Clean(chlhHotStates);
|
||||
}
|
||||
|
||||
//
|
||||
// Generate Score ...
|
||||
@@ -335,6 +432,9 @@ public:
|
||||
amaHelper = new XSCXAMAHelper();
|
||||
chmaHelper = new XSCXCHMAHelper();
|
||||
chlhHelper = new XSCXCHLHHelper();
|
||||
|
||||
//
|
||||
mNumberOfItems = 5;
|
||||
}
|
||||
|
||||
//
|
||||
@@ -544,29 +644,300 @@ public:
|
||||
// Functions ...
|
||||
|
||||
//
|
||||
virtual bool GetMarketConditions(
|
||||
X5MarketConditions &conditions, // Market Conditions Result
|
||||
int barIndex = 0 // Specified Bar Index
|
||||
)
|
||||
virtual string GetTag()
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
string result = NULL;
|
||||
|
||||
//
|
||||
result =
|
||||
//
|
||||
GetToken() +
|
||||
"[" +
|
||||
GetSymbol() +
|
||||
"," +
|
||||
ToString(GetPeriod()) +
|
||||
"]"
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
virtual void GetMarketConditions(
|
||||
X5MarketConditions &mConditions, // Market Conditions Result
|
||||
int barIndex = 0 // Specified Bar Index
|
||||
)
|
||||
{
|
||||
//
|
||||
mConditions.Clear();
|
||||
|
||||
//
|
||||
// XTM ...
|
||||
tmHelper.CopyMain(
|
||||
barIndex,
|
||||
mNumberOfItems,
|
||||
mConditions.tms);
|
||||
|
||||
//
|
||||
// XAMA ...
|
||||
amaHelper.CopyMain(
|
||||
barIndex,
|
||||
mNumberOfItems,
|
||||
mConditions.amas);
|
||||
|
||||
//
|
||||
// XFI ...
|
||||
fiHelper.CopyMain(
|
||||
barIndex,
|
||||
mNumberOfItems,
|
||||
mConditions.fis);
|
||||
|
||||
//
|
||||
// XOBD ...
|
||||
obdHelper.CopyMain(
|
||||
barIndex,
|
||||
mNumberOfItems,
|
||||
mConditions.obds);
|
||||
|
||||
//
|
||||
// XRSI ...
|
||||
rsiHelper.CopyMain(
|
||||
barIndex,
|
||||
mNumberOfItems,
|
||||
mConditions.rsis);
|
||||
|
||||
//
|
||||
// XLH ...
|
||||
|
||||
//
|
||||
// HH ...
|
||||
lhHelper.CopyHH(
|
||||
barIndex,
|
||||
mNumberOfItems,
|
||||
mConditions.lhHhs);
|
||||
|
||||
//
|
||||
// LL ...
|
||||
lhHelper.CopyLL(
|
||||
barIndex,
|
||||
mNumberOfItems,
|
||||
mConditions.lhLls);
|
||||
|
||||
//
|
||||
// Signal ...
|
||||
lhHelper.CopySignal(
|
||||
barIndex,
|
||||
mNumberOfItems,
|
||||
mConditions.lhSignals);
|
||||
|
||||
//
|
||||
// XTD ...
|
||||
|
||||
//
|
||||
// Bullish ...
|
||||
tdHelper.CopyBullish(
|
||||
barIndex,
|
||||
mNumberOfItems,
|
||||
mConditions.tdBullishs);
|
||||
|
||||
//
|
||||
// Bearish ...
|
||||
tdHelper.CopyBearish(
|
||||
barIndex,
|
||||
mNumberOfItems,
|
||||
mConditions.tdBearishs);
|
||||
|
||||
//
|
||||
// Signal ...
|
||||
tdHelper.CopySignal(
|
||||
barIndex,
|
||||
mNumberOfItems,
|
||||
mConditions.tdSignals);
|
||||
|
||||
//
|
||||
// XTS ...
|
||||
|
||||
//
|
||||
// Current ...
|
||||
tsHelper.CopyCurrent(
|
||||
barIndex,
|
||||
mNumberOfItems,
|
||||
mConditions.tsCurrents);
|
||||
|
||||
//
|
||||
// Nearest ...
|
||||
tsHelper.CopyNearest(
|
||||
barIndex,
|
||||
mNumberOfItems,
|
||||
mConditions.tsNearests);
|
||||
|
||||
//
|
||||
// Mediest ...
|
||||
tsHelper.CopyMediest(
|
||||
barIndex,
|
||||
mNumberOfItems,
|
||||
mConditions.tsMediests);
|
||||
|
||||
//
|
||||
// Farest ...
|
||||
tsHelper.CopyFarest(
|
||||
barIndex,
|
||||
mNumberOfItems,
|
||||
mConditions.tsFarests);
|
||||
|
||||
//
|
||||
// XCHMA ...
|
||||
|
||||
//
|
||||
// Short ...
|
||||
|
||||
//
|
||||
// Fast ...
|
||||
chmaHelper.CopySCFast(
|
||||
barIndex,
|
||||
mNumberOfItems,
|
||||
mConditions.chmaScFasts);
|
||||
|
||||
//
|
||||
// Slow ...
|
||||
chmaHelper.CopySCSlow(
|
||||
barIndex,
|
||||
mNumberOfItems,
|
||||
mConditions.chmaScSlows);
|
||||
|
||||
//
|
||||
// Medium ...
|
||||
|
||||
//
|
||||
// Fast ...
|
||||
chmaHelper.CopyMCFast(
|
||||
barIndex,
|
||||
mNumberOfItems,
|
||||
mConditions.chmaMcFasts);
|
||||
|
||||
//
|
||||
// Slow ...
|
||||
chmaHelper.CopyMCSlow(
|
||||
barIndex,
|
||||
mNumberOfItems,
|
||||
mConditions.chmaMcSlows);
|
||||
|
||||
//
|
||||
// Long ...
|
||||
|
||||
//
|
||||
// Fast ...
|
||||
chmaHelper.CopyLCFast(
|
||||
barIndex,
|
||||
mNumberOfItems,
|
||||
mConditions.chmaLcFasts);
|
||||
|
||||
//
|
||||
// Slow ...
|
||||
chmaHelper.CopyLCSlow(
|
||||
barIndex,
|
||||
mNumberOfItems,
|
||||
mConditions.chmaLcSlows);
|
||||
|
||||
//
|
||||
// Hot States ...
|
||||
chmaHelper.CopyHotState(
|
||||
barIndex,
|
||||
mNumberOfItems,
|
||||
mConditions.chmaHotStates);
|
||||
|
||||
//
|
||||
// XCHLH ...
|
||||
|
||||
//
|
||||
// Short ...
|
||||
|
||||
//
|
||||
// HH ...
|
||||
chlhHelper.CopySCHH(
|
||||
barIndex,
|
||||
mNumberOfItems,
|
||||
mConditions.chlhScHHs);
|
||||
|
||||
//
|
||||
// LL ...
|
||||
chlhHelper.CopySCLL(
|
||||
barIndex,
|
||||
mNumberOfItems,
|
||||
mConditions.chlhScLLs);
|
||||
|
||||
//
|
||||
// Medium ...
|
||||
|
||||
//
|
||||
// HH ...
|
||||
chlhHelper.CopyMCHH(
|
||||
barIndex,
|
||||
mNumberOfItems,
|
||||
mConditions.chlhMcHHs);
|
||||
|
||||
//
|
||||
// LL ...
|
||||
chlhHelper.CopyMCLL(
|
||||
barIndex,
|
||||
mNumberOfItems,
|
||||
mConditions.chlhMcLLs);
|
||||
|
||||
//
|
||||
// Long ...
|
||||
|
||||
//
|
||||
// HH ...
|
||||
chlhHelper.CopyLCHH(
|
||||
barIndex,
|
||||
mNumberOfItems,
|
||||
mConditions.chlhLcHHs);
|
||||
|
||||
//
|
||||
// LL ...
|
||||
chlhHelper.CopyLCLL(
|
||||
barIndex,
|
||||
mNumberOfItems,
|
||||
mConditions.chlhLcLLs);
|
||||
|
||||
//
|
||||
// Hot State ...
|
||||
chlhHelper.CopyHotState(
|
||||
barIndex,
|
||||
mNumberOfItems,
|
||||
mConditions.chlhHotStates);
|
||||
}
|
||||
|
||||
//
|
||||
// Check Market For Signal ...
|
||||
virtual bool HasSignal(
|
||||
int barIndex,
|
||||
XSignal &signal, // Hold's Signal if Exists ...
|
||||
X5MarketConditions &conditions // Hold's Market Conditions ...
|
||||
XSignal &mSignal, // Hold's Signal if Exists ...
|
||||
X5MarketConditions &mConditions // Hold's Market Conditions ...
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result = !CanIgnoreProcess();
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
GetMarketConditions(mConditions, barIndex);
|
||||
|
||||
//
|
||||
if (result)
|
||||
{
|
||||
Print(GetToken() + ", " + GetTag() + ", Salam");
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
@@ -582,6 +953,7 @@ protected:
|
||||
private:
|
||||
//
|
||||
// Props ...
|
||||
int mNumberOfItems; // Number of Buffer Ites Read in Conditions ...
|
||||
|
||||
//
|
||||
// Tools ...
|
||||
|
||||
Reference in New Issue
Block a user