last works ...
This commit is contained in:
@@ -1071,7 +1071,8 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
string GenerateSummary(
|
virtual string GenerateSummary(
|
||||||
|
const bool onlySummary = false, // Only Generate Conditions Summary
|
||||||
double cMarketMultiplier = 1, // Current Market Score Multiplier
|
double cMarketMultiplier = 1, // Current Market Score Multiplier
|
||||||
double sMarketMultiplier = 1.1, // Short Market Score Multiplier
|
double sMarketMultiplier = 1.1, // Short Market Score Multiplier
|
||||||
double mMarketMultiplier = 1.2, // Medium Market Score Multiplier
|
double mMarketMultiplier = 1.2, // Medium Market Score Multiplier
|
||||||
@@ -1126,6 +1127,93 @@ public:
|
|||||||
//
|
//
|
||||||
;
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
// XZG ...
|
||||||
|
string zigzagStr =
|
||||||
|
//
|
||||||
|
ToString("isZigZagInPeak", isZigZagInPeak, ignoreFalseConditions) +
|
||||||
|
ToString("isZigZagInVale", isZigZagInVale, ignoreFalseConditions) +
|
||||||
|
""
|
||||||
|
//
|
||||||
|
;
|
||||||
|
zigzagStr = SetLabel("XZG: ", zigzagStr, separator);
|
||||||
|
|
||||||
|
//
|
||||||
|
// XDON ...
|
||||||
|
string donStr =
|
||||||
|
//
|
||||||
|
ToString("isDONAttachedMaxLower", isDONAttachedMaxLower, ignoreFalseConditions) +
|
||||||
|
ToString("isDONAttachedMinLower", isDONAttachedMinLower, ignoreFalseConditions) +
|
||||||
|
ToString("isDONCrossedOverMaxLower", isDONCrossedOverMaxLower, ignoreFalseConditions) +
|
||||||
|
ToString("isDONCrossedUnderMaxLower", isDONCrossedUnderMaxLower, ignoreFalseConditions) +
|
||||||
|
ToString("isDONAttachedMaxUpper", isDONAttachedMaxUpper, ignoreFalseConditions) +
|
||||||
|
ToString("isDONAttachedMinUpper", isDONAttachedMinUpper, ignoreFalseConditions) +
|
||||||
|
ToString("isDONCrossedOverMaxUpper", isDONCrossedOverMaxUpper, ignoreFalseConditions) +
|
||||||
|
ToString("isDONCrossedUnderMaxUpper", isDONCrossedUnderMaxUpper, ignoreFalseConditions) +
|
||||||
|
""
|
||||||
|
//
|
||||||
|
;
|
||||||
|
donStr = SetLabel("XDON: ", donStr, separator);
|
||||||
|
|
||||||
|
//
|
||||||
|
// XPV ...
|
||||||
|
string pvStr =
|
||||||
|
//
|
||||||
|
ToString("isPVPeakSameAs", isPVPeakSameAs, ignoreFalseConditions) +
|
||||||
|
ToString("isPVNewPeak", isPVNewPeak, ignoreFalseConditions) +
|
||||||
|
ToString("isPVNewPeakOverLast", isPVNewPeakOverLast, ignoreFalseConditions) +
|
||||||
|
ToString("isPVNewPeakUnderLast", isPVNewPeakUnderLast, ignoreFalseConditions) +
|
||||||
|
ToString("isPVValeSameAs", isPVValeSameAs, ignoreFalseConditions) +
|
||||||
|
ToString("isPVNewVale", isPVNewVale, ignoreFalseConditions) +
|
||||||
|
ToString("isPVNewValeOverLast", isPVNewValeOverLast, ignoreFalseConditions) +
|
||||||
|
ToString("isPVNewValeUnderLast", isPVNewValeUnderLast, ignoreFalseConditions) +
|
||||||
|
ToString("isPVFiboIncreased", isPVFiboIncreased, ignoreFalseConditions) +
|
||||||
|
ToString("isPVFiboDecreased", isPVFiboDecreased, ignoreFalseConditions) +
|
||||||
|
ToString("isPVFiboSectionChanged", isPVFiboSectionChanged, ignoreFalseConditions) +
|
||||||
|
ToString("isPVSCBullish", isPVSCBullish, ignoreFalseConditions) +
|
||||||
|
ToString("isPVSCHHBullish", isPVSCHHBullish, ignoreFalseConditions) +
|
||||||
|
ToString("isPVSCLLBullish", isPVSCLLBullish, ignoreFalseConditions) +
|
||||||
|
ToString("isPVSCSwitchedToBullish", isPVSCSwitchedToBullish, ignoreFalseConditions) +
|
||||||
|
ToString("isPVSCBearish", isPVSCBearish, ignoreFalseConditions) +
|
||||||
|
ToString("isPVSCHHBearish", isPVSCHHBearish, ignoreFalseConditions) +
|
||||||
|
ToString("isPVSCLLBearish", isPVSCLLBearish, ignoreFalseConditions) +
|
||||||
|
ToString("isPVSCSwitchedToBearish", isPVSCSwitchedToBearish, ignoreFalseConditions) +
|
||||||
|
ToString("isPVMCBullish", isPVMCBullish, ignoreFalseConditions) +
|
||||||
|
ToString("isPVMCHHBullish", isPVMCHHBullish, ignoreFalseConditions) +
|
||||||
|
ToString("isPVMCLLBullish", isPVMCLLBullish, ignoreFalseConditions) +
|
||||||
|
ToString("isPVMCSwitchedToBullish", isPVMCSwitchedToBullish, ignoreFalseConditions) +
|
||||||
|
ToString("isPVMCBearish", isPVMCBearish, ignoreFalseConditions) +
|
||||||
|
ToString("isPVMCHHBearish", isPVMCHHBearish, ignoreFalseConditions) +
|
||||||
|
ToString("isPVMCLLBearish", isPVMCLLBearish, ignoreFalseConditions) +
|
||||||
|
ToString("isPVMCSwitchedToBearish", isPVMCSwitchedToBearish, ignoreFalseConditions) +
|
||||||
|
ToString("isPVLCBullish", isPVLCBullish, ignoreFalseConditions) +
|
||||||
|
ToString("isPVLCHHBullish", isPVLCHHBullish, ignoreFalseConditions) +
|
||||||
|
ToString("isPVLCLLBullish", isPVLCLLBullish, ignoreFalseConditions) +
|
||||||
|
ToString("isPVLCSwitchedToBullish", isPVLCSwitchedToBullish, ignoreFalseConditions) +
|
||||||
|
ToString("isPVLCBearish", isPVLCBearish, ignoreFalseConditions) +
|
||||||
|
ToString("isPVLCHHBearish", isPVLCHHBearish, ignoreFalseConditions) +
|
||||||
|
ToString("isPVLCLLBearish", isPVLCLLBearish, ignoreFalseConditions) +
|
||||||
|
ToString("isPVLCSwitchedToBearish", isPVLCSwitchedToBearish, ignoreFalseConditions) +
|
||||||
|
ToString("isPVHCBullish", isPVHCBullish, ignoreFalseConditions) +
|
||||||
|
ToString("isPVHCHHBullish", isPVHCHHBullish, ignoreFalseConditions) +
|
||||||
|
ToString("isPVHCLLBullish", isPVHCLLBullish, ignoreFalseConditions) +
|
||||||
|
ToString("isPVHCSwitchedToBullish", isPVHCSwitchedToBullish, ignoreFalseConditions) +
|
||||||
|
ToString("isPVHCBearish", isPVHCBearish, ignoreFalseConditions) +
|
||||||
|
ToString("isPVHCHHBearish", isPVHCHHBearish, ignoreFalseConditions) +
|
||||||
|
ToString("isPVHCLLBearish", isPVHCLLBearish, ignoreFalseConditions) +
|
||||||
|
ToString("isPVHCSwitchedToBearish", isPVHCSwitchedToBearish, ignoreFalseConditions) +
|
||||||
|
""
|
||||||
|
//
|
||||||
|
;
|
||||||
|
pvStr = SetLabel("XPV: ", pvStr, 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 =
|
result =
|
||||||
//
|
//
|
||||||
@@ -1133,6 +1221,18 @@ public:
|
|||||||
(IsSpecifiedValid(provided) ? provided + separator : "") +
|
(IsSpecifiedValid(provided) ? provided + separator : "") +
|
||||||
"-----------------------------" + separator +
|
"-----------------------------" + separator +
|
||||||
commonStr +
|
commonStr +
|
||||||
|
(!onlySummary
|
||||||
|
? zigzagStr +
|
||||||
|
donStr +
|
||||||
|
pvStr +
|
||||||
|
"======" + separator +
|
||||||
|
cMarketConditionsStr +
|
||||||
|
sMarketConditionsStr +
|
||||||
|
mMarketConditionsStr +
|
||||||
|
lMarketConditionsStr +
|
||||||
|
hMarketConditionsStr +
|
||||||
|
""
|
||||||
|
: "") +
|
||||||
""
|
""
|
||||||
//
|
//
|
||||||
;
|
;
|
||||||
@@ -1615,7 +1715,6 @@ public:
|
|||||||
// Here We Have to Prepare Signal ...
|
// Here We Have to Prepare Signal ...
|
||||||
|
|
||||||
//
|
//
|
||||||
// TODO: Make this Configurable ...
|
|
||||||
string symbol = GetSymbol();
|
string symbol = GetSymbol();
|
||||||
ENUM_TIMEFRAMES period = GetPeriod();
|
ENUM_TIMEFRAMES period = GetPeriod();
|
||||||
double tpPoint = 60;
|
double tpPoint = 60;
|
||||||
@@ -1637,14 +1736,80 @@ public:
|
|||||||
symbol,
|
symbol,
|
||||||
type //
|
type //
|
||||||
);
|
);
|
||||||
double tp = hasLong
|
|
||||||
? entry + tpPrice
|
//
|
||||||
: entry - tpPrice;
|
double tp = 0;
|
||||||
double sl = hasLong
|
double sl = 0;
|
||||||
? entry - slPrice
|
|
||||||
: entry + slPrice;
|
//
|
||||||
ENUM_X_SIGNAL_MANAGING_ACTIONS action = X_SIGNAL_USE_NOTHING;
|
ENUM_X_SIGNAL_MANAGING_ACTIONS action = X_SIGNAL_USE_NOTHING;
|
||||||
|
|
||||||
|
//
|
||||||
|
// TODO: Make Configurable ...
|
||||||
|
double r2r = 2;
|
||||||
|
|
||||||
|
//
|
||||||
|
if (provider == ToString(X786))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
double maxDonUpper = donHelper.GetMaxUpper(0);
|
||||||
|
double minDonUpper = donHelper.GetMinUpper(0);
|
||||||
|
|
||||||
|
//
|
||||||
|
double maxDonLower = donHelper.GetMaxLower(0);
|
||||||
|
double minDonLower = donHelper.GetMinLower(0);
|
||||||
|
|
||||||
|
//
|
||||||
|
double peak = pvHelper.GetPeak(0);
|
||||||
|
double vale = pvHelper.GetVale(0);
|
||||||
|
|
||||||
|
//
|
||||||
|
double hCHELE2 = hMarket.che.GetLongExit2(0);
|
||||||
|
double hCHESE2 = hMarket.che.GetShortExit2(0);
|
||||||
|
|
||||||
|
//
|
||||||
|
double lCHELE2 = lMarket.che.GetLongExit2(0);
|
||||||
|
double lCHESE2 = lMarket.che.GetShortExit2(0);
|
||||||
|
|
||||||
|
//
|
||||||
|
sl = hasLong
|
||||||
|
? lCHELE2
|
||||||
|
: lCHESE2;
|
||||||
|
|
||||||
|
//
|
||||||
|
double risk = MathAbs(entry - sl);
|
||||||
|
|
||||||
|
//
|
||||||
|
double reward = risk * r2r;
|
||||||
|
|
||||||
|
//
|
||||||
|
tp = hasLong
|
||||||
|
? entry + reward
|
||||||
|
: entry - reward;
|
||||||
|
}
|
||||||
|
else if (provider == ToString(X121))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
double peak = pvHelper.GetPeak(0);
|
||||||
|
double vale = pvHelper.GetVale(0);
|
||||||
|
|
||||||
|
//
|
||||||
|
sl = hasLong
|
||||||
|
? vale
|
||||||
|
: peak;
|
||||||
|
|
||||||
|
//
|
||||||
|
double risk = MathAbs(entry - sl);
|
||||||
|
|
||||||
|
//
|
||||||
|
double reward = risk * r2r;
|
||||||
|
|
||||||
|
//
|
||||||
|
tp = hasLong
|
||||||
|
? entry + reward
|
||||||
|
: entry - reward;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
result = mSignal.Prepare(
|
result = mSignal.Prepare(
|
||||||
symbol,
|
symbol,
|
||||||
@@ -1680,14 +1845,43 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
void Draw()
|
// Check for any Guards ...
|
||||||
|
bool HasGuard(XGuard &guards[])
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
return;
|
bool result = false;
|
||||||
|
|
||||||
|
// //
|
||||||
|
// XOHCL bar;
|
||||||
|
// bar.Init(
|
||||||
|
// GetSymbol(),
|
||||||
|
// GetPeriod(),
|
||||||
|
// 0 //
|
||||||
|
// );
|
||||||
|
|
||||||
|
// //
|
||||||
|
// double maxDONUppers = donHelper.GetMaxUpper(0);
|
||||||
|
// double minDONUppers = donHelper.GetMinUpper(0);
|
||||||
|
// // double minDONUppers = donHelper.GetMinUpper(1);
|
||||||
|
|
||||||
|
// //
|
||||||
|
// bool isDONUpAttached =
|
||||||
|
// //
|
||||||
|
// bar.high >= maxDONUppers
|
||||||
|
// //
|
||||||
|
// ;
|
||||||
|
// if (isDONUpAttached)
|
||||||
|
// {
|
||||||
|
// Print("Force Close Short X786");
|
||||||
|
// }
|
||||||
|
|
||||||
//
|
//
|
||||||
// ulong chID = 0;
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
void Draw()
|
||||||
|
{
|
||||||
//
|
//
|
||||||
string symbol = GetSymbol();
|
string symbol = GetSymbol();
|
||||||
ENUM_TIMEFRAMES period = GetPeriod();
|
ENUM_TIMEFRAMES period = GetPeriod();
|
||||||
@@ -1865,7 +2059,7 @@ private:
|
|||||||
if (mIsX121SignalProviderEnable)
|
if (mIsX121SignalProviderEnable)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
hasX121Signal = XSIHasSpecifiedLongSignal(
|
hasX121Signal = X121HasSpecifiedLongSignal(
|
||||||
mConditions //
|
mConditions //
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -1888,7 +2082,7 @@ private:
|
|||||||
if (mIsX110SignalProviderEnable)
|
if (mIsX110SignalProviderEnable)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
hasX110Signal = XTSFIHasSpecifiedLongSignal(
|
hasX110Signal = X110HasSpecifiedLongSignal(
|
||||||
mConditions //
|
mConditions //
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -1911,7 +2105,7 @@ private:
|
|||||||
if (mIsX92SignalProviderEnable)
|
if (mIsX92SignalProviderEnable)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
hasX92Signal = XOBDLHHasSpecifiedLongSignal(
|
hasX92Signal = X92HasSpecifiedLongSignal(
|
||||||
mConditions //
|
mConditions //
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -2055,7 +2249,7 @@ private:
|
|||||||
if (mIsX121SignalProviderEnable)
|
if (mIsX121SignalProviderEnable)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
hasX121Signal = XSIHasSpecifiedShortSignal(
|
hasX121Signal = X121HasSpecifiedShortSignal(
|
||||||
mConditions //
|
mConditions //
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -2078,7 +2272,7 @@ private:
|
|||||||
if (mIsX110SignalProviderEnable)
|
if (mIsX110SignalProviderEnable)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
hasX110Signal = XTSFIHasSpecifiedShortSignal(
|
hasX110Signal = X110HasSpecifiedShortSignal(
|
||||||
mConditions //
|
mConditions //
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -2925,12 +3119,146 @@ private:
|
|||||||
//
|
//
|
||||||
bool result = false;
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check For Long ...
|
||||||
|
bool isSTRLong =
|
||||||
|
//
|
||||||
|
(mConditions.hMarketConditions.isTrendSwitchedToBullish &&
|
||||||
|
(mConditions.lMarketConditions.isTrendBullish &&
|
||||||
|
mConditions.mMarketConditions.isTrendBullish &&
|
||||||
|
mConditions.sMarketConditions.isTrendBullish &&
|
||||||
|
mConditions.cMarketConditions.isTrendBullish))
|
||||||
|
//
|
||||||
|
||
|
||||||
|
//
|
||||||
|
(mConditions.lMarketConditions.isTrendSwitchedToBullish &&
|
||||||
|
(mConditions.hMarketConditions.isTrendBullish &&
|
||||||
|
mConditions.mMarketConditions.isTrendBullish &&
|
||||||
|
mConditions.sMarketConditions.isTrendBullish &&
|
||||||
|
mConditions.cMarketConditions.isTrendBullish))
|
||||||
|
//
|
||||||
|
||
|
||||||
|
//
|
||||||
|
(mConditions.mMarketConditions.isTrendSwitchedToBullish &&
|
||||||
|
(mConditions.hMarketConditions.isTrendBullish &&
|
||||||
|
mConditions.lMarketConditions.isTrendBullish &&
|
||||||
|
mConditions.sMarketConditions.isTrendBullish &&
|
||||||
|
mConditions.cMarketConditions.isTrendBullish))
|
||||||
|
//
|
||||||
|
||
|
||||||
|
//
|
||||||
|
(mConditions.sMarketConditions.isTrendSwitchedToBullish &&
|
||||||
|
(mConditions.hMarketConditions.isTrendBullish &&
|
||||||
|
mConditions.lMarketConditions.isTrendBullish &&
|
||||||
|
mConditions.mMarketConditions.isTrendBullish &&
|
||||||
|
mConditions.cMarketConditions.isTrendBullish))
|
||||||
|
//
|
||||||
|
||
|
||||||
|
//
|
||||||
|
(mConditions.cMarketConditions.isTrendSwitchedToBullish &&
|
||||||
|
(mConditions.hMarketConditions.isTrendBullish &&
|
||||||
|
mConditions.lMarketConditions.isTrendBullish &&
|
||||||
|
mConditions.mMarketConditions.isTrendBullish &&
|
||||||
|
mConditions.sMarketConditions.isTrendBullish))
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isCHELong =
|
||||||
|
//
|
||||||
|
(mConditions.hMarketConditions.isCHESwitchedInStrongLong &&
|
||||||
|
(mConditions.cMarketConditions.isCHEInStrongLong &&
|
||||||
|
mConditions.sMarketConditions.isCHEInStrongLong &&
|
||||||
|
mConditions.mMarketConditions.isCHEInStrongLong &&
|
||||||
|
mConditions.lMarketConditions.isCHEInStrongLong))
|
||||||
|
//
|
||||||
|
||
|
||||||
|
//
|
||||||
|
(mConditions.lMarketConditions.isCHESwitchedInStrongLong &&
|
||||||
|
(mConditions.cMarketConditions.isCHEInStrongLong &&
|
||||||
|
mConditions.sMarketConditions.isCHEInStrongLong &&
|
||||||
|
mConditions.mMarketConditions.isCHEInStrongLong &&
|
||||||
|
mConditions.hMarketConditions.isCHEInStrongLong))
|
||||||
|
//
|
||||||
|
||
|
||||||
|
//
|
||||||
|
(mConditions.mMarketConditions.isCHESwitchedInStrongLong &&
|
||||||
|
(mConditions.cMarketConditions.isCHEInStrongLong &&
|
||||||
|
mConditions.sMarketConditions.isCHEInStrongLong &&
|
||||||
|
mConditions.lMarketConditions.isCHEInStrongLong &&
|
||||||
|
mConditions.hMarketConditions.isCHEInStrongLong))
|
||||||
|
//
|
||||||
|
||
|
||||||
|
//
|
||||||
|
(mConditions.sMarketConditions.isCHESwitchedInStrongLong &&
|
||||||
|
(mConditions.cMarketConditions.isCHEInStrongLong &&
|
||||||
|
mConditions.mMarketConditions.isCHEInStrongLong &&
|
||||||
|
mConditions.lMarketConditions.isCHEInStrongLong &&
|
||||||
|
mConditions.hMarketConditions.isCHEInStrongLong))
|
||||||
|
//
|
||||||
|
||
|
||||||
|
//
|
||||||
|
(mConditions.cMarketConditions.isCHESwitchedInStrongLong &&
|
||||||
|
(mConditions.sMarketConditions.isCHEInStrongLong &&
|
||||||
|
mConditions.mMarketConditions.isCHEInStrongLong &&
|
||||||
|
mConditions.lMarketConditions.isCHEInStrongLong &&
|
||||||
|
mConditions.hMarketConditions.isCHEInStrongLong))
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
result =
|
||||||
|
//
|
||||||
|
isSTRLong
|
||||||
|
//
|
||||||
|
&&
|
||||||
|
//
|
||||||
|
isCHELong
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
bool XSIHasSpecifiedLongSignal(
|
bool X121HasSpecifiedLongSignal(
|
||||||
|
X121MarketConditions &mConditions //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isMCLong =
|
||||||
|
//
|
||||||
|
(
|
||||||
|
//
|
||||||
|
(mConditions.cMarketConditions.isSlowOverVerifier &&
|
||||||
|
mConditions.cMarketConditions.isFastCrossedOverVerifier)
|
||||||
|
//
|
||||||
|
||
|
||||||
|
//
|
||||||
|
(mConditions.cMarketConditions.isFastOverVerifier &&
|
||||||
|
mConditions.cMarketConditions.isSlowCrossedOverVerifier)
|
||||||
|
//
|
||||||
|
)
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
result =
|
||||||
|
//
|
||||||
|
isMCLong
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool X110HasSpecifiedLongSignal(
|
||||||
X121MarketConditions &mConditions //
|
X121MarketConditions &mConditions //
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@@ -2942,19 +3270,7 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
bool XTSFIHasSpecifiedLongSignal(
|
bool X92HasSpecifiedLongSignal(
|
||||||
X121MarketConditions &mConditions //
|
|
||||||
)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
bool result = false;
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
bool XOBDLHHasSpecifiedLongSignal(
|
|
||||||
X121MarketConditions &mConditions //
|
X121MarketConditions &mConditions //
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@@ -2997,24 +3313,146 @@ private:
|
|||||||
//
|
//
|
||||||
bool result = false;
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check For Short ...
|
||||||
|
bool isSTRShort =
|
||||||
|
//
|
||||||
|
(mConditions.hMarketConditions.isTrendSwitchedToBearish &&
|
||||||
|
(mConditions.lMarketConditions.isTrendBearish &&
|
||||||
|
mConditions.mMarketConditions.isTrendBearish &&
|
||||||
|
mConditions.sMarketConditions.isTrendBearish &&
|
||||||
|
mConditions.cMarketConditions.isTrendBearish))
|
||||||
|
//
|
||||||
|
||
|
||||||
|
//
|
||||||
|
(mConditions.lMarketConditions.isTrendSwitchedToBearish &&
|
||||||
|
(mConditions.hMarketConditions.isTrendBearish &&
|
||||||
|
mConditions.mMarketConditions.isTrendBearish &&
|
||||||
|
mConditions.sMarketConditions.isTrendBearish &&
|
||||||
|
mConditions.cMarketConditions.isTrendBearish))
|
||||||
|
//
|
||||||
|
||
|
||||||
|
//
|
||||||
|
(mConditions.mMarketConditions.isTrendSwitchedToBearish &&
|
||||||
|
(mConditions.hMarketConditions.isTrendBearish &&
|
||||||
|
mConditions.lMarketConditions.isTrendBearish &&
|
||||||
|
mConditions.sMarketConditions.isTrendBearish &&
|
||||||
|
mConditions.cMarketConditions.isTrendBearish))
|
||||||
|
//
|
||||||
|
||
|
||||||
|
//
|
||||||
|
(mConditions.sMarketConditions.isTrendSwitchedToBearish &&
|
||||||
|
(mConditions.hMarketConditions.isTrendBearish &&
|
||||||
|
mConditions.lMarketConditions.isTrendBearish &&
|
||||||
|
mConditions.mMarketConditions.isTrendBearish &&
|
||||||
|
mConditions.cMarketConditions.isTrendBearish))
|
||||||
|
//
|
||||||
|
||
|
||||||
|
//
|
||||||
|
(mConditions.cMarketConditions.isTrendSwitchedToBearish &&
|
||||||
|
(mConditions.hMarketConditions.isTrendBearish &&
|
||||||
|
mConditions.lMarketConditions.isTrendBearish &&
|
||||||
|
mConditions.mMarketConditions.isTrendBearish &&
|
||||||
|
mConditions.sMarketConditions.isTrendBearish))
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isCHEShort =
|
||||||
|
//
|
||||||
|
(mConditions.hMarketConditions.isCHESwitchedInStrongShort &&
|
||||||
|
(mConditions.cMarketConditions.isCHEInStrongShort &&
|
||||||
|
mConditions.sMarketConditions.isCHEInStrongShort &&
|
||||||
|
mConditions.mMarketConditions.isCHEInStrongShort &&
|
||||||
|
mConditions.lMarketConditions.isCHEInStrongShort))
|
||||||
|
//
|
||||||
|
||
|
||||||
|
//
|
||||||
|
(mConditions.lMarketConditions.isCHESwitchedInStrongShort &&
|
||||||
|
(mConditions.cMarketConditions.isCHEInStrongShort &&
|
||||||
|
mConditions.sMarketConditions.isCHEInStrongShort &&
|
||||||
|
mConditions.mMarketConditions.isCHEInStrongShort &&
|
||||||
|
mConditions.hMarketConditions.isCHEInStrongShort))
|
||||||
|
//
|
||||||
|
||
|
||||||
|
//
|
||||||
|
(mConditions.mMarketConditions.isCHESwitchedInStrongShort &&
|
||||||
|
(mConditions.cMarketConditions.isCHEInStrongShort &&
|
||||||
|
mConditions.sMarketConditions.isCHEInStrongShort &&
|
||||||
|
mConditions.lMarketConditions.isCHEInStrongShort &&
|
||||||
|
mConditions.hMarketConditions.isCHEInStrongShort))
|
||||||
|
//
|
||||||
|
||
|
||||||
|
//
|
||||||
|
(mConditions.sMarketConditions.isCHESwitchedInStrongShort &&
|
||||||
|
(mConditions.cMarketConditions.isCHEInStrongShort &&
|
||||||
|
mConditions.mMarketConditions.isCHEInStrongShort &&
|
||||||
|
mConditions.lMarketConditions.isCHEInStrongShort &&
|
||||||
|
mConditions.hMarketConditions.isCHEInStrongShort))
|
||||||
|
//
|
||||||
|
||
|
||||||
|
//
|
||||||
|
(mConditions.cMarketConditions.isCHESwitchedInStrongShort &&
|
||||||
|
(mConditions.sMarketConditions.isCHEInStrongShort &&
|
||||||
|
mConditions.mMarketConditions.isCHEInStrongShort &&
|
||||||
|
mConditions.lMarketConditions.isCHEInStrongShort &&
|
||||||
|
mConditions.hMarketConditions.isCHEInStrongShort))
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
result =
|
||||||
|
//
|
||||||
|
isSTRShort
|
||||||
|
//
|
||||||
|
&&
|
||||||
|
//
|
||||||
|
isCHEShort
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
bool XSIHasSpecifiedShortSignal(
|
bool X121HasSpecifiedShortSignal(
|
||||||
X121MarketConditions &mConditions //
|
X121MarketConditions &mConditions //
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
bool result = false;
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isMCShort =
|
||||||
|
//
|
||||||
|
(
|
||||||
|
//
|
||||||
|
(mConditions.cMarketConditions.isSlowUnderVerifier &&
|
||||||
|
mConditions.cMarketConditions.isFastCrossedUnderVerifier)
|
||||||
|
//
|
||||||
|
||
|
||||||
|
//
|
||||||
|
(mConditions.cMarketConditions.isFastUnderVerifier &&
|
||||||
|
mConditions.cMarketConditions.isSlowCrossedUnderVerifier)
|
||||||
|
//
|
||||||
|
)
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
result =
|
||||||
|
//
|
||||||
|
isMCShort
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
bool XTSFIHasSpecifiedShortSignal(
|
bool X110HasSpecifiedShortSignal(
|
||||||
X121MarketConditions &mConditions //
|
X121MarketConditions &mConditions //
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -185,8 +185,44 @@ public:
|
|||||||
bool CheckForGuard(XGuard &guards[]) override
|
bool CheckForGuard(XGuard &guards[]) override
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// TODO: Implement this ...
|
bool result = false;
|
||||||
return false;
|
|
||||||
|
//
|
||||||
|
Clean(guards);
|
||||||
|
|
||||||
|
//
|
||||||
|
int descriptorsCount = CountDescriptors();
|
||||||
|
result = descriptorsCount > 0;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
for (int i = 0; i < descriptorsCount; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
X121ProviderDescriptor iDescriptor = mDescriptors[i];
|
||||||
|
|
||||||
|
//
|
||||||
|
XGuard iGuards[];
|
||||||
|
bool iHasGuard = iDescriptor.provider.HasGuard(iGuards);
|
||||||
|
if (iHasGuard)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
Copy(
|
||||||
|
iGuards,
|
||||||
|
guards,
|
||||||
|
false //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
result = ArraySize(guards) > 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -250,8 +286,193 @@ public:
|
|||||||
bool HandleStateManagement() override
|
bool HandleStateManagement() override
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// TODO: Implement this ...
|
bool result = false;
|
||||||
return false;
|
|
||||||
|
//
|
||||||
|
int requiredAgeForSLTrail = 10;
|
||||||
|
int requiredDistanceForSLTrail = 10;
|
||||||
|
|
||||||
|
//
|
||||||
|
XPosition positions[];
|
||||||
|
int positionsCount = mTrader.GetPositions(positions);
|
||||||
|
if (positionsCount <= 0)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Trail Positions Stop ...
|
||||||
|
for (int i = 0; i < positionsCount; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XPosition iPosition = positions[i];
|
||||||
|
|
||||||
|
//
|
||||||
|
// Position Management for X786 ...
|
||||||
|
if (iPosition.provider == ToString(X786) ||
|
||||||
|
iPosition.provider == ToString(X121))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Check Position in Profit or not ...
|
||||||
|
if (iPosition.profit > 0)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XTrail trail;
|
||||||
|
bool isTrailedBefore = GetTrail(
|
||||||
|
iPosition.ticket,
|
||||||
|
trail //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
if (!isTrailedBefore)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Add First Time ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check Position Age ...
|
||||||
|
int iPositionAge = iPosition.GetAge(iPosition.period);
|
||||||
|
if (iPositionAge < requiredAgeForSLTrail)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check Position Profit Distance ...
|
||||||
|
double priceDistanceInPoint = PriceToPoint(iPosition.profit / iPosition.volume, iPosition.symbol);
|
||||||
|
double priceDistance = PointToPrice(priceDistanceInPoint, iPosition.symbol);
|
||||||
|
if (priceDistance < requiredDistanceForSLTrail)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
double slDiff = PointToPrice(priceDistance, iPosition.symbol);
|
||||||
|
|
||||||
|
//
|
||||||
|
double sl =
|
||||||
|
IsLong(iPosition.type)
|
||||||
|
? iPosition.sl + slDiff
|
||||||
|
: iPosition.sl - slDiff;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isInit = trail.Init(
|
||||||
|
iPosition.ticket,
|
||||||
|
iPosition.type,
|
||||||
|
iPosition.profit,
|
||||||
|
iPosition.sl,
|
||||||
|
sl);
|
||||||
|
if (!isInit)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Update Exists ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check Profit ...
|
||||||
|
bool isProfitPassed = iPosition.profit > trail.profit;
|
||||||
|
if (!isProfitPassed)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check Age Distance from Last ...
|
||||||
|
int age = iBarShift(
|
||||||
|
iPosition.symbol,
|
||||||
|
iPosition.period,
|
||||||
|
trail.time,
|
||||||
|
false //
|
||||||
|
);
|
||||||
|
if (age < requiredAgeForSLTrail)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
double priceDistanceInPoint = PriceToPoint((iPosition.profit - trail.profit) / iPosition.volume, iPosition.symbol);
|
||||||
|
double priceDistance = PointToPrice(priceDistanceInPoint, iPosition.symbol);
|
||||||
|
if (priceDistance < requiredDistanceForSLTrail)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// int positionAge = iPosition.GetAge(iPosition.period);
|
||||||
|
if (trail.level >= 3)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
string comment = "EQM Close In Profit ...";
|
||||||
|
bool isClosed = mTrader.Close(
|
||||||
|
iPosition.ticket,
|
||||||
|
comment //
|
||||||
|
);
|
||||||
|
if (isClosed)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
RemoveTrail(iPosition.ticket);
|
||||||
|
|
||||||
|
//
|
||||||
|
string message = "EQM Close (" + ToString(iPosition.ticket) + ") In Profit ...";
|
||||||
|
mAlert.Alert(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
double slDiff = PointToPrice(priceDistance, iPosition.symbol);
|
||||||
|
|
||||||
|
//
|
||||||
|
double sl =
|
||||||
|
IsLong(iPosition.type)
|
||||||
|
? iPosition.sl + slDiff
|
||||||
|
: iPosition.sl - slDiff;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Update Trail Values ...
|
||||||
|
bool isUpdated = trail.Update(
|
||||||
|
sl,
|
||||||
|
iPosition.profit //
|
||||||
|
);
|
||||||
|
if (!isUpdated)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (trail.IsValid())
|
||||||
|
{
|
||||||
|
//
|
||||||
|
string comment = trail.GenerateTag();
|
||||||
|
bool isModified = mTrader.Modify(
|
||||||
|
trail.ticket,
|
||||||
|
trail.after,
|
||||||
|
iPosition.tp,
|
||||||
|
comment //
|
||||||
|
);
|
||||||
|
if (isModified)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
RemoveTrail(trail.ticket);
|
||||||
|
|
||||||
|
//
|
||||||
|
AddTrail(trail);
|
||||||
|
|
||||||
|
//
|
||||||
|
string message = "Position (" + ToString(trail.ticket) + ") Trailed SL on Level: " + ToString(trail.level);
|
||||||
|
mAlert.Alert(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Must false ...
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -319,6 +540,117 @@ private:
|
|||||||
return ArraySize(mDescriptors);
|
return ArraySize(mDescriptors);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Trails Holding ...
|
||||||
|
|
||||||
|
//
|
||||||
|
XTrail mTrails[];
|
||||||
|
|
||||||
|
//
|
||||||
|
int CountTrails()
|
||||||
|
{
|
||||||
|
return ArraySize(mTrails);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool RemoveTrail(ulong ticket)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
int idx = FindTrailIndex(ticket);
|
||||||
|
result = idx >= 0;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
result = ArrayRemove(
|
||||||
|
mTrails,
|
||||||
|
idx,
|
||||||
|
1 //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
int FindTrailIndex(ulong ticket)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
int result = -1;
|
||||||
|
|
||||||
|
//
|
||||||
|
int trailsCount = CountTrails();
|
||||||
|
if (ticket <= 0 || trailsCount <= 0)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
for (int i = 0; i < trailsCount; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XTrail iTrail = mTrails[i];
|
||||||
|
|
||||||
|
//
|
||||||
|
if (iTrail.ticket == ticket)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
result = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool GetTrail(
|
||||||
|
ulong ticket,
|
||||||
|
XTrail &trail //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
int idx = FindTrailIndex(ticket);
|
||||||
|
result = idx >= 0;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
trail = mTrails[idx];
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
void AddTrail(
|
||||||
|
XTrail &trail //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
if (!trail.IsValid())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
AddRef(
|
||||||
|
trail,
|
||||||
|
mTrails //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Tools ...
|
// Tools ...
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -479,6 +479,12 @@ public:
|
|||||||
bool isCloseUnderSlow;
|
bool isCloseUnderSlow;
|
||||||
bool isCloseOverVerifier;
|
bool isCloseOverVerifier;
|
||||||
bool isCloseUnderVerifier;
|
bool isCloseUnderVerifier;
|
||||||
|
bool isFastCrossedOverSlow;
|
||||||
|
bool isFastCrossedUnderSlow;
|
||||||
|
bool isFastCrossedOverVerifier;
|
||||||
|
bool isFastCrossedUnderVerifier;
|
||||||
|
bool isSlowCrossedOverVerifier;
|
||||||
|
bool isSlowCrossedUnderVerifier;
|
||||||
|
|
||||||
//
|
//
|
||||||
// XSTR ...
|
// XSTR ...
|
||||||
@@ -491,8 +497,10 @@ public:
|
|||||||
// XCHE ...
|
// XCHE ...
|
||||||
bool isCHEInLong;
|
bool isCHEInLong;
|
||||||
bool isCHEInStrongLong;
|
bool isCHEInStrongLong;
|
||||||
|
bool isCHESwitchedInStrongLong;
|
||||||
bool isCHEInShort;
|
bool isCHEInShort;
|
||||||
bool isCHEInStrongShort;
|
bool isCHEInStrongShort;
|
||||||
|
bool isCHESwitchedInStrongShort;
|
||||||
|
|
||||||
//
|
//
|
||||||
// XOSC ...
|
// XOSC ...
|
||||||
@@ -1190,6 +1198,24 @@ public:
|
|||||||
{
|
{
|
||||||
bullScore++;
|
bullScore++;
|
||||||
}
|
}
|
||||||
|
if (isFastCrossedOverSlow)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bullScore++;
|
||||||
|
bearScore--;
|
||||||
|
}
|
||||||
|
if (isFastCrossedOverVerifier)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bullScore++;
|
||||||
|
bearScore--;
|
||||||
|
}
|
||||||
|
if (isSlowCrossedOverVerifier)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bullScore++;
|
||||||
|
bearScore--;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// BEARISH ...
|
// BEARISH ...
|
||||||
@@ -1217,6 +1243,60 @@ public:
|
|||||||
{
|
{
|
||||||
bearScore++;
|
bearScore++;
|
||||||
}
|
}
|
||||||
|
if (isFastCrossedUnderSlow)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bullScore--;
|
||||||
|
bearScore++;
|
||||||
|
}
|
||||||
|
if (isFastCrossedUnderVerifier)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bullScore--;
|
||||||
|
bearScore++;
|
||||||
|
}
|
||||||
|
if (isSlowCrossedUnderVerifier)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bullScore--;
|
||||||
|
bearScore++;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// XCHE ...
|
||||||
|
if (isCHEInLong)
|
||||||
|
{
|
||||||
|
bullScore++;
|
||||||
|
}
|
||||||
|
if (isCHEInStrongLong)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bullScore++;
|
||||||
|
bearScore--;
|
||||||
|
}
|
||||||
|
if (isCHESwitchedInStrongLong)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bullScore++;
|
||||||
|
bearScore--;
|
||||||
|
}
|
||||||
|
if (isCHEInShort)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bearScore++;
|
||||||
|
}
|
||||||
|
if (isCHEInStrongShort)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bullScore--;
|
||||||
|
bearScore++;
|
||||||
|
}
|
||||||
|
if (isCHESwitchedInStrongShort)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bullScore--;
|
||||||
|
bearScore++;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// XOSC ...
|
// XOSC ...
|
||||||
@@ -1563,8 +1643,10 @@ public:
|
|||||||
//
|
//
|
||||||
ToString("isCHEInLong", isCHEInLong, ignoreFalseConditions) +
|
ToString("isCHEInLong", isCHEInLong, ignoreFalseConditions) +
|
||||||
ToString("isCHEInStrongLong", isCHEInStrongLong, ignoreFalseConditions) +
|
ToString("isCHEInStrongLong", isCHEInStrongLong, ignoreFalseConditions) +
|
||||||
|
ToString("isCHESwitchedInStrongLong", isCHESwitchedInStrongLong, ignoreFalseConditions) +
|
||||||
ToString("isCHEInShort", isCHEInShort, ignoreFalseConditions) +
|
ToString("isCHEInShort", isCHEInShort, ignoreFalseConditions) +
|
||||||
ToString("isCHEInStrongShort", isCHEInStrongShort, ignoreFalseConditions) +
|
ToString("isCHEInStrongShort", isCHEInStrongShort, ignoreFalseConditions) +
|
||||||
|
ToString("isCHESwitchedInStrongShort", isCHESwitchedInStrongShort, ignoreFalseConditions) +
|
||||||
""
|
""
|
||||||
//
|
//
|
||||||
;
|
;
|
||||||
@@ -1607,6 +1689,12 @@ public:
|
|||||||
ToString("isCloseUnderSlow", isCloseUnderSlow, ignoreFalseConditions) +
|
ToString("isCloseUnderSlow", isCloseUnderSlow, ignoreFalseConditions) +
|
||||||
ToString("isCloseOverVerifier", isCloseOverVerifier, ignoreFalseConditions) +
|
ToString("isCloseOverVerifier", isCloseOverVerifier, ignoreFalseConditions) +
|
||||||
ToString("isCloseUnderVerifier", isCloseUnderVerifier, ignoreFalseConditions) +
|
ToString("isCloseUnderVerifier", isCloseUnderVerifier, ignoreFalseConditions) +
|
||||||
|
ToString("isFastCrossedOverSlow", isFastCrossedOverSlow, ignoreFalseConditions) +
|
||||||
|
ToString("isFastCrossedUnderSlow", isFastCrossedUnderSlow, ignoreFalseConditions) +
|
||||||
|
ToString("isFastCrossedOverVerifier", isFastCrossedOverVerifier, ignoreFalseConditions) +
|
||||||
|
ToString("isFastCrossedUnderVerifier", isFastCrossedUnderVerifier, ignoreFalseConditions) +
|
||||||
|
ToString("isSlowCrossedOverVerifier", isSlowCrossedOverVerifier, ignoreFalseConditions) +
|
||||||
|
ToString("isSlowCrossedUnderVerifier", isSlowCrossedUnderVerifier, ignoreFalseConditions) +
|
||||||
""
|
""
|
||||||
//
|
//
|
||||||
;
|
;
|
||||||
@@ -2135,29 +2223,63 @@ public:
|
|||||||
NotEmpty(che.GetLongExit1(curr))
|
NotEmpty(che.GetLongExit1(curr))
|
||||||
//
|
//
|
||||||
;
|
;
|
||||||
|
bool isCHEInLongPrev =
|
||||||
|
//
|
||||||
|
NotEmpty(che.GetLongExit1(prev))
|
||||||
|
//
|
||||||
|
;
|
||||||
bool isCHEInStrongLong =
|
bool isCHEInStrongLong =
|
||||||
//
|
//
|
||||||
isCHEInLong &&
|
isCHEInLong &&
|
||||||
NotEmpty(che.GetLongExit2(curr))
|
NotEmpty(che.GetLongExit2(curr))
|
||||||
//
|
//
|
||||||
;
|
;
|
||||||
|
bool isCHEInStrongLongPrev =
|
||||||
|
//
|
||||||
|
isCHEInLongPrev &&
|
||||||
|
NotEmpty(che.GetLongExit2(prev))
|
||||||
|
//
|
||||||
|
;
|
||||||
bool isCHEInShort =
|
bool isCHEInShort =
|
||||||
//
|
//
|
||||||
NotEmpty(che.GetShortExit1(curr))
|
NotEmpty(che.GetShortExit1(curr))
|
||||||
//
|
//
|
||||||
;
|
;
|
||||||
|
bool isCHEInShortPrev =
|
||||||
|
//
|
||||||
|
NotEmpty(che.GetShortExit1(prev))
|
||||||
|
//
|
||||||
|
;
|
||||||
bool isCHEInStrongShort =
|
bool isCHEInStrongShort =
|
||||||
//
|
//
|
||||||
isCHEInShort &&
|
isCHEInShort &&
|
||||||
NotEmpty(che.GetShortExit2(curr))
|
NotEmpty(che.GetShortExit2(curr))
|
||||||
//
|
//
|
||||||
;
|
;
|
||||||
|
bool isCHEInStrongShortPrev =
|
||||||
|
//
|
||||||
|
isCHEInShortPrev &&
|
||||||
|
NotEmpty(che.GetShortExit2(prev))
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
//
|
//
|
||||||
conditions.isCHEInLong = isCHEInLong;
|
conditions.isCHEInLong = isCHEInLong;
|
||||||
conditions.isCHEInShort = isCHEInShort;
|
|
||||||
conditions.isCHEInStrongLong = isCHEInStrongLong;
|
conditions.isCHEInStrongLong = isCHEInStrongLong;
|
||||||
|
conditions.isCHESwitchedInStrongLong =
|
||||||
|
//
|
||||||
|
isCHEInStrongLong &&
|
||||||
|
!isCHEInStrongLongPrev
|
||||||
|
//
|
||||||
|
;
|
||||||
|
conditions.isCHEInShort = isCHEInShort;
|
||||||
conditions.isCHEInStrongShort = isCHEInStrongShort;
|
conditions.isCHEInStrongShort = isCHEInStrongShort;
|
||||||
|
conditions.isCHESwitchedInStrongShort =
|
||||||
|
//
|
||||||
|
isCHEInStrongShort &&
|
||||||
|
!isCHEInStrongShortPrev
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
//
|
//
|
||||||
// XMC ...
|
// XMC ...
|
||||||
@@ -2247,6 +2369,54 @@ public:
|
|||||||
//
|
//
|
||||||
;
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isFastCrossedOverSlow =
|
||||||
|
//
|
||||||
|
conditions.mcFasts[curr] > conditions.mcSlows[curr] &&
|
||||||
|
conditions.mcFasts[prev] <= conditions.mcSlows[prev]
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isFastCrossedUnderSlow =
|
||||||
|
//
|
||||||
|
conditions.mcFasts[curr] < conditions.mcSlows[curr] &&
|
||||||
|
conditions.mcFasts[prev] >= conditions.mcSlows[prev]
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isFastCrossedOverVerifier =
|
||||||
|
//
|
||||||
|
conditions.mcFasts[curr] > conditions.mcVerifiers[curr] &&
|
||||||
|
conditions.mcFasts[prev] <= conditions.mcVerifiers[prev]
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isFastCrossedUnderVerifier =
|
||||||
|
//
|
||||||
|
conditions.mcFasts[curr] < conditions.mcVerifiers[curr] &&
|
||||||
|
conditions.mcFasts[prev] >= conditions.mcVerifiers[prev]
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isSlowCrossedOverVerifier =
|
||||||
|
//
|
||||||
|
conditions.mcSlows[curr] > conditions.mcVerifiers[curr] &&
|
||||||
|
conditions.mcSlows[prev] <= conditions.mcVerifiers[prev]
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isSlowCrossedUnderVerifier =
|
||||||
|
//
|
||||||
|
conditions.mcSlows[curr] < conditions.mcVerifiers[curr] &&
|
||||||
|
conditions.mcSlows[prev] >= conditions.mcVerifiers[prev]
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
//
|
//
|
||||||
conditions.isFastOverSlow = isFastOverSlow;
|
conditions.isFastOverSlow = isFastOverSlow;
|
||||||
conditions.isFastUnderSlow = isFastUnderSlow;
|
conditions.isFastUnderSlow = isFastUnderSlow;
|
||||||
@@ -2260,6 +2430,12 @@ public:
|
|||||||
conditions.isCloseUnderSlow = isCloseUnderSlow;
|
conditions.isCloseUnderSlow = isCloseUnderSlow;
|
||||||
conditions.isCloseOverVerifier = isCloseOverVerifier;
|
conditions.isCloseOverVerifier = isCloseOverVerifier;
|
||||||
conditions.isCloseUnderVerifier = isCloseUnderVerifier;
|
conditions.isCloseUnderVerifier = isCloseUnderVerifier;
|
||||||
|
conditions.isFastCrossedOverSlow = isFastCrossedOverSlow;
|
||||||
|
conditions.isFastCrossedUnderSlow = isFastCrossedUnderSlow;
|
||||||
|
conditions.isFastCrossedOverVerifier = isFastCrossedOverVerifier;
|
||||||
|
conditions.isFastCrossedUnderVerifier = isFastCrossedUnderVerifier;
|
||||||
|
conditions.isSlowCrossedOverVerifier = isSlowCrossedOverVerifier;
|
||||||
|
conditions.isSlowCrossedUnderVerifier = isSlowCrossedUnderVerifier;
|
||||||
|
|
||||||
//
|
//
|
||||||
// XICH ...
|
// XICH ...
|
||||||
|
|||||||
@@ -676,6 +676,18 @@ protected:
|
|||||||
//
|
//
|
||||||
// Props ...
|
// Props ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Trade Class Instance ...
|
||||||
|
XSCTrade *mTrader;
|
||||||
|
XSCAlert *mAlert;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check in Test Mode or not ...
|
||||||
|
bool mIsInTestMode;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Tools ...
|
||||||
|
|
||||||
//
|
//
|
||||||
// Signal Event Listeners ...
|
// Signal Event Listeners ...
|
||||||
void NotifyOnSignalEventHandlers(XSignal &signals[])
|
void NotifyOnSignalEventHandlers(XSignal &signals[])
|
||||||
@@ -1244,15 +1256,6 @@ private:
|
|||||||
//
|
//
|
||||||
// Props ...
|
// Props ...
|
||||||
|
|
||||||
//
|
|
||||||
// Trade Class Instance ...
|
|
||||||
XSCTrade *mTrader;
|
|
||||||
XSCAlert *mAlert;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Check in Test Mode or not ...
|
|
||||||
bool mIsInTestMode;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Signal Event Listeners ...
|
// Signal Event Listeners ...
|
||||||
TOnSignal mOnSignalEventHandlers[];
|
TOnSignal mOnSignalEventHandlers[];
|
||||||
|
|||||||
@@ -578,10 +578,6 @@ public:
|
|||||||
//
|
//
|
||||||
// Init On Trade Context ...
|
// Init On Trade Context ...
|
||||||
InitOnTradeContext();
|
InitOnTradeContext();
|
||||||
|
|
||||||
//
|
|
||||||
// Sync Position Infos ...
|
|
||||||
SyncPositionInfos();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -1116,6 +1112,11 @@ public:
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Prepare Signal Comment ...
|
||||||
|
string mSComment = mSignal.GenerateComment();
|
||||||
|
mSignal.comment += mSComment;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Handle Market Execution ...
|
// Handle Market Execution ...
|
||||||
if (mSignal.mode == X_ORDER_MODE_MARKET)
|
if (mSignal.mode == X_ORDER_MODE_MARKET)
|
||||||
@@ -1739,7 +1740,7 @@ public:
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Check Position Open ...
|
// Check Position Open ...
|
||||||
result = !IsOpen(ticket);
|
result = IsOpen(ticket);
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
return result;
|
return result;
|
||||||
@@ -3240,63 +3241,6 @@ private:
|
|||||||
//
|
//
|
||||||
// Position Info Collector ...
|
// Position Info Collector ...
|
||||||
|
|
||||||
//
|
|
||||||
XSCPositionInfoCollector mPositionInfoCollector; // Position Info Data Collector ...
|
|
||||||
|
|
||||||
//
|
|
||||||
void SyncPositionInfos()
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// TODO: Complete this ...
|
|
||||||
|
|
||||||
//
|
|
||||||
// Read All Stored Positions ...
|
|
||||||
// XPositionInfo infos[];
|
|
||||||
// int infosCount = mPositionInfoCollector.Collect(infos);
|
|
||||||
|
|
||||||
// //
|
|
||||||
// // Clear Store ...
|
|
||||||
// mPositionInfoCollector.Clear();
|
|
||||||
|
|
||||||
// //
|
|
||||||
// XPosition positions[];
|
|
||||||
// int positionsCount = GetPositions(positions);
|
|
||||||
// if (positionsCount <= 0)
|
|
||||||
// {
|
|
||||||
// Clean(infos);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// //
|
|
||||||
// // Now we Have to Find each Position Info inside Positions and Update them ...
|
|
||||||
// XPositionInfo datas[];
|
|
||||||
// for (int i = 0; i < infosCount; i++)
|
|
||||||
// {
|
|
||||||
// //
|
|
||||||
// XPositionInfo iInfo = infos[i];
|
|
||||||
|
|
||||||
// //
|
|
||||||
// // Check Positions Contains Specific ticket or not ...
|
|
||||||
// for (int j = 0; j < positionsCount; j++)
|
|
||||||
// {
|
|
||||||
// //
|
|
||||||
// XPosition jPosition = positions[j];
|
|
||||||
|
|
||||||
// //
|
|
||||||
// if (jPosition.ticket != iInfo.ticket)
|
|
||||||
// {
|
|
||||||
// //
|
|
||||||
// // this is a Position which is not listed in Collector ...
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// //
|
|
||||||
// // Now we have a Position which Listed Before in Collector ...
|
|
||||||
// // we Have to Update it ...
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Tools ...
|
// Tools ...
|
||||||
|
|
||||||
|
|||||||
+18
-18
@@ -238,9 +238,9 @@ bool InitialEA()
|
|||||||
|
|
||||||
//
|
//
|
||||||
// XMC ...
|
// XMC ...
|
||||||
iDescriptor.inputs.mcInputs.showFastMa = false;
|
iDescriptor.inputs.mcInputs.showFastMa = true;
|
||||||
iDescriptor.inputs.mcInputs.showSlowMa = false;
|
iDescriptor.inputs.mcInputs.showSlowMa = true;
|
||||||
iDescriptor.inputs.mcInputs.showVerifierMa = false;
|
iDescriptor.inputs.mcInputs.showVerifierMa = true;
|
||||||
|
|
||||||
//
|
//
|
||||||
// XICH ...
|
// XICH ...
|
||||||
@@ -254,11 +254,11 @@ bool InitialEA()
|
|||||||
iDescriptor.inputs.ichInputs.showKijunSenNegative = false;
|
iDescriptor.inputs.ichInputs.showKijunSenNegative = false;
|
||||||
|
|
||||||
//
|
//
|
||||||
// XSTR ...
|
// XCHE ...
|
||||||
iDescriptor.inputs.cheInputs.showLongExit1Line = false;
|
iDescriptor.inputs.cheInputs.showLongExit1Line = true;
|
||||||
iDescriptor.inputs.cheInputs.showShortExit1Line = false;
|
iDescriptor.inputs.cheInputs.showShortExit1Line = true;
|
||||||
iDescriptor.inputs.cheInputs.showLongExit2Line = false;
|
iDescriptor.inputs.cheInputs.showLongExit2Line = true;
|
||||||
iDescriptor.inputs.cheInputs.showShortExit2Line = false;
|
iDescriptor.inputs.cheInputs.showShortExit2Line = true;
|
||||||
|
|
||||||
//
|
//
|
||||||
// XPV ...
|
// XPV ...
|
||||||
@@ -274,14 +274,14 @@ bool InitialEA()
|
|||||||
//
|
//
|
||||||
// XZG ...
|
// XZG ...
|
||||||
iDescriptor.inputs.zgInputs.showZigZag = false;
|
iDescriptor.inputs.zgInputs.showZigZag = false;
|
||||||
iDescriptor.inputs.zgInputs.showPeaksAndVales = false;
|
iDescriptor.inputs.zgInputs.showPeaksAndVales = true;
|
||||||
|
|
||||||
//
|
//
|
||||||
// XDON ...
|
// XDON ...
|
||||||
iDescriptor.inputs.donInputs.showOpen = true;
|
iDescriptor.inputs.donInputs.showOpen = false;
|
||||||
iDescriptor.inputs.donInputs.showHigh = true;
|
iDescriptor.inputs.donInputs.showHigh = false;
|
||||||
iDescriptor.inputs.donInputs.showClose = true;
|
iDescriptor.inputs.donInputs.showClose = false;
|
||||||
iDescriptor.inputs.donInputs.showLow = true;
|
iDescriptor.inputs.donInputs.showLow = false;
|
||||||
|
|
||||||
//
|
//
|
||||||
// XSTR ...
|
// XSTR ...
|
||||||
@@ -313,15 +313,15 @@ bool InitialEA()
|
|||||||
string fontName = "Arial";
|
string fontName = "Arial";
|
||||||
ENUM_ANCHOR_POINT fontAnchor = ANCHOR_LEFT_UPPER;
|
ENUM_ANCHOR_POINT fontAnchor = ANCHOR_LEFT_UPPER;
|
||||||
|
|
||||||
//
|
//false
|
||||||
// Hind Market ...
|
// Hind Market ...
|
||||||
iDescriptor.inputs.hMarketPeriod = NULL;
|
iDescriptor.inputs.hMarketPeriod = NULL;
|
||||||
iDescriptor.inputs.hMarketMethod = X_PERIOD_AUTO;
|
iDescriptor.inputs.hMarketMethod = X_PERIOD_AUTO;
|
||||||
iDescriptor.inputs.hMarketInputs.drawLabels = false;
|
iDescriptor.inputs.hMarketInputs.drawLabels = false;
|
||||||
iDescriptor.inputs.hMarketInputs.drawCBar = true;
|
iDescriptor.inputs.hMarketInputs.drawCBar = false;
|
||||||
iDescriptor.inputs.hMarketInputs.drawPBar = true;
|
iDescriptor.inputs.hMarketInputs.drawPBar = false;
|
||||||
iDescriptor.inputs.hMarketInputs.drawCBarMid = true;
|
iDescriptor.inputs.hMarketInputs.drawCBarMid = false;
|
||||||
iDescriptor.inputs.hMarketInputs.drawPBarMid = true;
|
iDescriptor.inputs.hMarketInputs.drawPBarMid = false;
|
||||||
iDescriptor.inputs.hMarketInputs.cBarDrawSpecs.Default();
|
iDescriptor.inputs.hMarketInputs.cBarDrawSpecs.Default();
|
||||||
iDescriptor.inputs.hMarketInputs.pBarDrawSpecs.Default();
|
iDescriptor.inputs.hMarketInputs.pBarDrawSpecs.Default();
|
||||||
|
|
||||||
|
|||||||
+225
-9
@@ -202,7 +202,7 @@ struct X5121ProviderDescriptor
|
|||||||
result = x5Provider.Init(
|
result = x5Provider.Init(
|
||||||
this.x5Inputs //
|
this.x5Inputs //
|
||||||
);
|
);
|
||||||
if (result)
|
if (!result)
|
||||||
{
|
{
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -297,6 +297,125 @@ struct X5121ProviderDescriptor
|
|||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
void GenerateScore(
|
||||||
|
double &bullishScore,
|
||||||
|
double &bearishScore //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
double x5BullishScore = 5;
|
||||||
|
double x5BearishScore = 5;
|
||||||
|
|
||||||
|
//
|
||||||
|
GenerateX5Score(
|
||||||
|
x5BullishScore,
|
||||||
|
x5BearishScore //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
double x121BullishScore = 5;
|
||||||
|
double x121BearishScore = 5;
|
||||||
|
|
||||||
|
//
|
||||||
|
GenerateX121Score(
|
||||||
|
x121BullishScore,
|
||||||
|
x121BearishScore //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
bullishScore = x5BullishScore + x121BullishScore;
|
||||||
|
bearishScore = x5BearishScore + x121BearishScore;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
void GenerateX5Score(
|
||||||
|
double &bullishScore,
|
||||||
|
double &bearishScore //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
x5Conditions.GenerateScore(
|
||||||
|
bullishScore,
|
||||||
|
bearishScore //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
void GenerateX121Score(
|
||||||
|
double &bullishScore,
|
||||||
|
double &bearishScore //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
x121Conditions.GenerateScore(
|
||||||
|
bullishScore,
|
||||||
|
bearishScore //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
string GenerateSummary(
|
||||||
|
const bool onlySummary = false,
|
||||||
|
bool ignoreFalseConditions = true //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
string x5Str = GenerateX5Summary(
|
||||||
|
onlySummary,
|
||||||
|
ignoreFalseConditions //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
string x121Str = GenerateX121Summary(
|
||||||
|
onlySummary,
|
||||||
|
ignoreFalseConditions //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
string result =
|
||||||
|
//
|
||||||
|
x5Str + "\n" + x121Str
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
string GenerateX5Summary(
|
||||||
|
const bool onlySummary = false,
|
||||||
|
bool ignoreFalseConditions = true //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return x5Conditions.GenerateSummary(
|
||||||
|
onlySummary,
|
||||||
|
1,
|
||||||
|
"\n",
|
||||||
|
ignoreFalseConditions //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
string GenerateX121Summary(
|
||||||
|
const bool onlySummary = false,
|
||||||
|
bool ignoreFalseConditions = true //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return x121Conditions.GenerateSummary(
|
||||||
|
onlySummary,
|
||||||
|
1,
|
||||||
|
1.1,
|
||||||
|
1.2,
|
||||||
|
1.6,
|
||||||
|
1.8,
|
||||||
|
"\n",
|
||||||
|
NULL,
|
||||||
|
ignoreFalseConditions //
|
||||||
|
);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -376,7 +495,7 @@ int OnInit()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
TesterHideIndicators(true);
|
// TesterHideIndicators(true);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Init Succeed ...
|
// Init Succeed ...
|
||||||
@@ -830,15 +949,112 @@ int RequestForSignal(
|
|||||||
X5121ProviderDescriptor iDescriptor = x5121EAProviders[i];
|
X5121ProviderDescriptor iDescriptor = x5121EAProviders[i];
|
||||||
|
|
||||||
//
|
//
|
||||||
bool iHasSignal = iDescriptor.HasSignal(0);
|
iDescriptor.x5Provider.GetMarketConditions(
|
||||||
if (iHasSignal)
|
iDescriptor.x5Conditions //
|
||||||
{
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
iDescriptor.x121Provider.GetMarketConditions(
|
||||||
|
iDescriptor.x121Conditions //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
X5MarketConditions x5Conditions = iDescriptor.x5Conditions;
|
||||||
|
X121MarketConditions x121Conditions = iDescriptor.x121Conditions;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check For Long ...
|
||||||
|
bool hasLong =
|
||||||
//
|
//
|
||||||
AddRef(
|
(x121Conditions.hMarketConditions.isTrendSwitchedToBullish &&
|
||||||
iDescriptor.signal,
|
(x121Conditions.lMarketConditions.isTrendBullish &&
|
||||||
signals //
|
x121Conditions.mMarketConditions.isTrendBullish &&
|
||||||
);
|
x121Conditions.sMarketConditions.isTrendBullish &&
|
||||||
|
x121Conditions.cMarketConditions.isTrendBullish))
|
||||||
|
//
|
||||||
|
||
|
||||||
|
//
|
||||||
|
(x121Conditions.lMarketConditions.isTrendSwitchedToBullish &&
|
||||||
|
(x121Conditions.hMarketConditions.isTrendBullish &&
|
||||||
|
x121Conditions.mMarketConditions.isTrendBullish &&
|
||||||
|
x121Conditions.sMarketConditions.isTrendBullish &&
|
||||||
|
x121Conditions.cMarketConditions.isTrendBullish))
|
||||||
|
//
|
||||||
|
||
|
||||||
|
//
|
||||||
|
(x121Conditions.mMarketConditions.isTrendSwitchedToBullish &&
|
||||||
|
(x121Conditions.hMarketConditions.isTrendBullish &&
|
||||||
|
x121Conditions.lMarketConditions.isTrendBullish &&
|
||||||
|
x121Conditions.sMarketConditions.isTrendBullish &&
|
||||||
|
x121Conditions.cMarketConditions.isTrendBullish))
|
||||||
|
//
|
||||||
|
||
|
||||||
|
//
|
||||||
|
(x121Conditions.sMarketConditions.isTrendSwitchedToBullish &&
|
||||||
|
(x121Conditions.hMarketConditions.isTrendBullish &&
|
||||||
|
x121Conditions.lMarketConditions.isTrendBullish &&
|
||||||
|
x121Conditions.mMarketConditions.isTrendBullish &&
|
||||||
|
x121Conditions.cMarketConditions.isTrendBullish))
|
||||||
|
//
|
||||||
|
||
|
||||||
|
//
|
||||||
|
(x121Conditions.cMarketConditions.isTrendSwitchedToBullish &&
|
||||||
|
(x121Conditions.hMarketConditions.isTrendBullish &&
|
||||||
|
x121Conditions.lMarketConditions.isTrendBullish &&
|
||||||
|
x121Conditions.mMarketConditions.isTrendBullish &&
|
||||||
|
x121Conditions.sMarketConditions.isTrendBullish))
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check For Short ...
|
||||||
|
bool hasShort =
|
||||||
|
//
|
||||||
|
false
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
if (hasLong)
|
||||||
|
{
|
||||||
|
Print("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// bool iHasSignal = iDescriptor.HasSignal(0);
|
||||||
|
// if (iHasSignal)
|
||||||
|
// {
|
||||||
|
// //
|
||||||
|
// AddRef(
|
||||||
|
// iDescriptor.signal,
|
||||||
|
// signals //
|
||||||
|
// );
|
||||||
|
|
||||||
|
// // //
|
||||||
|
// // string conditionsStr = iDescriptor.GenerateSummary();
|
||||||
|
// // Print(conditionsStr);
|
||||||
|
|
||||||
|
// //
|
||||||
|
// double bullScore = 0;
|
||||||
|
// double bearScore = 0;
|
||||||
|
// iDescriptor.GenerateScore(
|
||||||
|
// bullScore,
|
||||||
|
// bearScore //
|
||||||
|
// );
|
||||||
|
|
||||||
|
// //
|
||||||
|
// Print(" ");
|
||||||
|
// Print((IsLong(iDescriptor.signal.type) ? "Long" : "Short"));
|
||||||
|
// Print(iDescriptor.signal.symbol, ",", ToString(iDescriptor.signal.period), ",", iDescriptor.signal.provider);
|
||||||
|
// Print("========================");
|
||||||
|
// Print("bullScore: ", bullScore);
|
||||||
|
// Print("bearScore: ", bearScore);
|
||||||
|
|
||||||
|
// //
|
||||||
|
// Print("");
|
||||||
|
|
||||||
|
// //
|
||||||
|
// Print(iDescriptor.GenerateX121Summary());
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -263,7 +263,7 @@ public:
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Upper ...
|
// Upper ...
|
||||||
|
|
||||||
//
|
//
|
||||||
double GetUpperO(
|
double GetUpperO(
|
||||||
int barIndex // Bar Index
|
int barIndex // Bar Index
|
||||||
@@ -316,7 +316,7 @@ public:
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Lower ...
|
// Lower ...
|
||||||
|
|
||||||
//
|
//
|
||||||
double GetLowerO(
|
double GetLowerO(
|
||||||
int barIndex // Bar Index
|
int barIndex // Bar Index
|
||||||
@@ -372,7 +372,7 @@ public:
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Upper ...
|
// Upper ...
|
||||||
|
|
||||||
//
|
//
|
||||||
double GetUpperC(
|
double GetUpperC(
|
||||||
int barIndex // Bar Index
|
int barIndex // Bar Index
|
||||||
@@ -425,7 +425,7 @@ public:
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Lower ...
|
// Lower ...
|
||||||
|
|
||||||
//
|
//
|
||||||
double GetLowerC(
|
double GetLowerC(
|
||||||
int barIndex // Bar Index
|
int barIndex // Bar Index
|
||||||
@@ -481,7 +481,7 @@ public:
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Upper ...
|
// Upper ...
|
||||||
|
|
||||||
//
|
//
|
||||||
double GetUpperH(
|
double GetUpperH(
|
||||||
int barIndex // Bar Index
|
int barIndex // Bar Index
|
||||||
@@ -534,7 +534,7 @@ public:
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Lower ...
|
// Lower ...
|
||||||
|
|
||||||
//
|
//
|
||||||
double GetLowerH(
|
double GetLowerH(
|
||||||
int barIndex // Bar Index
|
int barIndex // Bar Index
|
||||||
@@ -590,7 +590,7 @@ public:
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Upper ...
|
// Upper ...
|
||||||
|
|
||||||
//
|
//
|
||||||
double GetUpperL(
|
double GetUpperL(
|
||||||
int barIndex // Bar Index
|
int barIndex // Bar Index
|
||||||
@@ -643,7 +643,7 @@ public:
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Lower ...
|
// Lower ...
|
||||||
|
|
||||||
//
|
//
|
||||||
double GetLowerL(
|
double GetLowerL(
|
||||||
int barIndex // Bar Index
|
int barIndex // Bar Index
|
||||||
@@ -694,6 +694,106 @@ public:
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
void GetUppers(
|
||||||
|
double &result[],
|
||||||
|
int barIndex = 0 //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
Clean(result);
|
||||||
|
|
||||||
|
//
|
||||||
|
double uo = GetUpperO(barIndex);
|
||||||
|
double uc = GetUpperC(barIndex);
|
||||||
|
double uh = GetUpperH(barIndex);
|
||||||
|
double ul = GetUpperL(barIndex);
|
||||||
|
|
||||||
|
//
|
||||||
|
Add(uo, result);
|
||||||
|
Add(uc, result);
|
||||||
|
Add(uh, result);
|
||||||
|
Add(ul, result);
|
||||||
|
}
|
||||||
|
double GetMinUpper(
|
||||||
|
int barIndex = 0 //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
double values[];
|
||||||
|
GetUppers(values);
|
||||||
|
|
||||||
|
//
|
||||||
|
double result = GetMin(values);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
double GetMaxUpper(
|
||||||
|
int barIndex = 0 //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
double values[];
|
||||||
|
GetUppers(values);
|
||||||
|
|
||||||
|
//
|
||||||
|
double result = GetMax(values);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
void GetLowers(
|
||||||
|
double &result[],
|
||||||
|
int barIndex = 0 //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
Clean(result);
|
||||||
|
|
||||||
|
//
|
||||||
|
double lo = GetLowerO(barIndex);
|
||||||
|
double lc = GetLowerC(barIndex);
|
||||||
|
double lh = GetLowerH(barIndex);
|
||||||
|
double ll = GetLowerL(barIndex);
|
||||||
|
|
||||||
|
//
|
||||||
|
Add(lo, result);
|
||||||
|
Add(lc, result);
|
||||||
|
Add(lh, result);
|
||||||
|
Add(ll, result);
|
||||||
|
}
|
||||||
|
double GetMinLower(
|
||||||
|
int barIndex = 0 //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
double values[];
|
||||||
|
GetLowers(values);
|
||||||
|
|
||||||
|
//
|
||||||
|
double result = GetMin(values);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
double GetMaxLower(
|
||||||
|
int barIndex = 0 //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
double values[];
|
||||||
|
GetLowers(values);
|
||||||
|
|
||||||
|
//
|
||||||
|
double result = GetMin(values);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Protected ...
|
// Protected ...
|
||||||
protected:
|
protected:
|
||||||
|
|||||||
@@ -2482,7 +2482,6 @@ bool IsSpecifiedValid(string value)
|
|||||||
return IsValid(value);
|
return IsValid(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Validate a Date ...
|
// Validate a Date ...
|
||||||
bool IsValid(datetime value)
|
bool IsValid(datetime value)
|
||||||
@@ -4586,6 +4585,12 @@ double GetMax(
|
|||||||
//
|
//
|
||||||
double result = 0;
|
double result = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
if (count <= 0)
|
||||||
|
{
|
||||||
|
count = ArraySize(buffer);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
T tmp[];
|
T tmp[];
|
||||||
int tmpCount = Copy(
|
int tmpCount = Copy(
|
||||||
@@ -4635,6 +4640,12 @@ double GetMin(
|
|||||||
//
|
//
|
||||||
double result = 0;
|
double result = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
if (count <= 0)
|
||||||
|
{
|
||||||
|
count = ArraySize(buffer);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
T tmp[];
|
T tmp[];
|
||||||
int tmpCount = Copy(
|
int tmpCount = Copy(
|
||||||
|
|||||||
+151
-423
@@ -311,15 +311,15 @@ struct XSignal
|
|||||||
|
|
||||||
//
|
//
|
||||||
bool PrepareLong(
|
bool PrepareLong(
|
||||||
string mSymbol, // Trading Symbol
|
string mSymbol, // Trading Symbol
|
||||||
string mProvider, // Signal Provider
|
string mProvider, // Signal Provider
|
||||||
ENUM_TIMEFRAMES mPeriod, // Trading TimeFrame
|
ENUM_TIMEFRAMES mPeriod, // Trading TimeFrame
|
||||||
ENUM_X_ORDER_MODES mMode, // Execution Mode
|
ENUM_X_ORDER_MODES mMode, // Execution Mode
|
||||||
double mEntry, // Entry Price
|
double mEntry, // Entry Price
|
||||||
double mVolume, // Volume
|
double mVolume, // Volume
|
||||||
ENUM_X_SIGNAL_MANAGING_ACTIONS mAction = X_SIGNAL_USE_NOTHING, // Signal Management Action
|
ENUM_X_SIGNAL_MANAGING_ACTIONS mAction = X_SIGNAL_USE_NOTHING, // Signal Management Action
|
||||||
double sl = 0, // Stop Loss
|
double sl = 0, // Stop Loss
|
||||||
double tp = 0 // Take Profit
|
double tp = 0 // Take Profit
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -340,15 +340,15 @@ struct XSignal
|
|||||||
|
|
||||||
//
|
//
|
||||||
bool PrepareShort(
|
bool PrepareShort(
|
||||||
string mSymbol, // Trading Symbol
|
string mSymbol, // Trading Symbol
|
||||||
string mProvider, // Signal Provider
|
string mProvider, // Signal Provider
|
||||||
ENUM_TIMEFRAMES mPeriod, // Trading TimeFrame
|
ENUM_TIMEFRAMES mPeriod, // Trading TimeFrame
|
||||||
ENUM_X_ORDER_MODES mMode, // Execution Mode
|
ENUM_X_ORDER_MODES mMode, // Execution Mode
|
||||||
double mEntry, // Entry Price
|
double mEntry, // Entry Price
|
||||||
double mVolume, // Volume
|
double mVolume, // Volume
|
||||||
ENUM_X_SIGNAL_MANAGING_ACTIONS mAction = X_SIGNAL_USE_NOTHING, // Signal Management Action
|
ENUM_X_SIGNAL_MANAGING_ACTIONS mAction = X_SIGNAL_USE_NOTHING, // Signal Management Action
|
||||||
double sl = 0, // Stop Loss
|
double sl = 0, // Stop Loss
|
||||||
double tp = 0 // Take Profit
|
double tp = 0 // Take Profit
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -372,14 +372,14 @@ struct XSignal
|
|||||||
|
|
||||||
//
|
//
|
||||||
bool PrepareMarketLong(
|
bool PrepareMarketLong(
|
||||||
string mSymbol, // Trading Symbol
|
string mSymbol, // Trading Symbol
|
||||||
string mProvider, // Signal Provider
|
string mProvider, // Signal Provider
|
||||||
ENUM_TIMEFRAMES mPeriod, // Trading TimeFrame
|
ENUM_TIMEFRAMES mPeriod, // Trading TimeFrame
|
||||||
double mEntry, // Entry Price
|
double mEntry, // Entry Price
|
||||||
double mVolume, // Volume
|
double mVolume, // Volume
|
||||||
ENUM_X_SIGNAL_MANAGING_ACTIONS mAction = X_SIGNAL_USE_NOTHING, // Signal Management Action
|
ENUM_X_SIGNAL_MANAGING_ACTIONS mAction = X_SIGNAL_USE_NOTHING, // Signal Management Action
|
||||||
double sl = 0, // Stop Loss
|
double sl = 0, // Stop Loss
|
||||||
double tp = 0 // Take Profit
|
double tp = 0 // Take Profit
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -399,14 +399,14 @@ struct XSignal
|
|||||||
|
|
||||||
//
|
//
|
||||||
bool PrepareMarketShort(
|
bool PrepareMarketShort(
|
||||||
string mSymbol, // Trading Symbol
|
string mSymbol, // Trading Symbol
|
||||||
string mProvider, // Signal Provider
|
string mProvider, // Signal Provider
|
||||||
ENUM_TIMEFRAMES mPeriod, // Trading TimeFrame
|
ENUM_TIMEFRAMES mPeriod, // Trading TimeFrame
|
||||||
double mEntry, // Entry Price
|
double mEntry, // Entry Price
|
||||||
double mVolume, // Volume
|
double mVolume, // Volume
|
||||||
ENUM_X_SIGNAL_MANAGING_ACTIONS mAction = X_SIGNAL_USE_NOTHING, // Signal Management Action
|
ENUM_X_SIGNAL_MANAGING_ACTIONS mAction = X_SIGNAL_USE_NOTHING, // Signal Management Action
|
||||||
double sl = 0, // Stop Loss
|
double sl = 0, // Stop Loss
|
||||||
double tp = 0 // Take Profit
|
double tp = 0 // Take Profit
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -429,14 +429,14 @@ struct XSignal
|
|||||||
|
|
||||||
//
|
//
|
||||||
bool PrepareStopLong(
|
bool PrepareStopLong(
|
||||||
string mSymbol, // Trading Symbol
|
string mSymbol, // Trading Symbol
|
||||||
string mProvider, // Signal Provider
|
string mProvider, // Signal Provider
|
||||||
ENUM_TIMEFRAMES mPeriod, // Trading TimeFrame
|
ENUM_TIMEFRAMES mPeriod, // Trading TimeFrame
|
||||||
double mEntry, // Entry Price
|
double mEntry, // Entry Price
|
||||||
double mVolume, // Volume
|
double mVolume, // Volume
|
||||||
ENUM_X_SIGNAL_MANAGING_ACTIONS mAction = X_SIGNAL_USE_NOTHING, // Signal Management Action
|
ENUM_X_SIGNAL_MANAGING_ACTIONS mAction = X_SIGNAL_USE_NOTHING, // Signal Management Action
|
||||||
double sl = 0, // Stop Loss
|
double sl = 0, // Stop Loss
|
||||||
double tp = 0 // Take Profit
|
double tp = 0 // Take Profit
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -456,14 +456,14 @@ struct XSignal
|
|||||||
|
|
||||||
//
|
//
|
||||||
bool PrepareStopShort(
|
bool PrepareStopShort(
|
||||||
string mSymbol, // Trading Symbol
|
string mSymbol, // Trading Symbol
|
||||||
string mProvider, // Signal Provider
|
string mProvider, // Signal Provider
|
||||||
ENUM_TIMEFRAMES mPeriod, // Trading TimeFrame
|
ENUM_TIMEFRAMES mPeriod, // Trading TimeFrame
|
||||||
double mEntry, // Entry Price
|
double mEntry, // Entry Price
|
||||||
double mVolume, // Volume
|
double mVolume, // Volume
|
||||||
ENUM_X_SIGNAL_MANAGING_ACTIONS mAction = X_SIGNAL_USE_NOTHING, // Signal Management Action
|
ENUM_X_SIGNAL_MANAGING_ACTIONS mAction = X_SIGNAL_USE_NOTHING, // Signal Management Action
|
||||||
double sl = 0, // Stop Loss
|
double sl = 0, // Stop Loss
|
||||||
double tp = 0 // Take Profit
|
double tp = 0 // Take Profit
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -486,14 +486,14 @@ struct XSignal
|
|||||||
|
|
||||||
//
|
//
|
||||||
bool PrepareLimitLong(
|
bool PrepareLimitLong(
|
||||||
string mSymbol, // Trading Symbol
|
string mSymbol, // Trading Symbol
|
||||||
string mProvider, // Signal Provider
|
string mProvider, // Signal Provider
|
||||||
ENUM_TIMEFRAMES mPeriod, // Trading TimeFrame
|
ENUM_TIMEFRAMES mPeriod, // Trading TimeFrame
|
||||||
double mEntry, // Entry Price
|
double mEntry, // Entry Price
|
||||||
double mVolume, // Volume
|
double mVolume, // Volume
|
||||||
ENUM_X_SIGNAL_MANAGING_ACTIONS mAction = X_SIGNAL_USE_NOTHING, // Signal Management Action
|
ENUM_X_SIGNAL_MANAGING_ACTIONS mAction = X_SIGNAL_USE_NOTHING, // Signal Management Action
|
||||||
double sl = 0, // Stop Loss
|
double sl = 0, // Stop Loss
|
||||||
double tp = 0 // Take Profit
|
double tp = 0 // Take Profit
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -513,14 +513,14 @@ struct XSignal
|
|||||||
|
|
||||||
//
|
//
|
||||||
bool PrepareLimitShort(
|
bool PrepareLimitShort(
|
||||||
string mSymbol, // Trading Symbol
|
string mSymbol, // Trading Symbol
|
||||||
string mProvider, // Signal Provider
|
string mProvider, // Signal Provider
|
||||||
ENUM_TIMEFRAMES mPeriod, // Trading TimeFrame
|
ENUM_TIMEFRAMES mPeriod, // Trading TimeFrame
|
||||||
double mEntry, // Entry Price
|
double mEntry, // Entry Price
|
||||||
double mVolume, // Volume
|
double mVolume, // Volume
|
||||||
ENUM_X_SIGNAL_MANAGING_ACTIONS mAction = X_SIGNAL_USE_NOTHING, // Signal Management Action
|
ENUM_X_SIGNAL_MANAGING_ACTIONS mAction = X_SIGNAL_USE_NOTHING, // Signal Management Action
|
||||||
double sl = 0, // Stop Loss
|
double sl = 0, // Stop Loss
|
||||||
double tp = 0 // Take Profit
|
double tp = 0 // Take Profit
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -2637,153 +2637,114 @@ struct XPositionPack
|
|||||||
};
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
// Use for Manage Positions ...
|
// Check Position SL Trails Structure ...
|
||||||
struct XPositionInfo
|
struct XTrail
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Props ...
|
ulong ticket; // Position Ticket ...
|
||||||
ulong ticket; // Position Ticket
|
ENUM_POSITION_TYPE type; // Type ...
|
||||||
|
datetime time; // Trail Time ...
|
||||||
//
|
double before; // SL Value Before Trailing ...
|
||||||
|
double after; // SL Value After Trailing ...
|
||||||
double tps[]; // Un Touched Tps ( not include regular TP ) / For Managing using XTrade Class ...
|
int level; // Number of Trails SL ...
|
||||||
double sls[]; // Un Touched Sls ( not include regular SL ) / For Managing using XTrade Class ...
|
double profit; // Profit in SL Time ...
|
||||||
|
|
||||||
//
|
|
||||||
ENUM_X_SIGNAL_MANAGING_ACTIONS action; // Managing Action
|
|
||||||
double profits[]; // Check Postion profit
|
|
||||||
datetime times[]; // Last Times prfoit Checking
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Constructor ...
|
// Constructor ...
|
||||||
void XPositionInfo()
|
XTrail()
|
||||||
{
|
{
|
||||||
Clean();
|
Clean();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Fill from a Signal ...
|
|
||||||
// The Signal must Executed ...
|
|
||||||
bool BySignal(
|
|
||||||
XSignal &mSignal // the Signal which need to use
|
|
||||||
)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
bool result = false;
|
|
||||||
|
|
||||||
//
|
|
||||||
Clean();
|
|
||||||
|
|
||||||
//
|
|
||||||
result = mSignal.IsValid() && mSignal.IsExecuted() && mSignal.mode == X_ORDER_MODE_MARKET;
|
|
||||||
if (!result)
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
ticket = mSignal.positionId;
|
|
||||||
action = mSignal.action;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Select TPS and SLS from signal ...
|
|
||||||
|
|
||||||
//
|
|
||||||
double sl = 0;
|
|
||||||
bool hasRegularSL = mSignal.RegularSL(sl);
|
|
||||||
Copy(
|
|
||||||
mSignal.sls,
|
|
||||||
sls
|
|
||||||
//
|
|
||||||
);
|
|
||||||
if (hasRegularSL)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
Remove(
|
|
||||||
sl,
|
|
||||||
sls
|
|
||||||
//
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
double tp = 0;
|
|
||||||
bool hasRegularTP = mSignal.RegularTP(tp);
|
|
||||||
Copy(
|
|
||||||
mSignal.tps,
|
|
||||||
tps
|
|
||||||
//
|
|
||||||
);
|
|
||||||
if (hasRegularTP)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
Remove(
|
|
||||||
tp,
|
|
||||||
tps
|
|
||||||
//
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Fill from a Position ...
|
|
||||||
bool ByPosition(
|
|
||||||
XPosition &position // the Position which need to use
|
|
||||||
)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
bool result = false;
|
|
||||||
|
|
||||||
//
|
|
||||||
Clean();
|
|
||||||
|
|
||||||
//
|
|
||||||
result = position.IsValid();
|
|
||||||
if (!result)
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
ticket = position.ticket;
|
|
||||||
|
|
||||||
//
|
|
||||||
datetime time = TimeCurrent();
|
|
||||||
|
|
||||||
//
|
|
||||||
Add(
|
|
||||||
time,
|
|
||||||
times
|
|
||||||
//
|
|
||||||
);
|
|
||||||
Add(
|
|
||||||
position.profit,
|
|
||||||
profits
|
|
||||||
//
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Tools ...
|
// Tools ...
|
||||||
|
|
||||||
|
//
|
||||||
|
bool Init(
|
||||||
|
ulong mTicket, // Ticket
|
||||||
|
ENUM_POSITION_TYPE mType, // Type
|
||||||
|
double mProfit, // Profit
|
||||||
|
double mBefore, // Before
|
||||||
|
double mAfter // After
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
type = mType;
|
||||||
|
after = mAfter;
|
||||||
|
ticket = mTicket;
|
||||||
|
before = mBefore;
|
||||||
|
profit = mProfit;
|
||||||
|
|
||||||
|
//
|
||||||
|
level++;
|
||||||
|
|
||||||
|
//
|
||||||
|
time = TimeCurrent();
|
||||||
|
|
||||||
|
//
|
||||||
|
return IsValid();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool Update(
|
||||||
|
double mSl, // new SL ...
|
||||||
|
double mProfit // Profit
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
time = TimeCurrent();
|
||||||
|
|
||||||
|
//
|
||||||
|
double cAfter = after;
|
||||||
|
after = mSl;
|
||||||
|
before = cAfter;
|
||||||
|
profit = mProfit;
|
||||||
|
|
||||||
|
//
|
||||||
|
level++;
|
||||||
|
|
||||||
|
//
|
||||||
|
result = IsValid();
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
string GenerateTag()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
string result = NULL;
|
||||||
|
|
||||||
|
//
|
||||||
|
string ticketLevelStr = ToString(ticket) + "," + ToString(level);
|
||||||
|
|
||||||
|
//
|
||||||
|
result = Surround(
|
||||||
|
XSLTrailToken,
|
||||||
|
ticketLevelStr //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Cleanup ...
|
// Cleanup ...
|
||||||
void Clean()
|
void Clean()
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
ticket = 0;
|
ticket = 0;
|
||||||
|
time = 0;
|
||||||
//
|
before = 0;
|
||||||
Clean(tps);
|
after = 0;
|
||||||
Clean(sls);
|
level = 0;
|
||||||
Clean(times);
|
|
||||||
Clean(profits);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -2793,125 +2754,18 @@ struct XPositionInfo
|
|||||||
//
|
//
|
||||||
bool result = false;
|
bool result = false;
|
||||||
|
|
||||||
//
|
|
||||||
result = NotEmpty(ticket) && ticket > 0;
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Check this instance is Same os Given instance or not ...
|
|
||||||
bool IsSameAs(
|
|
||||||
const XPositionInfo &value // instance for Compare
|
|
||||||
)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
bool result = false;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
result =
|
result =
|
||||||
//
|
//
|
||||||
ticket == value.ticket
|
ticket > 0 &&
|
||||||
|
time > 0 &&
|
||||||
|
level > 0
|
||||||
//
|
//
|
||||||
;
|
;
|
||||||
|
|
||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Find index in a Collection ...
|
|
||||||
int FindIndex(
|
|
||||||
const XPositionInfo &values[] // Collection to Find
|
|
||||||
)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
return FindIndex(
|
|
||||||
this,
|
|
||||||
values
|
|
||||||
//
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Retrieve Token ...
|
|
||||||
string GetToken()
|
|
||||||
{
|
|
||||||
return GetToken(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
bool IsModelValid()
|
|
||||||
{
|
|
||||||
return IsValid();
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Convert to String Representation
|
|
||||||
string ToModelString()
|
|
||||||
{
|
|
||||||
//
|
|
||||||
string result = NULL;
|
|
||||||
|
|
||||||
//
|
|
||||||
if (!IsValid())
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
string ticketStr = Surround(XTicketToken, ticket);
|
|
||||||
string actionStr = Surround(XActionToken, action);
|
|
||||||
//
|
|
||||||
string tpsStr = SurroundArray(XTPToken, tps);
|
|
||||||
string slsStr = SurroundArray(XSLToken, sls);
|
|
||||||
string timesStr = SurroundArray(XTimeToken, times);
|
|
||||||
string profitsStr = SurroundArray(XProfitToken, profits);
|
|
||||||
|
|
||||||
//
|
|
||||||
result =
|
|
||||||
//
|
|
||||||
GetToken() + "[" +
|
|
||||||
//
|
|
||||||
ticketStr +
|
|
||||||
actionStr +
|
|
||||||
tpsStr +
|
|
||||||
slsStr +
|
|
||||||
timesStr +
|
|
||||||
profitsStr +
|
|
||||||
//
|
|
||||||
"]"
|
|
||||||
//
|
|
||||||
;
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Parse and Fill from Given String Representation
|
|
||||||
bool ParseModel(string value)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
bool result = false;
|
|
||||||
|
|
||||||
//
|
|
||||||
ticket = ParseLongSurrounded(value, XTicketToken);
|
|
||||||
action = ((ENUM_X_SIGNAL_MANAGING_ACTIONS)ParseIntSurrounded(value, XActionToken));
|
|
||||||
|
|
||||||
//
|
|
||||||
ParseDoubleArraySurrounded(tps, value, XTPToken);
|
|
||||||
ParseDoubleArraySurrounded(sls, value, XSLToken);
|
|
||||||
ParseDoubleArraySurrounded(profits, value, XProfitToken);
|
|
||||||
ParseTimeArraySurrounded(times, value, XTimeToken);
|
|
||||||
|
|
||||||
//
|
|
||||||
result = IsValid();
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -3120,132 +2974,6 @@ private:
|
|||||||
// Tools ...
|
// Tools ...
|
||||||
};
|
};
|
||||||
|
|
||||||
//
|
|
||||||
// Create a Position Info Data Collector ...
|
|
||||||
class XSCPositionInfoCollector
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// Public ...
|
|
||||||
public:
|
|
||||||
//
|
|
||||||
// Props ...
|
|
||||||
|
|
||||||
//
|
|
||||||
// Constructor ...
|
|
||||||
void XSCPositionInfoCollector()
|
|
||||||
{
|
|
||||||
//
|
|
||||||
XSCDataCollector<XPositionInfo> mBase;
|
|
||||||
mBase.Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Deconstructor ...
|
|
||||||
|
|
||||||
//
|
|
||||||
// Tools ...
|
|
||||||
|
|
||||||
//
|
|
||||||
// Inheritanced Functions ...
|
|
||||||
|
|
||||||
//
|
|
||||||
// Cleaning Store ...
|
|
||||||
void Clear()
|
|
||||||
{
|
|
||||||
//
|
|
||||||
XSCDataCollector<XPositionInfo> mBase;
|
|
||||||
|
|
||||||
//
|
|
||||||
mBase.Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Collect All Store ...
|
|
||||||
int Collect(XPositionInfo &result[])
|
|
||||||
{
|
|
||||||
//
|
|
||||||
int mResult = 0;
|
|
||||||
|
|
||||||
//
|
|
||||||
XSCDataCollector<XPositionInfo> mBase;
|
|
||||||
|
|
||||||
//
|
|
||||||
mResult = mBase.Collect(result);
|
|
||||||
|
|
||||||
//
|
|
||||||
return mResult;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Add Item To Store ...
|
|
||||||
bool Add(XPositionInfo &item)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
bool result = false;
|
|
||||||
|
|
||||||
//
|
|
||||||
XSCDataCollector<XPositionInfo> mBase;
|
|
||||||
|
|
||||||
//
|
|
||||||
result = mBase.Add(item);
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Add Item(s) To Store ...
|
|
||||||
int Add(XPositionInfo &items[])
|
|
||||||
{
|
|
||||||
//
|
|
||||||
int result = 0;
|
|
||||||
|
|
||||||
//
|
|
||||||
XSCDataCollector<XPositionInfo> mBase;
|
|
||||||
|
|
||||||
//
|
|
||||||
result = mBase.Add(items);
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Remove an Item from Store ...
|
|
||||||
bool Remove(XPositionInfo &item)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
bool result = false;
|
|
||||||
|
|
||||||
//
|
|
||||||
XSCDataCollector<XPositionInfo> mBase;
|
|
||||||
|
|
||||||
//
|
|
||||||
result = mBase.Remove(item);
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Custom Functions ...
|
|
||||||
|
|
||||||
//
|
|
||||||
// Protected ...
|
|
||||||
protected:
|
|
||||||
//
|
|
||||||
// Tools ...
|
|
||||||
|
|
||||||
//
|
|
||||||
// Private ...
|
|
||||||
private:
|
|
||||||
//
|
|
||||||
// Props ...
|
|
||||||
|
|
||||||
//
|
|
||||||
// Tools ...
|
|
||||||
};
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Tools ...
|
// Tools ...
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user