This commit is contained in:
2025-03-09 07:04:04 +03:30
parent d8a989d3dd
commit a81c09e2a5
5 changed files with 850 additions and 291 deletions
+660 -230
View File
@@ -953,262 +953,688 @@ struct X121SMCStrategyXWZWorkingZone
//
// Senario 1:
// ----------
//
// Senario 1 Bullish Conditions ...
bool isSenario1Bullish =
//
// X3Ma / XVwap Switched To Bulish ...
(
//
// X3Ma Switched To Bulish ...
(
//
(provider.decisionXConditions.isX3MaFastCrossedOverMid &&
decisionParser.isX3MaBullishStateUnderValesGoldenZone)
//
)
//
||
//
// XVWap Switched To Bulish ...
(
//
(provider.decisionXConditions.isVWapFastCrossedOverMid &&
decisionParser.isVWapBullishStateUnderValesGoldenZone)
//
)
//
)
//
&&
//
// Checking other Conditions ...
(
//
// XSTR ...
provider.decisionXConditions.isStrBullish &&
//
// XCHE ...
provider.decisionXConditions.isCheBullish &&
provider.decisionXConditions.le1Buffer[cIDX] < cBar.low &&
provider.decisionXConditions.le2Buffer[cIDX] < cBar.low
//
)
//
;
//
// Senario 1 Bearish Conditions ...
bool isSenario1Bearish =
//
// X3Ma / XVwap Switched To Bearish ...
(
//
// X3Ma Switched To Bearish ...
(
//
(provider.decisionXConditions.isX3MaFastCrossedUnderMid &&
decisionParser.isX3MaBearishStateOverPeaksGoldenZone)
//
)
//
||
//
// XVWap Switched To Bearish ...
(
//
(provider.decisionXConditions.isVWapFastCrossedUnderMid &&
decisionParser.isVWapBearishStateOverPeaksGoldenZone)
//
)
//
)
//
&&
//
// Checking other Conditions ...
(
//
// XSTR ...
provider.decisionXConditions.isStrBearish &&
//
// XCHE ...
provider.decisionXConditions.isCheBearish &&
provider.decisionXConditions.se1Buffer[cIDX] > cBar.high &&
provider.decisionXConditions.se2Buffer[cIDX] > cBar.high
//
)
//
;
//
// Filling Requirements using Senario 1 ...
bool isSenari1Happend =
isSenario1Bullish ||
isSenario1Bearish;
if (isSenari1Happend)
bool useSenario1 = false;
bool isSenario1Happend = false;
bool isSenario1Bullish = false;
bool isSenario1Bearish = false;
if (useSenario1)
{
//
dir =
isSenario1Bullish
? X_DIRECTION_BULLISH
: X_DIRECTION_BEARISH;
// Senario 1 Bullish Conditions ...
isSenario1Bullish =
//
// X3Ma / XVwap Switched To Bulish ...
(
//
// X3Ma Switched To Bulish ...
(
//
(provider.decisionXConditions.isX3MaFastCrossedOverMid &&
decisionParser.isX3MaBullishStateUnderValesGoldenZone)
//
)
//
||
//
// XVWap Switched To Bulish ...
(
//
(provider.decisionXConditions.isVWapFastCrossedOverMid &&
decisionParser.isVWapBullishStateUnderValesGoldenZone)
//
)
//
)
//
&&
//
// Checking other Conditions ...
(
//
// XSTR ...
provider.decisionXConditions.isStrBullish &&
//
// XCHE ...
provider.decisionXConditions.isCheBullish &&
provider.decisionXConditions.le1Buffer[cIDX] < cBar.low &&
provider.decisionXConditions.le2Buffer[cIDX] < cBar.low
//
)
//
;
//
box.dir = dir;
box.to = TimeCurrent();
box.symbol = provider
.decisionXConditions
.symbol;
box.period = provider
.decisionXConditions
.period;
// Senario 1 Bearish Conditions ...
isSenario1Bearish =
//
// X3Ma / XVwap Switched To Bearish ...
(
//
// X3Ma Switched To Bearish ...
(
//
(provider.decisionXConditions.isX3MaFastCrossedUnderMid &&
decisionParser.isX3MaBearishStateOverPeaksGoldenZone)
//
)
//
||
//
// XVWap Switched To Bearish ...
(
//
(provider.decisionXConditions.isVWapFastCrossedUnderMid &&
decisionParser.isVWapBearishStateOverPeaksGoldenZone)
//
)
//
)
//
&&
//
// Checking other Conditions ...
(
//
// XSTR ...
provider.decisionXConditions.isStrBearish &&
//
// XCHE ...
provider.decisionXConditions.isCheBearish &&
provider.decisionXConditions.se1Buffer[cIDX] > cBar.high &&
provider.decisionXConditions.se2Buffer[cIDX] > cBar.high
//
)
//
;
//
int fromIDX = -1;
if (isSenario1Bullish)
// Filling Requirements using Senario 1 ...
isSenario1Happend =
isSenario1Bullish ||
isSenario1Bearish;
if (isSenario1Happend)
{
//
double vale = provider
.decisionXConditions
.valesBuffer[cIDX];
dir =
isSenario1Bullish
? X_DIRECTION_BULLISH
: X_DIRECTION_BEARISH;
//
box.lower = vale;
box.dir = dir;
box.to = TimeCurrent();
box.symbol = provider
.decisionXConditions
.symbol;
box.period = provider
.decisionXConditions
.period;
//
box.upper = provider
.decisionXConditions
.valesGoldenBuffer[cIDX];
//
int lowerValeIDX = -1;
double lowerVale = provider
.decisionCycleHelper
.mX121Helper
.xpvHelper
.GetLowerVale(
lowerValeIDX,
vale,
cBar.Index() //
);
//
int higherValeIDX = -1;
double higherVale = provider
.decisionCycleHelper
.mX121Helper
.xpvHelper
.GetHigherVale(
higherValeIDX,
vale,
cBar.Index() //
);
//
if (IsValidIndex(lowerValeIDX) &&
IsValidIndex(higherValeIDX))
int fromIDX = -1;
if (isSenario1Bullish)
{
//
fromIDX =
lowerValeIDX < higherValeIDX
? lowerValeIDX
: higherValeIDX;
double vale = provider
.decisionXConditions
.valesBuffer[cIDX];
//
box.lower = vale;
//
box.upper = provider
.decisionXConditions
.valesGoldenBuffer[cIDX];
//
int lowerValeIDX = -1;
double lowerVale = provider
.decisionCycleHelper
.mX121Helper
.xpvHelper
.GetLowerVale(
lowerValeIDX,
vale,
cBar.Index() //
);
//
int higherValeIDX = -1;
double higherVale = provider
.decisionCycleHelper
.mX121Helper
.xpvHelper
.GetHigherVale(
higherValeIDX,
vale,
cBar.Index() //
);
//
if (IsValidIndex(lowerValeIDX) &&
IsValidIndex(higherValeIDX))
{
//
fromIDX =
lowerValeIDX < higherValeIDX
? lowerValeIDX
: higherValeIDX;
}
else if (IsValidIndex(lowerValeIDX) &&
!IsValidIndex(higherValeIDX))
{
//
fromIDX = lowerValeIDX;
}
else if (!IsValidIndex(lowerValeIDX) &&
IsValidIndex(higherValeIDX))
{
//
fromIDX = higherValeIDX;
}
}
else if (IsValidIndex(lowerValeIDX) &&
!IsValidIndex(higherValeIDX))
else
{
//
fromIDX = lowerValeIDX;
double peak = provider
.decisionXConditions
.peaksBuffer[cIDX];
//
box.upper = peak;
//
box.lower = provider
.decisionXConditions
.peaksGoldenBuffer[cIDX];
//
int lowerPeakIDX = -1;
double lowerPeak = provider
.decisionCycleHelper
.mX121Helper
.xpvHelper
.GetLowerPeak(
lowerPeakIDX,
peak,
cBar.Index() //
);
//
int higherPeakIDX = -1;
double higherPeak = provider
.decisionCycleHelper
.mX121Helper
.xpvHelper
.GetHigherPeak(
higherPeakIDX,
peak,
cBar.Index() //
);
//
if (IsValidIndex(lowerPeakIDX) &&
IsValidIndex(higherPeakIDX))
{
//
fromIDX =
lowerPeakIDX < higherPeakIDX
? lowerPeakIDX
: higherPeakIDX;
}
else if (IsValidIndex(lowerPeakIDX) &&
!IsValidIndex(higherPeakIDX))
{
//
fromIDX = lowerPeakIDX;
}
else if (!IsValidIndex(lowerPeakIDX) &&
IsValidIndex(higherPeakIDX))
{
//
fromIDX = higherPeakIDX;
}
}
else if (!IsValidIndex(lowerValeIDX) &&
IsValidIndex(higherValeIDX))
//
if (IsValidIndex(fromIDX))
{
//
fromIDX = higherValeIDX;
}
}
else
{
//
double peak = provider
.decisionXConditions
.peaksBuffer[cIDX];
//
box.upper = peak;
//
box.lower = provider
.decisionXConditions
.peaksGoldenBuffer[cIDX];
//
int lowerPeakIDX = -1;
double lowerPeak = provider
.decisionCycleHelper
.mX121Helper
.xpvHelper
.GetLowerPeak(
lowerPeakIDX,
peak,
cBar.Index() //
);
//
int higherPeakIDX = -1;
double higherPeak = provider
.decisionCycleHelper
.mX121Helper
.xpvHelper
.GetHigherPeak(
higherPeakIDX,
peak,
cBar.Index() //
);
//
if (IsValidIndex(lowerPeakIDX) &&
IsValidIndex(higherPeakIDX))
{
//
fromIDX =
lowerPeakIDX < higherPeakIDX
? lowerPeakIDX
: higherPeakIDX;
}
else if (IsValidIndex(lowerPeakIDX) &&
!IsValidIndex(higherPeakIDX))
{
//
fromIDX = lowerPeakIDX;
}
else if (!IsValidIndex(lowerPeakIDX) &&
IsValidIndex(higherPeakIDX))
{
//
fromIDX = higherPeakIDX;
box.from = iTime(
zBar.symbol,
zBar.period,
fromIDX //
);
}
else
{
box.from = pBar.time;
}
//
signalProvider = X121SMC_XWZ_PROVIDER_ACTIVATED_BOX;
}
}
//
// Senario 2:
// ----------
bool useSenario2 = true;
bool isSenario2Happend = false;
bool isSenario2Bullish = false;
bool isSenario2Bearish = false;
if (useSenario2)
{
//
if (IsValidIndex(fromIDX))
{
// Senario 2 Bullish Conditions ...
isSenario2Bullish =
//
box.from = iTime(
zBar.symbol,
zBar.period,
fromIDX //
// XSMHK ...
(
//
(decisionParser.isRawHKBullishUnderValesGoldenZone &&
decisionParser.isSMHKSwitchedToBullishUnderValesGoldenZone)
//
||
//
(decisionParser.isSMHKBullishUnderValesGoldenZone &&
decisionParser.isRawHKSwitchedToBullishUnderValesGoldenZone)
//
)
//
&&
//
// Other Conditions ...
(
//
provider.decisionXConditions.isSarBullish &&
provider.decisionXConditions.isStrBullish
//
);
}
else
{
box.from = pBar.time;
}
//
signalProvider = X121SMC_XWZ_PROVIDER_ACTIVATED_BOX;
// Senario 2 Bearish Conditions ...
isSenario2Bearish =
//
// XSMHK ...
(
//
(decisionParser.isRawHKBearishOverPeaksGoldenZone &&
decisionParser.isSMHKSwitchedToBearishOverPeaksGoldenZone)
//
||
//
(decisionParser.isSMHKBearishOverPeaksGoldenZone &&
decisionParser.isRawHKSwitchedToBearishOverPeaksGoldenZone)
//
)
//
&&
//
// Other Conditions ...
(
//
provider.decisionXConditions.isSarBearish &&
provider.decisionXConditions.isStrBearish
//
);
//
// Filling Requirements using Senario 2 ...
isSenario2Happend =
isSenario2Bullish ||
isSenario2Bearish;
if (isSenario2Happend)
{
//
dir =
isSenario2Bullish
? X_DIRECTION_BULLISH
: X_DIRECTION_BEARISH;
//
box.dir = dir;
box.to = TimeCurrent();
box.symbol = provider
.decisionXConditions
.symbol;
box.period = provider
.decisionXConditions
.period;
//
int fromIDX = -1;
if (isSenario2Bullish)
{
//
double vale = provider
.decisionXConditions
.valesBuffer[cIDX];
//
box.lower = vale;
//
box.upper = provider
.decisionXConditions
.valesGoldenBuffer[cIDX];
//
int lowerValeIDX = -1;
double lowerVale = provider
.decisionCycleHelper
.mX121Helper
.xpvHelper
.GetLowerVale(
lowerValeIDX,
vale,
cBar.Index() //
);
//
int higherValeIDX = -1;
double higherVale = provider
.decisionCycleHelper
.mX121Helper
.xpvHelper
.GetHigherVale(
higherValeIDX,
vale,
cBar.Index() //
);
//
if (IsValidIndex(lowerValeIDX) &&
IsValidIndex(higherValeIDX))
{
//
fromIDX =
lowerValeIDX < higherValeIDX
? lowerValeIDX
: higherValeIDX;
}
else if (IsValidIndex(lowerValeIDX) &&
!IsValidIndex(higherValeIDX))
{
//
fromIDX = lowerValeIDX;
}
else if (!IsValidIndex(lowerValeIDX) &&
IsValidIndex(higherValeIDX))
{
//
fromIDX = higherValeIDX;
}
}
else
{
//
double peak = provider
.decisionXConditions
.peaksBuffer[cIDX];
//
box.upper = peak;
//
box.lower = provider
.decisionXConditions
.peaksGoldenBuffer[cIDX];
//
int lowerPeakIDX = -1;
double lowerPeak = provider
.decisionCycleHelper
.mX121Helper
.xpvHelper
.GetLowerPeak(
lowerPeakIDX,
peak,
cBar.Index() //
);
//
int higherPeakIDX = -1;
double higherPeak = provider
.decisionCycleHelper
.mX121Helper
.xpvHelper
.GetHigherPeak(
higherPeakIDX,
peak,
cBar.Index() //
);
//
if (IsValidIndex(lowerPeakIDX) &&
IsValidIndex(higherPeakIDX))
{
//
fromIDX =
lowerPeakIDX < higherPeakIDX
? lowerPeakIDX
: higherPeakIDX;
}
else if (IsValidIndex(lowerPeakIDX) &&
!IsValidIndex(higherPeakIDX))
{
//
fromIDX = lowerPeakIDX;
}
else if (!IsValidIndex(lowerPeakIDX) &&
IsValidIndex(higherPeakIDX))
{
//
fromIDX = higherPeakIDX;
}
}
//
if (IsValidIndex(fromIDX))
{
//
box.from = iTime(
zBar.symbol,
zBar.period,
fromIDX //
);
}
else
{
box.from = pBar.time;
}
//
signalProvider = X121SMC_XWZ_PROVIDER_ACTIVATED_BOX;
}
}
//
// Senario 3:
// ----------
bool useSenario3 = false;
bool isSenario3Happend = false;
bool isSenario3Bullish = false;
bool isSenario3Bearish = false;
if (useSenario3)
{
//
// Senario 3 Bullish Conditions ...
isSenario3Bullish = false;
//
// Senario 3 Bearish Conditions ...
isSenario3Bearish = false;
//
// Filling Requirements using Senario 3 ...
isSenario3Happend =
isSenario3Bullish ||
isSenario3Bearish;
if (isSenario3Happend)
{
//
dir =
isSenario3Bullish
? X_DIRECTION_BULLISH
: X_DIRECTION_BEARISH;
//
box.dir = dir;
box.to = TimeCurrent();
box.symbol = provider
.decisionXConditions
.symbol;
box.period = provider
.decisionXConditions
.period;
//
int fromIDX = -1;
if (isSenario3Bullish)
{
//
double vale = provider
.decisionXConditions
.valesBuffer[cIDX];
//
box.lower = vale;
//
box.upper = provider
.decisionXConditions
.valesGoldenBuffer[cIDX];
//
int lowerValeIDX = -1;
double lowerVale = provider
.decisionCycleHelper
.mX121Helper
.xpvHelper
.GetLowerVale(
lowerValeIDX,
vale,
cBar.Index() //
);
//
int higherValeIDX = -1;
double higherVale = provider
.decisionCycleHelper
.mX121Helper
.xpvHelper
.GetHigherVale(
higherValeIDX,
vale,
cBar.Index() //
);
//
if (IsValidIndex(lowerValeIDX) &&
IsValidIndex(higherValeIDX))
{
//
fromIDX =
lowerValeIDX < higherValeIDX
? lowerValeIDX
: higherValeIDX;
}
else if (IsValidIndex(lowerValeIDX) &&
!IsValidIndex(higherValeIDX))
{
//
fromIDX = lowerValeIDX;
}
else if (!IsValidIndex(lowerValeIDX) &&
IsValidIndex(higherValeIDX))
{
//
fromIDX = higherValeIDX;
}
}
else
{
//
double peak = provider
.decisionXConditions
.peaksBuffer[cIDX];
//
box.upper = peak;
//
box.lower = provider
.decisionXConditions
.peaksGoldenBuffer[cIDX];
//
int lowerPeakIDX = -1;
double lowerPeak = provider
.decisionCycleHelper
.mX121Helper
.xpvHelper
.GetLowerPeak(
lowerPeakIDX,
peak,
cBar.Index() //
);
//
int higherPeakIDX = -1;
double higherPeak = provider
.decisionCycleHelper
.mX121Helper
.xpvHelper
.GetHigherPeak(
higherPeakIDX,
peak,
cBar.Index() //
);
//
if (IsValidIndex(lowerPeakIDX) &&
IsValidIndex(higherPeakIDX))
{
//
fromIDX =
lowerPeakIDX < higherPeakIDX
? lowerPeakIDX
: higherPeakIDX;
}
else if (IsValidIndex(lowerPeakIDX) &&
!IsValidIndex(higherPeakIDX))
{
//
fromIDX = lowerPeakIDX;
}
else if (!IsValidIndex(lowerPeakIDX) &&
IsValidIndex(higherPeakIDX))
{
//
fromIDX = higherPeakIDX;
}
}
//
if (IsValidIndex(fromIDX))
{
//
box.from = iTime(
zBar.symbol,
zBar.period,
fromIDX //
);
}
else
{
box.from = pBar.time;
}
//
signalProvider = X121SMC_XWZ_PROVIDER_ACTIVATED_BOX;
}
}
//
@@ -1217,14 +1643,18 @@ struct X121SMCStrategyXWZWorkingZone
//
isBullish =
//
isSenario1Bullish
isSenario1Bullish ||
isSenario2Bullish ||
isSenario3Bullish
//
;
//
isBearish =
//
isSenario1Bearish
isSenario1Bearish ||
isSenario2Bearish ||
isSenario3Bearish
//
;