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