This commit is contained in:
2024-05-25 22:20:20 +03:30
parent b8515c9d05
commit 1f661d4de3
6 changed files with 1072 additions and 512 deletions
+337 -155
View File
@@ -53,6 +53,7 @@ enum ENUM_X121_SIGNAL_PROVIDERS
X121,
X110,
X92,
X128,
};
//
@@ -1390,7 +1391,7 @@ public:
//
mNumberOfItems = 15;
mNumberOfSRVerified = 71;
mMinRequiredSupportAndResistances = 10;
mMinRequiredSupportAndResistances = 30;
}
//
@@ -1670,6 +1671,11 @@ public:
case X92:
mIsX92SignalProviderEnable = state;
break;
//
case X128:
mIsX128SignalProviderEnable = state;
break;
}
}
@@ -1907,6 +1913,17 @@ public:
: entry + risk;
}
//
// TODOO: Remove this ...
sl = hasLong
? GetMaxVales(true)
: GetMinPeaks(true);
double risk = MathAbs(entry - sl);
double reward = risk * r2r;
tp = hasLong
? entry + reward
: entry - reward;
//
result = mSignal.Prepare(
symbol,
@@ -1923,17 +1940,103 @@ public:
);
//
if (result)
// Generate Support Signal for Specified Provider ...
if (result && provider == ToString(X121NONE))
{
//
mWaitsUntilNewBar = true;
double cKijunSen = cMarket.ich.GetKijunSen(0);
double sKijunSen = sMarket.ich.GetKijunSen(0);
double mKijunSen = mMarket.ich.GetKijunSen(0);
double lKijunSen = lMarket.ich.GetKijunSen(0);
double hKijunSen = hMarket.ich.GetKijunSen(0);
// //
// TODO:
// string providerTypeStr = GetSymbol() + ", " + provider + "(" + (hasLong ? "Long" : "Short") + ")";
// string mConditionsStr = mConditions.GenerateSummary(providerTypeStr, true);
// mConditionsCollector.Add(mConditionsStr);
// Print(mConditionsStr);
//
double kijunSens[] = {
cKijunSen,
sKijunSen,
mKijunSen,
lKijunSen,
hKijunSen //
};
//
double lesserKijun = FindLesserThan(
entry,
kijunSens,
true //
);
//
double biggerKijun = FindBiggerThan(
entry,
kijunSens,
true //
);
//
ENUM_POSITION_TYPE sType =
hasLong
? POSITION_TYPE_SELL
: POSITION_TYPE_BUY;
bool isLongS = IsLong(sType);
//
double sEntry =
isLongS
? biggerKijun
: lesserKijun;
//
double peakMin = GetMinPeaks(true);
double peakMax = GetMinPeaks(true);
double valeMin = GetMaxVales(true);
double valeMax = GetMaxVales(true);
//
double sTP =
isLongS
? peakMin
: valeMax;
//
double sSL =
isLongS
? valeMin
: peakMax;
//
double sVolume = mSignal.volume * 2;
//
// Prepare ...
XSignal sSignal;
bool isValid = sSignal.Prepare(
mSignal.symbol,
mSignal.provider,
mSignal.period,
sType,
X_ORDER_MODE_STOP,
sEntry,
sVolume,
X_SIGNAL_USE_NOTHING,
sSL,
sTP //
);
if (isValid)
{
//
AddRef(
sSignal,
mSignal.supports //
);
}
}
//
if (result)
{
mWaitsUntilNewBar = true;
}
}
@@ -1958,6 +2061,24 @@ public:
//
return result;
}
//
// Generate EQM Support Signals ...
int GenerateEQMSupportSignals(XSignal &supports[]) {
//
int result = 0;
//
Clean(signals);
//
// TODO: Implement Support Mechanism ...
// we are in EQUITY STATE ...
// so we have to
//
return result;
}
//
// Tools ...
@@ -2105,8 +2226,15 @@ public:
// Peask and Vales Finder ...
//
double GetMinPeaks()
void GetPeaks(
double &peaks[],
bool ignoreCurrent = false //
)
{
//
Clean(peaks);
//
//
double cPeak = cMarket.pv.GetPeak(0);
double sPeak = sMarket.pv.GetPeak(0);
@@ -2115,7 +2243,7 @@ public:
double hPeak = hMarket.pv.GetPeak(0);
//
double peaks[] = {
double mPeaks[] = {
cPeak,
sPeak,
mPeak,
@@ -2123,6 +2251,75 @@ public:
hPeak //
};
//
if (ignoreCurrent)
{
//
Remove(
cPeak,
mPeaks //
);
}
//
Copy(
mPeaks,
peaks //
);
}
//
void GetVales(
double &vales[],
bool ignoreCurrent = false //
)
{
//
Clean(vales);
//
double cVale = cMarket.pv.GetVale(0);
double sVale = sMarket.pv.GetVale(0);
double mVale = mMarket.pv.GetVale(0);
double lVale = lMarket.pv.GetVale(0);
double hVale = hMarket.pv.GetVale(0);
//
double mVales[] = {
cVale,
sVale,
mVale,
lVale,
hVale //
};
//
if (ignoreCurrent)
{
//
Remove(
cVale,
mVales //
);
}
//
Copy(
mVales,
vales //
);
}
//
double GetMinPeaks(bool ignoreCurrent = false)
{
//
double peaks[];
GetPeaks(
peaks,
ignoreCurrent //
);
//
double minPeak = GetMin(peaks);
double maxPeak = GetMax(peaks);
@@ -2132,23 +2329,14 @@ public:
}
//
double GetMaxPeaks()
double GetMaxPeaks(bool ignoreCurrent = false)
{
//
double cPeak = cMarket.pv.GetPeak(0);
double sPeak = sMarket.pv.GetPeak(0);
double mPeak = mMarket.pv.GetPeak(0);
double lPeak = lMarket.pv.GetPeak(0);
double hPeak = hMarket.pv.GetPeak(0);
//
double peaks[] = {
cPeak,
sPeak,
mPeak,
lPeak,
hPeak //
};
double peaks[];
GetPeaks(
peaks,
ignoreCurrent //
);
//
double minPeak = GetMin(peaks);
@@ -2159,23 +2347,14 @@ public:
}
//
double GetMinVales()
double GetMinVales(bool ignoreCurrent = false)
{
//
double cMVale = cMarket.pv.GetVale(0);
double sMVale = sMarket.pv.GetVale(0);
double mMVale = mMarket.pv.GetVale(0);
double lMVale = lMarket.pv.GetVale(0);
double hMVale = hMarket.pv.GetVale(0);
//
double vales[] = {
cMVale,
sMVale,
mMVale,
lMVale,
hMVale //
};
double vales[];
GetVales(
vales,
ignoreCurrent //
);
//
double minVale = GetMin(vales);
@@ -2186,23 +2365,14 @@ public:
}
//
double GetMaxVales()
double GetMaxVales(bool ignoreCurrent = false)
{
//
double cMVale = cMarket.pv.GetVale(0);
double sMVale = sMarket.pv.GetVale(0);
double mMVale = mMarket.pv.GetVale(0);
double lMVale = lMarket.pv.GetVale(0);
double hMVale = hMarket.pv.GetVale(0);
//
double vales[] = {
cMVale,
sMVale,
mMVale,
lMVale,
hMVale //
};
double vales[];
GetVales(
vales,
ignoreCurrent //
);
//
double minVale = GetMin(vales);
@@ -2869,6 +3039,7 @@ private:
//
bool mIsX121XSPSignalProviderEnable;
bool mIsX128SignalProviderEnable;
bool mIsX92SignalProviderEnable;
bool mIsX786SignalProviderEnable;
bool mIsX121SignalProviderEnable;
@@ -2922,6 +3093,7 @@ private:
bool hasX121Signal = false;
bool hasX110Signal = false;
bool hasX92Signal = false;
bool hasX128Signal = false;
//
// XPS ...
@@ -3073,6 +3245,31 @@ private:
}
}
//
// X128 ...
if (mIsX128SignalProviderEnable)
{
//
hasX128Signal = X128HasSpecifiedLongSignal(
mConditions,
providedSL,
providedTP //
);
//
if (hasX128Signal)
{
//
if (!IsValid(provider))
{
provider = ToString(X128);
}
//
signalPusher++;
}
}
//
result =
//
@@ -3098,6 +3295,10 @@ private:
//
hasX92Signal
//
||
//
hasX128Signal
//
;
//
@@ -3124,6 +3325,7 @@ private:
bool hasX121Signal = false;
bool hasX110Signal = false;
bool hasX92Signal = false;
bool hasX128Signal = false;
//
// X121XSP ...
@@ -3275,6 +3477,31 @@ private:
}
}
//
// X128 ...
if (mIsX128SignalProviderEnable)
{
//
hasX128Signal = X128HasSpecifiedShortSignal(
mConditions,
providedSL,
providedTP //
);
//
if (hasX128Signal)
{
//
if (!IsValid(provider))
{
provider = ToString(X128);
}
//
signalPusher++;
}
}
//
result =
//
@@ -3300,6 +3527,10 @@ private:
//
hasX92Signal
//
||
//
hasX128Signal
//
;
//
@@ -4149,9 +4380,9 @@ private:
//
result =
//
isCMStrLong
//
||
// isCMStrLong
// //
// ||
//
isSMStrLong
//
@@ -4318,10 +4549,10 @@ private:
//
result =
//
isCMCLong
//
||
// //
// isCMCLong
// //
// ||
//
isSMCLong
//
@@ -4423,10 +4654,10 @@ private:
//
result =
//
isCCHELong
//
||
// //
// isCCHELong
// //
// ||
//
isSCHELong
//
@@ -4469,46 +4700,19 @@ private:
bool result = false;
//
double bullishScore = mBullishScore[0];
double bullishMin100 = GetBullishScoreMin(0, 100);
double bullishMax100 = GetBullishScoreMax(0, 100);
double bullish9AVG = GetBullishScoreAverage(0, 9);
double bullish17AVG = GetBullishScoreAverage(0, 17);
double bullish26AVG = GetBullishScoreAverage(0, 26);
return result;
}
//
// Use XICH ...
bool X128HasSpecifiedLongSignal(
X121MarketConditions &mConditions, //
double &sl, // Provided SL ...
double &tp // Provided TP ...
)
{
//
double bearishScore = mBearishScore[0];
//
bool isScorePassed = IsScorePassedForLong();
//
bool isBullishOverAVGs =
//
ArraySize(mBullishScore) > 100 &&
bullishScore > mBullishScore[1] &&
bullishScore > bearishScore &&
bullishScore > bullish9AVG &&
bullishScore > bullish17AVG &&
bullishScore > bullish26AVG
//
;
//
result =
//
isBullishOverAVGs
//
;
//
result = result && isScorePassed;
//
if (result)
{
sl = GetMinVales();
}
bool result = false;
//
return result;
@@ -4613,10 +4817,10 @@ private:
//
result =
//
isCMStrShort
//
||
// //
// isCMStrShort
// //
// ||
//
isSMStrShort
//
@@ -4783,10 +4987,10 @@ private:
//
result =
//
isCMCShort
//
||
// //
// isCMCShort
// //
// ||
//
isSMCShort
//
@@ -4888,10 +5092,10 @@ private:
//
result =
//
isCCHEShort
//
||
// //
// isCCHEShort
// //
// ||
//
isSCHEShort
//
@@ -4934,46 +5138,19 @@ private:
bool result = false;
//
double bearishScore = mBearishScore[0];
double bearishMin100 = GetBearishScoreMin(0, 100);
double bearishMax100 = GetBearishScoreMax(0, 100);
double bearish9AVG = GetBearishScoreAverage(0, 9);
double bearish17AVG = GetBearishScoreAverage(0, 17);
double bearish26AVG = GetBearishScoreAverage(0, 26);
return result;
}
//
// Use XICH ...
bool X128HasSpecifiedShortSignal(
X121MarketConditions &mConditions, //
double &sl, // Provided SL ...
double &tp // Provided TP ...
)
{
//
double bullishScore = mBullishScore[0];
//
bool isBearishOverAVGs =
//
ArraySize(mBearishScore) > 100 &&
bearishScore > mBearishScore[1] &&
bearishScore > bullishScore &&
bearishScore > bearish9AVG &&
bearishScore > bearish17AVG &&
bearishScore > bearish26AVG
//
;
//
bool isScorePassed = IsScorePassedForShort();
//
result =
//
isBearishOverAVGs
//
;
//
result = result && isScorePassed;
//
if (result)
{
sl = GetMaxPeaks();
}
bool result = false;
//
return result;
@@ -5212,6 +5389,7 @@ void GetAllX121SignalProviders(ENUM_X121_SIGNAL_PROVIDERS &result[])
Add(X121, result);
Add(X110, result);
Add(X92, result);
Add(X128, result);
}
//
@@ -5261,6 +5439,10 @@ ENUM_X121_SIGNAL_PROVIDERS ToX121SignalProvider(string content)
{
result = X92;
}
else if (content == ToString(X128))
{
result = X128;
}
//
return result;