11119 lines
277 KiB
Plaintext
11119 lines
277 KiB
Plaintext
///////////////////////////////////////////////////////
|
|
//
|
|
// SaherElm IT Center MQL5 Class Library
|
|
// ----------------------------------------------
|
|
// Name: XSC121Provider
|
|
// Description: provides all Base Provider
|
|
// requirements For X121 ...
|
|
//
|
|
//
|
|
// 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.xcc.helper.mq5"
|
|
#include "../Helpers/x-saherelm.xct.helper.mq5"
|
|
#include "../Helpers/x-saherelm.xmc.helper.mq5"
|
|
#include "../Helpers/x-saherelm.xdon.helper.mq5"
|
|
#include "../Helpers/x-saherelm.xzg.helper.mq5"
|
|
#include "../Helpers/x-saherelm.xpv.helper.mq5"
|
|
#include "../Helpers/x-saherelm.xstr.helper.mq5"
|
|
#include "../Helpers/x-saherelm.xche.helper.mq5"
|
|
#include "../Helpers/x-saherelm.xosc.helper.mq5"
|
|
#include "../Helpers/x-saherelm.xtm.helper.mq5"
|
|
#include "../Helpers/x-saherelm.xama.helper.mq5"
|
|
#include "../Helpers/x-saherelm.xlh.helper.mq5"
|
|
#include "../Helpers/x-saherelm.xtd.helper.mq5"
|
|
#include "../Helpers/x-saherelm.xfi.helper.mq5"
|
|
#include "../Helpers/x-saherelm.xts.helper.mq5"
|
|
#include "../Helpers/x-saherelm.xrsi.helper.mq5"
|
|
#include "../Helpers/x-saherelm.xobd.helper.mq5"
|
|
#include "../Helpers/x-saherelm.xchlh.helper.mq5"
|
|
#include "../Helpers/x-saherelm.xchma.helper.mq5"
|
|
|
|
//
|
|
#include "../Classes/x-saherelm.xprovider.class.mq5"
|
|
#include "../Classes/x-saherelm.x121.xmcycle.class.mq5"
|
|
|
|
//
|
|
// Definitions ...
|
|
|
|
//
|
|
// Signallers ...
|
|
enum ENUM_X121_SIGNAL_PROVIDERS
|
|
{
|
|
//
|
|
PROVIDER_NONE,
|
|
XSP,
|
|
XTEST,
|
|
X786,
|
|
X121,
|
|
X110,
|
|
X92,
|
|
X128,
|
|
//
|
|
XTD,
|
|
XTAM,
|
|
XSI,
|
|
XTSFI,
|
|
XOBDLH,
|
|
XCHMACC,
|
|
XCHMAMN,
|
|
XCHMAMX,
|
|
};
|
|
|
|
//
|
|
// X121 Provider Inputs ...
|
|
class X121ProviderInputs : public XSCBaseProviderInpts
|
|
{
|
|
//
|
|
// Public ...
|
|
public:
|
|
//
|
|
// Props ...
|
|
|
|
//
|
|
string symbol;
|
|
ENUM_TIMEFRAMES period;
|
|
|
|
//
|
|
// S Market ...
|
|
ENUM_TIMEFRAMES sMarketPeriod; // Short Market Period
|
|
ENUM_X_PERIOD_METHOD sMarketMethod; // Short Market Period Method
|
|
string sMarketPrefix; // Short Market Prefix
|
|
|
|
//
|
|
// MEDIUM Market ...
|
|
ENUM_TIMEFRAMES mMarketPeriod; // Medium Market Period
|
|
ENUM_X_PERIOD_METHOD mMarketMethod; // Medium Market Period Method
|
|
string mMarketPrefix; // Medium Market Prefix
|
|
|
|
//
|
|
// LONG Market ...
|
|
ENUM_TIMEFRAMES lMarketPeriod; // Long Market Period
|
|
ENUM_X_PERIOD_METHOD lMarketMethod; // Long Market Period Method
|
|
string lMarketPrefix; // Long Market Prefix
|
|
|
|
//
|
|
// HIND Market ...
|
|
ENUM_TIMEFRAMES hMarketPeriod; // Hind Market Period
|
|
ENUM_X_PERIOD_METHOD hMarketMethod; // Hind Market Period Method
|
|
string hMarketPrefix; // Hind Market Prefix
|
|
|
|
//
|
|
// Indicators ...
|
|
XCCInputs ccInputs;
|
|
XCTInputs ctInputs;
|
|
XZGInputs zgInputs;
|
|
XPVInputs pvInputs;
|
|
XHKInputs hkInputs;
|
|
XMCInputs mcInputs;
|
|
XMRBInputs mrbInputs;
|
|
XICHInputs ichInputs;
|
|
XCHEInputs cheInputs;
|
|
XSTRInputs strInputs;
|
|
XDONInputs donInputs;
|
|
XOSCInputs oscInputs;
|
|
|
|
//
|
|
XTSInputs tsInputs;
|
|
XTMInputs tmInputs;
|
|
XLHInputs lhInputs;
|
|
XTDInputs tdInputs;
|
|
XFIInputs fiInputs;
|
|
XOBDInputs obdInputs;
|
|
XAMAInputs amaInputs;
|
|
XRSIInputs rsiInputs;
|
|
XCHLHInputs chlhInputs;
|
|
XCHMAInputs chmaInputs;
|
|
|
|
//
|
|
X121MCycleInputs cMarketInputs; // Curent Market Inputs
|
|
X121MCycleInputs sMarketInputs; // Short Market Inputs
|
|
X121MCycleInputs mMarketInputs; // Medium Market Inputs
|
|
X121MCycleInputs lMarketInputs; // Long Market Inputs
|
|
X121MCycleInputs hMarketInputs; // Hind Market Inputs
|
|
|
|
//
|
|
// Tools ...
|
|
|
|
//
|
|
// Initialize Input ...
|
|
bool Init()
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
// Validate Base Requirements ...
|
|
result =
|
|
//
|
|
IsSpecifiedValid(symbol) &&
|
|
IsSpecifiedValid(period) &&
|
|
IsSpecifiedValid(sMarketMethod, sMarketPeriod) &&
|
|
IsSpecifiedValid(mMarketMethod, mMarketPeriod) &&
|
|
IsSpecifiedValid(lMarketMethod, lMarketPeriod) &&
|
|
IsSpecifiedValid(hMarketMethod, hMarketPeriod)
|
|
//
|
|
;
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
if (!zgInputs.IsValid())
|
|
{
|
|
zgInputs.Default();
|
|
}
|
|
if (!pvInputs.IsValid())
|
|
{
|
|
pvInputs.Default();
|
|
}
|
|
if (!mcInputs.IsValid())
|
|
{
|
|
mcInputs.Default();
|
|
}
|
|
if (!hkInputs.IsValid())
|
|
{
|
|
hkInputs.Default();
|
|
}
|
|
if (!mrbInputs.IsValid())
|
|
{
|
|
mrbInputs.Default();
|
|
}
|
|
if (!cheInputs.IsValid())
|
|
{
|
|
cheInputs.Default();
|
|
}
|
|
if (!strInputs.IsValid())
|
|
{
|
|
strInputs.Default();
|
|
}
|
|
if (!donInputs.IsValid())
|
|
{
|
|
donInputs.Default();
|
|
}
|
|
if (!oscInputs.IsValid())
|
|
{
|
|
oscInputs.Default();
|
|
}
|
|
if (!ichInputs.IsValid())
|
|
{
|
|
ichInputs.Default();
|
|
}
|
|
|
|
//
|
|
if (!tsInputs.IsValid())
|
|
{
|
|
tsInputs.Default();
|
|
}
|
|
if (!tmInputs.IsValid())
|
|
{
|
|
tmInputs.Default();
|
|
}
|
|
if (!lhInputs.IsValid())
|
|
{
|
|
lhInputs.Default();
|
|
}
|
|
if (!tdInputs.IsValid())
|
|
{
|
|
tdInputs.Default();
|
|
}
|
|
if (!fiInputs.IsValid())
|
|
{
|
|
fiInputs.Default();
|
|
}
|
|
if (!obdInputs.IsValid())
|
|
{
|
|
obdInputs.Default();
|
|
}
|
|
if (!amaInputs.IsValid())
|
|
{
|
|
amaInputs.Default();
|
|
}
|
|
if (!rsiInputs.IsValid())
|
|
{
|
|
rsiInputs.Default();
|
|
}
|
|
if (!chlhInputs.IsValid())
|
|
{
|
|
chlhInputs.Default();
|
|
}
|
|
if (!chmaInputs.IsValid())
|
|
{
|
|
chmaInputs.Default();
|
|
}
|
|
|
|
//
|
|
// Initialize Market Inputs ...
|
|
|
|
//
|
|
// Current ...
|
|
cMarketInputs.pvInputs = this.pvInputs;
|
|
cMarketInputs.zgInputs = this.zgInputs;
|
|
cMarketInputs.mcInputs = this.mcInputs;
|
|
cMarketInputs.hkInputs = this.hkInputs;
|
|
cMarketInputs.mrbInputs = this.mrbInputs;
|
|
cMarketInputs.strInputs = this.strInputs;
|
|
cMarketInputs.oscInputs = this.oscInputs;
|
|
cMarketInputs.cheInputs = this.cheInputs;
|
|
cMarketInputs.ichInputs = this.ichInputs;
|
|
cMarketInputs.donInputs = this.donInputs;
|
|
result = cMarketInputs.Init(
|
|
this.symbol,
|
|
this.period,
|
|
X_MARKET_CYCLE_SHORT,
|
|
this.period,
|
|
X_PERIOD_MANUALLY,
|
|
"HOST",
|
|
false //
|
|
);
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Short ...
|
|
sMarketInputs.pvInputs = this.pvInputs;
|
|
sMarketInputs.zgInputs = this.zgInputs;
|
|
sMarketInputs.mcInputs = this.mcInputs;
|
|
sMarketInputs.hkInputs = this.hkInputs;
|
|
sMarketInputs.mrbInputs = this.mrbInputs;
|
|
sMarketInputs.strInputs = this.strInputs;
|
|
sMarketInputs.oscInputs = this.oscInputs;
|
|
sMarketInputs.cheInputs = this.cheInputs;
|
|
sMarketInputs.ichInputs = this.ichInputs;
|
|
sMarketInputs.donInputs = this.donInputs;
|
|
result = sMarketInputs.Init(
|
|
this.symbol,
|
|
this.period,
|
|
X_MARKET_CYCLE_SHORT,
|
|
this.sMarketPeriod,
|
|
this.sMarketMethod,
|
|
this.sMarketPrefix,
|
|
false //
|
|
);
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Medium ...
|
|
mMarketInputs.pvInputs = this.pvInputs;
|
|
mMarketInputs.zgInputs = this.zgInputs;
|
|
mMarketInputs.mcInputs = this.mcInputs;
|
|
mMarketInputs.hkInputs = this.hkInputs;
|
|
mMarketInputs.mrbInputs = this.mrbInputs;
|
|
mMarketInputs.strInputs = this.strInputs;
|
|
mMarketInputs.oscInputs = this.oscInputs;
|
|
mMarketInputs.cheInputs = this.cheInputs;
|
|
mMarketInputs.ichInputs = this.ichInputs;
|
|
mMarketInputs.donInputs = this.donInputs;
|
|
result = mMarketInputs.Init(
|
|
this.symbol,
|
|
this.period,
|
|
X_MARKET_CYCLE_MEDIUM,
|
|
this.mMarketPeriod,
|
|
this.mMarketMethod,
|
|
this.mMarketPrefix,
|
|
false //
|
|
);
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Long ...
|
|
lMarketInputs.pvInputs = this.pvInputs;
|
|
lMarketInputs.zgInputs = this.zgInputs;
|
|
lMarketInputs.mcInputs = this.mcInputs;
|
|
lMarketInputs.hkInputs = this.hkInputs;
|
|
lMarketInputs.mrbInputs = this.mrbInputs;
|
|
lMarketInputs.strInputs = this.strInputs;
|
|
lMarketInputs.oscInputs = this.oscInputs;
|
|
lMarketInputs.cheInputs = this.cheInputs;
|
|
lMarketInputs.ichInputs = this.ichInputs;
|
|
lMarketInputs.donInputs = this.donInputs;
|
|
result = lMarketInputs.Init(
|
|
this.symbol,
|
|
this.period,
|
|
X_MARKET_CYCLE_LONG,
|
|
this.lMarketPeriod,
|
|
this.lMarketMethod,
|
|
this.lMarketPrefix,
|
|
false //
|
|
);
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Hind ...
|
|
hMarketInputs.pvInputs = this.pvInputs;
|
|
hMarketInputs.zgInputs = this.zgInputs;
|
|
hMarketInputs.mcInputs = this.mcInputs;
|
|
hMarketInputs.hkInputs = this.hkInputs;
|
|
hMarketInputs.mrbInputs = this.mrbInputs;
|
|
hMarketInputs.strInputs = this.strInputs;
|
|
hMarketInputs.oscInputs = this.oscInputs;
|
|
hMarketInputs.cheInputs = this.cheInputs;
|
|
hMarketInputs.ichInputs = this.ichInputs;
|
|
hMarketInputs.donInputs = this.donInputs;
|
|
result = hMarketInputs.Init(
|
|
this.symbol,
|
|
this.period,
|
|
X_MARKET_CYCLE_HIND,
|
|
this.hMarketPeriod,
|
|
this.hMarketMethod,
|
|
this.hMarketPrefix,
|
|
false //
|
|
);
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
result = IsValid();
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Validate Input ...
|
|
bool IsValid() override
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
result =
|
|
//
|
|
//
|
|
IsSpecifiedValid(symbol) &&
|
|
IsSpecifiedValid(period) &&
|
|
IsSpecifiedValid(sMarketMethod, sMarketPeriod) &&
|
|
IsSpecifiedValid(mMarketMethod, mMarketPeriod) &&
|
|
IsSpecifiedValid(lMarketMethod, lMarketPeriod) &&
|
|
IsSpecifiedValid(hMarketMethod, hMarketPeriod) &&
|
|
//
|
|
ccInputs.IsValid() &&
|
|
ctInputs.IsValid() &&
|
|
zgInputs.IsValid() &&
|
|
pvInputs.IsValid() &&
|
|
mcInputs.IsValid() &&
|
|
hkInputs.IsValid() &&
|
|
mrbInputs.IsValid() &&
|
|
cheInputs.IsValid() &&
|
|
strInputs.IsValid() &&
|
|
donInputs.IsValid() &&
|
|
oscInputs.IsValid() &&
|
|
ichInputs.IsValid() &&
|
|
//
|
|
tsInputs.IsValid() &&
|
|
tmInputs.IsValid() &&
|
|
lhInputs.IsValid() &&
|
|
tdInputs.IsValid() &&
|
|
fiInputs.IsValid() &&
|
|
obdInputs.IsValid() &&
|
|
amaInputs.IsValid() &&
|
|
rsiInputs.IsValid() &&
|
|
chlhInputs.IsValid() &&
|
|
chmaInputs.IsValid() &&
|
|
//
|
|
cMarketInputs.IsValid() &&
|
|
sMarketInputs.IsValid() &&
|
|
mMarketInputs.IsValid() &&
|
|
lMarketInputs.IsValid() &&
|
|
hMarketInputs.IsValid()
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Cleanup ...
|
|
void Clean() override
|
|
{
|
|
//
|
|
symbol = NULL;
|
|
period = NULL;
|
|
|
|
//
|
|
sMarketPeriod = NULL;
|
|
sMarketMethod = X_PERIOD_NOTHING;
|
|
sMarketPrefix = NULL;
|
|
|
|
//
|
|
mMarketPeriod = NULL;
|
|
mMarketMethod = X_PERIOD_NOTHING;
|
|
mMarketPrefix = NULL;
|
|
|
|
//
|
|
lMarketPeriod = NULL;
|
|
lMarketMethod = X_PERIOD_NOTHING;
|
|
lMarketPrefix = NULL;
|
|
|
|
//
|
|
hMarketPeriod = NULL;
|
|
hMarketMethod = X_PERIOD_NOTHING;
|
|
hMarketPrefix = NULL;
|
|
|
|
//
|
|
ccInputs.Clean();
|
|
ctInputs.Clean();
|
|
zgInputs.Clean();
|
|
pvInputs.Clean();
|
|
mcInputs.Clean();
|
|
hkInputs.Clean();
|
|
mrbInputs.Clean();
|
|
cheInputs.Clean();
|
|
strInputs.Clean();
|
|
donInputs.Clean();
|
|
oscInputs.Clean();
|
|
ichInputs.Clean();
|
|
//
|
|
tsInputs.Clean();
|
|
tmInputs.Clean();
|
|
lhInputs.Clean();
|
|
tdInputs.Clean();
|
|
fiInputs.Clean();
|
|
obdInputs.Clean();
|
|
amaInputs.Clean();
|
|
rsiInputs.Clean();
|
|
chlhInputs.Clean();
|
|
chmaInputs.Clean();
|
|
//
|
|
cMarketInputs.Clean();
|
|
sMarketInputs.Clean();
|
|
mMarketInputs.Clean();
|
|
lMarketInputs.Clean();
|
|
hMarketInputs.Clean();
|
|
}
|
|
|
|
//
|
|
// Default ...
|
|
void Default() override
|
|
{
|
|
//
|
|
symbol = NULL;
|
|
period = NULL;
|
|
|
|
//
|
|
sMarketPeriod = NULL;
|
|
sMarketMethod = X_PERIOD_AUTO;
|
|
sMarketPrefix = NULL;
|
|
|
|
//
|
|
mMarketPeriod = NULL;
|
|
mMarketMethod = X_PERIOD_AUTO;
|
|
mMarketPrefix = NULL;
|
|
|
|
//
|
|
lMarketPeriod = NULL;
|
|
lMarketMethod = X_PERIOD_AUTO;
|
|
lMarketPrefix = NULL;
|
|
|
|
//
|
|
hMarketPeriod = NULL;
|
|
hMarketMethod = X_PERIOD_AUTO;
|
|
hMarketPrefix = NULL;
|
|
|
|
//
|
|
ccInputs.Default();
|
|
ctInputs.Default();
|
|
zgInputs.Default();
|
|
pvInputs.Default();
|
|
mcInputs.Default();
|
|
hkInputs.Default();
|
|
mrbInputs.Default();
|
|
cheInputs.Default();
|
|
strInputs.Default();
|
|
donInputs.Default();
|
|
oscInputs.Default();
|
|
ichInputs.Default();
|
|
tsInputs.Default();
|
|
tmInputs.Default();
|
|
lhInputs.Default();
|
|
tdInputs.Default();
|
|
fiInputs.Default();
|
|
obdInputs.Default();
|
|
amaInputs.Default();
|
|
rsiInputs.Default();
|
|
chlhInputs.Default();
|
|
chmaInputs.Default();
|
|
cMarketInputs.Default();
|
|
sMarketInputs.Default();
|
|
mMarketInputs.Default();
|
|
lMarketInputs.Default();
|
|
hMarketInputs.Default();
|
|
}
|
|
|
|
//
|
|
// Max ...
|
|
int Max() override
|
|
{
|
|
//
|
|
int result = 0;
|
|
|
|
//
|
|
result = MathMax(lhInputs.Max(), tmInputs.Max());
|
|
|
|
//
|
|
result = MathMax(result, tsInputs.Max());
|
|
result = MathMax(result, ctInputs.Max());
|
|
result = MathMax(result, ccInputs.Max());
|
|
result = MathMax(result, tdInputs.Max());
|
|
result = MathMax(result, fiInputs.Max());
|
|
result = MathMax(result, obdInputs.Max());
|
|
result = MathMax(result, amaInputs.Max());
|
|
result = MathMax(result, rsiInputs.Max());
|
|
result = MathMax(result, chlhInputs.Max());
|
|
result = MathMax(result, chmaInputs.Max());
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Set Symbol ...
|
|
bool SetSymbol(string value)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
result = IsSpecifiedValid(value);
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
symbol = value;
|
|
cMarketInputs.cycle.symbol = value;
|
|
sMarketInputs.cycle.symbol = value;
|
|
mMarketInputs.cycle.symbol = value;
|
|
lMarketInputs.cycle.symbol = value;
|
|
hMarketInputs.cycle.symbol = value;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Set Period ...
|
|
bool SetPeriod(ENUM_TIMEFRAMES value)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
result = IsSpecifiedValid(value);
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
period = value;
|
|
cMarketInputs.cycle.period = value;
|
|
sMarketInputs.cycle.period = value;
|
|
mMarketInputs.cycle.period = value;
|
|
lMarketInputs.cycle.period = value;
|
|
hMarketInputs.cycle.period = value;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
};
|
|
|
|
//
|
|
// X121 Provider Market Conditions ...
|
|
class X121MarketConditions : public XSCBaseProviderMarketConditions
|
|
{
|
|
//
|
|
// Public ...
|
|
public:
|
|
//
|
|
|
|
//
|
|
// 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[];
|
|
|
|
//
|
|
// Conditional Variables ...
|
|
|
|
//
|
|
// XTM ...
|
|
bool isXTMPeak;
|
|
bool isXTMVale;
|
|
bool isXTMBullish;
|
|
bool isXTMBearish;
|
|
bool isXTMNeutural;
|
|
bool isXTMEndBullish;
|
|
bool isXTMEndBearish;
|
|
bool isXTMStartBullish;
|
|
bool isXTMStartBearish;
|
|
bool isXTMEndBullishByNeutural;
|
|
bool isXTMEndBearishByNeutural;
|
|
bool isXTMStartBullishAfterNeutural;
|
|
bool isXTMStartBearishAfterNeutural;
|
|
|
|
//
|
|
// XAMA ...
|
|
bool isXAMAPeak;
|
|
bool isXAMAVale;
|
|
bool isXAMABullish;
|
|
bool isXAMABearish;
|
|
bool isXAMANeutural;
|
|
bool isXAMAEndBullish;
|
|
bool isXAMAEndBearish;
|
|
bool isXAMAStartBullish;
|
|
bool isXAMAStartBearish;
|
|
bool isXAMAEndBullishByNeutural;
|
|
bool isXAMAEndBearishByNeutural;
|
|
bool isXAMAStartBullishAfterNeutural;
|
|
bool isXAMAStartBearishAfterNeutural;
|
|
|
|
//
|
|
// XLH ...
|
|
bool isXLHHHIncreased;
|
|
bool isXLHHHDecreased;
|
|
bool isXLHLLIncreased;
|
|
bool isXLHLLDecreased;
|
|
bool isXLHLowAttachedLL;
|
|
bool isXLHHighAttachedHH;
|
|
bool isXLHHHSameInLength;
|
|
bool isXLHLLSameInLength;
|
|
bool isXLHPriceOverSignal;
|
|
bool isXLHPriceUnderSignal;
|
|
bool isXLHPriceInSignalRange;
|
|
bool isXLHPriceCrossedOverSignal;
|
|
bool isXLHPriceCrossedUnderSignal;
|
|
|
|
//
|
|
// XTD ...
|
|
bool isXTDSignalPeak;
|
|
bool isXTDSignalVale;
|
|
bool isXTDBullishPeak;
|
|
bool isXTDBullishVale;
|
|
bool isXTDBearishPeak;
|
|
bool isXTDBearishVale;
|
|
bool isXTDBullOverBear;
|
|
bool isXTDBullUnderBear;
|
|
bool isXTDSignalOverBear;
|
|
bool isXTDSignalUnderBear;
|
|
bool isXTDBullCrossedOverBear;
|
|
bool isXTDBullCrossedUnderBear;
|
|
bool isXTDSignalCrossedOverBear;
|
|
bool isXTDSignalCrossedUnderBear;
|
|
|
|
//
|
|
// XFI ...
|
|
bool isXFIPeak;
|
|
bool isXFIVale;
|
|
bool isXFICrossedOverZero;
|
|
bool isXFIOverZero;
|
|
bool isXFICrossedUnderZero;
|
|
bool isXFIUnderZero;
|
|
|
|
//
|
|
// XTS ...
|
|
bool isXTSAllSame;
|
|
bool isXTSCurrentMin;
|
|
bool isXTSCurrentMax;
|
|
bool isXTSCurrentOverFarest;
|
|
bool isXTSCurrentOverNearest;
|
|
bool isXTSCurrentOverMediest;
|
|
bool isXTSCurrentUnderFarest;
|
|
bool isXTSCurrentUnderNearest;
|
|
bool isXTSCurrentUnderMediest;
|
|
bool isXTSCurrentCrossedOverFarest;
|
|
bool isXTSCurrentCrossedOverNearest;
|
|
bool isXTSCurrentCrossedOverMediest;
|
|
bool isXTSCurrentCrossedUnderFarest;
|
|
bool isXTSCurrentCrossedUnderNearest;
|
|
bool isXTSCurrentCrossedUnderMediest;
|
|
|
|
//
|
|
// XRSI ...
|
|
bool isXRSIPeak;
|
|
bool isXRSIVale;
|
|
bool isXRSICrossedOverLongExit;
|
|
bool isXRSICrossedOverLongEntry;
|
|
bool isXRSICrossedUnderShortExit;
|
|
bool isXRSICrossedUnderShortEntry;
|
|
|
|
//
|
|
// XOBD ...
|
|
bool isXOBDSwingLow;
|
|
bool isXOBDSwingHigh;
|
|
|
|
//
|
|
// XCHLH ...
|
|
//
|
|
bool isXCHLHSameHHs;
|
|
bool isXCHLHSameLLs;
|
|
//
|
|
bool isXCHLHSCMCHHSame;
|
|
bool isXCHLHSCMCLLSame;
|
|
//
|
|
bool isXCHLHSCLCHHSame;
|
|
bool isXCHLHSCLCLLSame;
|
|
//
|
|
bool isXCHLHMCLCHHSame;
|
|
bool isXCHLHMCLCLLSame;
|
|
//
|
|
bool isXCHLHMCOnTopOfLC;
|
|
bool isXCHLHMCInBottomOfLC;
|
|
|
|
//
|
|
// XCHMA ...
|
|
//
|
|
bool isXCHMASCOverMax;
|
|
bool isXCHMASCOverMin;
|
|
bool isXCHMASCUnderMax;
|
|
bool isXCHMASCUnderMin;
|
|
//
|
|
bool isXCHMASCCrossedOverMax;
|
|
bool isXCHMASCCrossedUnderMax;
|
|
bool isXCHMASCCrossedOverMin;
|
|
bool isXCHMASCCrossedUnderMin;
|
|
//
|
|
bool isXCHMASCPeak;
|
|
bool isXCHMASCVale;
|
|
bool isXCHMASCTrendsUp;
|
|
bool isXCHMASCTrendsDown;
|
|
bool isXCHMASCFastOverSlow;
|
|
bool isXCHMASCFastUnderSlow;
|
|
bool isXCHMASCFastCrossedOverSlow;
|
|
bool isXCHMASCFastCrossedUnderSlow;
|
|
//
|
|
bool isXCHMAMCPeak;
|
|
bool isXCHMAMCVale;
|
|
bool isXCHMAMCTrendsUp;
|
|
bool isXCHMAMCTrendsDown;
|
|
bool isXCHMAMCFastOverSlow;
|
|
bool isXCHMAMCFastUnderSlow;
|
|
bool isXCHMAMCFastCrossedOverSlow;
|
|
bool isXCHMAMCFastCrossedUnderSlow;
|
|
//
|
|
bool isXCHMALCPeak;
|
|
bool isXCHMALCVale;
|
|
bool isXCHMALCTrendsUp;
|
|
bool isXCHMALCTrendsDown;
|
|
bool isXCHMALCFastOverSlow;
|
|
bool isXCHMALCFastUnderSlow;
|
|
bool isXCHMALCFastCrossedOverSlow;
|
|
bool isXCHMALCFastCrossedUnderSlow;
|
|
|
|
//
|
|
X121MCycleConditions cMarketConditions; // Current Market Conditions
|
|
X121MCycleConditions sMarketConditions; // Short Market Conditions
|
|
X121MCycleConditions mMarketConditions; // Medium Market Conditions
|
|
X121MCycleConditions lMarketConditions; // Long Market Conditions
|
|
X121MCycleConditions hMarketConditions; // Hind Market Conditions
|
|
|
|
//
|
|
// Tools ...
|
|
|
|
//
|
|
// Cleanup ...
|
|
void Clear()
|
|
{
|
|
//
|
|
symbol = NULL;
|
|
period = NULL;
|
|
|
|
//
|
|
Clean(bars);
|
|
|
|
//
|
|
ArraySetAsSeries(bars, true);
|
|
|
|
//
|
|
cMarketConditions.Clear();
|
|
sMarketConditions.Clear();
|
|
mMarketConditions.Clear();
|
|
lMarketConditions.Clear();
|
|
hMarketConditions.Clear();
|
|
}
|
|
|
|
//
|
|
void GenerateScore(
|
|
double &bullishScore, // Bullish Score
|
|
double &bearishScore, // Bearish Score
|
|
double cMarketMultiplier = 1, // Current Market Score Multiplier
|
|
double sMarketMultiplier = 1.1, // Short Market Score Multiplier
|
|
double mMarketMultiplier = 1.2, // Medium Market Score Multiplier
|
|
double lMarketMultiplier = 1.6, // Long Market Score Multiplier
|
|
double hMarketMultiplier = 1.8 // Hind Market Score Multiplier
|
|
)
|
|
{
|
|
//
|
|
double bullScore = 0;
|
|
double bearScore = 0;
|
|
|
|
//
|
|
// XTM ...
|
|
|
|
//
|
|
if (isXTMPeak)
|
|
{
|
|
//
|
|
bullScore--;
|
|
bearScore++;
|
|
}
|
|
|
|
//
|
|
if (isXTMVale)
|
|
{
|
|
//
|
|
bullScore++;
|
|
bearScore--;
|
|
}
|
|
|
|
//
|
|
if (isXTMBullish)
|
|
{
|
|
bullScore++;
|
|
}
|
|
|
|
//
|
|
if (isXTMBearish)
|
|
{
|
|
bearScore++;
|
|
}
|
|
|
|
//
|
|
if (isXTMNeutural)
|
|
{
|
|
}
|
|
|
|
//
|
|
if (isXTMEndBullish)
|
|
{
|
|
bearScore++;
|
|
}
|
|
|
|
//
|
|
if (isXTMEndBearish)
|
|
{
|
|
bullScore++;
|
|
}
|
|
|
|
//
|
|
if (isXTMStartBullish)
|
|
{
|
|
bullScore++;
|
|
}
|
|
|
|
//
|
|
if (isXTMStartBearish)
|
|
{
|
|
bearScore++;
|
|
}
|
|
|
|
//
|
|
if (isXTMEndBullishByNeutural)
|
|
{
|
|
bearScore++;
|
|
}
|
|
|
|
//
|
|
if (isXTMEndBearishByNeutural)
|
|
{
|
|
bullScore++;
|
|
}
|
|
|
|
//
|
|
if (isXTMStartBullishAfterNeutural)
|
|
{
|
|
bullScore++;
|
|
}
|
|
|
|
//
|
|
if (isXTMStartBearishAfterNeutural)
|
|
{
|
|
bearScore++;
|
|
}
|
|
|
|
//
|
|
// XAMA ...
|
|
|
|
//
|
|
if (isXAMAPeak)
|
|
{
|
|
//
|
|
bullScore--;
|
|
bearScore++;
|
|
}
|
|
|
|
//
|
|
if (isXAMAVale)
|
|
{
|
|
//
|
|
bullScore++;
|
|
bearScore--;
|
|
}
|
|
|
|
//
|
|
if (isXAMABullish)
|
|
{
|
|
bullScore++;
|
|
}
|
|
|
|
//
|
|
if (isXAMABearish)
|
|
{
|
|
bearScore++;
|
|
}
|
|
|
|
//
|
|
if (isXAMANeutural)
|
|
{
|
|
}
|
|
|
|
//
|
|
if (isXAMAEndBullish)
|
|
{
|
|
bearScore++;
|
|
}
|
|
|
|
//
|
|
if (isXAMAEndBearish)
|
|
{
|
|
bullScore++;
|
|
}
|
|
|
|
//
|
|
if (isXAMAStartBullish)
|
|
{
|
|
bullScore++;
|
|
}
|
|
|
|
//
|
|
if (isXAMAStartBearish)
|
|
{
|
|
bearScore++;
|
|
}
|
|
|
|
//
|
|
if (isXAMAEndBullishByNeutural)
|
|
{
|
|
bearScore++;
|
|
}
|
|
|
|
//
|
|
if (isXAMAEndBearishByNeutural)
|
|
{
|
|
bullScore++;
|
|
}
|
|
|
|
//
|
|
if (isXAMAStartBullishAfterNeutural)
|
|
{
|
|
bullScore++;
|
|
}
|
|
|
|
//
|
|
if (isXAMAStartBearishAfterNeutural)
|
|
{
|
|
bearScore++;
|
|
}
|
|
|
|
//
|
|
// XLH ...
|
|
|
|
//
|
|
if (isXLHHHIncreased)
|
|
{
|
|
//
|
|
bullScore--;
|
|
bearScore++;
|
|
}
|
|
|
|
//
|
|
if (isXLHHHDecreased)
|
|
{
|
|
//
|
|
bullScore++;
|
|
bearScore--;
|
|
}
|
|
|
|
//
|
|
if (isXLHLLIncreased)
|
|
{
|
|
//
|
|
bullScore++;
|
|
bearScore--;
|
|
}
|
|
|
|
//
|
|
if (isXLHLLDecreased)
|
|
{
|
|
//
|
|
bullScore--;
|
|
bearScore++;
|
|
}
|
|
|
|
//
|
|
if (isXLHLowAttachedLL)
|
|
{
|
|
//
|
|
bullScore++;
|
|
bearScore--;
|
|
}
|
|
|
|
//
|
|
if (isXLHHighAttachedHH)
|
|
{
|
|
//
|
|
bullScore--;
|
|
bearScore++;
|
|
}
|
|
|
|
//
|
|
if (isXLHHHSameInLength)
|
|
{
|
|
}
|
|
|
|
//
|
|
if (isXLHLLSameInLength)
|
|
{
|
|
}
|
|
|
|
//
|
|
if (isXLHPriceOverSignal)
|
|
{
|
|
bullScore++;
|
|
}
|
|
|
|
//
|
|
if (isXLHPriceUnderSignal)
|
|
{
|
|
bearScore++;
|
|
}
|
|
|
|
//
|
|
if (isXLHPriceInSignalRange)
|
|
{
|
|
}
|
|
|
|
//
|
|
if (isXLHPriceCrossedOverSignal)
|
|
{
|
|
//
|
|
bullScore++;
|
|
bearScore--;
|
|
}
|
|
|
|
//
|
|
if (isXLHPriceCrossedUnderSignal)
|
|
{
|
|
//
|
|
bullScore--;
|
|
bearScore++;
|
|
}
|
|
|
|
//
|
|
// XTD ...
|
|
|
|
//
|
|
if (isXTDSignalPeak)
|
|
{
|
|
//
|
|
bullScore--;
|
|
bearScore++;
|
|
}
|
|
|
|
//
|
|
if (isXTDSignalVale)
|
|
{
|
|
//
|
|
bullScore++;
|
|
bearScore--;
|
|
}
|
|
|
|
//
|
|
if (isXTDBullishPeak)
|
|
{
|
|
//
|
|
bullScore--;
|
|
bearScore++;
|
|
}
|
|
|
|
//
|
|
if (isXTDBullishVale)
|
|
{
|
|
//
|
|
bullScore++;
|
|
bearScore--;
|
|
}
|
|
|
|
//
|
|
if (isXTDBearishPeak)
|
|
{
|
|
//
|
|
bullScore++;
|
|
bearScore--;
|
|
}
|
|
|
|
//
|
|
if (isXTDBearishVale)
|
|
{
|
|
//
|
|
bullScore--;
|
|
bearScore++;
|
|
}
|
|
|
|
//
|
|
if (isXTDBullOverBear)
|
|
{
|
|
bullScore++;
|
|
}
|
|
|
|
//
|
|
if (isXTDBullUnderBear)
|
|
{
|
|
bearScore++;
|
|
}
|
|
|
|
//
|
|
if (isXTDSignalOverBear)
|
|
{
|
|
bullScore++;
|
|
}
|
|
|
|
//
|
|
if (isXTDSignalUnderBear)
|
|
{
|
|
bearScore++;
|
|
}
|
|
|
|
//
|
|
if (isXTDBullCrossedOverBear)
|
|
{
|
|
//
|
|
bullScore++;
|
|
bearScore--;
|
|
}
|
|
|
|
//
|
|
if (isXTDBullCrossedUnderBear)
|
|
{
|
|
//
|
|
bullScore--;
|
|
bearScore++;
|
|
}
|
|
|
|
//
|
|
if (isXTDSignalCrossedOverBear)
|
|
{
|
|
//
|
|
bullScore++;
|
|
bearScore--;
|
|
}
|
|
|
|
//
|
|
if (isXTDSignalCrossedUnderBear)
|
|
{
|
|
//
|
|
bullScore--;
|
|
bearScore++;
|
|
}
|
|
|
|
//
|
|
// XFI ...
|
|
|
|
//
|
|
if (isXFIPeak)
|
|
{
|
|
//
|
|
bullScore--;
|
|
bearScore++;
|
|
}
|
|
|
|
//
|
|
if (isXFIVale)
|
|
{
|
|
//
|
|
bullScore++;
|
|
bearScore--;
|
|
}
|
|
|
|
//
|
|
if (isXFICrossedOverZero)
|
|
{
|
|
//
|
|
bullScore++;
|
|
bearScore--;
|
|
}
|
|
|
|
//
|
|
if (isXFIOverZero)
|
|
{
|
|
bullScore++;
|
|
}
|
|
|
|
//
|
|
if (isXFICrossedUnderZero)
|
|
{
|
|
//
|
|
bullScore--;
|
|
bearScore++;
|
|
}
|
|
|
|
//
|
|
if (isXFIUnderZero)
|
|
{
|
|
bearScore++;
|
|
}
|
|
|
|
//
|
|
// XTS ...
|
|
|
|
//
|
|
if (isXTSAllSame)
|
|
{
|
|
}
|
|
|
|
//
|
|
if (isXTSCurrentMin)
|
|
{
|
|
//
|
|
bullScore++;
|
|
bearScore--;
|
|
}
|
|
|
|
//
|
|
if (isXTSCurrentMax)
|
|
{
|
|
//
|
|
bullScore--;
|
|
bearScore++;
|
|
}
|
|
|
|
//
|
|
if (isXTSCurrentOverFarest)
|
|
{
|
|
bullScore--;
|
|
}
|
|
|
|
//
|
|
if (isXTSCurrentOverNearest)
|
|
{
|
|
bullScore--;
|
|
}
|
|
|
|
//
|
|
if (isXTSCurrentOverMediest)
|
|
{
|
|
bullScore--;
|
|
}
|
|
|
|
//
|
|
if (isXTSCurrentUnderFarest)
|
|
{
|
|
bearScore--;
|
|
}
|
|
|
|
//
|
|
if (isXTSCurrentUnderNearest)
|
|
{
|
|
bearScore--;
|
|
}
|
|
|
|
//
|
|
if (isXTSCurrentUnderMediest)
|
|
{
|
|
bearScore--;
|
|
}
|
|
|
|
//
|
|
if (isXTSCurrentCrossedOverFarest)
|
|
{
|
|
//
|
|
bullScore++;
|
|
bearScore--;
|
|
}
|
|
|
|
//
|
|
if (isXTSCurrentCrossedOverNearest)
|
|
{
|
|
//
|
|
bullScore++;
|
|
bearScore--;
|
|
}
|
|
|
|
//
|
|
if (isXTSCurrentCrossedOverMediest)
|
|
{
|
|
//
|
|
bullScore++;
|
|
bearScore--;
|
|
}
|
|
|
|
//
|
|
if (isXTSCurrentCrossedUnderFarest)
|
|
{
|
|
//
|
|
bullScore--;
|
|
bearScore++;
|
|
}
|
|
|
|
//
|
|
if (isXTSCurrentCrossedUnderNearest)
|
|
{
|
|
//
|
|
bullScore--;
|
|
bearScore++;
|
|
}
|
|
|
|
//
|
|
if (isXTSCurrentCrossedUnderMediest)
|
|
{
|
|
//
|
|
bullScore--;
|
|
bearScore++;
|
|
}
|
|
|
|
//
|
|
// XSI ...
|
|
|
|
//
|
|
if (isXRSIPeak)
|
|
{
|
|
//
|
|
bullScore--;
|
|
bearScore++;
|
|
}
|
|
|
|
//
|
|
if (isXRSIVale)
|
|
{
|
|
//
|
|
bullScore++;
|
|
bearScore--;
|
|
}
|
|
|
|
//
|
|
if (isXRSICrossedOverLongExit)
|
|
{
|
|
//
|
|
bullScore--;
|
|
bearScore++;
|
|
}
|
|
|
|
//
|
|
if (isXRSICrossedOverLongEntry)
|
|
{
|
|
//
|
|
bullScore++;
|
|
bearScore--;
|
|
}
|
|
|
|
//
|
|
if (isXRSICrossedUnderShortExit)
|
|
{
|
|
//
|
|
bullScore++;
|
|
bearScore--;
|
|
}
|
|
|
|
//
|
|
if (isXRSICrossedUnderShortEntry)
|
|
{
|
|
//
|
|
bullScore--;
|
|
bearScore++;
|
|
}
|
|
|
|
//
|
|
// XOBD ...
|
|
|
|
//
|
|
if (isXOBDSwingLow)
|
|
{
|
|
bullScore++;
|
|
}
|
|
|
|
//
|
|
if (isXOBDSwingHigh)
|
|
{
|
|
bearScore++;
|
|
}
|
|
|
|
//
|
|
// XCHLH ...
|
|
|
|
//
|
|
if (isXCHLHSameHHs)
|
|
{
|
|
bearScore++;
|
|
}
|
|
|
|
//
|
|
if (isXCHLHSameLLs)
|
|
{
|
|
bullScore++;
|
|
}
|
|
|
|
//
|
|
if (isXCHLHSCMCHHSame)
|
|
{
|
|
bearScore++;
|
|
}
|
|
|
|
//
|
|
if (isXCHLHSCMCLLSame)
|
|
{
|
|
bullScore++;
|
|
}
|
|
|
|
//
|
|
if (isXCHLHSCLCHHSame)
|
|
{
|
|
bearScore++;
|
|
}
|
|
|
|
//
|
|
if (isXCHLHSCLCLLSame)
|
|
{
|
|
bullScore++;
|
|
}
|
|
|
|
//
|
|
if (isXCHLHMCLCHHSame)
|
|
{
|
|
bearScore++;
|
|
}
|
|
|
|
//
|
|
if (isXCHLHMCLCLLSame)
|
|
{
|
|
bullScore++;
|
|
}
|
|
|
|
//
|
|
if (isXCHLHMCOnTopOfLC)
|
|
{
|
|
}
|
|
|
|
//
|
|
if (isXCHLHMCInBottomOfLC)
|
|
{
|
|
}
|
|
|
|
//
|
|
// XCHMA ...
|
|
|
|
//
|
|
if (isXCHMASCOverMax)
|
|
{
|
|
//
|
|
bullScore--;
|
|
bearScore++;
|
|
}
|
|
|
|
//
|
|
if (isXCHMASCOverMin)
|
|
{
|
|
//
|
|
bullScore++;
|
|
bearScore--;
|
|
}
|
|
|
|
//
|
|
if (isXCHMASCUnderMax)
|
|
{
|
|
//
|
|
bullScore--;
|
|
bearScore++;
|
|
}
|
|
|
|
//
|
|
if (isXCHMASCUnderMin)
|
|
{
|
|
//
|
|
bullScore++;
|
|
bearScore--;
|
|
}
|
|
|
|
//
|
|
if (isXCHMASCCrossedOverMax)
|
|
{
|
|
//
|
|
bearScore--;
|
|
bearScore++;
|
|
}
|
|
|
|
//
|
|
if (isXCHMASCCrossedUnderMax)
|
|
{
|
|
//
|
|
bullScore--;
|
|
bearScore++;
|
|
}
|
|
|
|
//
|
|
if (isXCHMASCCrossedOverMin)
|
|
{
|
|
//
|
|
bullScore++;
|
|
bearScore--;
|
|
}
|
|
|
|
//
|
|
if (isXCHMASCCrossedUnderMin)
|
|
{
|
|
//
|
|
bullScore++;
|
|
bearScore--;
|
|
}
|
|
|
|
//
|
|
if (isXCHMASCPeak)
|
|
{
|
|
//
|
|
bullScore--;
|
|
bearScore++;
|
|
}
|
|
|
|
//
|
|
if (isXCHMASCVale)
|
|
{
|
|
//
|
|
bullScore++;
|
|
bearScore--;
|
|
}
|
|
|
|
//
|
|
if (isXCHMASCTrendsUp)
|
|
{
|
|
//
|
|
if (isXCHMASCFastOverSlow)
|
|
{
|
|
//
|
|
bullScore++;
|
|
bearScore--;
|
|
}
|
|
|
|
//
|
|
if (isXCHMASCFastUnderSlow)
|
|
{
|
|
//
|
|
bullScore--;
|
|
bearScore++;
|
|
}
|
|
}
|
|
|
|
//
|
|
if (isXCHMASCTrendsDown)
|
|
{
|
|
//
|
|
if (isXCHMASCFastOverSlow)
|
|
{
|
|
//
|
|
bullScore--;
|
|
bearScore++;
|
|
}
|
|
|
|
//
|
|
if (isXCHMASCFastUnderSlow)
|
|
{
|
|
//
|
|
bullScore++;
|
|
bearScore--;
|
|
}
|
|
}
|
|
|
|
//
|
|
if (isXCHMASCFastOverSlow)
|
|
{
|
|
bearScore++;
|
|
}
|
|
|
|
//
|
|
if (isXCHMASCFastUnderSlow)
|
|
{
|
|
bearScore++;
|
|
}
|
|
|
|
//
|
|
if (isXCHMASCFastCrossedOverSlow)
|
|
{
|
|
//
|
|
bullScore++;
|
|
bearScore--;
|
|
}
|
|
|
|
//
|
|
if (isXCHMASCFastCrossedUnderSlow)
|
|
{
|
|
//
|
|
bullScore--;
|
|
bearScore++;
|
|
}
|
|
|
|
//
|
|
if (isXCHMAMCPeak)
|
|
{
|
|
//
|
|
bullScore--;
|
|
bearScore++;
|
|
}
|
|
|
|
//
|
|
if (isXCHMAMCVale)
|
|
{
|
|
//
|
|
bullScore++;
|
|
bearScore--;
|
|
}
|
|
|
|
//
|
|
if (isXCHMAMCTrendsUp)
|
|
{
|
|
//
|
|
if (isXCHMAMCFastOverSlow)
|
|
{
|
|
//
|
|
bullScore++;
|
|
bearScore--;
|
|
}
|
|
|
|
//
|
|
if (isXCHMAMCFastUnderSlow)
|
|
{
|
|
//
|
|
bullScore--;
|
|
bearScore++;
|
|
}
|
|
}
|
|
|
|
//
|
|
if (isXCHMAMCTrendsDown)
|
|
{
|
|
//
|
|
if (isXCHMAMCFastOverSlow)
|
|
{
|
|
//
|
|
bullScore--;
|
|
bearScore++;
|
|
}
|
|
|
|
//
|
|
if (isXCHMAMCFastUnderSlow)
|
|
{
|
|
//
|
|
bullScore++;
|
|
bearScore--;
|
|
}
|
|
}
|
|
|
|
//
|
|
if (isXCHMAMCFastOverSlow)
|
|
{
|
|
bullScore++;
|
|
}
|
|
|
|
//
|
|
if (isXCHMAMCFastUnderSlow)
|
|
{
|
|
bearScore++;
|
|
}
|
|
|
|
//
|
|
if (isXCHMAMCFastCrossedOverSlow)
|
|
{
|
|
//
|
|
bullScore++;
|
|
bearScore--;
|
|
}
|
|
|
|
//
|
|
if (isXCHMAMCFastCrossedUnderSlow)
|
|
{
|
|
//
|
|
bullScore--;
|
|
bearScore++;
|
|
}
|
|
|
|
//
|
|
if (isXCHMALCPeak)
|
|
{
|
|
//
|
|
bullScore--;
|
|
bearScore++;
|
|
}
|
|
|
|
//
|
|
if (isXCHMALCVale)
|
|
{
|
|
//
|
|
bullScore++;
|
|
bearScore--;
|
|
}
|
|
|
|
//
|
|
if (isXCHMALCTrendsUp)
|
|
{
|
|
//
|
|
if (isXCHMALCFastOverSlow)
|
|
{
|
|
//
|
|
bullScore++;
|
|
bearScore--;
|
|
}
|
|
|
|
//
|
|
if (isXCHMALCFastUnderSlow)
|
|
{
|
|
//
|
|
bullScore--;
|
|
bearScore++;
|
|
}
|
|
}
|
|
|
|
//
|
|
if (isXCHMALCTrendsDown)
|
|
{
|
|
//
|
|
if (isXCHMALCFastOverSlow)
|
|
{
|
|
//
|
|
bullScore--;
|
|
bearScore++;
|
|
}
|
|
|
|
//
|
|
if (isXCHMALCFastUnderSlow)
|
|
{
|
|
//
|
|
bullScore++;
|
|
bearScore--;
|
|
}
|
|
}
|
|
|
|
//
|
|
if (isXCHMALCFastOverSlow)
|
|
{
|
|
bullScore++;
|
|
}
|
|
|
|
//
|
|
if (isXCHMALCFastUnderSlow)
|
|
{
|
|
bearScore++;
|
|
}
|
|
|
|
//
|
|
if (isXCHMALCFastCrossedOverSlow)
|
|
{
|
|
//
|
|
bullScore++;
|
|
bearScore--;
|
|
}
|
|
|
|
//
|
|
if (isXCHMALCFastCrossedUnderSlow)
|
|
{
|
|
//
|
|
bullScore--;
|
|
bearScore++;
|
|
}
|
|
|
|
//
|
|
// Current Market ...
|
|
double cMarketBullScore = 0;
|
|
double cMarketBearScore = 0;
|
|
cMarketConditions.GenerateScore(
|
|
cMarketBullScore,
|
|
cMarketBearScore,
|
|
cMarketMultiplier //
|
|
);
|
|
|
|
//
|
|
// Short Market ...
|
|
double sMarketBullScore = 0;
|
|
double sMarketBearScore = 0;
|
|
sMarketConditions.GenerateScore(
|
|
sMarketBullScore,
|
|
sMarketBearScore,
|
|
sMarketMultiplier //
|
|
);
|
|
|
|
//
|
|
// Medium Market ...
|
|
double mMarketBullScore = 0;
|
|
double mMarketBearScore = 0;
|
|
mMarketConditions.GenerateScore(
|
|
mMarketBullScore,
|
|
mMarketBearScore,
|
|
mMarketMultiplier //
|
|
);
|
|
|
|
//
|
|
// Long Market ...
|
|
double lMarketBullScore = 0;
|
|
double lMarketBearScore = 0;
|
|
lMarketConditions.GenerateScore(
|
|
lMarketBullScore,
|
|
lMarketBearScore,
|
|
lMarketMultiplier //
|
|
);
|
|
|
|
//
|
|
// Hind Market ...
|
|
double hMarketBullScore = 0;
|
|
double hMarketBearScore = 0;
|
|
hMarketConditions.GenerateScore(
|
|
hMarketBullScore,
|
|
hMarketBearScore,
|
|
hMarketMultiplier //
|
|
);
|
|
|
|
//
|
|
// Calculate Summary Scores ...
|
|
|
|
//
|
|
bullishScore =
|
|
//
|
|
bullScore +
|
|
cMarketBullScore +
|
|
sMarketBullScore +
|
|
mMarketBullScore +
|
|
lMarketBullScore +
|
|
hMarketBullScore
|
|
//
|
|
;
|
|
|
|
//
|
|
bearishScore =
|
|
//
|
|
bearScore +
|
|
cMarketBearScore +
|
|
sMarketBearScore +
|
|
mMarketBearScore +
|
|
lMarketBearScore +
|
|
hMarketBearScore
|
|
//
|
|
;
|
|
}
|
|
|
|
//
|
|
virtual string GenerateSummary(
|
|
const bool onlySummary = false, // Only Generate Conditions Summary
|
|
double cMarketMultiplier = 1, // Current Market Score Multiplier
|
|
double sMarketMultiplier = 1.1, // Short Market Score Multiplier
|
|
double mMarketMultiplier = 1.2, // Medium Market Score Multiplier
|
|
double lMarketMultiplier = 1.6, // Long Market Score Multiplier
|
|
double hMarketMultiplier = 1.8, // Hind Market Score Multiplier
|
|
const string separator = "\n", // Separator
|
|
string provided = NULL, // Additional Info about Type, Provider and Symbol
|
|
const bool ignoreFalseConditions = true // Ignore False Conditions
|
|
)
|
|
{
|
|
//
|
|
string result = NULL;
|
|
|
|
//
|
|
double bullScore = 0;
|
|
double bearScore = 0;
|
|
GenerateScore(
|
|
bullScore,
|
|
bearScore,
|
|
cMarketMultiplier,
|
|
sMarketMultiplier,
|
|
mMarketMultiplier,
|
|
lMarketMultiplier,
|
|
hMarketMultiplier //
|
|
);
|
|
|
|
//
|
|
string commonStr =
|
|
//
|
|
"Commons: " + separator +
|
|
"-----------------------------" + separator +
|
|
"Symbol: " + symbol + separator +
|
|
"Period: " + ToString(period) + separator +
|
|
"Time: " + ToString(TimeCurrent()) + separator +
|
|
"-----------" + separator +
|
|
"Cycles: " + separator +
|
|
"-----------" + separator +
|
|
sMarketConditions.GetTitle() + separator +
|
|
mMarketConditions.GetTitle() + separator +
|
|
lMarketConditions.GetTitle() + separator +
|
|
hMarketConditions.GetTitle() + separator +
|
|
"-----------" + separator +
|
|
"Scores: " + separator +
|
|
"-----------" + separator +
|
|
"Bullish: " + ToString(bullScore) + separator +
|
|
"Bearish: " + ToString(bearScore) + separator +
|
|
"-----------------------------" + separator +
|
|
//
|
|
// TODO: Add Scores Later ...
|
|
separator +
|
|
""
|
|
//
|
|
;
|
|
|
|
//
|
|
// XOBD ...
|
|
string obdStr =
|
|
//
|
|
ToString("isXOBDSwingLow", isXOBDSwingLow, ignoreFalseConditions) +
|
|
ToString("isXOBDSwingHigh", isXOBDSwingHigh, ignoreFalseConditions) +
|
|
""
|
|
//
|
|
;
|
|
obdStr = SetLabel("XOBD: ", obdStr, separator);
|
|
|
|
//
|
|
// ToString("", , ignoreFalseConditions) +
|
|
|
|
//
|
|
// XFI ...
|
|
string fiStr =
|
|
//
|
|
ToString("isXFIPeak", isXFIPeak, ignoreFalseConditions) +
|
|
ToString("isXFIVale", isXFIVale, ignoreFalseConditions) +
|
|
ToString("isXFICrossedOverZero", isXFICrossedOverZero, ignoreFalseConditions) +
|
|
ToString("isXFIOverZero", isXFIOverZero, ignoreFalseConditions) +
|
|
ToString("isXFICrossedUnderZero", isXFICrossedUnderZero, ignoreFalseConditions) +
|
|
ToString("isXFIUnderZero", isXFIUnderZero, ignoreFalseConditions) +
|
|
""
|
|
//
|
|
;
|
|
fiStr = SetLabel("XFI: ", fiStr, separator);
|
|
|
|
//
|
|
// XRSI ...
|
|
string rsiStr =
|
|
//
|
|
ToString("isXRSIPeak", isXRSIPeak, ignoreFalseConditions) +
|
|
ToString("isXRSIVale", isXRSIVale, ignoreFalseConditions) +
|
|
ToString("isXRSICrossedOverLongExit", isXRSICrossedOverLongExit, ignoreFalseConditions) +
|
|
ToString("isXRSICrossedOverLongEntry", isXRSICrossedOverLongEntry, ignoreFalseConditions) +
|
|
ToString("isXRSICrossedUnderShortExit", isXRSICrossedUnderShortExit, ignoreFalseConditions) +
|
|
ToString("isXRSICrossedUnderShortEntry", isXRSICrossedUnderShortEntry, ignoreFalseConditions) +
|
|
""
|
|
//
|
|
;
|
|
rsiStr = SetLabel("XRSI: ", rsiStr, separator);
|
|
|
|
//
|
|
// XTM ...
|
|
string tmStr =
|
|
//
|
|
ToString("isXTMPeak", isXTMPeak, ignoreFalseConditions) +
|
|
ToString("isXTMVale", isXTMVale, ignoreFalseConditions) +
|
|
ToString("isXTMBullish", isXTMBullish, ignoreFalseConditions) +
|
|
ToString("isXTMBearish", isXTMBearish, ignoreFalseConditions) +
|
|
ToString("isXTMNeutural", isXTMNeutural, ignoreFalseConditions) +
|
|
ToString("isXTMEndBullish", isXTMEndBullish, ignoreFalseConditions) +
|
|
ToString("isXTMEndBearish", isXTMEndBearish, ignoreFalseConditions) +
|
|
ToString("isXTMStartBullish", isXTMStartBullish, ignoreFalseConditions) +
|
|
ToString("isXTMStartBearish", isXTMStartBearish, ignoreFalseConditions) +
|
|
ToString("isXTMEndBullishByNeutural", isXTMEndBullishByNeutural, ignoreFalseConditions) +
|
|
ToString("isXTMEndBearishByNeutural", isXTMEndBearishByNeutural, ignoreFalseConditions) +
|
|
ToString("isXTMStartBullishAfterNeutural", isXTMStartBullishAfterNeutural, ignoreFalseConditions) +
|
|
ToString("isXTMStartBearishAfterNeutural", isXTMStartBearishAfterNeutural, ignoreFalseConditions) +
|
|
""
|
|
//
|
|
;
|
|
tmStr = SetLabel("XTM: ", tmStr, separator);
|
|
|
|
//
|
|
// XAMA ...
|
|
string amaStr =
|
|
//
|
|
ToString("isXAMAPeak", isXAMAPeak, ignoreFalseConditions) +
|
|
ToString("isXAMAVale", isXAMAVale, ignoreFalseConditions) +
|
|
ToString("isXAMABullish", isXAMABullish, ignoreFalseConditions) +
|
|
ToString("isXAMABearish", isXAMABearish, ignoreFalseConditions) +
|
|
ToString("isXAMANeutural", isXAMANeutural, ignoreFalseConditions) +
|
|
ToString("isXAMAEndBullish", isXAMAEndBullish, ignoreFalseConditions) +
|
|
ToString("isXAMAEndBearish", isXAMAEndBearish, ignoreFalseConditions) +
|
|
ToString("isXAMAStartBullish", isXAMAStartBullish, ignoreFalseConditions) +
|
|
ToString("isXAMAStartBearish", isXAMAStartBearish, ignoreFalseConditions) +
|
|
ToString("isXAMAEndBullishByNeutural", isXAMAEndBullishByNeutural, ignoreFalseConditions) +
|
|
ToString("isXAMAEndBearishByNeutural", isXAMAEndBearishByNeutural, ignoreFalseConditions) +
|
|
ToString("isXAMAStartBullishAfterNeutural", isXAMAStartBullishAfterNeutural, ignoreFalseConditions) +
|
|
ToString("isXAMAStartBearishAfterNeutural", isXAMAStartBearishAfterNeutural, ignoreFalseConditions) +
|
|
""
|
|
//
|
|
;
|
|
amaStr = SetLabel("XAMA: ", amaStr, separator);
|
|
|
|
//
|
|
// XLH ...
|
|
string lhStr =
|
|
//
|
|
ToString("isXLHHHIncreased", isXLHHHIncreased, ignoreFalseConditions) +
|
|
ToString("isXLHHHDecreased", isXLHHHDecreased, ignoreFalseConditions) +
|
|
ToString("isXLHLLIncreased", isXLHLLIncreased, ignoreFalseConditions) +
|
|
ToString("isXLHLLDecreased", isXLHLLDecreased, ignoreFalseConditions) +
|
|
ToString("isXLHLowAttachedLL", isXLHLowAttachedLL, ignoreFalseConditions) +
|
|
ToString("isXLHHighAttachedHH", isXLHHighAttachedHH, ignoreFalseConditions) +
|
|
ToString("isXLHHHSameInLength", isXLHHHSameInLength, ignoreFalseConditions) +
|
|
ToString("isXLHLLSameInLength", isXLHLLSameInLength, ignoreFalseConditions) +
|
|
ToString("isXLHPriceOverSignal", isXLHPriceOverSignal, ignoreFalseConditions) +
|
|
ToString("isXLHPriceUnderSignal", isXLHPriceUnderSignal, ignoreFalseConditions) +
|
|
ToString("isXLHPriceInSignalRange", isXLHPriceInSignalRange, ignoreFalseConditions) +
|
|
ToString("isXLHPriceCrossedOverSignal", isXLHPriceCrossedOverSignal, ignoreFalseConditions) +
|
|
ToString("isXLHPriceCrossedUnderSignal", isXLHPriceCrossedUnderSignal, ignoreFalseConditions) +
|
|
""
|
|
//
|
|
;
|
|
lhStr = SetLabel("XLH: ", lhStr, separator);
|
|
|
|
//
|
|
// XTD ...
|
|
string tdStr =
|
|
//
|
|
ToString("isXTDSignalPeak", isXTDSignalPeak, ignoreFalseConditions) +
|
|
ToString("isXTDSignalVale", isXTDSignalVale, ignoreFalseConditions) +
|
|
ToString("isXTDBullishPeak", isXTDBullishPeak, ignoreFalseConditions) +
|
|
ToString("isXTDBullishVale", isXTDBullishVale, ignoreFalseConditions) +
|
|
ToString("isXTDBearishPeak", isXTDBearishPeak, ignoreFalseConditions) +
|
|
ToString("isXTDBearishVale", isXTDBearishVale, ignoreFalseConditions) +
|
|
ToString("isXTDBullOverBear", isXTDBullOverBear, ignoreFalseConditions) +
|
|
ToString("isXTDBullUnderBear", isXTDBullUnderBear, ignoreFalseConditions) +
|
|
ToString("isXTDSignalOverBear", isXTDSignalOverBear, ignoreFalseConditions) +
|
|
ToString("isXTDSignalUnderBear", isXTDSignalUnderBear, ignoreFalseConditions) +
|
|
ToString("isXTDBullCrossedOverBear", isXTDBullCrossedOverBear, ignoreFalseConditions) +
|
|
ToString("isXTDBullCrossedUnderBear", isXTDBullCrossedUnderBear, ignoreFalseConditions) +
|
|
ToString("isXTDSignalCrossedOverBear", isXTDSignalCrossedOverBear, ignoreFalseConditions) +
|
|
ToString("isXTDSignalCrossedUnderBear", isXTDSignalCrossedUnderBear, ignoreFalseConditions) +
|
|
""
|
|
//
|
|
;
|
|
tdStr = SetLabel("XTD: ", tdStr, separator);
|
|
|
|
//
|
|
// XTS ...
|
|
string tsStr =
|
|
//
|
|
ToString("isXTSAllSame", isXTSAllSame, ignoreFalseConditions) +
|
|
ToString("isXTSCurrentMin", isXTSCurrentMin, ignoreFalseConditions) +
|
|
ToString("isXTSCurrentMax", isXTSCurrentMax, ignoreFalseConditions) +
|
|
ToString("isXTSCurrentOverFarest", isXTSCurrentOverFarest, ignoreFalseConditions) +
|
|
ToString("isXTSCurrentOverNearest", isXTSCurrentOverNearest, ignoreFalseConditions) +
|
|
ToString("isXTSCurrentOverMediest", isXTSCurrentOverMediest, ignoreFalseConditions) +
|
|
ToString("isXTSCurrentUnderFarest", isXTSCurrentUnderFarest, ignoreFalseConditions) +
|
|
ToString("isXTSCurrentUnderNearest", isXTSCurrentUnderNearest, ignoreFalseConditions) +
|
|
ToString("isXTSCurrentUnderMediest", isXTSCurrentUnderMediest, ignoreFalseConditions) +
|
|
ToString("isXTSCurrentCrossedOverFarest", isXTSCurrentCrossedOverFarest, ignoreFalseConditions) +
|
|
ToString("isXTSCurrentCrossedOverNearest", isXTSCurrentCrossedOverNearest, ignoreFalseConditions) +
|
|
ToString("isXTSCurrentCrossedOverMediest", isXTSCurrentCrossedOverMediest, ignoreFalseConditions) +
|
|
ToString("isXTSCurrentCrossedUnderFarest", isXTSCurrentCrossedUnderFarest, ignoreFalseConditions) +
|
|
ToString("isXTSCurrentCrossedUnderNearest", isXTSCurrentCrossedUnderNearest, ignoreFalseConditions) +
|
|
ToString("isXTSCurrentCrossedUnderMediest", isXTSCurrentCrossedUnderMediest, ignoreFalseConditions) +
|
|
""
|
|
//
|
|
;
|
|
tsStr = SetLabel("XTS: ", tsStr, separator);
|
|
|
|
//
|
|
// XCHLH ...
|
|
string chlhStr =
|
|
//
|
|
ToString("isXCHLHSameHHs", isXCHLHSameHHs, ignoreFalseConditions) +
|
|
ToString("isXCHLHSameLLs", isXCHLHSameLLs, ignoreFalseConditions) +
|
|
ToString("isXCHLHSCMCHHSame", isXCHLHSCMCHHSame, ignoreFalseConditions) +
|
|
ToString("isXCHLHSCMCLLSame", isXCHLHSCMCLLSame, ignoreFalseConditions) +
|
|
ToString("isXCHLHSCLCHHSame", isXCHLHSCLCHHSame, ignoreFalseConditions) +
|
|
ToString("isXCHLHSCLCLLSame", isXCHLHSCLCLLSame, ignoreFalseConditions) +
|
|
ToString("isXCHLHMCLCHHSame", isXCHLHMCLCHHSame, ignoreFalseConditions) +
|
|
ToString("isXCHLHMCLCLLSame", isXCHLHMCLCLLSame, ignoreFalseConditions) +
|
|
ToString("isXCHLHMCOnTopOfLC", isXCHLHMCOnTopOfLC, ignoreFalseConditions) +
|
|
ToString("isXCHLHMCInBottomOfLC", isXCHLHMCInBottomOfLC, ignoreFalseConditions) +
|
|
""
|
|
//
|
|
;
|
|
chlhStr = SetLabel("XCHLH: ", chlhStr, separator);
|
|
|
|
//
|
|
// XCHMA ...
|
|
string chmaStr =
|
|
//
|
|
ToString("isXCHMASCOverMax", isXCHMASCOverMax, ignoreFalseConditions) +
|
|
ToString("isXCHMASCOverMin", isXCHMASCOverMin, ignoreFalseConditions) +
|
|
ToString("isXCHMASCUnderMax", isXCHMASCUnderMax, ignoreFalseConditions) +
|
|
ToString("isXCHMASCUnderMin", isXCHMASCUnderMin, ignoreFalseConditions) +
|
|
ToString("isXCHMASCCrossedOverMax", isXCHMASCCrossedOverMax, ignoreFalseConditions) +
|
|
ToString("isXCHMASCCrossedUnderMax", isXCHMASCCrossedUnderMax, ignoreFalseConditions) +
|
|
ToString("isXCHMASCCrossedOverMin", isXCHMASCCrossedOverMin, ignoreFalseConditions) +
|
|
ToString("isXCHMASCCrossedUnderMin", isXCHMASCCrossedUnderMin, ignoreFalseConditions) +
|
|
ToString("isXCHMASCPeak", isXCHMASCPeak, ignoreFalseConditions) +
|
|
ToString("isXCHMASCVale", isXCHMASCVale, ignoreFalseConditions) +
|
|
ToString("isXCHMASCTrendsUp", isXCHMASCTrendsUp, ignoreFalseConditions) +
|
|
ToString("isXCHMASCTrendsDown", isXCHMASCTrendsDown, ignoreFalseConditions) +
|
|
ToString("isXCHMASCFastOverSlow", isXCHMASCFastOverSlow, ignoreFalseConditions) +
|
|
ToString("isXCHMASCFastUnderSlow", isXCHMASCFastUnderSlow, ignoreFalseConditions) +
|
|
ToString("isXCHMASCFastCrossedOverSlow", isXCHMASCFastCrossedOverSlow, ignoreFalseConditions) +
|
|
ToString("isXCHMASCFastCrossedUnderSlow", isXCHMASCFastCrossedUnderSlow, ignoreFalseConditions) +
|
|
ToString("isXCHMAMCPeak", isXCHMAMCPeak, ignoreFalseConditions) +
|
|
ToString("isXCHMAMCVale", isXCHMAMCVale, ignoreFalseConditions) +
|
|
ToString("isXCHMAMCTrendsUp", isXCHMAMCTrendsUp, ignoreFalseConditions) +
|
|
ToString("isXCHMAMCTrendsDown", isXCHMAMCTrendsDown, ignoreFalseConditions) +
|
|
ToString("isXCHMAMCFastOverSlow", isXCHMAMCFastOverSlow, ignoreFalseConditions) +
|
|
ToString("isXCHMAMCFastUnderSlow", isXCHMAMCFastUnderSlow, ignoreFalseConditions) +
|
|
ToString("isXCHMAMCFastCrossedOverSlow", isXCHMAMCFastCrossedOverSlow, ignoreFalseConditions) +
|
|
ToString("isXCHMAMCFastCrossedUnderSlow", isXCHMAMCFastCrossedUnderSlow, ignoreFalseConditions) +
|
|
ToString("isXCHMALCPeak", isXCHMALCPeak, ignoreFalseConditions) +
|
|
ToString("isXCHMALCVale", isXCHMALCVale, ignoreFalseConditions) +
|
|
ToString("isXCHMALCTrendsUp", isXCHMALCTrendsUp, ignoreFalseConditions) +
|
|
ToString("isXCHMALCTrendsDown", isXCHMALCTrendsDown, ignoreFalseConditions) +
|
|
ToString("isXCHMALCFastOverSlow", isXCHMALCFastOverSlow, ignoreFalseConditions) +
|
|
ToString("isXCHMALCFastUnderSlow", isXCHMALCFastUnderSlow, ignoreFalseConditions) +
|
|
ToString("isXCHMALCFastCrossedOverSlow", isXCHMALCFastCrossedOverSlow, ignoreFalseConditions) +
|
|
ToString("isXCHMALCFastCrossedUnderSlow", isXCHMALCFastCrossedUnderSlow, ignoreFalseConditions) +
|
|
""
|
|
//
|
|
;
|
|
chmaStr = SetLabel("XCHMA: ", chmaStr, separator);
|
|
|
|
//
|
|
string cMarketConditionsStr = cMarketConditions.GenerateSummary(onlySummary, cMarketMultiplier);
|
|
string sMarketConditionsStr = sMarketConditions.GenerateSummary(onlySummary, sMarketMultiplier);
|
|
string mMarketConditionsStr = mMarketConditions.GenerateSummary(onlySummary, mMarketMultiplier);
|
|
string lMarketConditionsStr = lMarketConditions.GenerateSummary(onlySummary, lMarketMultiplier);
|
|
string hMarketConditionsStr = hMarketConditions.GenerateSummary(onlySummary, hMarketMultiplier);
|
|
|
|
//
|
|
result =
|
|
//
|
|
"[" + GetToken() + "]" + separator +
|
|
(IsSpecifiedValid(provided) ? provided + separator : "") +
|
|
"-----------------------------" + separator +
|
|
commonStr +
|
|
(!onlySummary
|
|
? obdStr +
|
|
fiStr +
|
|
rsiStr +
|
|
tmStr +
|
|
amaStr +
|
|
lhStr +
|
|
tdStr +
|
|
tsStr +
|
|
chlhStr +
|
|
chmaStr +
|
|
cMarketConditionsStr +
|
|
sMarketConditionsStr +
|
|
mMarketConditionsStr +
|
|
lMarketConditionsStr +
|
|
hMarketConditionsStr +
|
|
""
|
|
: "") +
|
|
""
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// For Data Collector ...
|
|
string GetToken()
|
|
{
|
|
return GetSpecificToken(this);
|
|
}
|
|
bool IsModelValid()
|
|
{
|
|
return false;
|
|
}
|
|
string ToModelString()
|
|
{
|
|
return NULL;
|
|
}
|
|
bool ParseModel(string content)
|
|
{
|
|
return false;
|
|
}
|
|
int FindIndex(X121MarketConditions &items[])
|
|
{
|
|
return -1;
|
|
}
|
|
};
|
|
|
|
//
|
|
// Class ...
|
|
|
|
//
|
|
// X121 Provider Class ...
|
|
class XSCX121Provider : public XSCBaseProvider
|
|
{
|
|
//
|
|
// Public ...
|
|
public:
|
|
//
|
|
// Props ...
|
|
|
|
//
|
|
XSCXCCHelper *ccHelper; // Candle Clear
|
|
XSCXCTHelper *ctHelper; // Candle Timer
|
|
|
|
//
|
|
XSCXTSHelper *tsHelper;
|
|
XSCXFIHelper *fiHelper;
|
|
XSCXTDHelper *tdHelper;
|
|
XSCXLHHelper *lhHelper;
|
|
XSCXTMHelper *tmHelper;
|
|
XSCXOBDHelper *obdHelper;
|
|
XSCXRSIHelper *rsiHelper;
|
|
XSCXAMAHelper *amaHelper;
|
|
XSCXCHMAHelper *chmaHelper;
|
|
XSCXCHLHHelper *chlhHelper;
|
|
|
|
//
|
|
XSCX121Market *cMarket; // Current Market
|
|
XSCX121Market *sMarket; // Short Market
|
|
XSCX121Market *mMarket; // Medium Market
|
|
XSCX121Market *lMarket; // Long Market
|
|
XSCX121Market *hMarket; // Hind Market
|
|
|
|
//
|
|
// Constructor ...
|
|
XSCX121Provider(
|
|
string symbol, // Trading Symbol
|
|
ENUM_TIMEFRAMES period, // Trading Period
|
|
double staticVolume // Static Volume for Positions
|
|
|
|
) : XSCBaseProvider(symbol, period, staticVolume)
|
|
{
|
|
//
|
|
ccHelper = new XSCXCCHelper();
|
|
ctHelper = new XSCXCTHelper();
|
|
|
|
//
|
|
tsHelper = new XSCXTSHelper();
|
|
fiHelper = new XSCXFIHelper();
|
|
tdHelper = new XSCXTDHelper();
|
|
lhHelper = new XSCXLHHelper();
|
|
tmHelper = new XSCXTMHelper();
|
|
obdHelper = new XSCXOBDHelper();
|
|
rsiHelper = new XSCXRSIHelper();
|
|
amaHelper = new XSCXAMAHelper();
|
|
chmaHelper = new XSCXCHMAHelper();
|
|
chlhHelper = new XSCXCHLHHelper();
|
|
|
|
//
|
|
// Instantiate X121 Market Cycles Classes ...
|
|
cMarket = new XSCX121Market();
|
|
sMarket = new XSCX121Market();
|
|
mMarket = new XSCX121Market();
|
|
lMarket = new XSCX121Market();
|
|
hMarket = new XSCX121Market();
|
|
|
|
//
|
|
mNumberOfItems = 15;
|
|
mNumberOfSRVerified = 71;
|
|
mMinRequiredSupportAndResistances = 30;
|
|
}
|
|
|
|
//
|
|
// Properties Gettr(s) / Setter(s) ...
|
|
|
|
//
|
|
void SetNumberOfSRVerified(int value)
|
|
{
|
|
mNumberOfSRVerified = value;
|
|
}
|
|
|
|
//
|
|
int GetNumberOfSRVerified()
|
|
{
|
|
return mNumberOfSRVerified;
|
|
}
|
|
|
|
//
|
|
void SetNumberOfItems(int value)
|
|
{
|
|
mNumberOfItems = value;
|
|
}
|
|
|
|
//
|
|
int GetNumberOfItems()
|
|
{
|
|
return mNumberOfItems;
|
|
}
|
|
|
|
//
|
|
void SetMinRequiredSupportAndResistances(int value)
|
|
{
|
|
mMinRequiredSupportAndResistances = value;
|
|
}
|
|
|
|
//
|
|
int GetMinRequiredSupportAndResistances()
|
|
{
|
|
return mMinRequiredSupportAndResistances;
|
|
}
|
|
|
|
//
|
|
// Overrides ...
|
|
|
|
//
|
|
// DeInit all Requirements ...
|
|
void DeInit() override
|
|
{
|
|
//
|
|
delete ccHelper;
|
|
delete ctHelper;
|
|
|
|
//
|
|
delete tsHelper;
|
|
delete fiHelper;
|
|
delete tdHelper;
|
|
delete lhHelper;
|
|
delete tmHelper;
|
|
delete obdHelper;
|
|
delete rsiHelper;
|
|
delete amaHelper;
|
|
delete chmaHelper;
|
|
delete chlhHelper;
|
|
|
|
//
|
|
delete cMarket;
|
|
delete sMarket;
|
|
delete mMarket;
|
|
delete lMarket;
|
|
delete hMarket;
|
|
}
|
|
|
|
//
|
|
// Functions ...
|
|
|
|
//
|
|
// Init all Requirements ...
|
|
bool Init(X121ProviderInputs &inputs)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
// Validate ...
|
|
result = inputs.IsValid();
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
mInputs = inputs;
|
|
|
|
//
|
|
string mSymbol = GetSymbol();
|
|
ENUM_TIMEFRAMES mPeriod = GetPeriod();
|
|
|
|
//
|
|
// Init Indicators Helpers ...
|
|
|
|
//
|
|
// CT ...
|
|
result = ctHelper
|
|
.Init(
|
|
mSymbol,
|
|
mPeriod,
|
|
mInputs.ctInputs
|
|
//
|
|
);
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// CC ...
|
|
result = ccHelper
|
|
.Init(
|
|
mSymbol,
|
|
mPeriod,
|
|
mInputs.ccInputs
|
|
//
|
|
);
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
result = tsHelper
|
|
.Init(
|
|
mSymbol,
|
|
mPeriod,
|
|
mInputs.tsInputs
|
|
//
|
|
);
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
result = fiHelper
|
|
.Init(
|
|
mSymbol,
|
|
mPeriod,
|
|
mInputs.fiInputs
|
|
//
|
|
);
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
result = tdHelper
|
|
.Init(
|
|
mSymbol,
|
|
mPeriod,
|
|
mInputs.tdInputs
|
|
//
|
|
);
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
result = lhHelper
|
|
.Init(
|
|
mSymbol,
|
|
mPeriod,
|
|
mInputs.lhInputs
|
|
//
|
|
);
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
result = tmHelper
|
|
.Init(
|
|
mSymbol,
|
|
mPeriod,
|
|
mInputs.tmInputs
|
|
//
|
|
);
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
result = obdHelper
|
|
.Init(
|
|
mSymbol,
|
|
mPeriod,
|
|
mInputs.obdInputs
|
|
//
|
|
);
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
result = rsiHelper
|
|
.Init(
|
|
mSymbol,
|
|
mPeriod,
|
|
mInputs.rsiInputs
|
|
//
|
|
);
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
result = amaHelper
|
|
.Init(
|
|
mSymbol,
|
|
mPeriod,
|
|
mInputs.amaInputs
|
|
//
|
|
);
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
result = chmaHelper
|
|
.Init(
|
|
mSymbol,
|
|
mPeriod,
|
|
mInputs.chmaInputs
|
|
//
|
|
);
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
result = chlhHelper
|
|
.Init(
|
|
mSymbol,
|
|
mPeriod,
|
|
mInputs.chlhInputs
|
|
//
|
|
);
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Initialize X121 Market Cycles ...
|
|
|
|
//
|
|
// Current Market ...
|
|
result = cMarket
|
|
.Init(mInputs.cMarketInputs);
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Short Market ...
|
|
result = sMarket
|
|
.Init(mInputs.sMarketInputs);
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Medium Market ...
|
|
result = mMarket
|
|
.Init(mInputs.mMarketInputs);
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Long Market ...
|
|
result = lMarket
|
|
.Init(mInputs.lMarketInputs);
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Hind Market ...
|
|
result = hMarket
|
|
.Init(mInputs.hMarketInputs);
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Set Default Position's Type ...
|
|
// Enable / Disable Long (Buy), Short (Sell) ...
|
|
void SetSignalTypeState(
|
|
ENUM_POSITION_TYPE type, // Which types are Signals be Targetted
|
|
bool state // Which State is going to Set
|
|
)
|
|
{
|
|
//
|
|
if (IsLong(type))
|
|
{
|
|
mIsLongEnable = state;
|
|
}
|
|
else
|
|
{
|
|
mIsShortEnable = state;
|
|
}
|
|
}
|
|
|
|
//
|
|
// Set Signal Providers ...
|
|
void SetSignalProviderState(
|
|
ENUM_X121_SIGNAL_PROVIDERS provider, // Provider State
|
|
bool state // Which state is going to set ...
|
|
)
|
|
{
|
|
//
|
|
if (provider == PROVIDER_NONE)
|
|
{
|
|
return;
|
|
}
|
|
|
|
//
|
|
switch (provider)
|
|
{
|
|
//
|
|
case XSP:
|
|
mIsXSPSignalProviderEnable = state;
|
|
break;
|
|
|
|
//
|
|
case XTEST:
|
|
mIsXTESTSignalProviderEnable = state;
|
|
break;
|
|
|
|
//
|
|
case X786:
|
|
mIsX786SignalProviderEnable = state;
|
|
break;
|
|
|
|
//
|
|
case X121:
|
|
mIsX121SignalProviderEnable = state;
|
|
break;
|
|
|
|
//
|
|
case X110:
|
|
mIsX110SignalProviderEnable = state;
|
|
break;
|
|
|
|
//
|
|
case X92:
|
|
mIsX92SignalProviderEnable = state;
|
|
break;
|
|
|
|
//
|
|
case X128:
|
|
mIsX128SignalProviderEnable = state;
|
|
break;
|
|
|
|
//
|
|
case XTD:
|
|
mIsXTDSignalProviderEnable = state;
|
|
break;
|
|
|
|
//
|
|
case XTAM:
|
|
mIsXTAMSignalProviderEnable = state;
|
|
break;
|
|
|
|
//
|
|
case XSI:
|
|
mIsXSISignalProviderEnable = state;
|
|
break;
|
|
|
|
//
|
|
case XTSFI:
|
|
mIsXTSFISignalProviderEnable = state;
|
|
break;
|
|
|
|
//
|
|
case XOBDLH:
|
|
mIsXOBDLHSignalProviderEnable = state;
|
|
break;
|
|
|
|
//
|
|
case XCHMACC:
|
|
mIsXCHMACCSignalProviderEnable = state;
|
|
break;
|
|
|
|
//
|
|
case XCHMAMN:
|
|
mIsXCHMAMNSignalProviderEnable = state;
|
|
break;
|
|
|
|
//
|
|
case XCHMAMX:
|
|
mIsXCHMAMXSignalProviderEnable = state;
|
|
break;
|
|
}
|
|
}
|
|
|
|
//
|
|
void SetSignalProviderStates(
|
|
ENUM_X121_SIGNAL_PROVIDERS &providers[], // Collection of Providers ...
|
|
bool state // Which state is going to set ...
|
|
)
|
|
{
|
|
//
|
|
int providersCount = ArraySize(providers);
|
|
if (providersCount <= 0)
|
|
{
|
|
return;
|
|
}
|
|
|
|
//
|
|
for (int i = 0; i < providersCount; i++)
|
|
{
|
|
SetSignalProviderState(providers[i], state);
|
|
}
|
|
}
|
|
|
|
//
|
|
string GetTag()
|
|
{
|
|
//
|
|
string result = NULL;
|
|
|
|
//
|
|
result =
|
|
//
|
|
GetToken() +
|
|
"[" +
|
|
GetSymbol() +
|
|
"," +
|
|
ToString(GetPeriod()) +
|
|
"]"
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
void GetMarketConditions(
|
|
X121MarketConditions &mConditions, // Market Conditions Result
|
|
int barIndex = 0 // Specified Bar Index
|
|
)
|
|
{
|
|
//
|
|
mConditions.Clear();
|
|
|
|
//
|
|
CalculateConditions(mConditions, barIndex);
|
|
}
|
|
|
|
//
|
|
// Check Market For Signal ...
|
|
bool HasSignal(
|
|
int barIndex,
|
|
XSignal &mSignal, // Hold's Signal if Exists ...
|
|
X121MarketConditions &mConditions // Hold's Market Conditions ...
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
// Validate Enable Process ...
|
|
result = !CanIgnoreProcess();
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
mWaitsUntilNewBar = false;
|
|
|
|
//
|
|
// Validate Enable Type of Signalling ...
|
|
result = mIsLongEnable || mIsShortEnable;
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Now we Have to Pass the Conditions to Each Signal Provider
|
|
// for Retrieving Signals Based On them ...
|
|
|
|
//
|
|
// Reading Market Conditions ...
|
|
GetMarketConditions(mConditions, barIndex);
|
|
AddScores(mConditions);
|
|
|
|
//
|
|
int signalPusher = 0;
|
|
bool hasLong = false;
|
|
bool hasShort = false;
|
|
string provider = "";
|
|
|
|
//
|
|
double providedSL = 0;
|
|
double providedTP = 0;
|
|
double providedR2r = 0;
|
|
|
|
//
|
|
// Long ...
|
|
if (mIsLongEnable)
|
|
{
|
|
//
|
|
signalPusher = 0;
|
|
|
|
//
|
|
hasLong = HasSpecificSignal(
|
|
barIndex,
|
|
POSITION_TYPE_BUY,
|
|
provider,
|
|
signalPusher,
|
|
mConditions,
|
|
providedSL,
|
|
providedTP,
|
|
providedR2r //
|
|
);
|
|
}
|
|
|
|
//
|
|
// Short ...
|
|
if (mIsShortEnable)
|
|
{
|
|
//
|
|
signalPusher = 0;
|
|
|
|
//
|
|
hasShort = HasSpecificSignal(
|
|
barIndex,
|
|
POSITION_TYPE_SELL,
|
|
provider,
|
|
signalPusher,
|
|
mConditions,
|
|
providedSL,
|
|
providedTP,
|
|
providedR2r //
|
|
);
|
|
}
|
|
|
|
//
|
|
result = hasLong || hasShort;
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Validate Longs Use Common Conditions ...
|
|
|
|
//
|
|
// if (hasLong)
|
|
// {
|
|
// //
|
|
// int pusher = 0;
|
|
// result = HasBaseLongConditions(
|
|
// mConditions,
|
|
// pusher //
|
|
// );
|
|
|
|
// //
|
|
// if (!result)
|
|
// {
|
|
// return result;
|
|
// }
|
|
// }
|
|
|
|
// //
|
|
// if (hasShort)
|
|
// {
|
|
// //
|
|
// int pusher = 0;
|
|
// result = HasBaseShortConditions(
|
|
// mConditions,
|
|
// pusher //
|
|
// );
|
|
|
|
// //
|
|
// if (!result)
|
|
// {
|
|
// return result;
|
|
// }
|
|
// }
|
|
|
|
//
|
|
// Prepare Signal ...
|
|
|
|
//
|
|
if (result)
|
|
{
|
|
//
|
|
// Here We Have to Prepare Signal ...
|
|
|
|
//
|
|
string symbol = GetSymbol();
|
|
ENUM_TIMEFRAMES period = GetPeriod();
|
|
double tpPoint = 60;
|
|
double slPoint = 30;
|
|
double volume = GetStaticVolume() * signalPusher;
|
|
double tpPrice = PointToPrice(
|
|
tpPoint,
|
|
symbol //
|
|
);
|
|
double slPrice = PointToPrice(
|
|
slPoint,
|
|
symbol //
|
|
);
|
|
ENUM_POSITION_TYPE type = hasLong
|
|
? POSITION_TYPE_BUY
|
|
: POSITION_TYPE_SELL;
|
|
ENUM_X_ORDER_MODES mode = X_ORDER_MODE_MARKET;
|
|
double entry = GetEntry(
|
|
symbol,
|
|
type //
|
|
);
|
|
|
|
//
|
|
double tp = 0;
|
|
double sl = 0;
|
|
|
|
//
|
|
ENUM_X_SIGNAL_MANAGING_ACTIONS action = X_SIGNAL_USE_NOTHING;
|
|
|
|
//
|
|
// TODO: Make Configurable ...
|
|
double r2r = providedR2r;
|
|
if (r2r <= 0)
|
|
{
|
|
r2r = 1.5;
|
|
}
|
|
|
|
//
|
|
sl = 0;
|
|
tp = 0;
|
|
|
|
//
|
|
// TP based on SL and Risk to Reward ...
|
|
if (providedSL > 0)
|
|
{
|
|
//
|
|
sl = providedSL;
|
|
|
|
//
|
|
double risk = MathAbs(entry - sl);
|
|
|
|
//
|
|
double reward = risk * r2r;
|
|
|
|
//
|
|
tp = hasLong
|
|
? entry + reward
|
|
: entry - reward;
|
|
}
|
|
else
|
|
//
|
|
// SL based on TP and Risk to Reward ...
|
|
if (providedTP > 0)
|
|
{
|
|
//
|
|
tp = providedTP;
|
|
|
|
//
|
|
double reward = MathAbs(entry - tp);
|
|
|
|
//
|
|
double risk = reward / r2r;
|
|
|
|
//
|
|
sl = hasLong
|
|
? entry - risk
|
|
: entry + risk;
|
|
}
|
|
|
|
//
|
|
// TODOO: Remove this ...
|
|
sl = hasLong
|
|
? GetMaxVales(true)
|
|
: GetMinPeaks(true);
|
|
double risk = MathAbs(entry - sl);
|
|
double reward = risk * r2r;
|
|
tp = hasLong
|
|
? entry + reward
|
|
: entry - reward;
|
|
|
|
//
|
|
result = mSignal.Prepare(
|
|
symbol,
|
|
provider,
|
|
period,
|
|
type,
|
|
mode,
|
|
entry,
|
|
volume,
|
|
action,
|
|
sl,
|
|
tp
|
|
//
|
|
);
|
|
|
|
//
|
|
// Generate Support Signal for Specified Provider ...
|
|
if (result && provider == ToString(PROVIDER_NONE))
|
|
{
|
|
//
|
|
double cKijunSen = cMarket.ich.GetKijunSen(0);
|
|
double sKijunSen = sMarket.ich.GetKijunSen(0);
|
|
double mKijunSen = mMarket.ich.GetKijunSen(0);
|
|
double lKijunSen = lMarket.ich.GetKijunSen(0);
|
|
double hKijunSen = hMarket.ich.GetKijunSen(0);
|
|
|
|
//
|
|
double kijunSens[] = {
|
|
cKijunSen,
|
|
sKijunSen,
|
|
mKijunSen,
|
|
lKijunSen,
|
|
hKijunSen //
|
|
};
|
|
|
|
//
|
|
double lesserKijun = FindLesserThan(
|
|
entry,
|
|
kijunSens,
|
|
true //
|
|
);
|
|
|
|
//
|
|
double biggerKijun = FindBiggerThan(
|
|
entry,
|
|
kijunSens,
|
|
true //
|
|
);
|
|
|
|
//
|
|
ENUM_POSITION_TYPE sType =
|
|
hasLong
|
|
? POSITION_TYPE_SELL
|
|
: POSITION_TYPE_BUY;
|
|
|
|
bool isLongS = IsLong(sType);
|
|
|
|
//
|
|
double sEntry =
|
|
isLongS
|
|
? biggerKijun
|
|
: lesserKijun;
|
|
|
|
//
|
|
double peakMin = GetMinPeaks(true);
|
|
double peakMax = GetMinPeaks(true);
|
|
double valeMin = GetMaxVales(true);
|
|
double valeMax = GetMaxVales(true);
|
|
|
|
//
|
|
double sTP =
|
|
isLongS
|
|
? peakMin
|
|
: valeMax;
|
|
|
|
//
|
|
double sSL =
|
|
isLongS
|
|
? valeMin
|
|
: peakMax;
|
|
|
|
//
|
|
double sVolume = mSignal.volume * 2;
|
|
|
|
//
|
|
// Prepare ...
|
|
XSignal sSignal;
|
|
bool isValid = sSignal.Prepare(
|
|
mSignal.symbol,
|
|
mSignal.provider,
|
|
mSignal.period,
|
|
sType,
|
|
X_ORDER_MODE_STOP,
|
|
sEntry,
|
|
sVolume,
|
|
X_SIGNAL_USE_NOTHING,
|
|
sSL,
|
|
sTP //
|
|
);
|
|
if (isValid)
|
|
{
|
|
//
|
|
AddRef(
|
|
sSignal,
|
|
mSignal.supports //
|
|
);
|
|
}
|
|
}
|
|
|
|
//
|
|
if (result)
|
|
{
|
|
mWaitsUntilNewBar = true;
|
|
}
|
|
}
|
|
|
|
//
|
|
UpdateSupportsAndResistances();
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Check for any Guards ...
|
|
bool HasGuard(XGuard &guards[])
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
// Try to Find Support and Resistances if Configured ...
|
|
FindSupportAndResistances();
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Tools ...
|
|
|
|
//
|
|
void Draw()
|
|
{
|
|
//
|
|
string symbol = GetSymbol();
|
|
ENUM_TIMEFRAMES period = GetPeriod();
|
|
|
|
//
|
|
ulong chID = FindChartID(
|
|
symbol,
|
|
period);
|
|
if (chID < 0)
|
|
{
|
|
return;
|
|
}
|
|
|
|
//
|
|
int subWindow = 0;
|
|
|
|
//
|
|
int offset = 0;
|
|
|
|
//
|
|
cMarket.Draw(chID, subWindow, offset);
|
|
sMarket.Draw(chID, subWindow, offset);
|
|
mMarket.Draw(chID, subWindow, offset);
|
|
lMarket.Draw(chID, subWindow, offset);
|
|
hMarket.Draw(chID, subWindow, offset);
|
|
}
|
|
|
|
//
|
|
// Support and Resistances ...
|
|
|
|
//
|
|
int CountSupportResistances()
|
|
{
|
|
return ArraySize(mSupportResistances);
|
|
}
|
|
|
|
//
|
|
bool GenerateSupRes(
|
|
XOHCLSupRes &supRes, // SupRes Instance ...
|
|
ENUM_POSITION_TYPE type, // Position Type ...
|
|
int count = 5,
|
|
double step = 0,
|
|
bool useAtrAsStep = true //
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
if (count <= 0)
|
|
{
|
|
count = 1;
|
|
}
|
|
|
|
//
|
|
if (step <= 0)
|
|
{
|
|
//
|
|
if (useAtrAsStep)
|
|
{
|
|
step = cMarket.osc.GetATR(0);
|
|
}
|
|
else
|
|
{
|
|
step = 0;
|
|
}
|
|
}
|
|
|
|
//
|
|
supRes.Clean();
|
|
|
|
//
|
|
double price = GetExit(
|
|
GetSymbol(),
|
|
type //
|
|
);
|
|
|
|
//
|
|
result = supRes.Init(
|
|
price,
|
|
mSupportResistances,
|
|
count,
|
|
step //
|
|
);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
bool GenerateLongSupRes(
|
|
XOHCLSupRes &supRes, // SupRes Instance ...
|
|
int count = 5,
|
|
double step = 0,
|
|
bool useAtrAsStep = true //
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
result = GenerateSupRes(
|
|
supRes,
|
|
POSITION_TYPE_BUY,
|
|
count,
|
|
step,
|
|
useAtrAsStep //
|
|
);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
bool GenerateShortSupRes(
|
|
XOHCLSupRes &supRes, // SupRes Instance ...
|
|
int count = 5,
|
|
double step = 0,
|
|
bool useAtrAsStep = true //
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
result = GenerateSupRes(
|
|
supRes,
|
|
POSITION_TYPE_BUY,
|
|
count,
|
|
step,
|
|
useAtrAsStep //
|
|
);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Peask and Vales Finder ...
|
|
|
|
//
|
|
void GetPeaks(
|
|
double &peaks[],
|
|
bool ignoreCurrent = false //
|
|
)
|
|
{
|
|
//
|
|
Clean(peaks);
|
|
|
|
//
|
|
//
|
|
double cPeak = cMarket.pv.GetPeak(0);
|
|
double sPeak = sMarket.pv.GetPeak(0);
|
|
double mPeak = mMarket.pv.GetPeak(0);
|
|
double lPeak = lMarket.pv.GetPeak(0);
|
|
double hPeak = hMarket.pv.GetPeak(0);
|
|
|
|
//
|
|
double mPeaks[] = {
|
|
cPeak,
|
|
sPeak,
|
|
mPeak,
|
|
lPeak,
|
|
hPeak //
|
|
};
|
|
|
|
//
|
|
if (ignoreCurrent)
|
|
{
|
|
//
|
|
Remove(
|
|
cPeak,
|
|
mPeaks //
|
|
);
|
|
}
|
|
|
|
//
|
|
Copy(
|
|
mPeaks,
|
|
peaks //
|
|
);
|
|
}
|
|
|
|
//
|
|
void GetVales(
|
|
double &vales[],
|
|
bool ignoreCurrent = false //
|
|
)
|
|
{
|
|
//
|
|
Clean(vales);
|
|
|
|
//
|
|
double cVale = cMarket.pv.GetVale(0);
|
|
double sVale = sMarket.pv.GetVale(0);
|
|
double mVale = mMarket.pv.GetVale(0);
|
|
double lVale = lMarket.pv.GetVale(0);
|
|
double hVale = hMarket.pv.GetVale(0);
|
|
|
|
//
|
|
double mVales[] = {
|
|
cVale,
|
|
sVale,
|
|
mVale,
|
|
lVale,
|
|
hVale //
|
|
};
|
|
|
|
//
|
|
if (ignoreCurrent)
|
|
{
|
|
//
|
|
Remove(
|
|
cVale,
|
|
mVales //
|
|
);
|
|
}
|
|
|
|
//
|
|
Copy(
|
|
mVales,
|
|
vales //
|
|
);
|
|
}
|
|
|
|
//
|
|
double GetMinPeaks(bool ignoreCurrent = false)
|
|
{
|
|
//
|
|
double peaks[];
|
|
GetPeaks(
|
|
peaks,
|
|
ignoreCurrent //
|
|
);
|
|
|
|
//
|
|
double minPeak = GetMin(peaks);
|
|
double maxPeak = GetMax(peaks);
|
|
|
|
//
|
|
return minPeak;
|
|
}
|
|
|
|
//
|
|
double GetMaxPeaks(bool ignoreCurrent = false)
|
|
{
|
|
//
|
|
double peaks[];
|
|
GetPeaks(
|
|
peaks,
|
|
ignoreCurrent //
|
|
);
|
|
|
|
//
|
|
double minPeak = GetMin(peaks);
|
|
double maxPeak = GetMax(peaks);
|
|
|
|
//
|
|
return maxPeak;
|
|
}
|
|
|
|
//
|
|
double GetMinVales(bool ignoreCurrent = false)
|
|
{
|
|
//
|
|
double vales[];
|
|
GetVales(
|
|
vales,
|
|
ignoreCurrent //
|
|
);
|
|
|
|
//
|
|
double minVale = GetMin(vales);
|
|
double maxVale = GetMax(vales);
|
|
|
|
//
|
|
return minVale;
|
|
}
|
|
|
|
//
|
|
double GetMaxVales(bool ignoreCurrent = false)
|
|
{
|
|
//
|
|
double vales[];
|
|
GetVales(
|
|
vales,
|
|
ignoreCurrent //
|
|
);
|
|
|
|
//
|
|
double minVale = GetMin(vales);
|
|
double maxVale = GetMax(vales);
|
|
|
|
//
|
|
return maxVale;
|
|
}
|
|
|
|
//
|
|
// Protected ...
|
|
protected:
|
|
//
|
|
X121ProviderInputs mInputs;
|
|
|
|
//
|
|
// Support and Resistances ...
|
|
|
|
//
|
|
// Check has Enough Support and Resistance ...
|
|
bool HasEnoughSupportAndResistance()
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
if (mNumberOfSRVerified <= 0 ||
|
|
mMinRequiredSupportAndResistances <= 0)
|
|
{
|
|
result = true;
|
|
}
|
|
else
|
|
{
|
|
//
|
|
int currentSRsCount = CountSupportResistances();
|
|
result = currentSRsCount >= mMinRequiredSupportAndResistances;
|
|
}
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Update Bar Index base Support and Resistances ....
|
|
void UpdateSupportsAndResistances(
|
|
int barIndex = 0 //
|
|
)
|
|
{
|
|
//
|
|
if (mNumberOfSRVerified <= 0 ||
|
|
mMinRequiredSupportAndResistances <= 0)
|
|
{
|
|
return;
|
|
}
|
|
|
|
//
|
|
int before = CountSupportResistances();
|
|
|
|
//
|
|
// XICH ...
|
|
|
|
//
|
|
// Current ...
|
|
|
|
//
|
|
if (cMarket.ich.IsSameKijunSen(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedKijunSen = cMarket.ich.GetKijunSen(barIndex);
|
|
AddSRValue(selectedKijunSen);
|
|
}
|
|
|
|
//
|
|
if (cMarket.ich.IsSameSenkouSpanA(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedSenkouSpanA = cMarket.ich.GetSenkouSpanA(barIndex);
|
|
AddSRValue(selectedSenkouSpanA);
|
|
}
|
|
|
|
//
|
|
if (cMarket.ich.IsSameSenkouSpanB(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedSenkouSpanB = cMarket.ich.GetSenkouSpanB(barIndex);
|
|
AddSRValue(selectedSenkouSpanB);
|
|
}
|
|
|
|
//
|
|
// Short ...
|
|
|
|
//
|
|
if (sMarket.ich.IsSameKijunSen(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedKijunSen = sMarket.ich.GetKijunSen(barIndex);
|
|
AddSRValue(selectedKijunSen);
|
|
}
|
|
|
|
//
|
|
if (sMarket.ich.IsSameSenkouSpanA(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedSenkouSpanA = sMarket.ich.GetSenkouSpanA(barIndex);
|
|
AddSRValue(selectedSenkouSpanA);
|
|
}
|
|
|
|
//
|
|
if (sMarket.ich.IsSameSenkouSpanB(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedSenkouSpanB = sMarket.ich.GetSenkouSpanB(barIndex);
|
|
AddSRValue(selectedSenkouSpanB);
|
|
}
|
|
|
|
//
|
|
// Medium ...
|
|
|
|
//
|
|
if (mMarket.ich.IsSameKijunSen(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedKijunSen = mMarket.ich.GetKijunSen(barIndex);
|
|
AddSRValue(selectedKijunSen);
|
|
}
|
|
|
|
//
|
|
if (mMarket.ich.IsSameSenkouSpanA(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedSenkouSpanA = mMarket.ich.GetSenkouSpanA(barIndex);
|
|
AddSRValue(selectedSenkouSpanA);
|
|
}
|
|
|
|
//
|
|
if (mMarket.ich.IsSameSenkouSpanB(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedSenkouSpanB = mMarket.ich.GetSenkouSpanB(barIndex);
|
|
AddSRValue(selectedSenkouSpanB);
|
|
}
|
|
|
|
//
|
|
// Long ...
|
|
|
|
//
|
|
if (lMarket.ich.IsSameKijunSen(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedKijunSen = lMarket.ich.GetKijunSen(barIndex);
|
|
AddSRValue(selectedKijunSen);
|
|
}
|
|
|
|
//
|
|
if (lMarket.ich.IsSameSenkouSpanA(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedSenkouSpanA = lMarket.ich.GetSenkouSpanA(barIndex);
|
|
AddSRValue(selectedSenkouSpanA);
|
|
}
|
|
|
|
//
|
|
if (lMarket.ich.IsSameSenkouSpanB(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedSenkouSpanB = lMarket.ich.GetSenkouSpanB(barIndex);
|
|
AddSRValue(selectedSenkouSpanB);
|
|
}
|
|
|
|
//
|
|
// Hind ...
|
|
|
|
//
|
|
if (hMarket.ich.IsSameKijunSen(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedKijunSen = hMarket.ich.GetKijunSen(barIndex);
|
|
AddSRValue(selectedKijunSen);
|
|
}
|
|
|
|
//
|
|
if (hMarket.ich.IsSameSenkouSpanA(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedSenkouSpanA = hMarket.ich.GetSenkouSpanA(barIndex);
|
|
AddSRValue(selectedSenkouSpanA);
|
|
}
|
|
|
|
//
|
|
if (hMarket.ich.IsSameSenkouSpanB(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedSenkouSpanB = hMarket.ich.GetSenkouSpanB(barIndex);
|
|
AddSRValue(selectedSenkouSpanB);
|
|
}
|
|
|
|
//
|
|
// XDON ...
|
|
|
|
//
|
|
// Short Market ...
|
|
|
|
//
|
|
if (sMarket.don.IsSameUpperO(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedUpperO = sMarket.don.GetUpperO(barIndex);
|
|
AddSRValue(selectedUpperO);
|
|
}
|
|
|
|
//
|
|
if (sMarket.don.IsSameLowerO(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedLowerO = sMarket.don.GetLowerO(barIndex);
|
|
AddSRValue(selectedLowerO);
|
|
}
|
|
|
|
//
|
|
if (sMarket.don.IsSameUpperC(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedUpperC = sMarket.don.GetUpperC(barIndex);
|
|
AddSRValue(selectedUpperC);
|
|
}
|
|
|
|
//
|
|
if (sMarket.don.IsSameLowerC(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedLowerC = sMarket.don.GetLowerC(barIndex);
|
|
AddSRValue(selectedLowerC);
|
|
}
|
|
|
|
//
|
|
if (sMarket.don.IsSameUpperH(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedUpperH = sMarket.don.GetUpperH(barIndex);
|
|
AddSRValue(selectedUpperH);
|
|
}
|
|
|
|
//
|
|
if (sMarket.don.IsSameLowerH(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedLowerH = sMarket.don.GetLowerH(barIndex);
|
|
AddSRValue(selectedLowerH);
|
|
}
|
|
|
|
//
|
|
if (sMarket.don.IsSameUpperL(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedUpperL = sMarket.don.GetUpperL(barIndex);
|
|
AddSRValue(selectedUpperL);
|
|
}
|
|
|
|
//
|
|
if (sMarket.don.IsSameLowerL(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedLowerL = sMarket.don.GetLowerL(barIndex);
|
|
AddSRValue(selectedLowerL);
|
|
}
|
|
|
|
//
|
|
// Medium Market ...
|
|
|
|
//
|
|
if (mMarket.don.IsSameUpperO(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedUpperO = mMarket.don.GetUpperO(barIndex);
|
|
AddSRValue(selectedUpperO);
|
|
}
|
|
|
|
//
|
|
if (mMarket.don.IsSameLowerO(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedLowerO = mMarket.don.GetLowerO(barIndex);
|
|
AddSRValue(selectedLowerO);
|
|
}
|
|
|
|
//
|
|
if (mMarket.don.IsSameUpperC(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedUpperC = mMarket.don.GetUpperC(barIndex);
|
|
AddSRValue(selectedUpperC);
|
|
}
|
|
|
|
//
|
|
if (mMarket.don.IsSameLowerC(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedLowerC = mMarket.don.GetLowerC(barIndex);
|
|
AddSRValue(selectedLowerC);
|
|
}
|
|
|
|
//
|
|
if (mMarket.don.IsSameUpperH(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedUpperH = mMarket.don.GetUpperH(barIndex);
|
|
AddSRValue(selectedUpperH);
|
|
}
|
|
|
|
//
|
|
if (mMarket.don.IsSameLowerH(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedLowerH = mMarket.don.GetLowerH(barIndex);
|
|
AddSRValue(selectedLowerH);
|
|
}
|
|
|
|
//
|
|
if (mMarket.don.IsSameUpperL(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedUpperL = mMarket.don.GetUpperL(barIndex);
|
|
AddSRValue(selectedUpperL);
|
|
}
|
|
|
|
//
|
|
if (mMarket.don.IsSameLowerL(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedLowerL = mMarket.don.GetLowerL(barIndex);
|
|
AddSRValue(selectedLowerL);
|
|
}
|
|
|
|
//
|
|
// Long Market ...
|
|
|
|
//
|
|
if (lMarket.don.IsSameUpperO(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedUpperO = lMarket.don.GetUpperO(barIndex);
|
|
AddSRValue(selectedUpperO);
|
|
}
|
|
|
|
//
|
|
if (lMarket.don.IsSameLowerO(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedLowerO = lMarket.don.GetLowerO(barIndex);
|
|
AddSRValue(selectedLowerO);
|
|
}
|
|
|
|
//
|
|
if (lMarket.don.IsSameUpperC(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedUpperC = lMarket.don.GetUpperC(barIndex);
|
|
AddSRValue(selectedUpperC);
|
|
}
|
|
|
|
//
|
|
if (lMarket.don.IsSameLowerC(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedLowerC = lMarket.don.GetLowerC(barIndex);
|
|
AddSRValue(selectedLowerC);
|
|
}
|
|
|
|
//
|
|
if (lMarket.don.IsSameUpperH(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedUpperH = lMarket.don.GetUpperH(barIndex);
|
|
AddSRValue(selectedUpperH);
|
|
}
|
|
|
|
//
|
|
if (lMarket.don.IsSameLowerH(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedLowerH = lMarket.don.GetLowerH(barIndex);
|
|
AddSRValue(selectedLowerH);
|
|
}
|
|
|
|
//
|
|
if (lMarket.don.IsSameUpperL(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedUpperL = lMarket.don.GetUpperL(barIndex);
|
|
AddSRValue(selectedUpperL);
|
|
}
|
|
|
|
//
|
|
if (lMarket.don.IsSameLowerL(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedLowerL = lMarket.don.GetLowerL(barIndex);
|
|
AddSRValue(selectedLowerL);
|
|
}
|
|
|
|
//
|
|
// Hind Market ...
|
|
|
|
//
|
|
if (hMarket.don.IsSameUpperO(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedUpperO = hMarket.don.GetUpperO(barIndex);
|
|
AddSRValue(selectedUpperO);
|
|
}
|
|
|
|
//
|
|
if (hMarket.don.IsSameLowerO(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedLowerO = hMarket.don.GetLowerO(barIndex);
|
|
AddSRValue(selectedLowerO);
|
|
}
|
|
|
|
//
|
|
if (hMarket.don.IsSameUpperC(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedUpperC = hMarket.don.GetUpperC(barIndex);
|
|
AddSRValue(selectedUpperC);
|
|
}
|
|
|
|
//
|
|
if (hMarket.don.IsSameLowerC(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedLowerC = hMarket.don.GetLowerC(barIndex);
|
|
AddSRValue(selectedLowerC);
|
|
}
|
|
|
|
//
|
|
if (hMarket.don.IsSameUpperH(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedUpperH = hMarket.don.GetUpperH(barIndex);
|
|
AddSRValue(selectedUpperH);
|
|
}
|
|
|
|
//
|
|
if (hMarket.don.IsSameLowerH(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedLowerH = hMarket.don.GetLowerH(barIndex);
|
|
AddSRValue(selectedLowerH);
|
|
}
|
|
|
|
//
|
|
if (hMarket.don.IsSameUpperL(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedUpperL = hMarket.don.GetUpperL(barIndex);
|
|
AddSRValue(selectedUpperL);
|
|
}
|
|
|
|
//
|
|
if (hMarket.don.IsSameLowerL(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedLowerL = hMarket.don.GetLowerL(barIndex);
|
|
AddSRValue(selectedLowerL);
|
|
}
|
|
|
|
//
|
|
// XPV ...
|
|
|
|
//
|
|
// Short Market ...
|
|
|
|
//
|
|
if (sMarket.pv.IsSamePeak(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedPeak = sMarket.pv.GetPeak(barIndex);
|
|
AddSRValue(selectedPeak);
|
|
}
|
|
|
|
//
|
|
if (sMarket.pv.IsSameVale(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedVale = sMarket.pv.GetVale(barIndex);
|
|
AddSRValue(selectedVale);
|
|
}
|
|
|
|
//
|
|
if (sMarket.pv.IsSameFib1(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedFib1 = sMarket.pv.GetFib1(barIndex);
|
|
AddSRValue(selectedFib1);
|
|
}
|
|
|
|
//
|
|
if (sMarket.pv.IsSameFib2(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedFib2 = sMarket.pv.GetFib2(barIndex);
|
|
AddSRValue(selectedFib2);
|
|
}
|
|
|
|
//
|
|
if (sMarket.pv.IsSameFib3(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedFib3 = sMarket.pv.GetFib3(barIndex);
|
|
AddSRValue(selectedFib3);
|
|
}
|
|
|
|
//
|
|
if (sMarket.pv.IsSameFib4(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedFib4 = sMarket.pv.GetFib4(barIndex);
|
|
AddSRValue(selectedFib4);
|
|
}
|
|
|
|
//
|
|
if (sMarket.pv.IsSameFib5(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedFib5 = sMarket.pv.GetFib5(barIndex);
|
|
AddSRValue(selectedFib5);
|
|
}
|
|
|
|
//
|
|
if (sMarket.pv.IsSameSCHH(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedSCHH = sMarket.pv.GetSCHH(barIndex);
|
|
AddSRValue(selectedSCHH);
|
|
}
|
|
|
|
//
|
|
if (sMarket.pv.IsSameSCLL(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedSCLL = sMarket.pv.GetSCLL(barIndex);
|
|
AddSRValue(selectedSCLL);
|
|
}
|
|
|
|
//
|
|
if (sMarket.pv.IsSameMCHH(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedMCHH = sMarket.pv.GetMCHH(barIndex);
|
|
AddSRValue(selectedMCHH);
|
|
}
|
|
|
|
//
|
|
if (sMarket.pv.IsSameMCLL(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedMCLL = sMarket.pv.GetMCLL(barIndex);
|
|
AddSRValue(selectedMCLL);
|
|
}
|
|
|
|
//
|
|
if (sMarket.pv.IsSameLCHH(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedLCHH = sMarket.pv.GetLCHH(barIndex);
|
|
AddSRValue(selectedLCHH);
|
|
}
|
|
|
|
//
|
|
if (sMarket.pv.IsSameLCLL(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedLCLL = sMarket.pv.GetLCLL(barIndex);
|
|
AddSRValue(selectedLCLL);
|
|
}
|
|
|
|
//
|
|
if (sMarket.pv.IsSameHCHH(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedHCHH = sMarket.pv.GetHCHH(barIndex);
|
|
AddSRValue(selectedHCHH);
|
|
}
|
|
|
|
//
|
|
if (sMarket.pv.IsSameHCLL(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedHCLL = sMarket.pv.GetHCLL(barIndex);
|
|
AddSRValue(selectedHCLL);
|
|
}
|
|
|
|
//
|
|
// Medium Market ...
|
|
|
|
//
|
|
if (mMarket.pv.IsSamePeak(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedPeak = mMarket.pv.GetPeak(barIndex);
|
|
AddSRValue(selectedPeak);
|
|
}
|
|
|
|
//
|
|
if (mMarket.pv.IsSameVale(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedVale = mMarket.pv.GetVale(barIndex);
|
|
AddSRValue(selectedVale);
|
|
}
|
|
|
|
//
|
|
if (mMarket.pv.IsSameFib1(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedFib1 = mMarket.pv.GetFib1(barIndex);
|
|
AddSRValue(selectedFib1);
|
|
}
|
|
|
|
//
|
|
if (mMarket.pv.IsSameFib2(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedFib2 = mMarket.pv.GetFib2(barIndex);
|
|
AddSRValue(selectedFib2);
|
|
}
|
|
|
|
//
|
|
if (mMarket.pv.IsSameFib3(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedFib3 = mMarket.pv.GetFib3(barIndex);
|
|
AddSRValue(selectedFib3);
|
|
}
|
|
|
|
//
|
|
if (mMarket.pv.IsSameFib4(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedFib4 = mMarket.pv.GetFib4(barIndex);
|
|
AddSRValue(selectedFib4);
|
|
}
|
|
|
|
//
|
|
if (mMarket.pv.IsSameFib5(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedFib5 = mMarket.pv.GetFib5(barIndex);
|
|
AddSRValue(selectedFib5);
|
|
}
|
|
|
|
//
|
|
if (mMarket.pv.IsSameSCHH(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedSCHH = mMarket.pv.GetSCHH(barIndex);
|
|
AddSRValue(selectedSCHH);
|
|
}
|
|
|
|
//
|
|
if (mMarket.pv.IsSameSCLL(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedSCLL = mMarket.pv.GetSCLL(barIndex);
|
|
AddSRValue(selectedSCLL);
|
|
}
|
|
|
|
//
|
|
if (mMarket.pv.IsSameMCHH(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedMCHH = mMarket.pv.GetMCHH(barIndex);
|
|
AddSRValue(selectedMCHH);
|
|
}
|
|
|
|
//
|
|
if (mMarket.pv.IsSameMCLL(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedMCLL = mMarket.pv.GetMCLL(barIndex);
|
|
AddSRValue(selectedMCLL);
|
|
}
|
|
|
|
//
|
|
if (mMarket.pv.IsSameLCHH(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedLCHH = mMarket.pv.GetLCHH(barIndex);
|
|
AddSRValue(selectedLCHH);
|
|
}
|
|
|
|
//
|
|
if (mMarket.pv.IsSameLCLL(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedLCLL = mMarket.pv.GetLCLL(barIndex);
|
|
AddSRValue(selectedLCLL);
|
|
}
|
|
|
|
//
|
|
if (mMarket.pv.IsSameHCHH(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedHCHH = mMarket.pv.GetHCHH(barIndex);
|
|
AddSRValue(selectedHCHH);
|
|
}
|
|
|
|
//
|
|
if (mMarket.pv.IsSameHCLL(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedHCLL = mMarket.pv.GetHCLL(barIndex);
|
|
AddSRValue(selectedHCLL);
|
|
}
|
|
|
|
//
|
|
// Long Market ...
|
|
|
|
//
|
|
if (lMarket.pv.IsSamePeak(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedPeak = lMarket.pv.GetPeak(barIndex);
|
|
AddSRValue(selectedPeak);
|
|
}
|
|
|
|
//
|
|
if (lMarket.pv.IsSameVale(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedVale = lMarket.pv.GetVale(barIndex);
|
|
AddSRValue(selectedVale);
|
|
}
|
|
|
|
//
|
|
if (lMarket.pv.IsSameFib1(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedFib1 = lMarket.pv.GetFib1(barIndex);
|
|
AddSRValue(selectedFib1);
|
|
}
|
|
|
|
//
|
|
if (lMarket.pv.IsSameFib2(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedFib2 = lMarket.pv.GetFib2(barIndex);
|
|
AddSRValue(selectedFib2);
|
|
}
|
|
|
|
//
|
|
if (lMarket.pv.IsSameFib3(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedFib3 = lMarket.pv.GetFib3(barIndex);
|
|
AddSRValue(selectedFib3);
|
|
}
|
|
|
|
//
|
|
if (lMarket.pv.IsSameFib4(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedFib4 = lMarket.pv.GetFib4(barIndex);
|
|
AddSRValue(selectedFib4);
|
|
}
|
|
|
|
//
|
|
if (lMarket.pv.IsSameFib5(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedFib5 = lMarket.pv.GetFib5(barIndex);
|
|
AddSRValue(selectedFib5);
|
|
}
|
|
|
|
//
|
|
if (lMarket.pv.IsSameSCHH(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedSCHH = lMarket.pv.GetSCHH(barIndex);
|
|
AddSRValue(selectedSCHH);
|
|
}
|
|
|
|
//
|
|
if (lMarket.pv.IsSameSCLL(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedSCLL = lMarket.pv.GetSCLL(barIndex);
|
|
AddSRValue(selectedSCLL);
|
|
}
|
|
|
|
//
|
|
if (lMarket.pv.IsSameMCHH(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedMCHH = lMarket.pv.GetMCHH(barIndex);
|
|
AddSRValue(selectedMCHH);
|
|
}
|
|
|
|
//
|
|
if (lMarket.pv.IsSameMCLL(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedMCLL = lMarket.pv.GetMCLL(barIndex);
|
|
AddSRValue(selectedMCLL);
|
|
}
|
|
|
|
//
|
|
if (lMarket.pv.IsSameLCHH(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedLCHH = lMarket.pv.GetLCHH(barIndex);
|
|
AddSRValue(selectedLCHH);
|
|
}
|
|
|
|
//
|
|
if (lMarket.pv.IsSameLCLL(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedLCLL = lMarket.pv.GetLCLL(barIndex);
|
|
AddSRValue(selectedLCLL);
|
|
}
|
|
|
|
//
|
|
if (lMarket.pv.IsSameHCHH(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedHCHH = lMarket.pv.GetHCHH(barIndex);
|
|
AddSRValue(selectedHCHH);
|
|
}
|
|
|
|
//
|
|
if (lMarket.pv.IsSameHCLL(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedHCLL = lMarket.pv.GetHCLL(barIndex);
|
|
AddSRValue(selectedHCLL);
|
|
}
|
|
|
|
//
|
|
// Hind Market ...
|
|
|
|
//
|
|
if (hMarket.pv.IsSamePeak(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedPeak = hMarket.pv.GetPeak(barIndex);
|
|
AddSRValue(selectedPeak);
|
|
}
|
|
|
|
//
|
|
if (hMarket.pv.IsSameVale(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedVale = hMarket.pv.GetVale(barIndex);
|
|
AddSRValue(selectedVale);
|
|
}
|
|
|
|
//
|
|
if (hMarket.pv.IsSameFib1(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedFib1 = hMarket.pv.GetFib1(barIndex);
|
|
AddSRValue(selectedFib1);
|
|
}
|
|
|
|
//
|
|
if (hMarket.pv.IsSameFib2(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedFib2 = hMarket.pv.GetFib2(barIndex);
|
|
AddSRValue(selectedFib2);
|
|
}
|
|
|
|
//
|
|
if (hMarket.pv.IsSameFib3(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedFib3 = hMarket.pv.GetFib3(barIndex);
|
|
AddSRValue(selectedFib3);
|
|
}
|
|
|
|
//
|
|
if (hMarket.pv.IsSameFib4(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedFib4 = hMarket.pv.GetFib4(barIndex);
|
|
AddSRValue(selectedFib4);
|
|
}
|
|
|
|
//
|
|
if (hMarket.pv.IsSameFib5(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedFib5 = hMarket.pv.GetFib5(barIndex);
|
|
AddSRValue(selectedFib5);
|
|
}
|
|
|
|
//
|
|
if (hMarket.pv.IsSameSCHH(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedSCHH = hMarket.pv.GetSCHH(barIndex);
|
|
AddSRValue(selectedSCHH);
|
|
}
|
|
|
|
//
|
|
if (hMarket.pv.IsSameSCLL(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedSCLL = hMarket.pv.GetSCLL(barIndex);
|
|
AddSRValue(selectedSCLL);
|
|
}
|
|
|
|
//
|
|
if (hMarket.pv.IsSameMCHH(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedMCHH = hMarket.pv.GetMCHH(barIndex);
|
|
AddSRValue(selectedMCHH);
|
|
}
|
|
|
|
//
|
|
if (hMarket.pv.IsSameMCLL(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedMCLL = hMarket.pv.GetMCLL(barIndex);
|
|
AddSRValue(selectedMCLL);
|
|
}
|
|
|
|
//
|
|
if (hMarket.pv.IsSameLCHH(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedLCHH = hMarket.pv.GetLCHH(barIndex);
|
|
AddSRValue(selectedLCHH);
|
|
}
|
|
|
|
//
|
|
if (hMarket.pv.IsSameLCLL(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedLCLL = hMarket.pv.GetLCLL(barIndex);
|
|
AddSRValue(selectedLCLL);
|
|
}
|
|
|
|
//
|
|
if (hMarket.pv.IsSameHCHH(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedHCHH = hMarket.pv.GetHCHH(barIndex);
|
|
AddSRValue(selectedHCHH);
|
|
}
|
|
|
|
//
|
|
if (hMarket.pv.IsSameHCLL(barIndex, mNumberOfSRVerified))
|
|
{
|
|
//
|
|
double selectedHCLL = hMarket.pv.GetHCLL(barIndex);
|
|
AddSRValue(selectedHCLL);
|
|
}
|
|
|
|
//
|
|
// Add Candelstick Pivots ...
|
|
|
|
//
|
|
// XOHCL sPBar = sMarket.GetBar(barIndex + 1);
|
|
// AddSRValue(sPBar);
|
|
|
|
//
|
|
XOHCL mPBar = mMarket.GetBar(barIndex + 1);
|
|
AddSRValue(mPBar);
|
|
|
|
//
|
|
XOHCL lPBar = lMarket.GetBar(barIndex + 1);
|
|
AddSRValue(lPBar);
|
|
|
|
//
|
|
XOHCL hPBar = hMarket.GetBar(barIndex + 1);
|
|
AddSRValue(hPBar);
|
|
|
|
//
|
|
int after = CountSupportResistances();
|
|
|
|
//
|
|
if (after > before)
|
|
{
|
|
//
|
|
string message = "Found: " + ToString(after - before) + " new Pivot for " + GetSymbol() + " ...";
|
|
Print(message);
|
|
}
|
|
}
|
|
|
|
//
|
|
void FindSupportAndResistances()
|
|
{
|
|
//
|
|
bool hasEnough = HasEnoughSupportAndResistance();
|
|
if (hasEnough)
|
|
{
|
|
//
|
|
// if (IsNewBar())
|
|
// {
|
|
// UpdateSupportsAndResistances();
|
|
// }
|
|
return;
|
|
}
|
|
|
|
//
|
|
int idx = 0;
|
|
while (!HasEnoughSupportAndResistance())
|
|
{
|
|
//
|
|
UpdateSupportsAndResistances(idx);
|
|
|
|
//
|
|
if (HasEnoughSupportAndResistance())
|
|
{
|
|
break;
|
|
}
|
|
|
|
//
|
|
idx += 50;
|
|
|
|
//
|
|
// Print("idx: " + ToString(idx) + ", Count: " + ToString(CountSupportResistances()));
|
|
Print("Pivots: " + ToString(CountSupportResistances()));
|
|
}
|
|
}
|
|
|
|
//
|
|
void AddSRValue(double value)
|
|
{
|
|
//
|
|
if (value <= 0)
|
|
{
|
|
return;
|
|
}
|
|
|
|
//
|
|
AddIfNotExists(
|
|
value,
|
|
mSupportResistances //
|
|
);
|
|
}
|
|
|
|
//
|
|
void AddSRValue(XOHCL &bar)
|
|
{
|
|
//
|
|
if (!bar.IsValid())
|
|
{
|
|
return;
|
|
}
|
|
|
|
//
|
|
AddSRValue(bar.open);
|
|
AddSRValue(bar.high);
|
|
AddSRValue(bar.close);
|
|
AddSRValue(bar.low);
|
|
}
|
|
|
|
//
|
|
// Private ...
|
|
private:
|
|
//
|
|
// Props ...
|
|
|
|
//
|
|
int mNumberOfItems; // Number of Buffer Ites Read in Conditions ...
|
|
|
|
//
|
|
// Support and Resistance ...
|
|
|
|
//
|
|
int mNumberOfSRVerified; // Number of Verifications for Selecting Support and Resistances ...
|
|
|
|
//
|
|
int mMinRequiredSupportAndResistances; // Minimum Requirement Supports and Resistances ...
|
|
|
|
//
|
|
double mSupportResistances[]; // Holds Supports and Resistances ...
|
|
|
|
//
|
|
// Bullish and Bearish Scores ...
|
|
|
|
//
|
|
double mBullishScore[];
|
|
double mBearishScore[];
|
|
|
|
//
|
|
// Store Market Conditions Scores ...
|
|
void AddScores(X121MarketConditions &conditions)
|
|
{
|
|
//
|
|
static datetime lasrScoreAdded = NULL;
|
|
ENUM_TIMEFRAMES mPeriod = GetPeriod();
|
|
int seconds = PeriodSeconds(mPeriod);
|
|
datetime cTime = TimeCurrent();
|
|
int dateDiff = (int)cTime - (int)lasrScoreAdded;
|
|
bool canDo =
|
|
//
|
|
lasrScoreAdded == NULL
|
|
? true
|
|
: dateDiff >= seconds
|
|
//
|
|
;
|
|
if (!canDo)
|
|
{
|
|
return;
|
|
}
|
|
|
|
//
|
|
lasrScoreAdded = cTime;
|
|
|
|
//
|
|
double bullishScore = 0;
|
|
double bearishScore = 0;
|
|
conditions.GenerateScore(
|
|
bullishScore,
|
|
bearishScore //
|
|
);
|
|
|
|
//
|
|
ArraySetAsSeries(mBullishScore, false);
|
|
ArraySetAsSeries(mBearishScore, false);
|
|
|
|
//
|
|
Add(
|
|
bullishScore,
|
|
mBullishScore //
|
|
);
|
|
|
|
//
|
|
Add(
|
|
bearishScore,
|
|
mBearishScore //
|
|
);
|
|
|
|
//
|
|
ArraySetAsSeries(mBullishScore, true);
|
|
ArraySetAsSeries(mBearishScore, true);
|
|
}
|
|
|
|
//
|
|
// Find Bullish Score Averages ...
|
|
double GetBullishScoreAverage(
|
|
int start = 0,
|
|
int count = 7 //
|
|
)
|
|
{
|
|
//
|
|
return GetAverage(
|
|
mBullishScore,
|
|
start,
|
|
count //
|
|
);
|
|
}
|
|
|
|
//
|
|
// Find Bullish Scores Max Value ...
|
|
double GetBullishScoreMax(
|
|
int start = 0,
|
|
int count = 71 //
|
|
)
|
|
{
|
|
//
|
|
return GetMax(
|
|
mBullishScore,
|
|
start,
|
|
count //
|
|
);
|
|
}
|
|
|
|
//
|
|
// Find Bullish Scores Min Value ...
|
|
double GetBullishScoreMin(
|
|
int start = 0,
|
|
int count = 71 //
|
|
)
|
|
{
|
|
//
|
|
return GetMin(
|
|
mBullishScore,
|
|
start,
|
|
count //
|
|
);
|
|
}
|
|
|
|
//
|
|
// Find Bearish Score Averages ...
|
|
double GetBearishScoreAverage(
|
|
int start = 0,
|
|
int count = 7 //
|
|
)
|
|
{
|
|
//
|
|
return GetAverage(
|
|
mBearishScore,
|
|
start,
|
|
count //
|
|
);
|
|
}
|
|
|
|
//
|
|
// Find Bearish Scores Max Value ...
|
|
double GetBearishScoreMax(
|
|
int start = 0,
|
|
int count = 71 //
|
|
)
|
|
{
|
|
//
|
|
return GetMax(
|
|
mBearishScore,
|
|
start,
|
|
count //
|
|
);
|
|
}
|
|
|
|
//
|
|
// Find Bearish Scores Min Value ...
|
|
double GetBearishScoreMin(
|
|
int start = 0,
|
|
int count = 71 //
|
|
)
|
|
{
|
|
//
|
|
return GetMin(
|
|
mBearishScore,
|
|
start,
|
|
count //
|
|
);
|
|
}
|
|
|
|
//
|
|
bool IsScorePassedForLong()
|
|
{
|
|
//
|
|
double bullishScore = mBullishScore[0];
|
|
double bullishScoreAVG7 = GetBullishScoreAverage(0, 7);
|
|
|
|
//
|
|
double bearishScore = mBearishScore[0];
|
|
double bearishScoreAVG7 = GetBearishScoreAverage(0, 7);
|
|
|
|
//
|
|
bool result =
|
|
//
|
|
ArraySize(mBullishScore) >= 7 &&
|
|
ArraySize(mBearishScore) >= 7 &&
|
|
bullishScore > bearishScore &&
|
|
bullishScore > mBullishScore[1] &&
|
|
bullishScore > bullishScoreAVG7 &&
|
|
bearishScore < bearishScoreAVG7
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
bool IsScorePassedForShort()
|
|
{
|
|
|
|
//
|
|
double bullishScore = mBullishScore[0];
|
|
double bullishScoreAVG7 = GetBullishScoreAverage(0, 7);
|
|
|
|
//
|
|
double bearishScore = mBearishScore[0];
|
|
double bearishScoreAVG7 = GetBearishScoreAverage(0, 7);
|
|
|
|
//
|
|
bool result =
|
|
//
|
|
ArraySize(mBullishScore) >= 7 &&
|
|
ArraySize(mBearishScore) >= 7 &&
|
|
bearishScore > bullishScore &&
|
|
bearishScore > mBearishScore[1] &&
|
|
bearishScore > bearishScoreAVG7 &&
|
|
bullishScore < bullishScoreAVG7
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Signallers ...
|
|
|
|
//
|
|
bool mIsLongEnable;
|
|
bool mIsShortEnable;
|
|
|
|
//
|
|
bool mIsXSPSignalProviderEnable;
|
|
bool mIsX128SignalProviderEnable;
|
|
bool mIsX92SignalProviderEnable;
|
|
bool mIsX786SignalProviderEnable;
|
|
bool mIsX121SignalProviderEnable;
|
|
bool mIsX110SignalProviderEnable;
|
|
bool mIsXTESTSignalProviderEnable;
|
|
bool mIsXTDSignalProviderEnable;
|
|
bool mIsXTAMSignalProviderEnable;
|
|
bool mIsXSISignalProviderEnable;
|
|
bool mIsXTSFISignalProviderEnable;
|
|
bool mIsXOBDLHSignalProviderEnable;
|
|
bool mIsXCHMACCSignalProviderEnable;
|
|
bool mIsXCHMAMNSignalProviderEnable;
|
|
bool mIsXCHMAMXSignalProviderEnable;
|
|
|
|
//
|
|
//
|
|
// Detect Signal ...
|
|
bool HasSpecificSignal(
|
|
int barIndex, // Specified Bar Index ...
|
|
ENUM_POSITION_TYPE mType, // Specific Signal Type ...
|
|
string &provider, // Signal Provider ...
|
|
int &signalPusher, // Number Of Same Time Signals ...
|
|
X121MarketConditions &mConditions, // Specified Market Conition ...
|
|
double &providedSL,
|
|
double &providedTP,
|
|
double &providedR2r //
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
// Validate Signal Type is Enables ...
|
|
bool isLong = IsLong(mType);
|
|
result =
|
|
(isLong && mIsLongEnable) ||
|
|
(!isLong && mIsShortEnable);
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Now we have to Filter based on Enabled Signal Providers ...
|
|
|
|
//
|
|
// Long ...
|
|
if (isLong && mIsLongEnable)
|
|
{
|
|
//
|
|
XSignal lSignal;
|
|
|
|
//
|
|
signalPusher = 0;
|
|
|
|
//
|
|
bool hasXSPSignal = false;
|
|
bool hasXTESTSignal = false;
|
|
bool hasX786Signal = false;
|
|
bool hasX121Signal = false;
|
|
bool hasX110Signal = false;
|
|
bool hasX92Signal = false;
|
|
bool hasX128Signal = false;
|
|
bool hasXTDSignal = false;
|
|
bool hasXTAMSignal = false;
|
|
bool hasXSISignal = false;
|
|
bool hasXTSFISignal = false;
|
|
bool hasXOBDLHSignal = false;
|
|
bool hasXCHMACCSignal = false;
|
|
bool hasXCHMAMNSignal = false;
|
|
bool hasXCHMAMXSignal = false;
|
|
|
|
//
|
|
// XPS ...
|
|
if (mIsXSPSignalProviderEnable)
|
|
{
|
|
//
|
|
hasXSPSignal = XSPHasSpecifiedLongSignal(
|
|
mConditions,
|
|
providedSL,
|
|
providedTP,
|
|
providedR2r //
|
|
);
|
|
|
|
//
|
|
if (hasXSPSignal)
|
|
{
|
|
//
|
|
if (!IsValid(provider))
|
|
{
|
|
provider = ToString(XSP);
|
|
}
|
|
|
|
//
|
|
signalPusher++;
|
|
}
|
|
}
|
|
|
|
//
|
|
// XTEST ...
|
|
if (mIsXTESTSignalProviderEnable)
|
|
{
|
|
//
|
|
hasXTESTSignal = XTESTHasSpecifiedLongSignal(
|
|
mConditions,
|
|
providedSL,
|
|
providedTP,
|
|
providedR2r //
|
|
);
|
|
|
|
//
|
|
if (hasXTESTSignal)
|
|
{
|
|
//
|
|
if (!IsValid(provider))
|
|
{
|
|
provider = ToString(XTEST);
|
|
}
|
|
|
|
//
|
|
signalPusher++;
|
|
}
|
|
}
|
|
|
|
//
|
|
// X786 ...
|
|
if (mIsX786SignalProviderEnable)
|
|
{
|
|
//
|
|
hasX786Signal = X786HasSpecifiedLongSignal(
|
|
mConditions,
|
|
providedSL,
|
|
providedTP,
|
|
providedR2r //
|
|
);
|
|
|
|
//
|
|
if (hasX786Signal)
|
|
{
|
|
//
|
|
if (!IsValid(provider))
|
|
{
|
|
provider = ToString(X786);
|
|
}
|
|
|
|
//
|
|
signalPusher++;
|
|
}
|
|
}
|
|
|
|
//
|
|
// X121 ...
|
|
if (mIsX121SignalProviderEnable)
|
|
{
|
|
//
|
|
hasX121Signal = X121HasSpecifiedLongSignal(
|
|
mConditions,
|
|
providedSL,
|
|
providedTP,
|
|
providedR2r //
|
|
);
|
|
|
|
//
|
|
if (hasX121Signal)
|
|
{
|
|
//
|
|
if (!IsValid(provider))
|
|
{
|
|
provider = ToString(X121);
|
|
}
|
|
|
|
//
|
|
signalPusher++;
|
|
}
|
|
}
|
|
|
|
//
|
|
// X110 ...
|
|
if (mIsX110SignalProviderEnable)
|
|
{
|
|
//
|
|
hasX110Signal = X110HasSpecifiedLongSignal(
|
|
mConditions,
|
|
providedSL,
|
|
providedTP,
|
|
providedR2r //
|
|
);
|
|
|
|
//
|
|
if (hasX110Signal)
|
|
{
|
|
//
|
|
if (!IsValid(provider))
|
|
{
|
|
provider = ToString(X110);
|
|
}
|
|
|
|
//
|
|
signalPusher++;
|
|
}
|
|
}
|
|
|
|
//
|
|
// X92 ...
|
|
if (mIsX92SignalProviderEnable)
|
|
{
|
|
//
|
|
hasX92Signal = X92HasSpecifiedLongSignal(
|
|
mConditions,
|
|
providedSL,
|
|
providedTP,
|
|
providedR2r //
|
|
);
|
|
|
|
//
|
|
if (hasX92Signal)
|
|
{
|
|
//
|
|
if (!IsValid(provider))
|
|
{
|
|
provider = ToString(X92);
|
|
}
|
|
|
|
//
|
|
signalPusher++;
|
|
}
|
|
}
|
|
|
|
//
|
|
// X128 ...
|
|
if (mIsX128SignalProviderEnable)
|
|
{
|
|
//
|
|
hasX128Signal = X128HasSpecifiedLongSignal(
|
|
mConditions,
|
|
providedSL,
|
|
providedTP,
|
|
providedR2r //
|
|
);
|
|
|
|
//
|
|
if (hasX128Signal)
|
|
{
|
|
//
|
|
if (!IsValid(provider))
|
|
{
|
|
provider = ToString(X128);
|
|
}
|
|
|
|
//
|
|
signalPusher++;
|
|
}
|
|
}
|
|
|
|
//
|
|
// XTD ...
|
|
if (mIsXTDSignalProviderEnable)
|
|
{
|
|
//
|
|
hasXTDSignal = XTDHasSpecifiedLongSignal(
|
|
mConditions,
|
|
providedSL,
|
|
providedTP,
|
|
providedR2r //
|
|
);
|
|
|
|
//
|
|
if (hasXTDSignal)
|
|
{
|
|
//
|
|
if (!IsValid(provider))
|
|
{
|
|
provider = ToString(XTD);
|
|
}
|
|
|
|
//
|
|
signalPusher++;
|
|
}
|
|
}
|
|
|
|
//
|
|
// XTAM ...
|
|
if (mIsXTAMSignalProviderEnable)
|
|
{
|
|
//
|
|
hasXTAMSignal = XTAMHasSpecifiedLongSignal(
|
|
mConditions,
|
|
providedSL,
|
|
providedTP,
|
|
providedR2r //
|
|
);
|
|
|
|
//
|
|
if (hasXTAMSignal)
|
|
{
|
|
//
|
|
if (!IsValid(provider))
|
|
{
|
|
provider = ToString(XTAM);
|
|
}
|
|
|
|
//
|
|
signalPusher++;
|
|
}
|
|
}
|
|
|
|
//
|
|
// XSI ...
|
|
if (mIsXSISignalProviderEnable)
|
|
{
|
|
//
|
|
hasXSISignal = XSIHasSpecifiedLongSignal(
|
|
mConditions,
|
|
providedSL,
|
|
providedTP,
|
|
providedR2r //
|
|
);
|
|
|
|
//
|
|
if (hasXSISignal)
|
|
{
|
|
//
|
|
if (!IsValid(provider))
|
|
{
|
|
provider = ToString(XSI);
|
|
}
|
|
|
|
//
|
|
signalPusher++;
|
|
}
|
|
}
|
|
|
|
//
|
|
// XTSFI ...
|
|
if (mIsXTSFISignalProviderEnable)
|
|
{
|
|
//
|
|
hasXTSFISignal = XTSFIHasSpecifiedLongSignal(
|
|
mConditions,
|
|
providedSL,
|
|
providedTP,
|
|
providedR2r //
|
|
);
|
|
|
|
//
|
|
if (hasXTSFISignal)
|
|
{
|
|
//
|
|
if (!IsValid(provider))
|
|
{
|
|
provider = ToString(XTSFI);
|
|
}
|
|
|
|
//
|
|
signalPusher++;
|
|
}
|
|
}
|
|
|
|
//
|
|
// XOBDLH ...
|
|
if (mIsXOBDLHSignalProviderEnable)
|
|
{
|
|
//
|
|
hasXOBDLHSignal = XOBDLHHasSpecifiedLongSignal(
|
|
mConditions,
|
|
providedSL,
|
|
providedTP,
|
|
providedR2r //
|
|
);
|
|
|
|
//
|
|
if (hasXOBDLHSignal)
|
|
{
|
|
//
|
|
if (!IsValid(provider))
|
|
{
|
|
provider = ToString(XOBDLH);
|
|
}
|
|
|
|
//
|
|
signalPusher++;
|
|
}
|
|
}
|
|
|
|
//
|
|
// XCHMACC ...
|
|
if (mIsXCHMACCSignalProviderEnable)
|
|
{
|
|
//
|
|
hasXCHMACCSignal = XCHMACCHasSpecifiedLongSignal(
|
|
mConditions,
|
|
providedSL,
|
|
providedTP,
|
|
providedR2r //
|
|
);
|
|
|
|
//
|
|
if (hasXCHMACCSignal)
|
|
{
|
|
//
|
|
if (!IsValid(provider))
|
|
{
|
|
provider = ToString(XCHMACC);
|
|
}
|
|
|
|
//
|
|
signalPusher++;
|
|
}
|
|
}
|
|
|
|
//
|
|
// XCHMAMN ...
|
|
if (mIsXCHMAMNSignalProviderEnable)
|
|
{
|
|
//
|
|
hasXCHMAMNSignal = XCHMAMNHasSpecifiedLongSignal(
|
|
mConditions,
|
|
providedSL,
|
|
providedTP,
|
|
providedR2r //
|
|
);
|
|
|
|
//
|
|
if (hasXCHMAMNSignal)
|
|
{
|
|
//
|
|
if (!IsValid(provider))
|
|
{
|
|
provider = ToString(XCHMAMN);
|
|
}
|
|
|
|
//
|
|
signalPusher++;
|
|
}
|
|
}
|
|
|
|
//
|
|
// XCHMAMX ...
|
|
if (mIsXCHMAMXSignalProviderEnable)
|
|
{
|
|
//
|
|
hasXCHMAMXSignal = XCHMAMXHasSpecifiedLongSignal(
|
|
mConditions,
|
|
providedSL,
|
|
providedTP,
|
|
providedR2r //
|
|
);
|
|
|
|
//
|
|
if (hasXCHMAMXSignal)
|
|
{
|
|
//
|
|
if (!IsValid(provider))
|
|
{
|
|
provider = ToString(XCHMAMX);
|
|
}
|
|
|
|
//
|
|
signalPusher++;
|
|
}
|
|
}
|
|
|
|
//
|
|
result =
|
|
//
|
|
hasXSPSignal
|
|
//
|
|
||
|
|
//
|
|
hasXTESTSignal
|
|
//
|
|
||
|
|
//
|
|
hasX786Signal
|
|
//
|
|
||
|
|
//
|
|
hasX121Signal
|
|
//
|
|
||
|
|
//
|
|
hasX110Signal
|
|
//
|
|
||
|
|
//
|
|
hasX92Signal
|
|
//
|
|
||
|
|
//
|
|
hasX128Signal
|
|
//
|
|
;
|
|
|
|
//
|
|
if (result)
|
|
{
|
|
return result;
|
|
}
|
|
}
|
|
|
|
//
|
|
// Short ...
|
|
if (!isLong && mIsShortEnable)
|
|
{
|
|
//
|
|
XSignal sSignal;
|
|
|
|
//
|
|
signalPusher = 0;
|
|
|
|
//
|
|
bool hasXSPSignal = false;
|
|
bool hasXTESTSignal = false;
|
|
bool hasX786Signal = false;
|
|
bool hasX121Signal = false;
|
|
bool hasX110Signal = false;
|
|
bool hasX92Signal = false;
|
|
bool hasX128Signal = false;
|
|
bool hasXTDSignal = false;
|
|
bool hasXTAMSignal = false;
|
|
bool hasXSISignal = false;
|
|
bool hasXTSFISignal = false;
|
|
bool hasXOBDLHSignal = false;
|
|
bool hasXCHMACCSignal = false;
|
|
bool hasXCHMAMNSignal = false;
|
|
bool hasXCHMAMXSignal = false;
|
|
|
|
//
|
|
// XSP ...
|
|
if (mIsXSPSignalProviderEnable)
|
|
{
|
|
//
|
|
hasXSPSignal = XSPHasSpecifiedShortSignal(
|
|
mConditions,
|
|
providedSL,
|
|
providedTP,
|
|
providedR2r //
|
|
);
|
|
|
|
//
|
|
if (hasXSPSignal)
|
|
{
|
|
//
|
|
if (!IsValid(provider))
|
|
{
|
|
provider = ToString(XSP);
|
|
}
|
|
|
|
//
|
|
signalPusher++;
|
|
}
|
|
}
|
|
|
|
//
|
|
// XTEST ...
|
|
if (mIsXTESTSignalProviderEnable)
|
|
{
|
|
//
|
|
hasXTESTSignal = XTESTHasSpecifiedShortSignal(
|
|
mConditions,
|
|
providedSL,
|
|
providedTP,
|
|
providedR2r //
|
|
);
|
|
|
|
//
|
|
if (hasXTESTSignal)
|
|
{
|
|
//
|
|
if (!IsValid(provider))
|
|
{
|
|
provider = ToString(XTEST);
|
|
}
|
|
|
|
//
|
|
signalPusher++;
|
|
}
|
|
}
|
|
|
|
//
|
|
// X786 ...
|
|
if (mIsX786SignalProviderEnable)
|
|
{
|
|
//
|
|
hasX786Signal = X786HasSpecifiedShortSignal(
|
|
mConditions,
|
|
providedSL,
|
|
providedTP,
|
|
providedR2r //
|
|
);
|
|
|
|
//
|
|
if (hasX786Signal)
|
|
{
|
|
//
|
|
if (!IsValid(provider))
|
|
{
|
|
provider = ToString(X786);
|
|
}
|
|
|
|
//
|
|
signalPusher++;
|
|
}
|
|
}
|
|
|
|
//
|
|
// X121 ...
|
|
if (mIsX121SignalProviderEnable)
|
|
{
|
|
//
|
|
hasX121Signal = X121HasSpecifiedShortSignal(
|
|
mConditions,
|
|
providedSL,
|
|
providedTP,
|
|
providedR2r //
|
|
);
|
|
|
|
//
|
|
if (hasX121Signal)
|
|
{
|
|
//
|
|
if (!IsValid(provider))
|
|
{
|
|
provider = ToString(X121);
|
|
}
|
|
|
|
//
|
|
signalPusher++;
|
|
}
|
|
}
|
|
|
|
//
|
|
// X110 ...
|
|
if (mIsX110SignalProviderEnable)
|
|
{
|
|
//
|
|
hasX110Signal = X110HasSpecifiedShortSignal(
|
|
mConditions,
|
|
providedSL,
|
|
providedTP,
|
|
providedR2r //
|
|
);
|
|
|
|
//
|
|
if (hasX110Signal)
|
|
{
|
|
//
|
|
if (!IsValid(provider))
|
|
{
|
|
provider = ToString(X110);
|
|
}
|
|
|
|
//
|
|
signalPusher++;
|
|
}
|
|
}
|
|
|
|
//
|
|
// X92 ...
|
|
if (mIsX92SignalProviderEnable)
|
|
{
|
|
//
|
|
hasX92Signal = X92HasSpecifiedShortSignal(
|
|
mConditions,
|
|
providedSL,
|
|
providedTP,
|
|
providedR2r //
|
|
);
|
|
|
|
//
|
|
if (hasX92Signal)
|
|
{
|
|
//
|
|
if (!IsValid(provider))
|
|
{
|
|
provider = ToString(X92);
|
|
}
|
|
|
|
//
|
|
signalPusher++;
|
|
}
|
|
}
|
|
|
|
//
|
|
// X128 ...
|
|
if (mIsX128SignalProviderEnable)
|
|
{
|
|
//
|
|
hasX128Signal = X128HasSpecifiedShortSignal(
|
|
mConditions,
|
|
providedSL,
|
|
providedTP,
|
|
providedR2r //
|
|
);
|
|
|
|
//
|
|
if (hasX128Signal)
|
|
{
|
|
//
|
|
if (!IsValid(provider))
|
|
{
|
|
provider = ToString(X128);
|
|
}
|
|
|
|
//
|
|
signalPusher++;
|
|
}
|
|
}
|
|
|
|
//
|
|
// XTD ...
|
|
if (mIsXTDSignalProviderEnable)
|
|
{
|
|
//
|
|
hasXTDSignal = XTDHasSpecifiedShortSignal(
|
|
mConditions,
|
|
providedSL,
|
|
providedTP,
|
|
providedR2r //
|
|
);
|
|
|
|
//
|
|
if (hasXTDSignal)
|
|
{
|
|
//
|
|
if (!IsValid(provider))
|
|
{
|
|
provider = ToString(XTD);
|
|
}
|
|
|
|
//
|
|
signalPusher++;
|
|
}
|
|
}
|
|
|
|
//
|
|
// XTAM ...
|
|
if (mIsXTAMSignalProviderEnable)
|
|
{
|
|
//
|
|
hasXTAMSignal = XTAMHasSpecifiedShortSignal(
|
|
mConditions,
|
|
providedSL,
|
|
providedTP,
|
|
providedR2r //
|
|
);
|
|
|
|
//
|
|
if (hasXTAMSignal)
|
|
{
|
|
//
|
|
if (!IsValid(provider))
|
|
{
|
|
provider = ToString(XTAM);
|
|
}
|
|
|
|
//
|
|
signalPusher++;
|
|
}
|
|
}
|
|
|
|
//
|
|
// XSI ...
|
|
if (mIsXSISignalProviderEnable)
|
|
{
|
|
//
|
|
hasXSISignal = XSIHasSpecifiedShortSignal(
|
|
mConditions,
|
|
providedSL,
|
|
providedTP,
|
|
providedR2r //
|
|
);
|
|
|
|
//
|
|
if (hasXSISignal)
|
|
{
|
|
//
|
|
if (!IsValid(provider))
|
|
{
|
|
provider = ToString(XSI);
|
|
}
|
|
|
|
//
|
|
signalPusher++;
|
|
}
|
|
}
|
|
|
|
//
|
|
// XTSFI ...
|
|
if (mIsXTSFISignalProviderEnable)
|
|
{
|
|
//
|
|
hasXTSFISignal = XTSFIHasSpecifiedShortSignal(
|
|
mConditions,
|
|
providedSL,
|
|
providedTP,
|
|
providedR2r //
|
|
);
|
|
|
|
//
|
|
if (hasXTSFISignal)
|
|
{
|
|
//
|
|
if (!IsValid(provider))
|
|
{
|
|
provider = ToString(XTSFI);
|
|
}
|
|
|
|
//
|
|
signalPusher++;
|
|
}
|
|
}
|
|
|
|
//
|
|
// XOBDLH ...
|
|
if (mIsXOBDLHSignalProviderEnable)
|
|
{
|
|
//
|
|
hasXOBDLHSignal = XOBDLHHasSpecifiedShortSignal(
|
|
mConditions,
|
|
providedSL,
|
|
providedTP,
|
|
providedR2r //
|
|
);
|
|
|
|
//
|
|
if (hasXOBDLHSignal)
|
|
{
|
|
//
|
|
if (!IsValid(provider))
|
|
{
|
|
provider = ToString(XOBDLH);
|
|
}
|
|
|
|
//
|
|
signalPusher++;
|
|
}
|
|
}
|
|
|
|
//
|
|
// XCHMACC ...
|
|
if (mIsXCHMACCSignalProviderEnable)
|
|
{
|
|
//
|
|
hasXCHMACCSignal = XCHMACCHasSpecifiedShortSignal(
|
|
mConditions,
|
|
providedSL,
|
|
providedTP,
|
|
providedR2r //
|
|
);
|
|
|
|
//
|
|
if (hasXCHMACCSignal)
|
|
{
|
|
//
|
|
if (!IsValid(provider))
|
|
{
|
|
provider = ToString(XCHMACC);
|
|
}
|
|
|
|
//
|
|
signalPusher++;
|
|
}
|
|
}
|
|
|
|
//
|
|
// XCHMAMN ...
|
|
if (mIsXCHMAMNSignalProviderEnable)
|
|
{
|
|
//
|
|
hasXCHMAMNSignal = XCHMAMNHasSpecifiedShortSignal(
|
|
mConditions,
|
|
providedSL,
|
|
providedTP,
|
|
providedR2r //
|
|
);
|
|
|
|
//
|
|
if (hasXCHMAMNSignal)
|
|
{
|
|
//
|
|
if (!IsValid(provider))
|
|
{
|
|
provider = ToString(XCHMAMN);
|
|
}
|
|
|
|
//
|
|
signalPusher++;
|
|
}
|
|
}
|
|
|
|
//
|
|
// XCHMAMX ...
|
|
if (mIsXCHMAMXSignalProviderEnable)
|
|
{
|
|
//
|
|
hasXCHMAMXSignal = XCHMAMXHasSpecifiedShortSignal(
|
|
mConditions,
|
|
providedSL,
|
|
providedTP,
|
|
providedR2r //
|
|
);
|
|
|
|
//
|
|
if (hasXCHMAMXSignal)
|
|
{
|
|
//
|
|
if (!IsValid(provider))
|
|
{
|
|
provider = ToString(XCHMAMX);
|
|
}
|
|
|
|
//
|
|
signalPusher++;
|
|
}
|
|
}
|
|
|
|
//
|
|
result =
|
|
//
|
|
hasXSPSignal
|
|
//
|
|
||
|
|
//
|
|
hasXTESTSignal
|
|
//
|
|
||
|
|
//
|
|
hasX786Signal
|
|
//
|
|
||
|
|
//
|
|
hasX121Signal
|
|
//
|
|
||
|
|
//
|
|
hasX110Signal
|
|
//
|
|
||
|
|
//
|
|
hasX92Signal
|
|
//
|
|
||
|
|
//
|
|
hasX128Signal
|
|
//
|
|
||
|
|
//
|
|
hasXTDSignal
|
|
//
|
|
||
|
|
//
|
|
hasXTAMSignal
|
|
//
|
|
||
|
|
//
|
|
hasXSISignal
|
|
//
|
|
||
|
|
//
|
|
hasXTSFISignal
|
|
//
|
|
||
|
|
//
|
|
hasXOBDLHSignal
|
|
//
|
|
||
|
|
//
|
|
hasXCHMACCSignal
|
|
//
|
|
||
|
|
//
|
|
hasXCHMAMNSignal
|
|
//
|
|
||
|
|
//
|
|
hasXCHMAMXSignal
|
|
//
|
|
;
|
|
|
|
//
|
|
if (result)
|
|
{
|
|
return result;
|
|
}
|
|
}
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
void CalculateConditions(
|
|
X121MarketConditions &mConditions, // Market Conditions Result
|
|
int barIndex = 0 // Specified Bar Index
|
|
)
|
|
{
|
|
//
|
|
mConditions.Clear();
|
|
|
|
//
|
|
if (barIndex < 0)
|
|
{
|
|
barIndex = 0;
|
|
}
|
|
|
|
//
|
|
if (barIndex >= CountBars())
|
|
{
|
|
barIndex = CountBars() + 2;
|
|
}
|
|
|
|
//
|
|
int curr = barIndex + 1;
|
|
int prev = curr + 1;
|
|
int mLength = 10;
|
|
int mFrom = curr + mLength;
|
|
|
|
//
|
|
mConditions.symbol = GetSymbol();
|
|
mConditions.period = GetPeriod();
|
|
mConditions.time = iTime(
|
|
mConditions.symbol,
|
|
mConditions.period,
|
|
barIndex //
|
|
);
|
|
|
|
//
|
|
GetBars(
|
|
mConditions.bars,
|
|
mConditions.symbol,
|
|
mConditions.period,
|
|
barIndex,
|
|
mNumberOfItems //
|
|
);
|
|
|
|
//
|
|
// Current Market Specified ...
|
|
|
|
//
|
|
// XTM ...
|
|
tmHelper.CopyMain(
|
|
barIndex,
|
|
mNumberOfItems,
|
|
mConditions.tms);
|
|
//
|
|
mConditions.isXTMPeak = IsIncreasing(
|
|
mFrom,
|
|
curr,
|
|
mConditions.tms);
|
|
|
|
//
|
|
mConditions.isXTMVale = IsDecreasing(
|
|
mFrom,
|
|
curr,
|
|
mConditions.tms);
|
|
|
|
//
|
|
mConditions.isXTMBullish = mConditions.bars[curr].low > mConditions.tms[curr];
|
|
bool isXTMBullishPrev = mConditions.bars[prev].low > mConditions.tms[prev];
|
|
|
|
//
|
|
mConditions.isXTMBearish = mConditions.bars[curr].high < mConditions.tms[curr];
|
|
bool isXTMBearishPrev = mConditions.bars[prev].high < mConditions.tms[prev];
|
|
|
|
//
|
|
mConditions.isXTMNeutural = !mConditions.isXTMBullish && !mConditions.isXTMBearish;
|
|
bool isXTMNeuturalPrev = !isXTMBullishPrev && !isXTMBearishPrev;
|
|
|
|
//
|
|
mConditions.isXTMEndBullish =
|
|
//
|
|
!mConditions.isXTMBullish &&
|
|
isXTMBullishPrev
|
|
//
|
|
;
|
|
|
|
//
|
|
mConditions.isXTMEndBearish =
|
|
//
|
|
!mConditions.isXTMBearish &&
|
|
isXTMBearishPrev
|
|
//
|
|
;
|
|
|
|
//
|
|
mConditions.isXTMStartBullish =
|
|
//
|
|
mConditions.isXTMBullish &&
|
|
!isXTMBullishPrev
|
|
//
|
|
;
|
|
|
|
//
|
|
mConditions.isXTMStartBearish =
|
|
//
|
|
mConditions.isXTMBearish &&
|
|
!isXTMBearishPrev
|
|
//
|
|
;
|
|
|
|
//
|
|
mConditions.isXTMEndBullishByNeutural =
|
|
//
|
|
mConditions.isXTMNeutural &&
|
|
isXTMBullishPrev
|
|
//
|
|
;
|
|
|
|
//
|
|
mConditions.isXTMEndBearishByNeutural =
|
|
//
|
|
mConditions.isXTMNeutural &&
|
|
isXTMBearishPrev
|
|
//
|
|
;
|
|
|
|
//
|
|
mConditions.isXTMStartBullishAfterNeutural =
|
|
//
|
|
mConditions.isXTMBullish &&
|
|
isXTMNeuturalPrev
|
|
//
|
|
;
|
|
|
|
//
|
|
mConditions.isXTMStartBearishAfterNeutural =
|
|
//
|
|
mConditions.isXTMBearish &&
|
|
isXTMNeuturalPrev
|
|
//
|
|
;
|
|
|
|
//
|
|
// XAMA ...
|
|
amaHelper.CopyMain(
|
|
barIndex,
|
|
mNumberOfItems,
|
|
mConditions.amas);
|
|
|
|
//
|
|
mConditions.isXAMAPeak = IsIncreasing(
|
|
mFrom,
|
|
curr,
|
|
mConditions.amas);
|
|
|
|
//
|
|
mConditions.isXAMAVale = IsDecreasing(
|
|
mFrom,
|
|
curr,
|
|
mConditions.amas);
|
|
|
|
//
|
|
mConditions.isXAMABullish = mConditions.bars[curr].low > mConditions.amas[curr];
|
|
bool isXAMABullishPrev = mConditions.bars[prev].low > mConditions.amas[prev];
|
|
|
|
//
|
|
mConditions.isXAMABearish = mConditions.bars[curr].high < mConditions.amas[curr];
|
|
bool isXAMABearishPrev = mConditions.bars[prev].high < mConditions.amas[prev];
|
|
|
|
//
|
|
mConditions.isXAMANeutural = !mConditions.isXAMABullish && !mConditions.isXAMABearish;
|
|
bool isXAMANeuturalPrev = !isXAMABullishPrev && !isXAMABearishPrev;
|
|
|
|
//
|
|
mConditions.isXAMAEndBullish =
|
|
//
|
|
!mConditions.isXAMABullish &&
|
|
isXAMABullishPrev
|
|
//
|
|
;
|
|
|
|
//
|
|
mConditions.isXAMAEndBearish =
|
|
//
|
|
!mConditions.isXAMABearish &&
|
|
isXAMABearishPrev
|
|
//
|
|
;
|
|
|
|
//
|
|
mConditions.isXAMAStartBullish =
|
|
//
|
|
mConditions.isXAMABullish &&
|
|
!isXAMABullishPrev
|
|
//
|
|
;
|
|
|
|
//
|
|
mConditions.isXAMAStartBearish =
|
|
//
|
|
mConditions.isXAMABearish &&
|
|
!isXAMABearishPrev
|
|
//
|
|
;
|
|
|
|
//
|
|
mConditions.isXAMAEndBullishByNeutural =
|
|
//
|
|
mConditions.isXAMANeutural &&
|
|
isXAMABullishPrev
|
|
//
|
|
;
|
|
|
|
//
|
|
mConditions.isXAMAEndBearishByNeutural =
|
|
//
|
|
mConditions.isXAMANeutural &&
|
|
isXAMABearishPrev
|
|
//
|
|
;
|
|
|
|
//
|
|
mConditions.isXAMAStartBullishAfterNeutural =
|
|
//
|
|
mConditions.isXAMABullish &&
|
|
isXAMANeuturalPrev
|
|
//
|
|
;
|
|
|
|
//
|
|
mConditions.isXAMAStartBearishAfterNeutural =
|
|
//
|
|
mConditions.isXAMABearish &&
|
|
isXAMANeuturalPrev
|
|
//
|
|
;
|
|
|
|
//
|
|
// XFI ...
|
|
fiHelper.CopyMain(
|
|
barIndex,
|
|
mNumberOfItems,
|
|
mConditions.fis);
|
|
|
|
//
|
|
mConditions.isXFIPeak = IsIncreasing(
|
|
mFrom,
|
|
curr,
|
|
mConditions.fis);
|
|
|
|
//
|
|
mConditions.isXFIVale = IsDecreasing(
|
|
mFrom,
|
|
curr,
|
|
mConditions.fis);
|
|
|
|
//
|
|
mConditions.isXFIOverZero = mConditions.fis[curr] > 0;
|
|
|
|
//
|
|
mConditions.isXFICrossedOverZero =
|
|
//
|
|
mConditions.isXFIOverZero &&
|
|
mConditions.fis[prev] <= 0
|
|
//
|
|
;
|
|
|
|
//
|
|
mConditions.isXFIUnderZero = mConditions.fis[curr] < 0;
|
|
|
|
//
|
|
mConditions.isXFICrossedUnderZero =
|
|
//
|
|
mConditions.isXFIUnderZero &&
|
|
mConditions.fis[prev] >= 0
|
|
//
|
|
;
|
|
|
|
//
|
|
// XOBD ...
|
|
obdHelper.CopyMain(
|
|
barIndex,
|
|
mNumberOfItems,
|
|
mConditions.obds);
|
|
|
|
//
|
|
mConditions.isXOBDSwingLow = mConditions.obds[curr] == X_SWING_LOW;
|
|
mConditions.isXOBDSwingHigh = mConditions.obds[curr] == X_SWING_HIGH;
|
|
|
|
//
|
|
// XRSI ...
|
|
rsiHelper.CopyMain(
|
|
barIndex,
|
|
mNumberOfItems,
|
|
mConditions.rsis);
|
|
|
|
//
|
|
double shortEntryValue = mInputs.rsiInputs.shortEntryValue;
|
|
double shortExitValue = mInputs.rsiInputs.shortExitValue;
|
|
double longEntryValue = mInputs.rsiInputs.longEntryValue;
|
|
double longExitValue = mInputs.rsiInputs.longExitValue;
|
|
|
|
//
|
|
mConditions.isXRSIPeak = IsIncreasing(
|
|
mFrom,
|
|
curr,
|
|
mConditions.rsis);
|
|
|
|
//
|
|
mConditions.isXRSIVale = IsDecreasing(
|
|
mFrom,
|
|
curr,
|
|
mConditions.rsis);
|
|
|
|
//
|
|
mConditions.isXRSICrossedOverLongExit =
|
|
//
|
|
mConditions.rsis[curr] > longExitValue &&
|
|
mConditions.rsis[prev] <= longExitValue;
|
|
//
|
|
;
|
|
|
|
//
|
|
mConditions.isXRSICrossedOverLongEntry =
|
|
//
|
|
mConditions.rsis[curr] > longEntryValue &&
|
|
mConditions.rsis[prev] <= longEntryValue;
|
|
//
|
|
;
|
|
|
|
//
|
|
mConditions.isXRSICrossedUnderShortExit =
|
|
//
|
|
mConditions.rsis[curr] < shortExitValue &&
|
|
mConditions.rsis[prev] >= shortExitValue;
|
|
//
|
|
;
|
|
|
|
//
|
|
mConditions.isXRSICrossedUnderShortEntry =
|
|
//
|
|
mConditions.rsis[curr] < shortEntryValue &&
|
|
mConditions.rsis[prev] >= shortEntryValue;
|
|
//
|
|
;
|
|
|
|
//
|
|
// XLH ...
|
|
|
|
//
|
|
// HH ...
|
|
lhHelper.CopyHH(
|
|
barIndex,
|
|
mNumberOfItems,
|
|
mConditions.lhHhs);
|
|
|
|
//
|
|
// LL ...
|
|
lhHelper.CopyLL(
|
|
barIndex,
|
|
mNumberOfItems,
|
|
mConditions.lhLls);
|
|
|
|
//
|
|
// Signal ...
|
|
lhHelper.CopySignal(
|
|
barIndex,
|
|
mNumberOfItems,
|
|
mConditions.lhSignals);
|
|
|
|
//
|
|
mConditions.isXLHHHIncreased = IsIncreasing(
|
|
mFrom,
|
|
curr,
|
|
mConditions.lhHhs);
|
|
|
|
//
|
|
mConditions.isXLHHHDecreased = IsDecreasing(
|
|
mFrom,
|
|
curr,
|
|
mConditions.lhHhs);
|
|
|
|
//
|
|
mConditions.isXLHLLIncreased = IsIncreasing(
|
|
mFrom,
|
|
curr,
|
|
mConditions.lhLls);
|
|
|
|
//
|
|
mConditions.isXLHLLDecreased = IsDecreasing(
|
|
mFrom,
|
|
curr,
|
|
mConditions.lhLls);
|
|
|
|
//
|
|
mConditions.isXLHLowAttachedLL = mConditions.bars[curr].low == mConditions.lhLls[curr];
|
|
|
|
//
|
|
mConditions.isXLHHighAttachedHH = mConditions.bars[curr].high == mConditions.lhHhs[curr];
|
|
;
|
|
|
|
//
|
|
mConditions.isXLHHHSameInLength = IsSame(mConditions.lhHhs);
|
|
|
|
//
|
|
mConditions.isXLHLLSameInLength = IsSame(mConditions.lhLls);
|
|
|
|
//
|
|
mConditions.isXLHPriceOverSignal = mConditions.bars[curr].low > mConditions.lhSignals[curr];
|
|
|
|
//
|
|
mConditions.isXLHPriceUnderSignal = mConditions.bars[curr].high < mConditions.lhSignals[curr];
|
|
|
|
//
|
|
mConditions.isXLHPriceInSignalRange = !mConditions.isXLHPriceOverSignal && !mConditions.isXLHPriceUnderSignal;
|
|
|
|
//
|
|
mConditions.isXLHPriceCrossedOverSignal =
|
|
//
|
|
mConditions.isXLHPriceOverSignal &&
|
|
!(mConditions.bars[prev].low > mConditions.lhSignals[prev])
|
|
//
|
|
;
|
|
|
|
//
|
|
mConditions.isXLHPriceCrossedUnderSignal =
|
|
//
|
|
mConditions.isXLHPriceUnderSignal &&
|
|
!(mConditions.bars[curr].high < mConditions.lhSignals[curr])
|
|
//
|
|
;
|
|
|
|
//
|
|
// XTD ...
|
|
|
|
//
|
|
// Bullish ...
|
|
tdHelper.CopyBullish(
|
|
barIndex,
|
|
mNumberOfItems,
|
|
mConditions.tdBullishs);
|
|
|
|
//
|
|
// Bearish ...
|
|
tdHelper.CopyBearish(
|
|
barIndex,
|
|
mNumberOfItems,
|
|
mConditions.tdBearishs);
|
|
|
|
//
|
|
// Signal ...
|
|
tdHelper.CopySignal(
|
|
barIndex,
|
|
mNumberOfItems,
|
|
mConditions.tdSignals);
|
|
|
|
//
|
|
mConditions.isXTDSignalPeak = IsIncreasing(
|
|
mFrom,
|
|
curr,
|
|
mConditions.tdSignals);
|
|
|
|
//
|
|
mConditions.isXTDSignalVale = IsDecreasing(
|
|
mFrom,
|
|
curr,
|
|
mConditions.tdSignals);
|
|
|
|
//
|
|
mConditions.isXTDBullishPeak = IsIncreasing(
|
|
mFrom,
|
|
curr,
|
|
mConditions.tdBullishs);
|
|
|
|
//
|
|
mConditions.isXTDBullishVale = IsDecreasing(
|
|
mFrom,
|
|
curr,
|
|
mConditions.tdBullishs);
|
|
|
|
//
|
|
mConditions.isXTDBearishPeak = IsIncreasing(
|
|
mFrom,
|
|
curr,
|
|
mConditions.tdBearishs);
|
|
|
|
//
|
|
mConditions.isXTDBearishVale = IsDecreasing(
|
|
mFrom,
|
|
curr,
|
|
mConditions.tdBearishs);
|
|
|
|
//
|
|
mConditions.isXTDBullOverBear = mConditions.tdBullishs[curr] > mConditions.tdBearishs[curr];
|
|
bool isXTDBullOverBearPrev = mConditions.tdBullishs[prev] > mConditions.tdBearishs[prev];
|
|
|
|
//
|
|
mConditions.isXTDBullUnderBear = mConditions.tdBullishs[curr] < mConditions.tdBearishs[curr];
|
|
bool isXTDBullUnderBearPrev = mConditions.tdBullishs[prev] < mConditions.tdBearishs[prev];
|
|
|
|
//
|
|
mConditions.isXTDSignalOverBear = mConditions.tdSignals[curr] > mConditions.tdBearishs[curr];
|
|
bool isXTDSignalOverBearPrev = mConditions.tdSignals[prev] > mConditions.tdBearishs[prev];
|
|
|
|
//
|
|
mConditions.isXTDSignalUnderBear = mConditions.tdSignals[curr] < mConditions.tdBearishs[curr];
|
|
bool isXTDSignalUnderBearPrev = mConditions.tdSignals[prev] < mConditions.tdBearishs[prev];
|
|
|
|
//
|
|
mConditions.isXTDBullCrossedOverBear =
|
|
mConditions.isXTDBullOverBear &&
|
|
!isXTDBullOverBearPrev;
|
|
|
|
//
|
|
mConditions.isXTDBullCrossedUnderBear =
|
|
mConditions.isXTDBullUnderBear &&
|
|
!isXTDBullUnderBearPrev;
|
|
|
|
//
|
|
mConditions.isXTDSignalCrossedOverBear =
|
|
mConditions.isXTDSignalOverBear &&
|
|
!isXTDSignalOverBearPrev;
|
|
|
|
//
|
|
mConditions.isXTDSignalCrossedUnderBear =
|
|
mConditions.isXTDSignalUnderBear &&
|
|
!isXTDSignalUnderBearPrev;
|
|
|
|
//
|
|
// 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);
|
|
|
|
//
|
|
double current = mConditions.tsCurrents[curr];
|
|
double currentPrev = mConditions.tsCurrents[prev];
|
|
|
|
//
|
|
double nearest = mConditions.tsNearests[curr];
|
|
double nearestPrev = mConditions.tsNearests[prev];
|
|
|
|
//
|
|
double mediest = mConditions.tsMediests[curr];
|
|
double mediestPrev = mConditions.tsMediests[prev];
|
|
|
|
//
|
|
double farest = mConditions.tsFarests[curr];
|
|
double farestPrev = mConditions.tsFarests[prev];
|
|
|
|
//
|
|
double tsValues[] = {current, nearest, mediest, farest};
|
|
double tsMax = GetMax(tsValues);
|
|
double tsMin = GetMin(tsValues);
|
|
|
|
//
|
|
double tsPrevValues[] = {currentPrev, nearestPrev, mediestPrev, farestPrev};
|
|
double tsPrevMax = GetMax(tsPrevValues);
|
|
double tsPrevMin = GetMin(tsPrevValues);
|
|
|
|
//
|
|
mConditions.isXTSAllSame =
|
|
//
|
|
current == nearest &&
|
|
nearest == mediest &&
|
|
mediest == farest
|
|
//
|
|
;
|
|
|
|
//
|
|
mConditions.isXTSCurrentMin = current == tsMin;
|
|
mConditions.isXTSCurrentMax = current == tsMax;
|
|
|
|
//
|
|
mConditions.isXTSCurrentOverFarest = current > farest;
|
|
bool isXTSCurrentOverFarestPrev = currentPrev > farestPrev;
|
|
|
|
//
|
|
mConditions.isXTSCurrentOverNearest = current > nearest;
|
|
bool isXTSCurrentOverNearestPrev = currentPrev > nearestPrev;
|
|
|
|
//
|
|
mConditions.isXTSCurrentOverMediest = current > mediest;
|
|
bool isXTSCurrentOverMediestPrev = currentPrev > mediestPrev;
|
|
|
|
//
|
|
mConditions.isXTSCurrentUnderFarest = current < farest;
|
|
bool isXTSCurrentUnderFarestPrev = currentPrev < farestPrev;
|
|
|
|
//
|
|
mConditions.isXTSCurrentUnderNearest = current < nearest;
|
|
bool isXTSCurrentUnderNearestPrev = currentPrev < nearestPrev;
|
|
|
|
//
|
|
mConditions.isXTSCurrentUnderMediest = current < mediest;
|
|
bool isXTSCurrentUnderMediestPrev = currentPrev < mediestPrev;
|
|
|
|
//
|
|
mConditions.isXTSCurrentCrossedOverFarest =
|
|
mConditions.isXTSCurrentOverFarest &&
|
|
!isXTSCurrentOverFarestPrev;
|
|
|
|
//
|
|
mConditions.isXTSCurrentCrossedOverNearest =
|
|
mConditions.isXTSCurrentOverNearest &&
|
|
!isXTSCurrentOverNearestPrev;
|
|
|
|
//
|
|
mConditions.isXTSCurrentCrossedOverMediest =
|
|
mConditions.isXTSCurrentOverMediest &&
|
|
!isXTSCurrentOverMediestPrev;
|
|
|
|
//
|
|
mConditions.isXTSCurrentCrossedUnderFarest =
|
|
mConditions.isXTSCurrentUnderFarest &&
|
|
!isXTSCurrentUnderFarestPrev;
|
|
|
|
//
|
|
mConditions.isXTSCurrentCrossedUnderNearest =
|
|
mConditions.isXTSCurrentUnderNearest &&
|
|
!isXTSCurrentUnderNearestPrev;
|
|
|
|
//
|
|
mConditions.isXTSCurrentCrossedUnderMediest =
|
|
mConditions.isXTSCurrentUnderMediest &&
|
|
!isXTSCurrentUnderMediestPrev;
|
|
|
|
//
|
|
// 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);
|
|
|
|
//
|
|
double scFast = mConditions.chmaScFasts[curr];
|
|
double scSlow = mConditions.chmaScSlows[curr];
|
|
double scFastPrev = mConditions.chmaScFasts[prev];
|
|
double scSlowPrev = mConditions.chmaScSlows[prev];
|
|
|
|
//
|
|
double mcFast = mConditions.chmaMcFasts[curr];
|
|
double mcSlow = mConditions.chmaMcSlows[curr];
|
|
double mcFastPrev = mConditions.chmaMcFasts[prev];
|
|
double mcSlowPrev = mConditions.chmaMcSlows[prev];
|
|
|
|
//
|
|
double lcFast = mConditions.chmaLcFasts[curr];
|
|
double lcSlow = mConditions.chmaLcSlows[curr];
|
|
double lcFastPrev = mConditions.chmaLcFasts[prev];
|
|
double lcSlowPrev = mConditions.chmaLcSlows[prev];
|
|
|
|
//
|
|
double chmaValues[] = {
|
|
scFast,
|
|
scSlow,
|
|
mcFast,
|
|
mcSlow,
|
|
lcFast,
|
|
lcSlow};
|
|
double chmaNonSCValues[] = {
|
|
mcFast,
|
|
mcSlow,
|
|
lcFast,
|
|
lcSlow};
|
|
double chmaMin = GetMin(chmaValues);
|
|
double chmaMax = GetMax(chmaValues);
|
|
double chmaNonSCMin = GetMin(chmaNonSCValues);
|
|
double chmaNonSCMax = GetMax(chmaNonSCValues);
|
|
|
|
//
|
|
double chmaValuesPrev[] = {
|
|
scFastPrev,
|
|
scSlowPrev,
|
|
mcFastPrev,
|
|
mcSlowPrev,
|
|
lcFastPrev,
|
|
lcSlowPrev};
|
|
double chmaNonSCValuesPrev[] = {
|
|
mcFastPrev,
|
|
mcSlowPrev,
|
|
lcFastPrev,
|
|
lcSlowPrev};
|
|
double chmaMinPrev = GetMin(chmaValuesPrev);
|
|
double chmaMaxPrev = GetMax(chmaValuesPrev);
|
|
double chmaNonSCMinPrev = GetMin(chmaNonSCValuesPrev);
|
|
double chmaNonSCMaxPrev = GetMax(chmaNonSCValuesPrev);
|
|
|
|
//
|
|
mConditions.isXCHMASCOverMax = MathMin(scFast, scSlow) > chmaNonSCMax;
|
|
bool isXCHMASCOverMaxPrev = MathMin(scFastPrev, scSlowPrev) > chmaNonSCMaxPrev;
|
|
|
|
//
|
|
mConditions.isXCHMASCOverMin = MathMin(scFast, scSlow) > chmaNonSCMin;
|
|
bool isXCHMASCOverMinPrev = MathMin(scFastPrev, scSlowPrev) > chmaNonSCMinPrev;
|
|
|
|
//
|
|
mConditions.isXCHMASCUnderMax = MathMax(scFast, scSlow) < chmaNonSCMax;
|
|
bool isXCHMASCUnderMaxPrev = MathMax(scFastPrev, scSlowPrev) < chmaNonSCMaxPrev;
|
|
|
|
//
|
|
mConditions.isXCHMASCUnderMin = MathMax(scFast, scSlow) < chmaNonSCMin;
|
|
bool isXCHMASCUnderMinPrev = MathMax(scFastPrev, scSlowPrev) < chmaNonSCMinPrev;
|
|
|
|
//
|
|
mConditions.isXCHMASCCrossedOverMax =
|
|
mConditions.isXCHMASCOverMax &&
|
|
!isXCHMASCOverMaxPrev;
|
|
|
|
//
|
|
mConditions.isXCHMASCCrossedUnderMax =
|
|
mConditions.isXCHMASCUnderMax &&
|
|
!isXCHMASCUnderMaxPrev;
|
|
|
|
//
|
|
mConditions.isXCHMASCCrossedOverMin =
|
|
mConditions.isXCHMASCOverMin &&
|
|
!isXCHMASCOverMinPrev;
|
|
|
|
//
|
|
mConditions.isXCHMASCCrossedUnderMin =
|
|
mConditions.isXCHMASCUnderMin &&
|
|
!isXCHMASCUnderMinPrev;
|
|
|
|
//
|
|
// Short ...
|
|
|
|
//
|
|
mConditions.isXCHMASCPeak = IsIncreasing(
|
|
mFrom,
|
|
curr,
|
|
mConditions.chmaScFasts);
|
|
|
|
//
|
|
mConditions.isXCHMASCVale = IsDecreasing(
|
|
mFrom,
|
|
curr,
|
|
mConditions.chmaScFasts);
|
|
|
|
//
|
|
mConditions.isXCHMASCTrendsUp = IsTrendingUp(
|
|
mConditions.chmaScFasts,
|
|
mConditions.chmaScSlows);
|
|
|
|
//
|
|
mConditions.isXCHMASCTrendsDown = IsTrendingDown(
|
|
mConditions.chmaScFasts,
|
|
mConditions.chmaScSlows);
|
|
|
|
//
|
|
mConditions.isXCHMASCFastOverSlow = scFast > scSlow;
|
|
bool isXCHMASCFastOverSlowPrev = scFastPrev > scSlowPrev;
|
|
|
|
//
|
|
mConditions.isXCHMASCFastUnderSlow = scFast < scSlow;
|
|
bool isXCHMASCFastUnderSlowPrev = scFastPrev < scSlowPrev;
|
|
|
|
//
|
|
mConditions.isXCHMASCFastCrossedOverSlow =
|
|
mConditions.isXCHMASCFastOverSlow &&
|
|
!isXCHMASCFastOverSlowPrev;
|
|
|
|
//
|
|
mConditions.isXCHMASCFastCrossedUnderSlow =
|
|
mConditions.isXCHMASCFastUnderSlow &&
|
|
!isXCHMASCFastUnderSlowPrev;
|
|
|
|
//
|
|
// Medium ...
|
|
|
|
//
|
|
mConditions.isXCHMAMCPeak = IsIncreasing(
|
|
mFrom,
|
|
curr,
|
|
mConditions.chmaMcFasts);
|
|
|
|
//
|
|
mConditions.isXCHMAMCVale = IsDecreasing(
|
|
mFrom,
|
|
curr,
|
|
mConditions.chmaMcFasts);
|
|
|
|
//
|
|
mConditions.isXCHMAMCTrendsUp = IsTrendingUp(
|
|
mConditions.chmaMcFasts,
|
|
mConditions.chmaMcSlows);
|
|
|
|
//
|
|
mConditions.isXCHMAMCTrendsDown = IsTrendingDown(
|
|
mConditions.chmaMcFasts,
|
|
mConditions.chmaMcSlows);
|
|
|
|
//
|
|
mConditions.isXCHMAMCFastOverSlow = mcFast > mcSlow;
|
|
bool isXCHMAMCFastOverSlowPrev = mcFastPrev > mcSlowPrev;
|
|
|
|
//
|
|
mConditions.isXCHMAMCFastUnderSlow = mcFast < mcSlow;
|
|
bool isXCHMAMCFastUnderSlowPrev = mcFastPrev < mcSlowPrev;
|
|
|
|
//
|
|
mConditions.isXCHMAMCFastCrossedOverSlow =
|
|
mConditions.isXCHMAMCFastOverSlow &&
|
|
!isXCHMAMCFastOverSlowPrev;
|
|
|
|
//
|
|
mConditions.isXCHMAMCFastCrossedUnderSlow =
|
|
mConditions.isXCHMAMCFastUnderSlow &&
|
|
!isXCHMAMCFastUnderSlowPrev;
|
|
|
|
//
|
|
// Long ...
|
|
|
|
//
|
|
mConditions.isXCHMALCPeak = IsIncreasing(
|
|
mFrom,
|
|
curr,
|
|
mConditions.chmaLcFasts);
|
|
|
|
//
|
|
mConditions.isXCHMALCVale = IsDecreasing(
|
|
mFrom,
|
|
curr,
|
|
mConditions.chmaLcFasts);
|
|
|
|
//
|
|
mConditions.isXCHMALCTrendsUp = IsTrendingUp(
|
|
mConditions.chmaLcFasts,
|
|
mConditions.chmaLcSlows);
|
|
|
|
//
|
|
mConditions.isXCHMALCTrendsDown = IsTrendingDown(
|
|
mConditions.chmaMcFasts,
|
|
mConditions.chmaMcSlows);
|
|
|
|
//
|
|
mConditions.isXCHMALCFastOverSlow = lcFast > lcSlow;
|
|
bool isXCHMALCFastOverSlowPrev = lcFastPrev > lcSlowPrev;
|
|
|
|
//
|
|
mConditions.isXCHMALCFastUnderSlow = lcFast < lcSlow;
|
|
bool isXCHMALCFastUnderSlowPrev = lcFastPrev < lcSlowPrev;
|
|
|
|
//
|
|
mConditions.isXCHMALCFastCrossedOverSlow =
|
|
mConditions.isXCHMALCFastOverSlow &&
|
|
!isXCHMALCFastOverSlowPrev;
|
|
|
|
//
|
|
mConditions.isXCHMALCFastCrossedUnderSlow =
|
|
mConditions.isXCHMALCFastUnderSlow &&
|
|
!isXCHMALCFastUnderSlowPrev;
|
|
|
|
//
|
|
// 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);
|
|
|
|
//
|
|
mConditions.isXCHLHSameHHs =
|
|
//
|
|
mConditions.chlhScHHs[curr] == mConditions.chlhMcHHs[curr] &&
|
|
mConditions.chlhMcHHs[curr] == mConditions.chlhLcHHs[curr]
|
|
//
|
|
;
|
|
|
|
//
|
|
mConditions.isXCHLHSameLLs =
|
|
//
|
|
mConditions.chlhScLLs[curr] == mConditions.chlhMcLLs[curr] &&
|
|
mConditions.chlhMcLLs[curr] == mConditions.chlhLcLLs[curr]
|
|
//
|
|
;
|
|
|
|
//
|
|
mConditions.isXCHLHSCMCHHSame =
|
|
//
|
|
mConditions.chlhScHHs[curr] == mConditions.chlhMcHHs[curr]
|
|
//
|
|
;
|
|
|
|
//
|
|
mConditions.isXCHLHSCMCLLSame =
|
|
//
|
|
mConditions.chlhScLLs[curr] == mConditions.chlhMcLLs[curr]
|
|
//
|
|
;
|
|
|
|
//
|
|
mConditions.isXCHLHSCLCHHSame =
|
|
//
|
|
mConditions.chlhScHHs[curr] == mConditions.chlhLcLLs[curr]
|
|
//
|
|
;
|
|
|
|
//
|
|
mConditions.isXCHLHSCLCLLSame =
|
|
//
|
|
mConditions.chlhScLLs[curr] == mConditions.chlhLcLLs[curr]
|
|
//
|
|
;
|
|
|
|
//
|
|
mConditions.isXCHLHMCLCHHSame =
|
|
//
|
|
mConditions.chlhMcHHs[curr] == mConditions.chlhLcHHs[curr]
|
|
//
|
|
;
|
|
|
|
//
|
|
mConditions.isXCHLHMCLCLLSame =
|
|
//
|
|
mConditions.chlhMcLLs[curr] == mConditions.chlhLcLLs[curr]
|
|
//
|
|
;
|
|
|
|
//
|
|
// X121 Cycles Conditions ...
|
|
|
|
//
|
|
cMarket.GetMarketConditions(
|
|
mConditions.cMarketConditions,
|
|
barIndex,
|
|
mNumberOfItems //
|
|
);
|
|
|
|
//
|
|
sMarket.GetMarketConditions(
|
|
mConditions.sMarketConditions,
|
|
barIndex,
|
|
mNumberOfItems //
|
|
);
|
|
|
|
//
|
|
mMarket.GetMarketConditions(
|
|
mConditions.mMarketConditions,
|
|
barIndex,
|
|
mNumberOfItems //
|
|
);
|
|
|
|
//
|
|
lMarket.GetMarketConditions(
|
|
mConditions.lMarketConditions,
|
|
barIndex,
|
|
mNumberOfItems //
|
|
);
|
|
|
|
//
|
|
hMarket.GetMarketConditions(
|
|
mConditions.hMarketConditions,
|
|
barIndex,
|
|
mNumberOfItems //
|
|
);
|
|
}
|
|
|
|
//
|
|
// Check Market Conditions is Ready for Long Signals or not ...
|
|
bool IsReadyForLong(
|
|
X121MarketConditions &mConditions, // Market Conditions ...
|
|
bool checkXCHMAMin = true, // Force Check XCHMA Min State
|
|
bool checkXCHMAMax = true, // Force Check XCHMA Max State
|
|
bool checkXCHMACycles = true, // Force Check XCHMA Cycles State
|
|
bool checkXCHMAPeaks = true, // Force Check XCHMA Peaks State
|
|
bool checkXCHMATrendPowers = true, // Force Check XCHMA Trend Powers
|
|
bool checkXOBD = true, // Force Check XOBD State
|
|
bool checkXTS = true // Force Check XTS State
|
|
)
|
|
{
|
|
//
|
|
bool result = true;
|
|
|
|
//
|
|
if (checkXCHMAMin)
|
|
{
|
|
//
|
|
result =
|
|
//
|
|
// XCHMA MIN ...
|
|
!(
|
|
//
|
|
(mConditions.isXCHMASCOverMin ||
|
|
mConditions.isXCHMASCCrossedOverMin) &&
|
|
(mConditions.isXCHMASCUnderMin ||
|
|
mConditions.isXCHMASCCrossedUnderMin)
|
|
//
|
|
);
|
|
}
|
|
|
|
//
|
|
if (checkXCHMAMax && result)
|
|
{
|
|
//
|
|
result =
|
|
//
|
|
// XCHMA MAX ...
|
|
!(
|
|
//
|
|
(mConditions.isXCHMASCOverMax ||
|
|
mConditions.isXCHMASCCrossedOverMax) &&
|
|
(mConditions.isXCHMASCUnderMax ||
|
|
mConditions.isXCHMASCCrossedUnderMax)
|
|
//
|
|
)
|
|
//
|
|
;
|
|
}
|
|
|
|
//
|
|
if (checkXCHMACycles && result)
|
|
{
|
|
//
|
|
result =
|
|
//
|
|
// Check XCHMA Trend Bullish ...
|
|
(
|
|
//
|
|
// All Cycles Bullish ...
|
|
(
|
|
//
|
|
// SC ...
|
|
(mConditions.isXCHMASCFastOverSlow ||
|
|
mConditions.isXCHMASCFastCrossedOverSlow)
|
|
//
|
|
&&
|
|
//
|
|
// MC ...
|
|
(mConditions.isXCHMAMCFastOverSlow ||
|
|
mConditions.isXCHMAMCFastCrossedOverSlow)
|
|
//
|
|
&&
|
|
//
|
|
// LC ...
|
|
(mConditions.isXCHMALCFastOverSlow ||
|
|
mConditions.isXCHMALCFastCrossedOverSlow)
|
|
//
|
|
)
|
|
//
|
|
||
|
|
//
|
|
// Two Cycle Fully Bullish ...
|
|
(
|
|
//
|
|
// SC and MC ...
|
|
(
|
|
//
|
|
// SC ...
|
|
(mConditions.isXCHMASCFastOverSlow ||
|
|
mConditions.isXCHMASCFastCrossedOverSlow)
|
|
//
|
|
&&
|
|
//
|
|
// MC ...
|
|
(mConditions.isXCHMAMCFastOverSlow ||
|
|
mConditions.isXCHMAMCFastCrossedOverSlow)
|
|
//
|
|
)
|
|
//
|
|
||
|
|
//
|
|
// SC and LC ...
|
|
(
|
|
//
|
|
// SC ...
|
|
(mConditions.isXCHMASCFastOverSlow ||
|
|
mConditions.isXCHMASCFastCrossedOverSlow)
|
|
//
|
|
&&
|
|
//
|
|
// LC ...
|
|
(mConditions.isXCHMALCFastOverSlow ||
|
|
mConditions.isXCHMALCFastCrossedOverSlow)
|
|
//
|
|
)
|
|
//
|
|
||
|
|
//
|
|
// MC and LC ...
|
|
(
|
|
//
|
|
// MC ...
|
|
(mConditions.isXCHMAMCFastOverSlow ||
|
|
mConditions.isXCHMAMCFastCrossedOverSlow)
|
|
//
|
|
&&
|
|
//
|
|
// LC ...
|
|
(mConditions.isXCHMALCFastOverSlow ||
|
|
mConditions.isXCHMALCFastCrossedOverSlow)
|
|
//
|
|
)
|
|
//
|
|
)
|
|
//
|
|
)
|
|
//
|
|
;
|
|
}
|
|
|
|
//
|
|
if (checkXCHMAPeaks && result)
|
|
{
|
|
//
|
|
result =
|
|
//
|
|
// XCHMA Check Peaks ...
|
|
!(
|
|
//
|
|
// All Cycles Peak ...
|
|
(mConditions.isXCHMASCPeak &&
|
|
mConditions.isXCHMAMCPeak &&
|
|
mConditions.isXCHMALCPeak)
|
|
//
|
|
||
|
|
//
|
|
(
|
|
//
|
|
// SC MC ...
|
|
(mConditions.isXCHMASCPeak &&
|
|
mConditions.isXCHMAMCPeak)
|
|
//
|
|
||
|
|
//
|
|
// SC LC ...
|
|
(mConditions.isXCHMASCPeak &&
|
|
mConditions.isXCHMALCPeak)
|
|
//
|
|
||
|
|
//
|
|
// MC LC ...
|
|
(mConditions.isXCHMAMCPeak &&
|
|
mConditions.isXCHMALCPeak)
|
|
//
|
|
)
|
|
//
|
|
)
|
|
//
|
|
;
|
|
}
|
|
|
|
//
|
|
if (checkXCHMATrendPowers && result)
|
|
{
|
|
//
|
|
result =
|
|
//
|
|
// XCHMA Check Trends Power ...
|
|
!(
|
|
//
|
|
// All Trends Down ...
|
|
(mConditions.isXCHMASCTrendsDown &&
|
|
mConditions.isXCHMAMCTrendsDown &&
|
|
mConditions.isXCHMALCTrendsDown)
|
|
//
|
|
||
|
|
//
|
|
// Twisted pairs ...
|
|
(
|
|
//
|
|
(mConditions.isXCHMASCTrendsDown &&
|
|
mConditions.isXCHMAMCTrendsDown)
|
|
//
|
|
||
|
|
//
|
|
(mConditions.isXCHMASCTrendsDown &&
|
|
mConditions.isXCHMALCTrendsDown)
|
|
//
|
|
||
|
|
//
|
|
(mConditions.isXCHMAMCTrendsDown &&
|
|
mConditions.isXCHMALCTrendsDown)
|
|
//
|
|
)
|
|
//
|
|
)
|
|
//
|
|
;
|
|
}
|
|
|
|
//
|
|
if (checkXOBD && result)
|
|
{
|
|
//
|
|
result =
|
|
//
|
|
// XOBD Check Swings ...
|
|
!mConditions.isXOBDSwingLow
|
|
//
|
|
;
|
|
}
|
|
|
|
//
|
|
if (checkXTS && result)
|
|
{
|
|
result =
|
|
//
|
|
// XTS Check ...
|
|
!(
|
|
//
|
|
mConditions.isXTSCurrentMin &&
|
|
//
|
|
(
|
|
//
|
|
// All Under ...
|
|
(
|
|
(mConditions.isXTSCurrentUnderNearest ||
|
|
mConditions.isXTSCurrentCrossedUnderNearest) &&
|
|
(mConditions.isXTSCurrentUnderMediest ||
|
|
mConditions.isXTSCurrentCrossedUnderMediest) &&
|
|
(mConditions.isXTSCurrentUnderFarest ||
|
|
mConditions.isXTSCurrentCrossedUnderFarest))
|
|
//
|
|
||
|
|
//
|
|
// Pairs ...
|
|
(
|
|
//
|
|
((mConditions.isXTSCurrentUnderNearest ||
|
|
mConditions.isXTSCurrentCrossedUnderNearest) &&
|
|
(mConditions.isXTSCurrentUnderMediest ||
|
|
mConditions.isXTSCurrentCrossedUnderMediest))
|
|
//
|
|
||
|
|
//
|
|
((mConditions.isXTSCurrentUnderNearest ||
|
|
mConditions.isXTSCurrentCrossedUnderNearest) &&
|
|
(mConditions.isXTSCurrentUnderFarest ||
|
|
mConditions.isXTSCurrentCrossedUnderFarest))
|
|
//
|
|
||
|
|
//
|
|
((mConditions.isXTSCurrentUnderMediest ||
|
|
mConditions.isXTSCurrentCrossedUnderMediest) &&
|
|
(mConditions.isXTSCurrentUnderFarest ||
|
|
mConditions.isXTSCurrentCrossedUnderFarest))
|
|
//
|
|
)
|
|
//
|
|
)
|
|
//
|
|
)
|
|
//
|
|
;
|
|
}
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Check Market Conditions is Ready for Short Signals or not ...
|
|
bool IsReadyForShort(
|
|
X121MarketConditions &mConditions, // Market Conditions ...
|
|
bool checkXCHMAMin = true, // Force Check XCHMA Min State
|
|
bool checkXCHMAMax = true, // Force Check XCHMA Max State
|
|
bool checkXCHMACycles = true, // Force Check XCHMA Cycles State
|
|
bool checkXCHMAVales = true, // Force Check XCHMA Vales State
|
|
bool checkXCHMATrendPowers = true, // Force Check XCHMA Trend Powers
|
|
bool checkXOBD = true, // Force Check XOBD State
|
|
bool checkXTS = true // Force Check XTS State
|
|
)
|
|
{
|
|
//
|
|
bool result = true;
|
|
|
|
//
|
|
if (checkXCHMAMin)
|
|
{
|
|
//
|
|
result =
|
|
//
|
|
// XCHMA MIN ...
|
|
!(
|
|
//
|
|
(mConditions.isXCHMASCOverMin ||
|
|
mConditions.isXCHMASCCrossedOverMin) &&
|
|
(mConditions.isXCHMASCUnderMin ||
|
|
mConditions.isXCHMASCCrossedUnderMin)
|
|
//
|
|
);
|
|
}
|
|
|
|
//
|
|
if (checkXCHMAMax && result)
|
|
{
|
|
//
|
|
result =
|
|
//
|
|
// XCHMA MAX ...
|
|
!(
|
|
//
|
|
(mConditions.isXCHMASCOverMax ||
|
|
mConditions.isXCHMASCCrossedOverMax) &&
|
|
(mConditions.isXCHMASCUnderMax ||
|
|
mConditions.isXCHMASCCrossedUnderMax)
|
|
//
|
|
)
|
|
//
|
|
;
|
|
}
|
|
|
|
//
|
|
if (checkXCHMACycles && result)
|
|
{
|
|
//
|
|
result =
|
|
//
|
|
// Check XCHMA Trend Bullish ...
|
|
(
|
|
//
|
|
// All Cycles Bullish ...
|
|
(
|
|
//
|
|
// SC ...
|
|
(mConditions.isXCHMASCFastUnderSlow ||
|
|
mConditions.isXCHMASCFastCrossedUnderSlow)
|
|
//
|
|
&&
|
|
//
|
|
// MC ...
|
|
(mConditions.isXCHMAMCFastUnderSlow ||
|
|
mConditions.isXCHMAMCFastCrossedUnderSlow)
|
|
//
|
|
&&
|
|
//
|
|
// LC ...
|
|
(mConditions.isXCHMALCFastUnderSlow ||
|
|
mConditions.isXCHMALCFastCrossedUnderSlow)
|
|
//
|
|
)
|
|
//
|
|
||
|
|
//
|
|
// Two Cycle Fully Bullish ...
|
|
(
|
|
//
|
|
// SC and MC ...
|
|
(
|
|
//
|
|
// SC ...
|
|
(mConditions.isXCHMASCFastUnderSlow ||
|
|
mConditions.isXCHMASCFastCrossedOverSlow)
|
|
//
|
|
&&
|
|
//
|
|
// MC ...
|
|
(mConditions.isXCHMAMCFastUnderSlow ||
|
|
mConditions.isXCHMAMCFastCrossedOverSlow)
|
|
//
|
|
)
|
|
//
|
|
||
|
|
//
|
|
// SC and LC ...
|
|
(
|
|
//
|
|
// SC ...
|
|
(mConditions.isXCHMASCFastUnderSlow ||
|
|
mConditions.isXCHMASCFastCrossedUnderSlow)
|
|
//
|
|
&&
|
|
//
|
|
// LC ...
|
|
(mConditions.isXCHMALCFastUnderSlow ||
|
|
mConditions.isXCHMALCFastCrossedUnderSlow)
|
|
//
|
|
)
|
|
//
|
|
||
|
|
//
|
|
// MC and LC ...
|
|
(
|
|
//
|
|
// MC ...
|
|
(mConditions.isXCHMAMCFastUnderSlow ||
|
|
mConditions.isXCHMAMCFastCrossedOverSlow)
|
|
//
|
|
&&
|
|
//
|
|
// LC ...
|
|
(mConditions.isXCHMALCFastUnderSlow ||
|
|
mConditions.isXCHMALCFastCrossedOverSlow)
|
|
//
|
|
)
|
|
//
|
|
)
|
|
//
|
|
)
|
|
//
|
|
;
|
|
}
|
|
|
|
//
|
|
if (checkXCHMAVales && result)
|
|
{
|
|
//
|
|
result =
|
|
//
|
|
// XCHMA Check Vales ...
|
|
!(
|
|
//
|
|
// All Cycles Vale ...
|
|
(mConditions.isXCHMASCVale &&
|
|
mConditions.isXCHMAMCVale &&
|
|
mConditions.isXCHMALCVale)
|
|
//
|
|
||
|
|
//
|
|
(
|
|
//
|
|
// SC MC ...
|
|
(mConditions.isXCHMASCVale &&
|
|
mConditions.isXCHMAMCVale)
|
|
//
|
|
||
|
|
//
|
|
// SC LC ...
|
|
(mConditions.isXCHMASCVale &&
|
|
mConditions.isXCHMALCVale)
|
|
//
|
|
||
|
|
//
|
|
// MC LC ...
|
|
(mConditions.isXCHMAMCVale &&
|
|
mConditions.isXCHMALCVale)
|
|
//
|
|
)
|
|
//
|
|
)
|
|
//
|
|
;
|
|
}
|
|
|
|
//
|
|
if (checkXCHMATrendPowers && result)
|
|
{
|
|
//
|
|
result =
|
|
//
|
|
// XCHMA Check Trends Power ...
|
|
!(
|
|
//
|
|
// All Trends Down ...
|
|
(mConditions.isXCHMASCTrendsDown &&
|
|
mConditions.isXCHMAMCTrendsDown &&
|
|
mConditions.isXCHMALCTrendsDown)
|
|
//
|
|
||
|
|
//
|
|
// Twisted pairs ...
|
|
(
|
|
//
|
|
(mConditions.isXCHMASCTrendsDown &&
|
|
mConditions.isXCHMAMCTrendsDown)
|
|
//
|
|
||
|
|
//
|
|
(mConditions.isXCHMASCTrendsDown &&
|
|
mConditions.isXCHMALCTrendsDown)
|
|
//
|
|
||
|
|
//
|
|
(mConditions.isXCHMAMCTrendsDown &&
|
|
mConditions.isXCHMALCTrendsDown)
|
|
//
|
|
)
|
|
//
|
|
)
|
|
//
|
|
;
|
|
}
|
|
|
|
//
|
|
if (checkXOBD && result)
|
|
{
|
|
//
|
|
result =
|
|
//
|
|
// XOBD Check Swings ...
|
|
!mConditions.isXOBDSwingHigh
|
|
//
|
|
;
|
|
}
|
|
|
|
//
|
|
if (checkXTS && result)
|
|
{
|
|
//
|
|
result =
|
|
//
|
|
// XTS Check ...
|
|
!(
|
|
//
|
|
mConditions.isXTSCurrentMax &&
|
|
//
|
|
(
|
|
//
|
|
// All Over ...
|
|
(
|
|
(mConditions.isXTSCurrentOverNearest ||
|
|
mConditions.isXTSCurrentCrossedOverNearest) &&
|
|
(mConditions.isXTSCurrentOverMediest ||
|
|
mConditions.isXTSCurrentCrossedOverMediest) &&
|
|
(mConditions.isXTSCurrentOverFarest ||
|
|
mConditions.isXTSCurrentCrossedOverFarest))
|
|
//
|
|
||
|
|
//
|
|
// Pairs ...
|
|
(
|
|
//
|
|
((mConditions.isXTSCurrentOverNearest ||
|
|
mConditions.isXTSCurrentCrossedOverNearest) &&
|
|
(mConditions.isXTSCurrentOverMediest ||
|
|
mConditions.isXTSCurrentCrossedOverMediest))
|
|
//
|
|
||
|
|
//
|
|
((mConditions.isXTSCurrentOverNearest ||
|
|
mConditions.isXTSCurrentCrossedOverNearest) &&
|
|
(mConditions.isXTSCurrentOverFarest ||
|
|
mConditions.isXTSCurrentCrossedOverFarest))
|
|
//
|
|
||
|
|
//
|
|
((mConditions.isXTSCurrentOverMediest ||
|
|
mConditions.isXTSCurrentCrossedOverMediest) &&
|
|
(mConditions.isXTSCurrentOverFarest ||
|
|
mConditions.isXTSCurrentCrossedOverFarest))
|
|
//
|
|
)
|
|
//
|
|
)
|
|
//
|
|
)
|
|
//
|
|
;
|
|
}
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Signalling based On Signallers ...
|
|
|
|
//
|
|
// Longs ...
|
|
|
|
//
|
|
bool XSPHasSpecifiedLongSignal(
|
|
X121MarketConditions &mConditions, //
|
|
double &sl, // Provided SL ...
|
|
double &tp, // Provided TP ...
|
|
double &r2r // Risk Reward Ratio ...
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
bool XTESTHasSpecifiedLongSignal(
|
|
X121MarketConditions &mConditions, //
|
|
double &sl, // Provided SL ...
|
|
double &tp, // Provided TP ...
|
|
double &r2r // Risk Reward Ratio ...
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Use XSTR ...
|
|
bool X786HasSpecifiedLongSignal(
|
|
X121MarketConditions &mConditions, //
|
|
double &sl, // Provided SL ...
|
|
double &tp, // Provided TP ...
|
|
double &r2r // Risk Reward Ratio ...
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
// //
|
|
// bool isCMStrLong =
|
|
// //
|
|
// mConditions.cMarketConditions.isTrendSwitchedToBullish &&
|
|
// (mConditions.hMarketConditions.isTrendBullish &&
|
|
// mConditions.lMarketConditions.isTrendBullish &&
|
|
// mConditions.mMarketConditions.isTrendBullish &&
|
|
// mConditions.sMarketConditions.isTrendBullish)
|
|
// //
|
|
// ;
|
|
|
|
// //
|
|
// bool isSMStrLong =
|
|
// //
|
|
// mConditions.sMarketConditions.isTrendSwitchedToBullish &&
|
|
// (mConditions.hMarketConditions.isTrendBullish &&
|
|
// mConditions.lMarketConditions.isTrendBullish &&
|
|
// mConditions.mMarketConditions.isTrendBullish &&
|
|
// mConditions.cMarketConditions.isTrendBullish)
|
|
// //
|
|
// ;
|
|
|
|
//
|
|
bool isMMStrLong =
|
|
//
|
|
mConditions.mMarketConditions.isTrendSwitchedToBullish &&
|
|
(mConditions.hMarketConditions.isTrendBullish &&
|
|
mConditions.lMarketConditions.isTrendBullish &&
|
|
mConditions.sMarketConditions.isTrendBullish &&
|
|
mConditions.cMarketConditions.isTrendBullish)
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isLMStrLong =
|
|
//
|
|
mConditions.lMarketConditions.isTrendSwitchedToBullish &&
|
|
(mConditions.hMarketConditions.isTrendBullish &&
|
|
mConditions.mMarketConditions.isTrendBullish &&
|
|
mConditions.sMarketConditions.isTrendBullish &&
|
|
mConditions.cMarketConditions.isTrendBullish)
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isHMStrLong =
|
|
//
|
|
mConditions.hMarketConditions.isTrendSwitchedToBullish &&
|
|
(mConditions.lMarketConditions.isTrendBullish &&
|
|
mConditions.mMarketConditions.isTrendBullish &&
|
|
mConditions.sMarketConditions.isTrendBullish &&
|
|
mConditions.cMarketConditions.isTrendBullish)
|
|
//
|
|
;
|
|
|
|
//
|
|
// bool isScorePassed = IsScorePassedForLong();
|
|
|
|
//
|
|
result =
|
|
//
|
|
// isCMStrLong
|
|
// //
|
|
// ||
|
|
//
|
|
// isSMStrLong
|
|
// //
|
|
// ||
|
|
//
|
|
isMMStrLong
|
|
//
|
|
||
|
|
//
|
|
isLMStrLong
|
|
//
|
|
||
|
|
//
|
|
isHMStrLong
|
|
//
|
|
;
|
|
|
|
//
|
|
// result = result && isScorePassed;
|
|
|
|
//
|
|
// if (result)
|
|
// {
|
|
// sl = GetMinVales();
|
|
// }
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Use XMC ...
|
|
bool X121HasSpecifiedLongSignal(
|
|
X121MarketConditions &mConditions, //
|
|
double &sl, // Provided SL ...
|
|
double &tp, // Provided TP ...
|
|
double &r2r // Risk Reward Ratio ...
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
// Current Market ...
|
|
// bool isCMCLong =
|
|
// //
|
|
// (
|
|
// //
|
|
// (mConditions.cMarketConditions.isSlowOverVerifier &&
|
|
// mConditions.cMarketConditions.isFastCrossedOverVerifier)
|
|
// //
|
|
// ||
|
|
// //
|
|
// (mConditions.cMarketConditions.isFastOverVerifier &&
|
|
// mConditions.cMarketConditions.isSlowCrossedOverVerifier)
|
|
// //
|
|
// )
|
|
// //
|
|
// &&
|
|
// //
|
|
// (mConditions.cMarketConditions.isCloseOverFast &&
|
|
// mConditions.cMarketConditions.isCloseOverSlow &&
|
|
// mConditions.cMarketConditions.isCloseOverVerifier)
|
|
// //
|
|
// ;
|
|
|
|
//
|
|
// Short Market ...
|
|
// bool isSMCLong =
|
|
// //
|
|
// (
|
|
// //
|
|
// (mConditions.sMarketConditions.isSlowOverVerifier &&
|
|
// mConditions.sMarketConditions.isFastCrossedOverVerifier)
|
|
// //
|
|
// ||
|
|
// //
|
|
// (mConditions.sMarketConditions.isFastOverVerifier &&
|
|
// mConditions.sMarketConditions.isSlowCrossedOverVerifier)
|
|
// //
|
|
// )
|
|
// //
|
|
// &&
|
|
// //
|
|
// (mConditions.sMarketConditions.isCloseOverFast &&
|
|
// mConditions.sMarketConditions.isCloseOverSlow &&
|
|
// mConditions.sMarketConditions.isCloseOverVerifier)
|
|
// //
|
|
// ;
|
|
|
|
//
|
|
// Medium Market ...
|
|
bool isMMCLong =
|
|
//
|
|
(
|
|
//
|
|
(mConditions.mMarketConditions.isSlowOverVerifier &&
|
|
mConditions.mMarketConditions.isFastCrossedOverVerifier)
|
|
//
|
|
||
|
|
//
|
|
(mConditions.mMarketConditions.isFastOverVerifier &&
|
|
mConditions.mMarketConditions.isSlowCrossedOverVerifier)
|
|
//
|
|
)
|
|
//
|
|
&&
|
|
//
|
|
(mConditions.mMarketConditions.isCloseOverFast &&
|
|
mConditions.mMarketConditions.isCloseOverSlow &&
|
|
mConditions.mMarketConditions.isCloseOverVerifier)
|
|
//
|
|
;
|
|
|
|
//
|
|
// Long Market ...
|
|
bool isLMCLong =
|
|
//
|
|
(
|
|
//
|
|
(mConditions.lMarketConditions.isSlowOverVerifier &&
|
|
mConditions.lMarketConditions.isFastCrossedOverVerifier)
|
|
//
|
|
||
|
|
//
|
|
(mConditions.lMarketConditions.isFastOverVerifier &&
|
|
mConditions.lMarketConditions.isSlowCrossedOverVerifier)
|
|
//
|
|
)
|
|
//
|
|
&&
|
|
//
|
|
(mConditions.lMarketConditions.isCloseOverFast &&
|
|
mConditions.lMarketConditions.isCloseOverSlow &&
|
|
mConditions.lMarketConditions.isCloseOverVerifier)
|
|
//
|
|
;
|
|
|
|
//
|
|
// Hind Market ...
|
|
bool isHMCLong =
|
|
//
|
|
(
|
|
//
|
|
(mConditions.hMarketConditions.isSlowOverVerifier &&
|
|
mConditions.hMarketConditions.isFastCrossedOverVerifier)
|
|
//
|
|
||
|
|
//
|
|
(mConditions.hMarketConditions.isFastOverVerifier &&
|
|
mConditions.hMarketConditions.isSlowCrossedOverVerifier)
|
|
//
|
|
)
|
|
//
|
|
&&
|
|
//
|
|
(mConditions.hMarketConditions.isCloseOverFast &&
|
|
mConditions.hMarketConditions.isCloseOverSlow &&
|
|
mConditions.hMarketConditions.isCloseOverVerifier)
|
|
//
|
|
;
|
|
|
|
//
|
|
// bool isScorePassed = IsScorePassedForLong();
|
|
|
|
//
|
|
result =
|
|
// //
|
|
// isCMCLong
|
|
// //
|
|
// ||
|
|
// //
|
|
// isSMCLong
|
|
// //
|
|
// ||
|
|
//
|
|
isMMCLong
|
|
//
|
|
||
|
|
//
|
|
isLMCLong
|
|
//
|
|
||
|
|
//
|
|
isHMCLong
|
|
//
|
|
;
|
|
|
|
//
|
|
// result = result && isScorePassed;
|
|
|
|
// //
|
|
// if (result)
|
|
// {
|
|
// sl = GetMinVales();
|
|
// }
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Use XCHE ...
|
|
bool X110HasSpecifiedLongSignal(
|
|
X121MarketConditions &mConditions, //
|
|
double &sl, // Provided SL ...
|
|
double &tp, // Provided TP ...
|
|
double &r2r // Risk Reward Ratio ...
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
// //
|
|
// bool isCCHELong =
|
|
// //
|
|
// (mConditions.cMarketConditions.isCHESwitchedInStrongLong &&
|
|
// (mConditions.sMarketConditions.isCHEInStrongLong &&
|
|
// mConditions.mMarketConditions.isCHEInStrongLong &&
|
|
// mConditions.lMarketConditions.isCHEInStrongLong &&
|
|
// mConditions.hMarketConditions.isCHEInStrongLong))
|
|
// //
|
|
// ;
|
|
|
|
// //
|
|
// bool isSCHELong =
|
|
// //
|
|
// (mConditions.sMarketConditions.isCHESwitchedInStrongLong &&
|
|
// (mConditions.cMarketConditions.isCHEInStrongLong &&
|
|
// mConditions.mMarketConditions.isCHEInStrongLong &&
|
|
// mConditions.lMarketConditions.isCHEInStrongLong &&
|
|
// mConditions.hMarketConditions.isCHEInStrongLong))
|
|
// //
|
|
// ;
|
|
|
|
//
|
|
bool isMCHELong =
|
|
//
|
|
(mConditions.mMarketConditions.isCHESwitchedInStrongLong &&
|
|
(mConditions.cMarketConditions.isCHEInStrongLong &&
|
|
mConditions.sMarketConditions.isCHEInStrongLong &&
|
|
mConditions.lMarketConditions.isCHEInStrongLong &&
|
|
mConditions.hMarketConditions.isCHEInStrongLong))
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isLCHELong =
|
|
//
|
|
(mConditions.lMarketConditions.isCHESwitchedInStrongLong &&
|
|
(mConditions.cMarketConditions.isCHEInStrongLong &&
|
|
mConditions.sMarketConditions.isCHEInStrongLong &&
|
|
mConditions.mMarketConditions.isCHEInStrongLong &&
|
|
mConditions.hMarketConditions.isCHEInStrongLong))
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isHCHELong =
|
|
//
|
|
(mConditions.hMarketConditions.isCHESwitchedInStrongLong &&
|
|
(mConditions.cMarketConditions.isCHEInStrongLong &&
|
|
mConditions.sMarketConditions.isCHEInStrongLong &&
|
|
mConditions.mMarketConditions.isCHEInStrongLong &&
|
|
mConditions.lMarketConditions.isCHEInStrongLong))
|
|
//
|
|
;
|
|
|
|
//
|
|
// bool isScorePassed = IsScorePassedForLong();
|
|
|
|
//
|
|
result =
|
|
// //
|
|
// isCCHELong
|
|
// //
|
|
// ||
|
|
// //
|
|
// isSCHELong
|
|
// //
|
|
// ||
|
|
//
|
|
isMCHELong
|
|
//
|
|
||
|
|
//
|
|
isLCHELong
|
|
//
|
|
||
|
|
//
|
|
isHCHELong
|
|
//
|
|
;
|
|
|
|
//
|
|
// result = result && isScorePassed;
|
|
|
|
// //
|
|
// if (result)
|
|
// {
|
|
// sl = GetMinVales();
|
|
// }
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Use XHK ...
|
|
bool X92HasSpecifiedLongSignal(
|
|
X121MarketConditions &mConditions, //
|
|
double &sl, // Provided SL ...
|
|
double &tp, // Provided TP ...
|
|
double &r2r // Risk Reward Ratio ...
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
int curr = 0;
|
|
int prev = 1;
|
|
|
|
//
|
|
bool isCSMHKSwitchedToBullish =
|
|
//
|
|
mConditions.cMarketConditions.smHKBars[curr].IsBullish() &&
|
|
!mConditions.cMarketConditions.smHKBars[prev].IsBullish()
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isCSMHKBullish =
|
|
//
|
|
mConditions.cMarketConditions.smHKBars[curr].IsBullish() &&
|
|
mConditions.cMarketConditions.smHKBars[prev].IsBullish() &&
|
|
!mConditions.bars[curr].open > mConditions.cMarketConditions.smHKBars[curr].GetUp() &&
|
|
!mConditions.bars[prev].close > mConditions.cMarketConditions.smHKBars[prev].GetUp()
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isSSMHKSwitchedToBullish =
|
|
//
|
|
mConditions.sMarketConditions.smHKBars[curr].IsBullish() &&
|
|
!mConditions.sMarketConditions.smHKBars[prev].IsBullish()
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isSSMHKBullish =
|
|
//
|
|
mConditions.sMarketConditions.smHKBars[curr].IsBullish() &&
|
|
mConditions.sMarketConditions.smHKBars[prev].IsBullish() &&
|
|
!mConditions.bars[curr].open > mConditions.sMarketConditions.smHKBars[curr].GetUp() &&
|
|
!mConditions.bars[prev].close > mConditions.sMarketConditions.smHKBars[prev].GetUp()
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isMSMHKSwitchedToBullish =
|
|
//
|
|
mConditions.mMarketConditions.smHKBars[curr].IsBullish() &&
|
|
!mConditions.mMarketConditions.smHKBars[prev].IsBullish()
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isMSMHKBullish =
|
|
//
|
|
mConditions.mMarketConditions.smHKBars[curr].IsBullish() &&
|
|
mConditions.mMarketConditions.smHKBars[prev].IsBullish() &&
|
|
!mConditions.bars[curr].open > mConditions.mMarketConditions.smHKBars[curr].GetUp() &&
|
|
!mConditions.bars[prev].close > mConditions.mMarketConditions.smHKBars[prev].GetUp()
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isLSMHKSwitchedToBullish =
|
|
//
|
|
mConditions.lMarketConditions.smHKBars[curr].IsBullish() &&
|
|
!mConditions.lMarketConditions.smHKBars[prev].IsBullish()
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isLSMHKBullish =
|
|
//
|
|
mConditions.lMarketConditions.smHKBars[curr].IsBullish() &&
|
|
mConditions.lMarketConditions.smHKBars[prev].IsBullish() &&
|
|
!mConditions.bars[curr].open > mConditions.lMarketConditions.smHKBars[curr].GetUp() &&
|
|
!mConditions.bars[prev].close > mConditions.lMarketConditions.smHKBars[prev].GetUp()
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isHSMHKSwitchedToBullish =
|
|
//
|
|
mConditions.hMarketConditions.smHKBars[curr].IsBullish() &&
|
|
!mConditions.hMarketConditions.smHKBars[prev].IsBullish()
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isHSMHKBullish =
|
|
//
|
|
mConditions.hMarketConditions.smHKBars[curr].IsBullish() &&
|
|
mConditions.hMarketConditions.smHKBars[prev].IsBullish() &&
|
|
!mConditions.bars[curr].open > mConditions.hMarketConditions.smHKBars[curr].GetUp() &&
|
|
!mConditions.bars[prev].close > mConditions.hMarketConditions.smHKBars[prev].GetUp()
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isCSMHKLong =
|
|
//
|
|
(isCSMHKBullish ||
|
|
isCSMHKSwitchedToBullish) &&
|
|
isSSMHKBullish &&
|
|
isMSMHKBullish &&
|
|
isLSMHKBullish &&
|
|
isHSMHKBullish
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isSSMHKLong =
|
|
//
|
|
(isSSMHKBullish ||
|
|
isSSMHKSwitchedToBullish) &&
|
|
isCSMHKBullish &&
|
|
isMSMHKBullish &&
|
|
isLSMHKBullish &&
|
|
isHSMHKBullish
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isMSMHKLong =
|
|
//
|
|
(isMSMHKBullish ||
|
|
isMSMHKSwitchedToBullish) &&
|
|
isSSMHKBullish &&
|
|
isCSMHKBullish &&
|
|
isLSMHKBullish &&
|
|
isHSMHKBullish
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isLSMHKLong =
|
|
//
|
|
(isLSMHKBullish ||
|
|
isLSMHKSwitchedToBullish) &&
|
|
isSSMHKBullish &&
|
|
isCSMHKBullish &&
|
|
isMSMHKBullish &&
|
|
isHSMHKBullish
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isHSMHKLong =
|
|
//
|
|
(isHSMHKBullish ||
|
|
isHSMHKSwitchedToBullish) &&
|
|
isSSMHKBullish &&
|
|
isCSMHKBullish &&
|
|
isMSMHKBullish &&
|
|
isLSMHKBullish
|
|
//
|
|
;
|
|
|
|
//
|
|
result =
|
|
//
|
|
// isCSMHKLong
|
|
// //
|
|
// ||
|
|
// //
|
|
// isSSMHKLong
|
|
// //
|
|
// ||
|
|
//
|
|
isMSMHKLong
|
|
//
|
|
||
|
|
//
|
|
isLSMHKLong
|
|
//
|
|
||
|
|
//
|
|
isHSMHKLong
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Use XMRB ...
|
|
bool X128HasSpecifiedLongSignal(
|
|
X121MarketConditions &mConditions, //
|
|
double &sl, // Provided SL ...
|
|
double &tp, // Provided TP ...
|
|
double &r2r // Risk Reward Ratio ...
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
// Current Cycle ...
|
|
|
|
//
|
|
bool isCMRBFastOverSlow =
|
|
//
|
|
mConditions.cMarketConditions.mrbFasts[1] > mConditions.cMarketConditions.mrbSlows[1]
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isCMRBFastCrossedOverSlow =
|
|
//
|
|
mConditions.cMarketConditions.mrbFasts[1] > mConditions.cMarketConditions.mrbSlows[1] &&
|
|
mConditions.cMarketConditions.mrbFasts[2] <= mConditions.cMarketConditions.mrbSlows[2]
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isCMRBClosedOverFast =
|
|
//
|
|
mConditions.cMarketConditions.bars[1].close > mConditions.cMarketConditions.mrbFasts[1]
|
|
//
|
|
;
|
|
|
|
//
|
|
// Short Cycle ...
|
|
|
|
//
|
|
bool isSMRBFastOverSlow =
|
|
//
|
|
mConditions.sMarketConditions.mrbFasts[1] > mConditions.sMarketConditions.mrbSlows[1]
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isSMRBFastCrossedOverSlow =
|
|
//
|
|
mConditions.sMarketConditions.mrbFasts[1] > mConditions.sMarketConditions.mrbSlows[1] &&
|
|
mConditions.sMarketConditions.mrbFasts[2] <= mConditions.sMarketConditions.mrbSlows[2]
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isSMRBClosedOverFast =
|
|
//
|
|
mConditions.sMarketConditions.bars[1].close > mConditions.sMarketConditions.mrbFasts[1]
|
|
//
|
|
;
|
|
|
|
//
|
|
// Medium Cycle ...
|
|
|
|
//
|
|
bool isMMRBFastOverSlow =
|
|
//
|
|
mConditions.mMarketConditions.mrbFasts[1] > mConditions.mMarketConditions.mrbSlows[1]
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isMMRBFastCrossedOverSlow =
|
|
//
|
|
mConditions.mMarketConditions.mrbFasts[1] > mConditions.mMarketConditions.mrbSlows[1] &&
|
|
mConditions.mMarketConditions.mrbFasts[2] <= mConditions.mMarketConditions.mrbSlows[2]
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isMMRBClosedOverFast =
|
|
//
|
|
mConditions.mMarketConditions.bars[1].close > mConditions.mMarketConditions.mrbFasts[1]
|
|
//
|
|
;
|
|
|
|
//
|
|
// Long Cycle ...
|
|
|
|
//
|
|
bool isLMRBFastOverSlow =
|
|
//
|
|
mConditions.lMarketConditions.mrbFasts[1] > mConditions.lMarketConditions.mrbSlows[1]
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isLMRBFastCrossedOverSlow =
|
|
//
|
|
mConditions.lMarketConditions.mrbFasts[1] > mConditions.lMarketConditions.mrbSlows[1] &&
|
|
mConditions.lMarketConditions.mrbFasts[2] <= mConditions.lMarketConditions.mrbSlows[2]
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isLMRBClosedOverFast =
|
|
//
|
|
mConditions.lMarketConditions.bars[1].close > mConditions.lMarketConditions.mrbFasts[1]
|
|
//
|
|
;
|
|
|
|
//
|
|
// Hind Cycle ...
|
|
|
|
//
|
|
bool isHMRBFastOverSlow =
|
|
//
|
|
mConditions.hMarketConditions.mrbFasts[1] > mConditions.hMarketConditions.mrbSlows[1]
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isHMRBFastCrossedOverSlow =
|
|
//
|
|
mConditions.hMarketConditions.mrbFasts[1] > mConditions.hMarketConditions.mrbSlows[1] &&
|
|
mConditions.hMarketConditions.mrbFasts[2] <= mConditions.hMarketConditions.mrbSlows[2]
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isHMRBClosedOverFast =
|
|
//
|
|
mConditions.hMarketConditions.bars[1].close > mConditions.hMarketConditions.mrbFasts[1]
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isMRBLongWeight =
|
|
//
|
|
(
|
|
//
|
|
isCMRBFastOverSlow &&
|
|
isSMRBFastOverSlow &&
|
|
isMMRBFastOverSlow &&
|
|
isLMRBFastOverSlow &&
|
|
isHMRBFastOverSlow
|
|
//
|
|
)
|
|
//
|
|
||
|
|
//
|
|
(
|
|
//
|
|
isCMRBFastOverSlow &&
|
|
((
|
|
isSMRBFastOverSlow &&
|
|
isMMRBFastOverSlow &&
|
|
isLMRBFastOverSlow)
|
|
//
|
|
||
|
|
//
|
|
(
|
|
isSMRBFastOverSlow &&
|
|
isLMRBFastOverSlow &&
|
|
isHMRBFastOverSlow)
|
|
//
|
|
||
|
|
//
|
|
(
|
|
isMMRBFastOverSlow &&
|
|
isLMRBFastOverSlow &&
|
|
isHMRBFastOverSlow))
|
|
//
|
|
)
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isMBRCloseLong =
|
|
//
|
|
(
|
|
//
|
|
isCMRBClosedOverFast &&
|
|
isSMRBClosedOverFast &&
|
|
isMMRBClosedOverFast &&
|
|
isLMRBClosedOverFast &&
|
|
isHMRBClosedOverFast
|
|
//
|
|
)
|
|
//
|
|
||
|
|
//
|
|
(
|
|
//
|
|
isCMRBClosedOverFast &&
|
|
((
|
|
isSMRBClosedOverFast &&
|
|
isMMRBClosedOverFast)
|
|
//
|
|
||
|
|
//
|
|
(
|
|
isSMRBClosedOverFast &&
|
|
isLMRBClosedOverFast)
|
|
//
|
|
||
|
|
//
|
|
(
|
|
isSMRBClosedOverFast &&
|
|
isHMRBClosedOverFast)
|
|
//
|
|
||
|
|
//
|
|
(
|
|
isMMRBClosedOverFast &&
|
|
isLMRBClosedOverFast)
|
|
//
|
|
||
|
|
//
|
|
(
|
|
isLMRBClosedOverFast &&
|
|
isHMRBClosedOverFast)
|
|
//
|
|
||
|
|
//
|
|
(
|
|
isMMRBClosedOverFast &&
|
|
isHMRBClosedOverFast)
|
|
//
|
|
||
|
|
//
|
|
(
|
|
isSMRBClosedOverFast &&
|
|
isMMRBClosedOverFast &&
|
|
isLMRBClosedOverFast)
|
|
//
|
|
||
|
|
//
|
|
(
|
|
isSMRBClosedOverFast &&
|
|
isLMRBClosedOverFast &&
|
|
isHMRBClosedOverFast)
|
|
//
|
|
||
|
|
//
|
|
(
|
|
isMMRBClosedOverFast &&
|
|
isLMRBClosedOverFast &&
|
|
isHMRBClosedOverFast))
|
|
//
|
|
)
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isCMRBShort =
|
|
//
|
|
(isCMRBFastOverSlow ||
|
|
isCMRBFastCrossedOverSlow)
|
|
//
|
|
&&
|
|
//
|
|
isCMRBClosedOverFast &&
|
|
//
|
|
isMRBLongWeight &&
|
|
//
|
|
isMBRCloseLong
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isSMRBShort =
|
|
//
|
|
(isSMRBFastOverSlow ||
|
|
isSMRBFastCrossedOverSlow)
|
|
//
|
|
&&
|
|
//
|
|
isSMRBClosedOverFast &&
|
|
//
|
|
isMRBLongWeight &&
|
|
//
|
|
isMBRCloseLong
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isMMRBShort =
|
|
//
|
|
(isMMRBFastOverSlow ||
|
|
isMMRBFastCrossedOverSlow)
|
|
//
|
|
&&
|
|
//
|
|
isMMRBClosedOverFast &&
|
|
//
|
|
isMRBLongWeight &&
|
|
//
|
|
isMBRCloseLong
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isLMRBShort =
|
|
//
|
|
(isLMRBFastOverSlow ||
|
|
isLMRBFastCrossedOverSlow)
|
|
//
|
|
&&
|
|
//
|
|
isLMRBClosedOverFast &&
|
|
//
|
|
isMRBLongWeight &&
|
|
//
|
|
isMBRCloseLong
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isHMRBShort =
|
|
//
|
|
(isHMRBFastOverSlow ||
|
|
isHMRBFastCrossedOverSlow)
|
|
//
|
|
&&
|
|
//
|
|
isHMRBClosedOverFast &&
|
|
//
|
|
isMRBLongWeight &&
|
|
//
|
|
isMBRCloseLong
|
|
//
|
|
;
|
|
|
|
//
|
|
result =
|
|
//
|
|
isCMRBShort
|
|
//
|
|
||
|
|
//
|
|
isSMRBShort
|
|
//
|
|
||
|
|
//
|
|
isMMRBShort
|
|
//
|
|
||
|
|
//
|
|
isLMRBShort
|
|
//
|
|
||
|
|
//
|
|
isHMRBShort
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// XTD ...
|
|
bool XTDHasSpecifiedLongSignal(
|
|
X121MarketConditions &mConditions, //
|
|
double &sl, // Provided SL ...
|
|
double &tp, // Provided TP ...
|
|
double &r2r // Risk Reward Ratio ...
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
result =
|
|
//
|
|
false
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// XTAM ...
|
|
bool XTAMHasSpecifiedLongSignal(
|
|
X121MarketConditions &mConditions, //
|
|
double &sl, // Provided SL ...
|
|
double &tp, // Provided TP ...
|
|
double &r2r // Risk Reward Ratio ...
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
result =
|
|
//
|
|
false
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// XSI ...
|
|
bool XSIHasSpecifiedLongSignal(
|
|
X121MarketConditions &mConditions, //
|
|
double &sl, // Provided SL ...
|
|
double &tp, // Provided TP ...
|
|
double &r2r // Risk Reward Ratio ...
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
result =
|
|
//
|
|
false
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// XTSFI ...
|
|
bool XTSFIHasSpecifiedLongSignal(
|
|
X121MarketConditions &mConditions, //
|
|
double &sl, // Provided SL ...
|
|
double &tp, // Provided TP ...
|
|
double &r2r // Risk Reward Ratio ...
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
result =
|
|
//
|
|
false
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// XOBDLH ...
|
|
bool XOBDLHHasSpecifiedLongSignal(
|
|
X121MarketConditions &mConditions, //
|
|
double &sl, // Provided SL ...
|
|
double &tp, // Provided TP ...
|
|
double &r2r // Risk Reward Ratio ...
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
result =
|
|
//
|
|
false
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// XCHMACC ...
|
|
bool XCHMACCHasSpecifiedLongSignal(
|
|
X121MarketConditions &mConditions, //
|
|
double &sl, // Provided SL ...
|
|
double &tp, // Provided TP ...
|
|
double &r2r // Risk Reward Ratio ...
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
result =
|
|
//
|
|
false
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// XCHMAMN ...
|
|
bool XCHMAMNHasSpecifiedLongSignal(
|
|
X121MarketConditions &mConditions, //
|
|
double &sl, // Provided SL ...
|
|
double &tp, // Provided TP ...
|
|
double &r2r // Risk Reward Ratio ...
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
result =
|
|
//
|
|
false
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// XCHMAMX ...
|
|
bool XCHMAMXHasSpecifiedLongSignal(
|
|
X121MarketConditions &mConditions, //
|
|
double &sl, // Provided SL ...
|
|
double &tp, // Provided TP ...
|
|
double &r2r // Risk Reward Ratio ...
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
result =
|
|
//
|
|
false
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Short ...
|
|
|
|
//
|
|
bool XSPHasSpecifiedShortSignal(
|
|
X121MarketConditions &mConditions, //
|
|
double &sl, // Provided SL ...
|
|
double &tp, // Provided TP ...
|
|
double &r2r // Risk Reward Ratio ...
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
bool XTESTHasSpecifiedShortSignal(
|
|
X121MarketConditions &mConditions, //
|
|
double &sl, // Provided SL ...
|
|
double &tp, // Provided TP ...
|
|
double &r2r // Risk Reward Ratio ...
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Use XSTR ...
|
|
bool X786HasSpecifiedShortSignal(
|
|
X121MarketConditions &mConditions, //
|
|
double &sl, // Provided SL ...
|
|
double &tp, // Provided TP ...
|
|
double &r2r // Risk Reward Ratio ...
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
// //
|
|
// bool isCMStrShort =
|
|
// //
|
|
// mConditions.cMarketConditions.isTrendSwitchedToBearish &&
|
|
// (mConditions.hMarketConditions.isTrendBearish &&
|
|
// mConditions.lMarketConditions.isTrendBearish &&
|
|
// mConditions.mMarketConditions.isTrendBearish &&
|
|
// mConditions.sMarketConditions.isTrendBearish)
|
|
// //
|
|
// ;
|
|
|
|
// //
|
|
// bool isSMStrShort =
|
|
// //
|
|
// mConditions.sMarketConditions.isTrendSwitchedToBearish &&
|
|
// (mConditions.hMarketConditions.isTrendBearish &&
|
|
// mConditions.lMarketConditions.isTrendBearish &&
|
|
// mConditions.mMarketConditions.isTrendBearish &&
|
|
// mConditions.cMarketConditions.isTrendBearish)
|
|
// //
|
|
// ;
|
|
|
|
//
|
|
bool isMMStrShort =
|
|
//
|
|
mConditions.mMarketConditions.isTrendSwitchedToBearish &&
|
|
(mConditions.hMarketConditions.isTrendBearish &&
|
|
mConditions.lMarketConditions.isTrendBearish &&
|
|
mConditions.sMarketConditions.isTrendBearish &&
|
|
mConditions.cMarketConditions.isTrendBearish)
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isLMStrShort =
|
|
//
|
|
mConditions.lMarketConditions.isTrendSwitchedToBearish &&
|
|
(mConditions.hMarketConditions.isTrendBearish &&
|
|
mConditions.mMarketConditions.isTrendBearish &&
|
|
mConditions.sMarketConditions.isTrendBearish &&
|
|
mConditions.cMarketConditions.isTrendBearish)
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isHMStrShort =
|
|
//
|
|
mConditions.hMarketConditions.isTrendSwitchedToBearish &&
|
|
(mConditions.lMarketConditions.isTrendBearish &&
|
|
mConditions.mMarketConditions.isTrendBearish &&
|
|
mConditions.sMarketConditions.isTrendBearish &&
|
|
mConditions.cMarketConditions.isTrendBearish)
|
|
//
|
|
;
|
|
|
|
//
|
|
// bool isScorePassed = IsScorePassedForShort();
|
|
|
|
//
|
|
result =
|
|
// //
|
|
// isCMStrShort
|
|
// //
|
|
// ||
|
|
// //
|
|
// isSMStrShort
|
|
// //
|
|
// ||
|
|
//
|
|
isMMStrShort
|
|
//
|
|
||
|
|
//
|
|
isLMStrShort
|
|
//
|
|
||
|
|
//
|
|
isHMStrShort
|
|
//
|
|
;
|
|
|
|
//
|
|
// result = result && isScorePassed;
|
|
|
|
// //
|
|
// if (result)
|
|
// {
|
|
// sl = GetMaxPeaks();
|
|
// }
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Use XMC ...
|
|
bool X121HasSpecifiedShortSignal(
|
|
X121MarketConditions &mConditions, //
|
|
double &sl, // Provided SL ...
|
|
double &tp, // Provided TP ...
|
|
double &r2r // Risk Reward Ratio ...
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
// Current Market ...
|
|
// bool isCMCShort =
|
|
// //
|
|
// (
|
|
// //
|
|
// (mConditions.cMarketConditions.isSlowUnderVerifier &&
|
|
// mConditions.cMarketConditions.isFastCrossedUnderVerifier)
|
|
// //
|
|
// ||
|
|
// //
|
|
// (mConditions.cMarketConditions.isFastUnderVerifier &&
|
|
// mConditions.cMarketConditions.isSlowCrossedUnderVerifier)
|
|
// //
|
|
// )
|
|
// //
|
|
// &&
|
|
// //
|
|
// (mConditions.cMarketConditions.isCloseUnderFast &&
|
|
// mConditions.cMarketConditions.isCloseUnderSlow &&
|
|
// mConditions.cMarketConditions.isCloseUnderVerifier)
|
|
// //
|
|
// ;
|
|
|
|
//
|
|
// Short Market ...
|
|
// bool isSMCShort =
|
|
// //
|
|
// (
|
|
// //
|
|
// (mConditions.sMarketConditions.isSlowUnderVerifier &&
|
|
// mConditions.sMarketConditions.isFastCrossedUnderVerifier)
|
|
// //
|
|
// ||
|
|
// //
|
|
// (mConditions.sMarketConditions.isFastUnderVerifier &&
|
|
// mConditions.sMarketConditions.isSlowCrossedUnderVerifier)
|
|
// //
|
|
// )
|
|
// //
|
|
// &&
|
|
// //
|
|
// (mConditions.sMarketConditions.isCloseUnderFast &&
|
|
// mConditions.sMarketConditions.isCloseUnderSlow &&
|
|
// mConditions.sMarketConditions.isCloseUnderVerifier)
|
|
// //
|
|
// ;
|
|
|
|
//
|
|
// Medium Market ...
|
|
bool isMMCShort =
|
|
//
|
|
(
|
|
//
|
|
(mConditions.mMarketConditions.isSlowUnderVerifier &&
|
|
mConditions.mMarketConditions.isFastCrossedUnderVerifier)
|
|
//
|
|
||
|
|
//
|
|
(mConditions.mMarketConditions.isFastUnderVerifier &&
|
|
mConditions.mMarketConditions.isSlowCrossedUnderVerifier)
|
|
//
|
|
)
|
|
//
|
|
&&
|
|
//
|
|
(mConditions.mMarketConditions.isCloseUnderFast &&
|
|
mConditions.mMarketConditions.isCloseUnderSlow &&
|
|
mConditions.mMarketConditions.isCloseUnderVerifier)
|
|
//
|
|
;
|
|
|
|
//
|
|
// Long Market ...
|
|
bool isLMCShort =
|
|
//
|
|
(
|
|
//
|
|
(mConditions.lMarketConditions.isSlowUnderVerifier &&
|
|
mConditions.lMarketConditions.isFastCrossedUnderVerifier)
|
|
//
|
|
||
|
|
//
|
|
(mConditions.lMarketConditions.isFastUnderVerifier &&
|
|
mConditions.lMarketConditions.isSlowCrossedUnderVerifier)
|
|
//
|
|
)
|
|
//
|
|
&&
|
|
//
|
|
(mConditions.lMarketConditions.isCloseUnderFast &&
|
|
mConditions.lMarketConditions.isCloseUnderSlow &&
|
|
mConditions.lMarketConditions.isCloseUnderVerifier)
|
|
//
|
|
;
|
|
|
|
//
|
|
// Hind Market ...
|
|
bool isHMCShort =
|
|
//
|
|
(
|
|
//
|
|
(mConditions.hMarketConditions.isSlowUnderVerifier &&
|
|
mConditions.hMarketConditions.isFastCrossedUnderVerifier)
|
|
//
|
|
||
|
|
//
|
|
(mConditions.hMarketConditions.isFastUnderVerifier &&
|
|
mConditions.hMarketConditions.isSlowCrossedUnderVerifier)
|
|
//
|
|
)
|
|
//
|
|
&&
|
|
//
|
|
(mConditions.hMarketConditions.isCloseUnderFast &&
|
|
mConditions.hMarketConditions.isCloseUnderSlow &&
|
|
mConditions.hMarketConditions.isCloseUnderVerifier)
|
|
//
|
|
;
|
|
|
|
//
|
|
// bool isScorePassed = IsScorePassedForShort();
|
|
|
|
//
|
|
result =
|
|
// //
|
|
// isCMCShort
|
|
// //
|
|
// ||
|
|
// //
|
|
// isSMCShort
|
|
// //
|
|
// ||
|
|
//
|
|
isMMCShort
|
|
//
|
|
||
|
|
//
|
|
isLMCShort
|
|
//
|
|
||
|
|
//
|
|
isHMCShort
|
|
//
|
|
;
|
|
|
|
// //
|
|
// result = result && isScorePassed;
|
|
|
|
// //
|
|
// if (result)
|
|
// {
|
|
// sl = GetMaxPeaks();
|
|
// }
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Use XCHE ...
|
|
bool X110HasSpecifiedShortSignal(
|
|
X121MarketConditions &mConditions, //
|
|
double &sl, // Provided SL ...
|
|
double &tp, // Provided TP ...
|
|
double &r2r // Risk Reward Ratio ...
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
// //
|
|
// bool isCCHEShort =
|
|
// //
|
|
// (mConditions.cMarketConditions.isCHESwitchedInStrongShort &&
|
|
// (mConditions.sMarketConditions.isCHEInStrongShort &&
|
|
// mConditions.mMarketConditions.isCHEInStrongShort &&
|
|
// mConditions.lMarketConditions.isCHEInStrongShort &&
|
|
// mConditions.hMarketConditions.isCHEInStrongShort))
|
|
// //
|
|
// ;
|
|
|
|
// //
|
|
// bool isSCHEShort =
|
|
// //
|
|
// (mConditions.sMarketConditions.isCHESwitchedInStrongShort &&
|
|
// (mConditions.cMarketConditions.isCHEInStrongShort &&
|
|
// mConditions.mMarketConditions.isCHEInStrongShort &&
|
|
// mConditions.lMarketConditions.isCHEInStrongShort &&
|
|
// mConditions.hMarketConditions.isCHEInStrongShort))
|
|
// //
|
|
// ;
|
|
|
|
//
|
|
bool isMCHEShort =
|
|
//
|
|
(mConditions.mMarketConditions.isCHESwitchedInStrongShort &&
|
|
(mConditions.cMarketConditions.isCHEInStrongShort &&
|
|
mConditions.sMarketConditions.isCHEInStrongShort &&
|
|
mConditions.lMarketConditions.isCHEInStrongShort &&
|
|
mConditions.hMarketConditions.isCHEInStrongShort))
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isLCHEShort =
|
|
//
|
|
(mConditions.lMarketConditions.isCHESwitchedInStrongShort &&
|
|
(mConditions.cMarketConditions.isCHEInStrongShort &&
|
|
mConditions.sMarketConditions.isCHEInStrongShort &&
|
|
mConditions.mMarketConditions.isCHEInStrongShort &&
|
|
mConditions.hMarketConditions.isCHEInStrongShort))
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isHCHEShort =
|
|
//
|
|
(mConditions.hMarketConditions.isCHESwitchedInStrongShort &&
|
|
(mConditions.cMarketConditions.isCHEInStrongShort &&
|
|
mConditions.sMarketConditions.isCHEInStrongShort &&
|
|
mConditions.mMarketConditions.isCHEInStrongShort &&
|
|
mConditions.lMarketConditions.isCHEInStrongShort))
|
|
//
|
|
;
|
|
|
|
//
|
|
// bool isScorePassed = IsScorePassedForShort();
|
|
|
|
//
|
|
result =
|
|
// //
|
|
// isCCHEShort
|
|
// //
|
|
// ||
|
|
// //
|
|
// isSCHEShort
|
|
// //
|
|
// ||
|
|
//
|
|
isMCHEShort
|
|
//
|
|
||
|
|
//
|
|
isLCHEShort
|
|
//
|
|
||
|
|
//
|
|
isHCHEShort
|
|
//
|
|
;
|
|
|
|
//
|
|
// result = result && isScorePassed;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Use XHK ...
|
|
bool X92HasSpecifiedShortSignal(
|
|
X121MarketConditions &mConditions, //
|
|
double &sl, // Provided SL ...
|
|
double &tp, // Provided TP ...
|
|
double &r2r // Risk Reward Ratio ...
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
int curr = 0;
|
|
int prev = 1;
|
|
|
|
//
|
|
bool isCSMHKSwitchedToBearish =
|
|
//
|
|
mConditions.cMarketConditions.smHKBars[curr].IsBearish() &&
|
|
!mConditions.cMarketConditions.smHKBars[prev].IsBearish()
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isCSMHKBearish =
|
|
//
|
|
mConditions.cMarketConditions.smHKBars[curr].IsBearish() &&
|
|
mConditions.cMarketConditions.smHKBars[prev].IsBearish() &&
|
|
!mConditions.bars[curr].open < mConditions.cMarketConditions.smHKBars[curr].GetDown() &&
|
|
!mConditions.bars[prev].close < mConditions.cMarketConditions.smHKBars[prev].GetDown()
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isSSMHKSwitchedToBearish =
|
|
//
|
|
mConditions.sMarketConditions.smHKBars[curr].IsBearish() &&
|
|
!mConditions.sMarketConditions.smHKBars[prev].IsBearish()
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isSSMHKBearish =
|
|
//
|
|
mConditions.sMarketConditions.smHKBars[curr].IsBearish() &&
|
|
mConditions.sMarketConditions.smHKBars[prev].IsBearish() &&
|
|
!mConditions.bars[curr].open < mConditions.sMarketConditions.smHKBars[curr].GetDown() &&
|
|
!mConditions.bars[prev].close < mConditions.sMarketConditions.smHKBars[prev].GetDown()
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isMSMHKSwitchedToBearish =
|
|
//
|
|
mConditions.mMarketConditions.smHKBars[curr].IsBearish() &&
|
|
!mConditions.mMarketConditions.smHKBars[prev].IsBearish()
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isMSMHKBearish =
|
|
//
|
|
mConditions.mMarketConditions.smHKBars[curr].IsBearish() &&
|
|
mConditions.mMarketConditions.smHKBars[prev].IsBearish() &&
|
|
!mConditions.bars[curr].open < mConditions.mMarketConditions.smHKBars[curr].GetDown() &&
|
|
!mConditions.bars[prev].close < mConditions.mMarketConditions.smHKBars[prev].GetDown()
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isLSMHKSwitchedToBearish =
|
|
//
|
|
mConditions.lMarketConditions.smHKBars[curr].IsBearish() &&
|
|
!mConditions.lMarketConditions.smHKBars[prev].IsBearish()
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isLSMHKBearish =
|
|
//
|
|
mConditions.lMarketConditions.smHKBars[curr].IsBearish() &&
|
|
mConditions.lMarketConditions.smHKBars[prev].IsBearish() &&
|
|
!mConditions.bars[curr].open < mConditions.lMarketConditions.smHKBars[curr].GetDown() &&
|
|
!mConditions.bars[prev].close < mConditions.lMarketConditions.smHKBars[prev].GetDown()
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isHSMHKSwitchedToBearish =
|
|
//
|
|
mConditions.hMarketConditions.smHKBars[curr].IsBearish() &&
|
|
!mConditions.hMarketConditions.smHKBars[prev].IsBearish()
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isHSMHKBearish =
|
|
//
|
|
mConditions.hMarketConditions.smHKBars[curr].IsBearish() &&
|
|
mConditions.hMarketConditions.smHKBars[prev].IsBearish() &&
|
|
!mConditions.bars[curr].open < mConditions.hMarketConditions.smHKBars[curr].GetDown() &&
|
|
!mConditions.bars[prev].close < mConditions.hMarketConditions.smHKBars[prev].GetDown()
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isCSMHKShort =
|
|
//
|
|
(isCSMHKBearish ||
|
|
isCSMHKSwitchedToBearish) &&
|
|
isSSMHKBearish &&
|
|
isMSMHKBearish &&
|
|
isLSMHKBearish &&
|
|
isHSMHKBearish
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isSSMHKShort =
|
|
//
|
|
(isSSMHKBearish ||
|
|
isSSMHKSwitchedToBearish) &&
|
|
isCSMHKBearish &&
|
|
isMSMHKBearish &&
|
|
isLSMHKBearish &&
|
|
isHSMHKBearish
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isMSMHKShort =
|
|
//
|
|
(isMSMHKBearish ||
|
|
isMSMHKSwitchedToBearish) &&
|
|
isSSMHKBearish &&
|
|
isCSMHKBearish &&
|
|
isLSMHKBearish &&
|
|
isHSMHKBearish
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isLSMHKShort =
|
|
//
|
|
(isLSMHKBearish ||
|
|
isLSMHKSwitchedToBearish) &&
|
|
isSSMHKBearish &&
|
|
isCSMHKBearish &&
|
|
isMSMHKBearish &&
|
|
isHSMHKBearish
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isHSMHKShort =
|
|
//
|
|
(isHSMHKBearish ||
|
|
isHSMHKSwitchedToBearish) &&
|
|
isSSMHKBearish &&
|
|
isCSMHKBearish &&
|
|
isMSMHKBearish &&
|
|
isLSMHKBearish
|
|
//
|
|
;
|
|
|
|
//
|
|
result =
|
|
//
|
|
// isCSMHKShort
|
|
// //
|
|
// ||
|
|
// //
|
|
// isSSMHKShort
|
|
// //
|
|
// ||
|
|
//
|
|
isMSMHKShort
|
|
//
|
|
||
|
|
//
|
|
isLSMHKShort
|
|
//
|
|
||
|
|
//
|
|
isHSMHKShort
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Use XMRB ...
|
|
bool X128HasSpecifiedShortSignal(
|
|
X121MarketConditions &mConditions, //
|
|
double &sl, // Provided SL ...
|
|
double &tp, // Provided TP ...
|
|
double &r2r // Risk Reward Ratio ...
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
// Current Cycle ...
|
|
|
|
//
|
|
bool isCMRBFastUnderSlow =
|
|
//
|
|
mConditions.cMarketConditions.mrbFasts[1] < mConditions.cMarketConditions.mrbSlows[1]
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isCMRBFastCrossedUnderSlow =
|
|
//
|
|
mConditions.cMarketConditions.mrbFasts[1] < mConditions.cMarketConditions.mrbSlows[1] &&
|
|
mConditions.cMarketConditions.mrbFasts[2] >= mConditions.cMarketConditions.mrbSlows[2]
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isCMRBClosedUnderFast =
|
|
//
|
|
mConditions.cMarketConditions.bars[1].close < mConditions.cMarketConditions.mrbFasts[1]
|
|
//
|
|
;
|
|
|
|
//
|
|
// Short Cycle ...
|
|
|
|
//
|
|
bool isSMRBFastUnderSlow =
|
|
//
|
|
mConditions.sMarketConditions.mrbFasts[1] < mConditions.sMarketConditions.mrbSlows[1]
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isSMRBFastCrossedUnderSlow =
|
|
//
|
|
mConditions.sMarketConditions.mrbFasts[1] < mConditions.sMarketConditions.mrbSlows[1] &&
|
|
mConditions.sMarketConditions.mrbFasts[2] >= mConditions.sMarketConditions.mrbSlows[2]
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isSMRBClosedUnderFast =
|
|
//
|
|
mConditions.sMarketConditions.bars[1].close < mConditions.sMarketConditions.mrbFasts[1]
|
|
//
|
|
;
|
|
|
|
//
|
|
// Medium Cycle ...
|
|
|
|
//
|
|
bool isMMRBFastUnderSlow =
|
|
//
|
|
mConditions.mMarketConditions.mrbFasts[1] < mConditions.mMarketConditions.mrbSlows[1]
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isMMRBFastCrossedUnderSlow =
|
|
//
|
|
mConditions.mMarketConditions.mrbFasts[1] < mConditions.mMarketConditions.mrbSlows[1] &&
|
|
mConditions.mMarketConditions.mrbFasts[2] >= mConditions.mMarketConditions.mrbSlows[2]
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isMMRBClosedUnderFast =
|
|
//
|
|
mConditions.mMarketConditions.bars[1].close < mConditions.mMarketConditions.mrbFasts[1]
|
|
//
|
|
;
|
|
|
|
//
|
|
// Long Cycle ...
|
|
|
|
//
|
|
bool isLMRBFastUnderSlow =
|
|
//
|
|
mConditions.lMarketConditions.mrbFasts[1] < mConditions.lMarketConditions.mrbSlows[1]
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isLMRBFastCrossedUnderSlow =
|
|
//
|
|
mConditions.lMarketConditions.mrbFasts[1] < mConditions.lMarketConditions.mrbSlows[1] &&
|
|
mConditions.lMarketConditions.mrbFasts[2] >= mConditions.lMarketConditions.mrbSlows[2]
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isLMRBClosedUnderFast =
|
|
//
|
|
mConditions.lMarketConditions.bars[1].close < mConditions.lMarketConditions.mrbFasts[1]
|
|
//
|
|
;
|
|
|
|
//
|
|
// Hind Cycle ...
|
|
|
|
//
|
|
bool isHMRBFastUnderSlow =
|
|
//
|
|
mConditions.hMarketConditions.mrbFasts[1] < mConditions.hMarketConditions.mrbSlows[1]
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isHMRBFastCrossedUnderSlow =
|
|
//
|
|
mConditions.hMarketConditions.mrbFasts[1] < mConditions.hMarketConditions.mrbSlows[1] &&
|
|
mConditions.hMarketConditions.mrbFasts[2] >= mConditions.hMarketConditions.mrbSlows[2]
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isHMRBClosedUnderFast =
|
|
//
|
|
mConditions.hMarketConditions.bars[1].close < mConditions.hMarketConditions.mrbFasts[1]
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isMRBShortWeight =
|
|
//
|
|
(
|
|
//
|
|
isCMRBFastUnderSlow &&
|
|
isSMRBFastUnderSlow &&
|
|
isMMRBFastUnderSlow &&
|
|
isLMRBFastUnderSlow &&
|
|
isHMRBFastUnderSlow
|
|
//
|
|
)
|
|
//
|
|
||
|
|
//
|
|
(
|
|
//
|
|
isCMRBFastUnderSlow &&
|
|
((
|
|
isSMRBFastUnderSlow &&
|
|
isMMRBFastUnderSlow &&
|
|
isLMRBFastUnderSlow)
|
|
//
|
|
||
|
|
//
|
|
(
|
|
isSMRBFastUnderSlow &&
|
|
isLMRBFastUnderSlow &&
|
|
isHMRBFastUnderSlow)
|
|
//
|
|
||
|
|
//
|
|
(
|
|
isMMRBFastUnderSlow &&
|
|
isLMRBFastUnderSlow &&
|
|
isHMRBFastUnderSlow))
|
|
//
|
|
)
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isMBRCloseShort =
|
|
//
|
|
(
|
|
//
|
|
isCMRBClosedUnderFast &&
|
|
isSMRBClosedUnderFast &&
|
|
isMMRBClosedUnderFast &&
|
|
isLMRBClosedUnderFast &&
|
|
isHMRBClosedUnderFast
|
|
//
|
|
)
|
|
//
|
|
||
|
|
//
|
|
(
|
|
//
|
|
isCMRBClosedUnderFast &&
|
|
((
|
|
isSMRBClosedUnderFast &&
|
|
isMMRBClosedUnderFast)
|
|
//
|
|
||
|
|
//
|
|
(
|
|
isSMRBClosedUnderFast &&
|
|
isLMRBClosedUnderFast)
|
|
//
|
|
||
|
|
//
|
|
(
|
|
isSMRBClosedUnderFast &&
|
|
isHMRBClosedUnderFast)
|
|
//
|
|
||
|
|
//
|
|
(
|
|
isMMRBClosedUnderFast &&
|
|
isLMRBClosedUnderFast)
|
|
//
|
|
||
|
|
//
|
|
(
|
|
isLMRBClosedUnderFast &&
|
|
isHMRBClosedUnderFast)
|
|
//
|
|
||
|
|
//
|
|
(
|
|
isMMRBClosedUnderFast &&
|
|
isHMRBClosedUnderFast)
|
|
//
|
|
||
|
|
//
|
|
(
|
|
isSMRBClosedUnderFast &&
|
|
isMMRBClosedUnderFast &&
|
|
isLMRBClosedUnderFast)
|
|
//
|
|
||
|
|
//
|
|
(
|
|
isSMRBClosedUnderFast &&
|
|
isLMRBClosedUnderFast &&
|
|
isHMRBClosedUnderFast)
|
|
//
|
|
||
|
|
//
|
|
(
|
|
isMMRBClosedUnderFast &&
|
|
isLMRBClosedUnderFast &&
|
|
isHMRBClosedUnderFast))
|
|
//
|
|
)
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isCMRBShort =
|
|
//
|
|
(isCMRBFastUnderSlow ||
|
|
isCMRBFastCrossedUnderSlow)
|
|
//
|
|
&&
|
|
//
|
|
isCMRBClosedUnderFast &&
|
|
//
|
|
isMRBShortWeight &&
|
|
//
|
|
isMBRCloseShort
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isSMRBShort =
|
|
//
|
|
(isSMRBFastUnderSlow ||
|
|
isSMRBFastCrossedUnderSlow)
|
|
//
|
|
&&
|
|
//
|
|
isSMRBClosedUnderFast &&
|
|
//
|
|
isMRBShortWeight &&
|
|
//
|
|
isMBRCloseShort
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isMMRBShort =
|
|
//
|
|
(isMMRBFastUnderSlow ||
|
|
isMMRBFastCrossedUnderSlow)
|
|
//
|
|
&&
|
|
//
|
|
isMMRBClosedUnderFast &&
|
|
//
|
|
isMRBShortWeight &&
|
|
//
|
|
isMBRCloseShort
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isLMRBShort =
|
|
//
|
|
(isLMRBFastUnderSlow ||
|
|
isLMRBFastCrossedUnderSlow)
|
|
//
|
|
&&
|
|
//
|
|
isLMRBClosedUnderFast &&
|
|
//
|
|
isMRBShortWeight &&
|
|
//
|
|
isMBRCloseShort
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isHMRBShort =
|
|
//
|
|
(isHMRBFastUnderSlow ||
|
|
isHMRBFastCrossedUnderSlow)
|
|
//
|
|
&&
|
|
//
|
|
isHMRBClosedUnderFast &&
|
|
//
|
|
isMRBShortWeight &&
|
|
//
|
|
isMBRCloseShort
|
|
//
|
|
;
|
|
|
|
//
|
|
result =
|
|
//
|
|
isCMRBShort
|
|
//
|
|
||
|
|
//
|
|
isSMRBShort
|
|
//
|
|
||
|
|
//
|
|
isMMRBShort
|
|
//
|
|
||
|
|
//
|
|
isLMRBShort
|
|
//
|
|
||
|
|
//
|
|
isHMRBShort
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// XTD ...
|
|
bool XTDHasSpecifiedShortSignal(
|
|
X121MarketConditions &mConditions, //
|
|
double &sl, // Provided SL ...
|
|
double &tp, // Provided TP ...
|
|
double &r2r // Risk Reward Ratio ...
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
result =
|
|
//
|
|
false
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// XTAM ...
|
|
bool XTAMHasSpecifiedShortSignal(
|
|
X121MarketConditions &mConditions, //
|
|
double &sl, // Provided SL ...
|
|
double &tp, // Provided TP ...
|
|
double &r2r // Risk Reward Ratio ...
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
result =
|
|
//
|
|
false
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// XSI ...
|
|
bool XSIHasSpecifiedShortSignal(
|
|
X121MarketConditions &mConditions, //
|
|
double &sl, // Provided SL ...
|
|
double &tp, // Provided TP ...
|
|
double &r2r // Risk Reward Ratio ...
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
result =
|
|
//
|
|
false
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// XTSFI ...
|
|
bool XTSFIHasSpecifiedShortSignal(
|
|
X121MarketConditions &mConditions, //
|
|
double &sl, // Provided SL ...
|
|
double &tp, // Provided TP ...
|
|
double &r2r // Risk Reward Ratio ...
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
result =
|
|
//
|
|
false
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// XOBDLH ...
|
|
bool XOBDLHHasSpecifiedShortSignal(
|
|
X121MarketConditions &mConditions, //
|
|
double &sl, // Provided SL ...
|
|
double &tp, // Provided TP ...
|
|
double &r2r // Risk Reward Ratio ...
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
result =
|
|
//
|
|
false
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// XCHMACC ...
|
|
bool XCHMACCHasSpecifiedShortSignal(
|
|
X121MarketConditions &mConditions, //
|
|
double &sl, // Provided SL ...
|
|
double &tp, // Provided TP ...
|
|
double &r2r // Risk Reward Ratio ...
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
result =
|
|
//
|
|
false
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// XCHMAMN ...
|
|
bool XCHMAMNHasSpecifiedShortSignal(
|
|
X121MarketConditions &mConditions, //
|
|
double &sl, // Provided SL ...
|
|
double &tp, // Provided TP ...
|
|
double &r2r // Risk Reward Ratio ...
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
result =
|
|
//
|
|
false
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// XCHMAMX ...
|
|
bool XCHMAMXHasSpecifiedShortSignal(
|
|
X121MarketConditions &mConditions, //
|
|
double &sl, // Provided SL ...
|
|
double &tp, // Provided TP ...
|
|
double &r2r // Risk Reward Ratio ...
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
result =
|
|
//
|
|
false
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Base Signals ...
|
|
// Common Conditions ...
|
|
|
|
//
|
|
bool HasBaseLongConditions(
|
|
X121MarketConditions &mConditions,
|
|
int &pusher //
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
int count = 0;
|
|
|
|
//
|
|
bool hasXTDConditions = XTDHasLongConditions(mConditions);
|
|
if (hasXTDConditions)
|
|
{
|
|
count++;
|
|
}
|
|
bool hasXTAMConditions = XTAMHasLongConditions(mConditions);
|
|
if (hasXTAMConditions)
|
|
{
|
|
count++;
|
|
}
|
|
bool hasXSIConditions = XSIHasLongConditions(mConditions);
|
|
if (hasXSIConditions)
|
|
{
|
|
count++;
|
|
}
|
|
bool hasXTSFIConditions = XTSFIHasLongConditions(mConditions);
|
|
if (hasXTSFIConditions)
|
|
{
|
|
count++;
|
|
}
|
|
bool hasXOBDLHConditions = XOBDLHHasLongConditions(mConditions);
|
|
if (hasXOBDLHConditions)
|
|
{
|
|
count++;
|
|
}
|
|
bool hasXCHMACCConditions = XCHMACCHasLongConditions(mConditions);
|
|
if (hasXCHMACCConditions)
|
|
{
|
|
count++;
|
|
}
|
|
bool hasXCHMAMNConditions = XCHMAMNHasLongConditions(mConditions);
|
|
if (hasXCHMAMNConditions)
|
|
{
|
|
count++;
|
|
}
|
|
bool hasXCHMAMXConditions = XCHMAMXHasLongConditions(mConditions);
|
|
if (hasXCHMAMXConditions)
|
|
{
|
|
count++;
|
|
}
|
|
|
|
//
|
|
result = count >= 1;
|
|
pusher = count;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
bool HasBaseShortConditions(
|
|
X121MarketConditions &mConditions,
|
|
int &pusher //
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
int count = 0;
|
|
|
|
//
|
|
bool hasXTDConditions = XTDHasShortConditions(mConditions);
|
|
if (hasXTDConditions)
|
|
{
|
|
count++;
|
|
}
|
|
bool hasXTAMConditions = XTAMHasShortConditions(mConditions);
|
|
if (hasXTAMConditions)
|
|
{
|
|
count++;
|
|
}
|
|
bool hasXSIConditions = XSIHasShortConditions(mConditions);
|
|
if (hasXSIConditions)
|
|
{
|
|
count++;
|
|
}
|
|
bool hasXTSFIConditions = XTSFIHasShortConditions(mConditions);
|
|
if (hasXTSFIConditions)
|
|
{
|
|
count++;
|
|
}
|
|
bool hasXOBDLHConditions = XOBDLHHasShortConditions(mConditions);
|
|
if (hasXOBDLHConditions)
|
|
{
|
|
count++;
|
|
}
|
|
bool hasXCHMACCConditions = XCHMACCHasShortConditions(mConditions);
|
|
if (hasXCHMACCConditions)
|
|
{
|
|
count++;
|
|
}
|
|
bool hasXCHMAMNConditions = XCHMAMNHasShortConditions(mConditions);
|
|
if (hasXCHMAMNConditions)
|
|
{
|
|
count++;
|
|
}
|
|
bool hasXCHMAMXConditions = XCHMAMXHasShortConditions(mConditions);
|
|
if (hasXCHMAMXConditions)
|
|
{
|
|
count++;
|
|
}
|
|
|
|
//
|
|
result = count >= 1;
|
|
pusher = count;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// XTD ...
|
|
|
|
//
|
|
bool XTDHasLongConditions(
|
|
X121MarketConditions &mConditions //
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
// Start Analysing Market based On Conditions ...
|
|
result =
|
|
//
|
|
// Base Condition:
|
|
// each Strategy must has a Base Conditions, which they are usually common combinations
|
|
// of Market Properties that must be happens to lookup for signals ...
|
|
(
|
|
//
|
|
mConditions.isXTDSignalCrossedOverBear
|
|
//
|
|
)
|
|
//
|
|
&&
|
|
//
|
|
// Next Step is combine sorts of Conditions which make our choice
|
|
// so Exact in Market ...
|
|
(
|
|
//
|
|
IsReadyForLong(mConditions)
|
|
//
|
|
)
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
bool XTDHasShortConditions(
|
|
X121MarketConditions &mConditions //
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
// Start Analysing Market based On Conditions ...
|
|
result =
|
|
//
|
|
// Base Condition:
|
|
// each Strategy must has a Base Conditions, which they are usually common combinations
|
|
// of Market Properties that must be happens to lookup for signals ...
|
|
(
|
|
//
|
|
mConditions.isXTDSignalCrossedUnderBear
|
|
//
|
|
)
|
|
//
|
|
&&
|
|
//
|
|
// Next Step is combine sorts of Conditions which make our choice
|
|
// so Exact in Market ...
|
|
(
|
|
//
|
|
IsReadyForShort(mConditions)
|
|
//
|
|
)
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// XTAM ...
|
|
|
|
//
|
|
bool XTAMHasLongConditions(
|
|
X121MarketConditions &mConditions //
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
// Start Analysing Market based On Conditions ...
|
|
result =
|
|
//
|
|
// Base Condition:
|
|
// each Strategy must has a Base Conditions, which they are usually common combinations
|
|
// of Market Properties that must be happens to lookup for signals ...
|
|
(
|
|
//
|
|
(mConditions.amas[1] > mConditions.tms[1] &&
|
|
mConditions.amas[2] > mConditions.tms[2])
|
|
//
|
|
&&
|
|
//
|
|
!(mConditions.amas[2] > mConditions.tms[2] &&
|
|
mConditions.amas[3] > mConditions.tms[3])
|
|
//
|
|
)
|
|
//
|
|
&&
|
|
//
|
|
// Next Step is combine sorts of Conditions which make our choice
|
|
// so Exact in Market ...
|
|
(
|
|
//
|
|
IsReadyForLong(mConditions)
|
|
//
|
|
)
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
bool XTAMHasShortConditions(
|
|
X121MarketConditions &mConditions //
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
// Start Analysing Market based On Conditions ...
|
|
result =
|
|
//
|
|
// Base Condition:
|
|
// each Strategy must has a Base Conditions, which they are usually common combinations
|
|
// of Market Properties that must be happens to lookup for signals ...
|
|
(
|
|
//
|
|
(mConditions.amas[1] < mConditions.amas[1] &&
|
|
mConditions.amas[2] < mConditions.amas[2])
|
|
//
|
|
&&
|
|
//
|
|
!(mConditions.amas[2] < mConditions.amas[2] &&
|
|
mConditions.amas[3] < mConditions.amas[3])
|
|
//
|
|
)
|
|
//
|
|
&&
|
|
//
|
|
// Next Step is combine sorts of Conditions which make our choice
|
|
// so Exact in Market ...
|
|
(
|
|
//
|
|
IsReadyForShort(mConditions)
|
|
//
|
|
)
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// XSI ...
|
|
|
|
//
|
|
bool XSIHasLongConditions(
|
|
X121MarketConditions &mConditions //
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
// Start Analysing Market based On Conditions ...
|
|
result =
|
|
//
|
|
// Base Condition:
|
|
// each Strategy must has a Base Conditions, which they are usually common combinations
|
|
// of Market Properties that must be happens to lookup for signals ...
|
|
(
|
|
//
|
|
mConditions.isXRSICrossedOverLongEntry &&
|
|
mConditions.rsis[3] < mInputs.rsiInputs.longEntryValue
|
|
//
|
|
)
|
|
//
|
|
&&
|
|
//
|
|
// Next Step is combine sorts of Conditions which make our choice
|
|
// so Exact in Market ...
|
|
(
|
|
//
|
|
IsReadyForLong(
|
|
mConditions,
|
|
true, // XCHMA Min
|
|
true, // XCHMA Max
|
|
true, // XCHMA Cycles
|
|
true, // XCHMA Peaks
|
|
false, // XCHMA Trend Powers
|
|
true, // XOBD
|
|
true // XTS
|
|
)
|
|
//
|
|
)
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
bool XSIHasShortConditions(
|
|
X121MarketConditions &mConditions //
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
// Start Analysing Market based On Conditions ...
|
|
result =
|
|
//
|
|
// Base Condition:
|
|
// each Strategy must has a Base Conditions, which they are usually common combinations
|
|
// of Market Properties that must be happens to lookup for signals ...
|
|
(
|
|
//
|
|
mConditions.isXRSICrossedUnderShortEntry &&
|
|
mConditions.rsis[3] > mInputs.rsiInputs.shortEntryValue
|
|
//
|
|
)
|
|
//
|
|
&&
|
|
//
|
|
// Next Step is combine sorts of Conditions which make our choice
|
|
// so Exact in Market ...
|
|
(
|
|
//
|
|
IsReadyForShort(
|
|
mConditions,
|
|
true, // XCHMA Min
|
|
true, // XCHMA Max
|
|
true, // XCHMA Cycles
|
|
true, // XCHMA Peaks
|
|
false, // XCHMA Trend Powers
|
|
true, // XOBD
|
|
true // XTS
|
|
)
|
|
//
|
|
)
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// XTSFI ...
|
|
|
|
//
|
|
bool XTSFIHasLongConditions(
|
|
X121MarketConditions &mConditions //
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
double tsValues[] = {
|
|
mConditions.tsCurrents[1],
|
|
mConditions.tsNearests[1],
|
|
mConditions.tsMediests[1],
|
|
mConditions.tsFarests[1],
|
|
};
|
|
|
|
//
|
|
double tsMin = GetMin(tsValues);
|
|
|
|
//
|
|
// Start Analysing Market based On Conditions ...
|
|
result =
|
|
//
|
|
// Base Condition:
|
|
// each Strategy must has a Base Conditions, which they are usually common combinations
|
|
// of Market Properties that must be happens to lookup for signals ...
|
|
(
|
|
//
|
|
tsMin == mConditions.tsFarests[1] &&
|
|
(mConditions.isXTSCurrentOverFarest ||
|
|
mConditions.isXTSCurrentCrossedOverFarest) &&
|
|
(mConditions.tsCurrents[1] < mConditions.tsNearests[1] ||
|
|
mConditions.tsCurrents[1] < mConditions.tsMediests[1]) &&
|
|
!(mConditions.isXTSCurrentUnderNearest ||
|
|
mConditions.isXTSCurrentCrossedUnderNearest)
|
|
//
|
|
)
|
|
//
|
|
&&
|
|
//
|
|
// Next Step is combine sorts of Conditions which make our choice
|
|
// so Exact in Market ...
|
|
(
|
|
//
|
|
IsReadyForLong(mConditions)
|
|
//
|
|
)
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
bool XTSFIHasShortConditions(
|
|
X121MarketConditions &mConditions //
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
double tsValues[] = {
|
|
mConditions.tsCurrents[1],
|
|
mConditions.tsNearests[1],
|
|
mConditions.tsMediests[1],
|
|
mConditions.tsFarests[1],
|
|
};
|
|
|
|
//
|
|
double tsMax = GetMax(tsValues);
|
|
|
|
//
|
|
// Start Analysing Market based On Conditions ...
|
|
result =
|
|
//
|
|
// Base Condition:
|
|
// each Strategy must has a Base Conditions, which they are usually common combinations
|
|
// of Market Properties that must be happens to lookup for signals ...
|
|
(
|
|
//
|
|
tsMax == mConditions.tsFarests[1] &&
|
|
(mConditions.isXTSCurrentUnderFarest ||
|
|
mConditions.isXTSCurrentCrossedUnderFarest) &&
|
|
(mConditions.tsCurrents[1] > mConditions.tsNearests[1] ||
|
|
mConditions.tsCurrents[1] > mConditions.tsMediests[1]) &&
|
|
!(mConditions.isXTSCurrentOverNearest ||
|
|
mConditions.isXTSCurrentCrossedOverNearest)
|
|
//
|
|
)
|
|
//
|
|
&&
|
|
//
|
|
// Next Step is combine sorts of Conditions which make our choice
|
|
// so Exact in Market ...
|
|
(
|
|
//
|
|
IsReadyForShort(mConditions)
|
|
//
|
|
)
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// XOBDLH ...
|
|
|
|
//
|
|
bool XOBDLHHasLongConditions(
|
|
X121MarketConditions &mConditions //
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
X121MarketConditions mConditions2;
|
|
GetMarketConditions(
|
|
mConditions,
|
|
2 //
|
|
);
|
|
|
|
//
|
|
// Start Analysing Market based On Conditions ...
|
|
result =
|
|
//
|
|
// Base Condition:
|
|
// each Strategy must has a Base Conditions, which they are usually common combinations
|
|
// of Market Properties that must be happens to lookup for signals ...
|
|
(
|
|
//
|
|
mConditions2.isXOBDSwingLow &&
|
|
mConditions2.isXLHLowAttachedLL &&
|
|
mConditions.lhLls[1] >= mConditions.lhLls[2]
|
|
//
|
|
)
|
|
//
|
|
&&
|
|
//
|
|
// Next Step is combine sorts of Conditions which make our choice
|
|
// so Exact in Market ...
|
|
(
|
|
//
|
|
IsReadyForLong(
|
|
mConditions,
|
|
true, // XCHMA Min
|
|
true, // XCHMA Max
|
|
false, // XCHMA Cycles
|
|
false, // XCHMA Peaks
|
|
false, // XCHMA Trend Powers
|
|
false, // XOBD
|
|
false // XTS
|
|
)
|
|
//
|
|
)
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
bool XOBDLHHasShortConditions(
|
|
X121MarketConditions &mConditions //
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
X121MarketConditions mConditions2;
|
|
GetMarketConditions(
|
|
mConditions,
|
|
2 //
|
|
);
|
|
|
|
//
|
|
// Start Analysing Market based On Conditions ...
|
|
result =
|
|
//
|
|
// Base Condition:
|
|
// each Strategy must has a Base Conditions, which they are usually common combinations
|
|
// of Market Properties that must be happens to lookup for signals ...
|
|
(
|
|
//
|
|
mConditions2.isXOBDSwingHigh &&
|
|
mConditions2.isXLHHighAttachedHH &&
|
|
mConditions.lhHhs[1] <= mConditions.lhHhs[2]
|
|
//
|
|
)
|
|
//
|
|
&&
|
|
//
|
|
// Next Step is combine sorts of Conditions which make our choice
|
|
// so Exact in Market ...
|
|
(
|
|
//
|
|
IsReadyForShort(
|
|
mConditions,
|
|
true, // XCHMA Min
|
|
true, // XCHMA Max
|
|
false, // XCHMA Cycles
|
|
false, // XCHMA Peaks
|
|
false, // XCHMA Trend Powers
|
|
false, // XOBD
|
|
false // XTS
|
|
)
|
|
//
|
|
)
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// XCHMACC ...
|
|
|
|
//
|
|
bool XCHMACCHasLongConditions(
|
|
X121MarketConditions &mConditions //
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
// Start Analysing Market based On Conditions ...
|
|
result =
|
|
//
|
|
// Base Condition:
|
|
// each Strategy must has a Base Conditions, which they are usually common combinations
|
|
// of Market Properties that must be happens to lookup for signals ...
|
|
(
|
|
//
|
|
mConditions.chmaScFasts[1] > mConditions.chmaScSlows[1] &&
|
|
mConditions.chmaMcFasts[1] > mConditions.chmaMcSlows[1] &&
|
|
mConditions.chmaLcFasts[1] > mConditions.chmaLcSlows[1] &&
|
|
//
|
|
mConditions.chmaScFasts[2] > mConditions.chmaScSlows[2] &&
|
|
mConditions.chmaMcFasts[2] > mConditions.chmaMcSlows[2] &&
|
|
mConditions.chmaLcFasts[2] > mConditions.chmaLcSlows[2] &&
|
|
//
|
|
!(
|
|
//
|
|
mConditions.chmaScFasts[3] > mConditions.chmaScSlows[3] &&
|
|
mConditions.chmaMcFasts[3] > mConditions.chmaMcSlows[3] &&
|
|
mConditions.chmaLcFasts[3] > mConditions.chmaLcSlows[3]
|
|
//
|
|
)
|
|
//
|
|
)
|
|
//
|
|
&&
|
|
//
|
|
// Next Step is combine sorts of Conditions which make our choice
|
|
// so Exact in Market ...
|
|
(
|
|
//
|
|
IsReadyForLong(mConditions)
|
|
//
|
|
)
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
bool XCHMACCHasShortConditions(
|
|
X121MarketConditions &mConditions //
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
// Start Analysing Market based On Conditions ...
|
|
result =
|
|
//
|
|
// Base Condition:
|
|
// each Strategy must has a Base Conditions, which they are usually common combinations
|
|
// of Market Properties that must be happens to lookup for signals ...
|
|
(
|
|
//
|
|
mConditions.chmaScFasts[1] < mConditions.chmaScSlows[1] &&
|
|
mConditions.chmaMcFasts[1] < mConditions.chmaMcSlows[1] &&
|
|
mConditions.chmaLcFasts[1] < mConditions.chmaLcSlows[1] &&
|
|
//
|
|
mConditions.chmaScFasts[2] < mConditions.chmaScSlows[2] &&
|
|
mConditions.chmaMcFasts[2] < mConditions.chmaMcSlows[2] &&
|
|
mConditions.chmaLcFasts[2] < mConditions.chmaLcSlows[2] &&
|
|
//
|
|
!(
|
|
//
|
|
mConditions.chmaScFasts[3] < mConditions.chmaScSlows[3] &&
|
|
mConditions.chmaMcFasts[3] < mConditions.chmaMcSlows[3] &&
|
|
mConditions.chmaLcFasts[3] < mConditions.chmaLcSlows[3]
|
|
//
|
|
)
|
|
//
|
|
)
|
|
//
|
|
&&
|
|
//
|
|
// Next Step is combine sorts of Conditions which make our choice
|
|
// so Exact in Market ...
|
|
(
|
|
//
|
|
IsReadyForLong(mConditions)
|
|
//
|
|
)
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// XCHMAMN ...
|
|
|
|
//
|
|
bool XCHMAMNHasLongConditions(
|
|
X121MarketConditions &mConditions //
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
double nonSC2[] = {
|
|
mConditions.chmaMcFasts[2],
|
|
mConditions.chmaMcSlows[2],
|
|
mConditions.chmaLcFasts[2],
|
|
mConditions.chmaLcSlows[2],
|
|
};
|
|
|
|
//
|
|
double nonSCMax2 = GetMax(nonSC2);
|
|
double nonSCMin2 = GetMax(nonSC2);
|
|
|
|
//
|
|
// Start Analysing Market based On Conditions ...
|
|
result =
|
|
//
|
|
// Base Condition:
|
|
// each Strategy must has a Base Conditions, which they are usually common combinations
|
|
// of Market Properties that must be happens to lookup for signals ...
|
|
(
|
|
//
|
|
mConditions.isXCHMASCCrossedOverMin &&
|
|
mConditions.chmaScFasts[2] < nonSCMin2 &&
|
|
mConditions.chmaScSlows[2] < nonSCMin2
|
|
//
|
|
)
|
|
//
|
|
&&
|
|
//
|
|
// Next Step is combine sorts of Conditions which make our choice
|
|
// so Exact in Market ...
|
|
(
|
|
//
|
|
IsReadyForLong(
|
|
mConditions,
|
|
true, // XCHMA Min
|
|
true, // XCHMA Max
|
|
false, // XCHMA Cycles
|
|
false, // XCHMA Peaks
|
|
false, // XCHMA Trend Powers
|
|
true, // XOBD
|
|
true // XTS
|
|
)
|
|
//
|
|
)
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
bool XCHMAMNHasShortConditions(
|
|
X121MarketConditions &mConditions //
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
double nonSC2[] = {
|
|
mConditions.chmaMcFasts[2],
|
|
mConditions.chmaMcSlows[2],
|
|
mConditions.chmaLcFasts[2],
|
|
mConditions.chmaLcSlows[2],
|
|
};
|
|
|
|
//
|
|
double nonSCMax2 = GetMax(nonSC2);
|
|
double nonSCMin2 = GetMax(nonSC2);
|
|
|
|
//
|
|
// Start Analysing Market based On Conditions ...
|
|
result =
|
|
//
|
|
// Base Condition:
|
|
// each Strategy must has a Base Conditions, which they are usually common combinations
|
|
// of Market Properties that must be happens to lookup for signals ...
|
|
(
|
|
//
|
|
mConditions.isXCHMASCCrossedUnderMin &&
|
|
mConditions.chmaScFasts[2] > nonSCMin2 &&
|
|
mConditions.chmaScSlows[2] > nonSCMin2
|
|
//
|
|
)
|
|
//
|
|
&&
|
|
//
|
|
// Next Step is combine sorts of Conditions which make our choice
|
|
// so Exact in Market ...
|
|
(
|
|
//
|
|
IsReadyForLong(
|
|
mConditions,
|
|
true, // XCHMA Min
|
|
true, // XCHMA Max
|
|
false, // XCHMA Cycles
|
|
false, // XCHMA Peaks
|
|
false, // XCHMA Trend Powers
|
|
true, // XOBD
|
|
true // XTS
|
|
)
|
|
//
|
|
)
|
|
//
|
|
;
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// XCHMAMX ...
|
|
|
|
//
|
|
bool XCHMAMXHasLongConditions(
|
|
X121MarketConditions &mConditions //
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
double nonSC2[] = {
|
|
mConditions.chmaMcFasts[2],
|
|
mConditions.chmaMcSlows[2],
|
|
mConditions.chmaLcFasts[2],
|
|
mConditions.chmaLcSlows[2],
|
|
};
|
|
|
|
//
|
|
double nonSCMax2 = GetMax(nonSC2);
|
|
double nonSCMin2 = GetMax(nonSC2);
|
|
|
|
//
|
|
// Start Analysing Market based On Conditions ...
|
|
result =
|
|
//
|
|
// Base Condition:
|
|
// each Strategy must has a Base Conditions, which they are usually common combinations
|
|
// of Market Properties that must be happens to lookup for signals ...
|
|
(
|
|
//
|
|
mConditions.isXCHMASCCrossedOverMax &&
|
|
mConditions.chmaScFasts[2] < nonSCMax2 &&
|
|
mConditions.chmaScSlows[2] < nonSCMax2 &&
|
|
MathAbs(nonSCMax2 - mConditions.chmaScFasts[2]) > MathAbs(mConditions.chmaScFasts[2] - mConditions.chmaScSlows[2]) &&
|
|
MathAbs(nonSCMax2 - mConditions.chmaScSlows[2]) > MathAbs(mConditions.chmaScFasts[2] - mConditions.chmaScSlows[2])
|
|
//
|
|
)
|
|
//
|
|
&&
|
|
//
|
|
// Next Step is combine sorts of Conditions which make our choice
|
|
// so Exact in Market ...
|
|
(
|
|
//
|
|
IsReadyForLong(
|
|
mConditions,
|
|
true, // XCHMA Min
|
|
true, // XCHMA Max
|
|
false, // XCHMA Cycles
|
|
false, // XCHMA Peaks
|
|
false, // XCHMA Trend Powers
|
|
true, // XOBD
|
|
true // XTS
|
|
)
|
|
//
|
|
)
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
bool XCHMAMXHasShortConditions(
|
|
X121MarketConditions &mConditions //
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
double nonSC2[] = {
|
|
mConditions.chmaMcFasts[2],
|
|
mConditions.chmaMcSlows[2],
|
|
mConditions.chmaLcFasts[2],
|
|
mConditions.chmaLcSlows[2],
|
|
};
|
|
|
|
//
|
|
double nonSCMax2 = GetMax(nonSC2);
|
|
double nonSCMin2 = GetMax(nonSC2);
|
|
|
|
//
|
|
// Start Analysing Market based On Conditions ...
|
|
result =
|
|
//
|
|
// Base Condition:
|
|
// each Strategy must has a Base Conditions, which they are usually common combinations
|
|
// of Market Properties that must be happens to lookup for signals ...
|
|
(
|
|
//
|
|
mConditions.isXCHMASCCrossedUnderMax &&
|
|
mConditions.chmaScFasts[2] > nonSCMax2 &&
|
|
mConditions.chmaScSlows[2] > nonSCMax2
|
|
//
|
|
)
|
|
//
|
|
&&
|
|
//
|
|
// Next Step is combine sorts of Conditions which make our choice
|
|
// so Exact in Market ...
|
|
(
|
|
//
|
|
IsReadyForShort(
|
|
mConditions,
|
|
true, // XCHMA Min
|
|
true, // XCHMA Max
|
|
false, // XCHMA Cycles
|
|
false, // XCHMA Peaks
|
|
false, // XCHMA Trend Powers
|
|
true, // XOBD
|
|
true // XTS
|
|
)
|
|
//
|
|
)
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
};
|
|
|
|
//
|
|
// Tools ...
|
|
|
|
//
|
|
// Model Provider Descriptor ...
|
|
struct X121ProviderDescriptor
|
|
{
|
|
//
|
|
string symbol; // Trading Symbol
|
|
ENUM_TIMEFRAMES period; // Trading Timeframe
|
|
double staticVolume; // Static Volume for Positions
|
|
bool allowLong; // Allow Long Signals
|
|
bool allowShort; // Allow Short Signals
|
|
ENUM_X121_SIGNAL_PROVIDERS signallers[]; // Allowed Signal Providers
|
|
|
|
//
|
|
X121ProviderInputs inputs;
|
|
XSCX121Provider *provider;
|
|
|
|
//
|
|
XSignal signal;
|
|
X121MarketConditions conditions;
|
|
|
|
//
|
|
// Tools ...
|
|
|
|
//
|
|
bool Init()
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
result = this.Init(
|
|
this.symbol,
|
|
this.period,
|
|
this.signallers,
|
|
this.allowLong,
|
|
this.allowShort,
|
|
this.staticVolume //
|
|
);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
bool Init(
|
|
ENUM_X121_SIGNAL_PROVIDERS &mSignallers[], // Allowed Signal Providers
|
|
bool mAllowLong = true, // Allow Long Signals
|
|
bool mAllowShort = true, // Allow Short Signals
|
|
double mStaticVolume = 0.01 // Static Volume for Positions
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
result = this.Init(
|
|
this.symbol,
|
|
this.period,
|
|
mSignallers,
|
|
mAllowLong,
|
|
mAllowShort,
|
|
mStaticVolume //
|
|
);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
bool Init(
|
|
string mSymbol, // Trading Symbol
|
|
ENUM_TIMEFRAMES mPeriod, // Trading Timeframe
|
|
ENUM_X121_SIGNAL_PROVIDERS &mSignallers[], // Allowed Signal Providers
|
|
bool mAllowLong = true, // Allow Long Signals
|
|
bool mAllowShort = true, // Allow Short Signals
|
|
double mStaticVolume = 0.01 // Static Volume for Positions
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
result =
|
|
//
|
|
inputs.IsValid() &&
|
|
IsValid(mSymbol) &&
|
|
IsValid(mPeriod) &&
|
|
NotEmpty(mStaticVolume) &&
|
|
(allowLong || allowShort) &&
|
|
ArraySize(mSignallers) > 0
|
|
//
|
|
;
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
this.symbol = mSymbol;
|
|
this.period = mPeriod;
|
|
this.allowLong = mAllowLong;
|
|
this.allowShort = mAllowShort;
|
|
this.staticVolume = mStaticVolume;
|
|
|
|
//
|
|
ENUM_X121_SIGNAL_PROVIDERS tmp[];
|
|
Copy(
|
|
mSignallers,
|
|
tmp //
|
|
);
|
|
Copy(
|
|
tmp,
|
|
this.signallers //
|
|
);
|
|
|
|
//
|
|
// Instantiate Provider ...
|
|
provider = new XSCX121Provider(
|
|
this.symbol,
|
|
this.period,
|
|
this.staticVolume //
|
|
);
|
|
|
|
//
|
|
// Set Long/Short State ...
|
|
|
|
//
|
|
provider
|
|
.SetSignalTypeState(
|
|
POSITION_TYPE_BUY,
|
|
this.allowLong //
|
|
);
|
|
|
|
//
|
|
provider
|
|
.SetSignalTypeState(
|
|
POSITION_TYPE_SELL,
|
|
this.allowShort //
|
|
);
|
|
|
|
//
|
|
// Enable Required Signallers ...
|
|
provider
|
|
.SetSignalProviderStates(
|
|
this.signallers,
|
|
true //
|
|
);
|
|
|
|
//
|
|
// Now Must to Initialize Provider ...
|
|
result = provider.Init(
|
|
this.inputs //
|
|
);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Cleanup ...
|
|
void Clean()
|
|
{
|
|
//
|
|
signal.Clean();
|
|
conditions.Clear();
|
|
}
|
|
|
|
//
|
|
// Validate ...
|
|
bool IsValid(bool validateInputs = true)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
result =
|
|
//
|
|
IsValid(symbol) &&
|
|
IsValid(period) &&
|
|
NotEmpty(staticVolume) &&
|
|
(validateInputs
|
|
? inputs.IsValid()
|
|
: true) &&
|
|
(allowLong || allowShort) &&
|
|
ArraySize(signallers) > 0
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Check Signal ...
|
|
bool HasSignal(int barIndex = 0)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
result = inputs.IsValid();
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Clear Signal and Conditions ...
|
|
Clean();
|
|
|
|
//
|
|
result = provider.HasSignal(
|
|
barIndex,
|
|
signal,
|
|
conditions //
|
|
);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
};
|
|
|
|
//
|
|
void GetAllX121SignalProviders(ENUM_X121_SIGNAL_PROVIDERS &result[])
|
|
{
|
|
//
|
|
Clean(result);
|
|
|
|
//
|
|
Add(XSP, result);
|
|
Add(XTEST, result);
|
|
Add(X786, result);
|
|
Add(X121, result);
|
|
Add(X110, result);
|
|
Add(X92, result);
|
|
Add(X128, result);
|
|
Add(XTD, result);
|
|
Add(XTAM, result);
|
|
Add(XSI, result);
|
|
Add(XTSFI, result);
|
|
Add(XOBDLH, result);
|
|
Add(XCHMACC, result);
|
|
Add(XCHMAMN, result);
|
|
Add(XCHMAMX, result);
|
|
}
|
|
|
|
//
|
|
string ToString(ENUM_X121_SIGNAL_PROVIDERS value)
|
|
{
|
|
return EnumToString(value);
|
|
}
|
|
|
|
//
|
|
ENUM_X121_SIGNAL_PROVIDERS ToX121SignalProvider(string content)
|
|
{
|
|
//
|
|
ENUM_X121_SIGNAL_PROVIDERS result = PROVIDER_NONE;
|
|
|
|
//
|
|
if (!IsValid(content))
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
if (content == ToString(PROVIDER_NONE))
|
|
{
|
|
result = PROVIDER_NONE;
|
|
}
|
|
else if (content == ToString(XSP))
|
|
{
|
|
result = XSP;
|
|
}
|
|
else if (content == ToString(XTEST))
|
|
{
|
|
result = XTEST;
|
|
}
|
|
else if (content == ToString(X786))
|
|
{
|
|
result = X786;
|
|
}
|
|
else if (content == ToString(X121))
|
|
{
|
|
result = X121;
|
|
}
|
|
else if (content == ToString(X110))
|
|
{
|
|
result = X110;
|
|
}
|
|
else if (content == ToString(X92))
|
|
{
|
|
result = X92;
|
|
}
|
|
else if (content == ToString(X128))
|
|
{
|
|
result = X128;
|
|
}
|
|
else if (content == ToString(XTD))
|
|
{
|
|
result = XTD;
|
|
}
|
|
else if (content == ToString(XTAM))
|
|
{
|
|
result = XTAM;
|
|
}
|
|
else if (content == ToString(XSI))
|
|
{
|
|
result = XSI;
|
|
}
|
|
else if (content == ToString(XTSFI))
|
|
{
|
|
result = XTSFI;
|
|
}
|
|
else if (content == ToString(XOBDLH))
|
|
{
|
|
result = XOBDLH;
|
|
}
|
|
else if (content == ToString(XCHMACC))
|
|
{
|
|
result = XCHMACC;
|
|
}
|
|
else if (content == ToString(XCHMAMN))
|
|
{
|
|
result = XCHMAMN;
|
|
}
|
|
else if (content == ToString(XCHMAMX))
|
|
{
|
|
result = XCHMAMX;
|
|
}
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
// |