This commit is contained in:
2025-03-30 02:46:12 +03:30
parent ac95a26e24
commit eaddb8aa72
5 changed files with 375 additions and 80 deletions
@@ -2661,7 +2661,7 @@ struct X121SMCStrategyConditionParser
//
// Rejected Boxes ...
bool HasRejectedBocXConditions(
bool HasRejectedBoxConditions(
ENUM_X_CYCLES cycle,
XSignalBox &box,
ENUM_X_DIRECTION &dir,
@@ -2952,7 +2952,7 @@ struct X121SMCStrategyConditionParser
//
// Activated Boxes ...
bool HasActivatedBocXConditions(
bool HasActivatedBoxConditions(
ENUM_X_CYCLES cycle,
XSignalBox &box,
ENUM_X_DIRECTION &dir,
@@ -3267,7 +3267,7 @@ struct X121SMCStrategyConditionParser
//
// Breaked Boxes ...
bool HasBreakedBocXConditions(
bool HasBreakedBoxConditions(
ENUM_X_CYCLES cycle,
XSignalBox &box,
ENUM_X_DIRECTION &dir,
@@ -4501,16 +4501,16 @@ struct X121SMCStrategyConditionParser
//
bool isBullishTKZone =
isIchIsBullish &&
cBar.low < cXConditions.tenkanSenBuffer[cIndex] &&
cBar.low > cXConditions.kijunSenBuffer[cIndex] &&
cBar.low < cXConditions.tenkanSenBuffer[cIDX] &&
cBar.low > cXConditions.kijunSenBuffer[cIDX] &&
cBar.low < pBar.low &&
zBar.open > cBar.low;
//
bool isBearishTKZone =
isIchIsBearish &&
cBar.high > cXConditions.tenkanSenBuffer[cIndex] &&
cBar.high < cXConditions.kijunSenBuffer[cIndex] &&
cBar.high > cXConditions.tenkanSenBuffer[cIDX] &&
cBar.high < cXConditions.kijunSenBuffer[cIDX] &&
cBar.high > pBar.high &&
zBar.open < cBar.high;
@@ -4563,14 +4563,17 @@ struct X121SMCStrategyConditionParser
box.period = cBar.period;
//
pivot = isBullish
? cBar.low - (points * 5)
: cBar.high + (points * 5);
double points = GetPoints(box.symbol);
//
point = GetEntry(
double pivot = isBullish
? cBar.low - (points * 5)
: cBar.high + (points * 5);
//
double point = GetEntry(
cBar.symbol,
signalBoxDir //
dir //
);
//
@@ -4591,12 +4594,306 @@ struct X121SMCStrategyConditionParser
{
//
}
}
//
// Check All Conditions ...
result =
box.IsValid() &&
HasDirection(dir) &&
(isBullish ||
isBearish);
//
// Cleanup Resources ...
zBar.Clean();
cBar.Clean();
pBar.Clean();
pPBar.Clean();
cState.Clean();
cConditions.Clean();
cConditions.Clean();
ZeroMemory(cHelper);
cStateEvents.Clean();
cXConditions.Clean();
//
return result;
}
//
bool HasXSTRConditions(
ENUM_X_CYCLES cycle,
XBoxZone &box,
ENUM_X_DIRECTION &dir,
X121SMCStrategySignalProviderData &provider,
int barIndex = 0 //
)
{
//
bool result = false;
//
box.Clean();
dir = X_DIRECTION_NONE;
//
// Fil Selected Data ...
XPOIState cState;
X121Conditions cXConditions;
XPOIStateEvents cStateEvents;
XC121SMCCycleHelper *cHelper;
X121SMCCycleConditions cConditions;
result = provider.SelectCycle(
cycle,
cState,
cStateEvents,
cXConditions,
cHelper,
cConditions //
);
if (!result)
{
//
cState.Clean();
ZeroMemory(cHelper);
cConditions.Clean();
cXConditions.Clean();
cStateEvents.Clean();
//
Print("Signal ...");
result = false;
isBearish = false;
isBullish = false;
return result;
}
Parse(cXConditions);
//
// Normalize Args ...
//
if (barIndex < 0)
{
barIndex = 0;
}
//
int idx = -1;
int count = 0;
bool has = false;
//
int zIDX = barIndex;
int cIDX = zIDX + 1;
int pIDX = cIDX + 1;
int ppIDX = pIDX + 1;
//
bool isBullish = false;
bool isBearish = false;
//
XOHCL zBar;
XOHCL cBar;
XOHCL pBar;
XOHCL pPBar;
//
// Initial Bars ...
result = zBar.Init(
cState.symbol,
cState.period,
barIndex //
);
result =
result &&
zBar.GetPreviousBar(cBar);
result =
result &&
cBar.GetPreviousBar(pBar);
result =
result &&
pBar.GetPreviousBar(pPBar);
if (!result)
{
//
zBar.Clean();
cBar.Clean();
pBar.Clean();
cState.Clean();
ZeroMemory(cHelper);
cConditions.Clean();
cXConditions.Clean();
//
return result;
}
//
// Checking Conditions ...
//
// XDELTA ...
//
bool isDeltaSwitchedToBullish =
(cXConditions.isDeltaCrossedOverMa &&
cXConditions.isDeltaSwitchedToBullish);
bool isDeltaBullish =
(cXConditions.isDeltaOverMa &&
cXConditions.isDeltaBullish);
bool isDeltaIsBullish =
isDeltaBullish ||
isDeltaSwitchedToBullish;
//
bool isDeltaSwitchedToBearish =
(cXConditions.isDeltaCrossedUnderMa &&
cXConditions.isDeltaSwitchedToBearish);
bool isDeltaBearish =
(cXConditions.isDeltaUnderMa &&
cXConditions.isDeltaBearish);
bool isDeltaIsBearish =
isDeltaBearish ||
isDeltaSwitchedToBearish;
//
// XVOLUME ...
//
bool isVolumeSwitchedToBullish =
(cXConditions.isVolumeSwitchedToBullish &&
cXConditions.isBullishVolumeSwitchedToIncreased);
bool isVolumeBullish =
(cXConditions.isBullishVolumeIncreased &&
cXConditions.isBullishVolumeMaOverBearishVolumeMa);
bool isVolumeIsBullish =
isVolumeBullish ||
isVolumeSwitchedToBullish;
//
bool isVolumeSwitchedToBearish =
(cXConditions.isVolumeSwitchedToBearish &&
cXConditions.isBearishVolumeSwitchedToIncreased);
bool isVolumeBearish =
(cXConditions.isBullishVolumeMaUnderBearishVolumeMa &&
cXConditions.isBearishVolumeIncreased);
bool isVolumeIsBearish =
isVolumeBearish ||
isVolumeSwitchedToBearish;
//
// XSTR ...
bool isStrIsBullish =
(cXConditions.isStrBullish ||
cXConditions.isStrSwitchedToBullish);
bool isStrIsBearish =
(cXConditions.isStrBearish ||
cXConditions.isStrSwitchedToBearish);
//
// XFastMa ...
//
bool isFastMaOverStr =
(cXConditions.x3maFastBuffer[cIDX] > cXConditions.strBuffer[cIDX]);
//
bool isFastMaUnderStr =
(cXConditions.x3maFastBuffer[cIDX] < cXConditions.strBuffer[cIDX]);
//
bool isFastMaBullishReject =
cBar.low < pBar.low &&
cBar.low > cXConditions.strBuffer[cIDX] &&
cBar.low < cXConditions.x3maFastBuffer[cIDX] &&
cBar.GetDown() > cXConditions.x3maFastBuffer[cIDX];
//
bool isFastMaBearishReject =
cBar.high > pBar.high &&
cBar.high < cXConditions.strBuffer[cIDX] &&
cBar.high > cXConditions.x3maFastBuffer[cIDX] &&
cBar.GetUp() < cXConditions.x3maFastBuffer[cIDX];
//
// Summarize Conditions ...
//
isBullish =
//
// false
isStrIsBullish &&
isFastMaOverStr &&
// isDeltaIsBullish &&
// isVolumeIsBullish &&
isFastMaBullishReject
//
//
;
//
isBearish =
//
// false
isStrIsBearish &&
isFastMaUnderStr &&
// isDeltaIsBearish &&
// isVolumeIsBearish &&
isFastMaBearishReject
//
;
//
// Filling Requirements ...
result =
isBullish ||
isBearish;
if (result)
{
//
dir =
isBullish
? X_DIRECTION_BULLISH
: X_DIRECTION_BEARISH;
//
box.dir = dir;
box.from = pPBar.time;
box.to = TimeCurrent();
box.symbol = cBar.symbol;
box.period = cBar.period;
//
double points = GetPoints(box.symbol);
//
double pivot = cXConditions.strBuffer[cIDX];
// isBullish
// ? cBar.low - (points * 5)
// : cBar.high + (points * 5);
//
double point = GetEntry(
cBar.symbol,
dir //
);
//
box.upper =
isBullish
? point
: pivot;
//
box.lower =
isBullish
? pivot
: point;
//
bool drawBoxes = true;
if (drawBoxes)
{
//
}
}
//