apply fix for multi signaller signal generating issue ...

This commit is contained in:
2024-06-05 20:21:44 +03:30
parent b1b2ef36ec
commit b6323751cd
3 changed files with 424 additions and 384 deletions
+85 -47
View File
@@ -1204,7 +1204,7 @@ struct X121ProviderDescriptor
XSCX121Provider *provider;
//
XSignal signal;
XSignal signals[];
X121MarketConditions conditions;
//
@@ -1273,7 +1273,7 @@ struct X121ProviderDescriptor
void Clean()
{
//
signal.Clean();
Clean(signals);
conditions.Clear();
}
@@ -1302,22 +1302,20 @@ struct X121ProviderDescriptor
//
// Check Signal ...
bool HasSignal(int barIndex = 0)
int HasSignal(int barIndex = 0)
{
//
bool result = false;
int result = 0;
//
result = inputs.IsValid();
if (!result)
if (!inputs.IsValid())
{
return result;
}
//
int signallersCount = ArraySize(this.signallers);
result = IsValidSize(signallersCount);
if (!result)
if (!IsValidSize(signallersCount))
{
return result;
}
@@ -1328,8 +1326,7 @@ struct X121ProviderDescriptor
//
// Check Waits Until New Bar ...
result = !this.provider.CanIgnoreProcess();
if (!result)
if (!this.provider.CanIgnoreProcess())
{
return result;
}
@@ -1662,7 +1659,6 @@ struct X121ProviderDescriptor
mProvider = this.signallers[i].GetName();
mVolume = this.signallers[i].staticVolumeShort;
}
}
//
bool hasLong =
@@ -1711,10 +1707,9 @@ struct X121ProviderDescriptor
;
//
result = hasLong || hasShort;
if (!result)
if (!(hasLong || hasShort))
{
return result;
continue;
}
//
@@ -1723,7 +1718,7 @@ struct X121ProviderDescriptor
: bearishScore > bullishScore * 2;
//
result =
bool hasSignal =
//
isScorePassed &&
(hasLong
@@ -1731,9 +1726,9 @@ struct X121ProviderDescriptor
: shortVerifiers > 1)
//
;
if (!result)
if (!hasSignal)
{
return result;
continue;
}
//
@@ -1741,7 +1736,8 @@ struct X121ProviderDescriptor
//
// For Longs ...
if (hasLong) {
if (hasLong)
{
//
// Collect all Verifications SLs ...
@@ -1753,7 +1749,8 @@ struct X121ProviderDescriptor
// Current Market ...
//
if (cLNSL > 0) {
if (cLNSL > 0)
{
//
Add(
cLNSL,
@@ -1762,7 +1759,8 @@ struct X121ProviderDescriptor
}
//
if (cLNTP > 0) {
if (cLNTP > 0)
{
//
Add(
cLNTP,
@@ -1774,7 +1772,8 @@ struct X121ProviderDescriptor
// Short Market ...
//
if (sLNSL > 0) {
if (sLNSL > 0)
{
//
Add(
sLNSL,
@@ -1783,7 +1782,8 @@ struct X121ProviderDescriptor
}
//
if (sLNTP > 0) {
if (sLNTP > 0)
{
//
Add(
sLNTP,
@@ -1795,7 +1795,8 @@ struct X121ProviderDescriptor
// Medium Market ...
//
if (mLNSL > 0) {
if (mLNSL > 0)
{
//
Add(
mLNSL,
@@ -1804,7 +1805,8 @@ struct X121ProviderDescriptor
}
//
if (mLNTP > 0) {
if (mLNTP > 0)
{
//
Add(
mLNTP,
@@ -1816,7 +1818,8 @@ struct X121ProviderDescriptor
// Long Market ...
//
if (lLNSL > 0) {
if (lLNSL > 0)
{
//
Add(
lLNSL,
@@ -1825,7 +1828,8 @@ struct X121ProviderDescriptor
}
//
if (lLNTP > 0) {
if (lLNTP > 0)
{
//
Add(
lLNTP,
@@ -1837,7 +1841,8 @@ struct X121ProviderDescriptor
// Hind Market ...
//
if (hLNSL > 0) {
if (hLNSL > 0)
{
//
Add(
hLNSL,
@@ -1846,7 +1851,8 @@ struct X121ProviderDescriptor
}
//
if (hLNTP > 0) {
if (hLNTP > 0)
{
//
Add(
hLNTP,
@@ -1856,20 +1862,23 @@ struct X121ProviderDescriptor
//
// Now Select Minimum SL ...
if (IsValidSize(ArraySize(sls))) {
if (IsValidSize(ArraySize(sls)))
{
slPrice = GetMin(sls);
}
//
// Average TP ...
if (IsValidSize(ArraySize(tps))) {
if (IsValidSize(ArraySize(tps)))
{
tpPrice = GetAverage(tps);
}
}
//
// For Shorts ...
if (hasShort) {
if (hasShort)
{
//
// Collect all Verifications SLs ...
@@ -1881,7 +1890,8 @@ struct X121ProviderDescriptor
// Current Market ...
//
if (cSHSL > 0) {
if (cSHSL > 0)
{
//
Add(
cSHSL,
@@ -1890,7 +1900,8 @@ struct X121ProviderDescriptor
}
//
if (cSHTP > 0) {
if (cSHTP > 0)
{
//
Add(
cSHTP,
@@ -1902,7 +1913,8 @@ struct X121ProviderDescriptor
// Short Market ...
//
if (sSHSL > 0) {
if (sSHSL > 0)
{
//
Add(
sSHSL,
@@ -1911,7 +1923,8 @@ struct X121ProviderDescriptor
}
//
if (sSHTP > 0) {
if (sSHTP > 0)
{
//
Add(
sSHTP,
@@ -1923,7 +1936,8 @@ struct X121ProviderDescriptor
// Medium Market ...
//
if (mSHSL > 0) {
if (mSHSL > 0)
{
//
Add(
mSHSL,
@@ -1932,7 +1946,8 @@ struct X121ProviderDescriptor
}
//
if (mSHTP > 0) {
if (mSHTP > 0)
{
//
Add(
mSHTP,
@@ -1944,7 +1959,8 @@ struct X121ProviderDescriptor
// Long Market ...
//
if (lSHSL > 0) {
if (lSHSL > 0)
{
//
Add(
lSHSL,
@@ -1953,7 +1969,8 @@ struct X121ProviderDescriptor
}
//
if (lSHTP > 0) {
if (lSHTP > 0)
{
//
Add(
lSHTP,
@@ -1965,7 +1982,8 @@ struct X121ProviderDescriptor
// Hind Market ...
//
if (hSHSL > 0) {
if (hSHSL > 0)
{
//
Add(
hSHSL,
@@ -1974,7 +1992,8 @@ struct X121ProviderDescriptor
}
//
if (hSHTP > 0) {
if (hSHTP > 0)
{
//
Add(
hSHTP,
@@ -1984,20 +2003,22 @@ struct X121ProviderDescriptor
//
// Now Select Minimum SL ...
if (IsValidSize(ArraySize(sls))) {
if (IsValidSize(ArraySize(sls)))
{
slPrice = GetMin(sls);
}
//
// Average TP ...
if (IsValidSize(ArraySize(tps))) {
if (IsValidSize(ArraySize(tps)))
{
tpPrice = GetAverage(tps);
}
}
//
// Generate Signal ...
this.signal.Clean();
XSignal iSignal;
//
ENUM_POSITION_TYPE mType =
@@ -2029,7 +2050,7 @@ struct X121ProviderDescriptor
}
//
result = this.signal.Prepare(
bool isPrepared = iSignal.Prepare(
this.symbol,
mProvider,
this.period,
@@ -2040,14 +2061,31 @@ struct X121ProviderDescriptor
mSL,
mTP //
);
if (!result)
if (!isPrepared)
{
this.signal.Clean();
iSignal.Clean();
}
//
if (iSignal.IsValid() && isPrepared && hasSignal)
{
//
AddRef(
iSignal,
this.signals //
);
}
}
//
result = ArraySize(this.signals);
//
// Set Wait Until New Bar ...
if (IsValidSize(result))
{
this.provider.SetWaitsUntilNewBar(true);
}
//
return result;
+7 -5
View File
@@ -231,17 +231,19 @@ public:
X121ProviderDescriptor iDescriptor = mDescriptors[i];
//
bool iHasSignal = iDescriptor.HasSignal();
if (iHasSignal)
int iSignalsCount = iDescriptor.HasSignal();
if (IsValidSize(iSignalsCount))
{
//
// Here we Can double check Signals by Conditions
// for Score Base Filtering ...
iDescriptor.provider.SetWaitsUntilNewBar(true);
//
AddRef(
iDescriptor.signal,
signals
Copy(
iDescriptor.signals,
signals,
false
//
);
+3 -3
View File
@@ -1050,9 +1050,9 @@ void ApplyPreDefineConfigurations(X121ProviderDescriptor &iDescriptor)
}
//
iDescriptor.inputs.ichInputs.showKumo = true; // isX110;
iDescriptor.inputs.ichInputs.showKijunSen = true; // isX110;
iDescriptor.inputs.ichInputs.showTenkanSen = true; // isX110;
iDescriptor.inputs.ichInputs.showKumo = false; // isX110;
iDescriptor.inputs.ichInputs.showKijunSen = false; // isX110;
iDescriptor.inputs.ichInputs.showTenkanSen = false; // isX110;
}
//