This commit is contained in:
2025-03-19 01:38:07 +03:30
parent 9f0ebd1afe
commit 012499cc73
7 changed files with 1242 additions and 387 deletions
@@ -2631,7 +2631,7 @@ struct X121SMCStrategyConditionParser
XBoxZone &box,
XBoxZone &holderBox,
ENUM_X_DIRECTION &dir,
XBoxZone &waitingBoxes[],
XSignalBox &waitingBoxes[],
X121SMCStrategySignalProviderData &provider,
ENUM_X_CYCLES holderCycle = X_CYCLE_NONE,
int barIndex = 0 //
@@ -2783,41 +2783,6 @@ struct X121SMCStrategyConditionParser
return result;
}
//
// Detect Inside Box ...
XBoxZone insideBox;
count = ArraySize(waitingBoxes);
has = IsValidSize(count);
if (has)
{
//
for (int i = 0; i < count; i++)
{
//
XBoxZone iBox = waitingBoxes[i];
bool isBullish = iBox.IsBullish();
double iMid = iBox.lower + ((iBox.upper - iBox.lower) / 2);
//
has =
//
isBullish
? cBar.low < iMid &&
cBar.low > iBox.lower
: cBar.high > iMid &&
cBar.high < iBox.upper
//
;
if (has)
{
//
insideBox = iBox;
break;
}
}
}
has = insideBox.IsValid();
//
ENUM_X_DIRECTION iBarPosDir;
bool isBarValidForDir = cHelper
@@ -2834,55 +2799,27 @@ struct X121SMCStrategyConditionParser
IsBearish(iBarPosDir);
//
if (has)
{
//
XCBoxObject *iObj;
has = drawer.DrawBox(
insideBox,
iObj //
);
if (has)
{
//
Print("Dec Scores:");
Print("-------------");
Print("Bull: ", provider.decisionBullishScore);
Print("Bear: ", provider.decisionBearishScore);
Print("-------------");
Print("Anal Scores:");
Print("-------------");
Print("Bull: ", provider.analyseBullishScore);
Print("Bear: ", provider.analyseBearishScore);
Print("-------------");
Print("Bar Valid For: " + ToString(iBarPosDir));
Print("-------------");
Print(ToString(insideBox.dir), " Inside ...");
Print("-------------");
}
}
// result = isBarValidForBullish ||
// isBarValidForBearish;
// if (!result)
// {
// //
// zBar.Clean();
// cBar.Clean();
// pBar.Clean();
// cState.Clean();
// chState.Clean();
// insideBox.Clean();
// ZeroMemory(cHelper);
// cConditions.Clean();
// cXConditions.Clean();
// ZeroMemory(chHelper);
// chConditions.Clean();
// chXConditions.Clean();
//
result = has;
if (!result)
{
//
zBar.Clean();
cBar.Clean();
pBar.Clean();
cState.Clean();
chState.Clean();
insideBox.Clean();
ZeroMemory(cHelper);
cConditions.Clean();
cXConditions.Clean();
ZeroMemory(chHelper);
chConditions.Clean();
chXConditions.Clean();
//
return result;
}
// //
// return result;
// }
//
// Detecting Signal Conditions ...
@@ -2894,8 +2831,11 @@ struct X121SMCStrategyConditionParser
// Base Condition ...
(
//
insideBox.IsBullish() &&
isBarValidForBullish
false
// cBar.IsBullish() &&
// isBarValidForBullish &&
// cBar.close > cXConditions.x3maFastBuffer[cIDX] &&
// cXConditions.x3maFastBuffer[cIDX] < cXConditions.x3maSlowBuffer[cIDX]
//
)
//
@@ -2908,8 +2848,11 @@ struct X121SMCStrategyConditionParser
// Base Condition ...
(
//
insideBox.IsBearish() &&
isBarValidForBearish
false
// cBar.IsBearish() &&
// isBarValidForBearish &&
// cBar.close < cXConditions.x3maFastBuffer[cIDX] &&
// cXConditions.x3maFastBuffer[cIDX] > cXConditions.x3maSlowBuffer[cIDX]
//
)
//
@@ -2931,9 +2874,9 @@ struct X121SMCStrategyConditionParser
//
box.dir = dir;
box.to = TimeCurrent();
box.from = insideBox.from;
box.upper = insideBox.upper;
box.lower = insideBox.lower;
// box.from = insideBox.from;
// box.upper = insideBox.upper;
// box.lower = insideBox.lower;
box.symbol = cXConditions.symbol;
box.period = cXConditions.period;
}
@@ -2953,7 +2896,7 @@ struct X121SMCStrategyConditionParser
pBar.Clean();
cState.Clean();
chState.Clean();
insideBox.Clean();
// insideBox.Clean();
ZeroMemory(cHelper);
cConditions.Clean();
cStateEvents.Clean();
@@ -119,11 +119,11 @@ class XCX121SMCXWZSignalDetector : public XCBase
zIndex,
loopback,
false, // Trigger ...
true, // Decision ...
true, // Analyse ...
true, // Verification ...
true, // Consolidation ...
true // Vision ...
true, // Decision ...
true, // Analyse ...
true, // Verification ...
true, // Consolidation ...
true // Vision ...
);
if (!result)
{
@@ -224,7 +224,7 @@ class XCX121SMCXWZSignalDetector : public XCBase
// Detectiong Signal Boxes ...
hasWaitingBoxes = workingZone
.DetectSignalBoxes(
X_CYCLE_DECISION,
X_CYCLE_ANALYSE,
provider,
zIndex //
);
@@ -311,11 +311,12 @@ class XCX121SMCXWZSignalDetector : public XCBase
if (hasBreakedBoxes)
{
//
int idx = FindIndex(
int idx = -1;
bool has = FindIndex(
idx,
signalBox,
workingZone.breakedBoxes //
);
bool has = IsValidIndex(idx);
if (has)
{
//
@@ -333,11 +334,12 @@ class XCX121SMCXWZSignalDetector : public XCBase
if (hasWaitingBoxes)
{
//
int idx = FindIndex(
int idx = -1;
bool has = FindIndex(
idx,
signalBox,
workingZone.waitingBoxes //
);
bool has = IsValidIndex(idx);
if (has)
{
//
@@ -470,7 +472,7 @@ class XCX121SMCXWZSignalDetector : public XCBase
iAtr = provider.decisionXConditions.atrBuffer[1];
iAtr *= 0;
}
// else
// else
// if (signalProvider == X121SMC_XWZ_PROVIDER_ACTIVATED_BOX)
// {
// //
@@ -838,8 +840,8 @@ class XCX121SMCXWZSignalDetector : public XCBase
//
// Summarize Results ...
result = hasPriority &&
hasSignalBox &&
hasRewardAmount;
hasSignalBox &&
hasRewardAmount;
//
if (result)
+115 -243
View File
@@ -71,9 +71,9 @@ struct X121SMCStrategyXWZWorkingZone
XCDemandZone *demandZone;
//
XBoxZone waitingBoxes[];
XBoxZone breakedBoxes[];
XBoxZone unavailableBoxes[];
XSignalBox waitingBoxes[];
XSignalBox breakedBoxes[];
XSignalBox unavailableBoxes[];
//
CArrayObj mDrawnObjects;
@@ -236,7 +236,7 @@ struct X121SMCStrategyXWZWorkingZone
*
* @return ( bool )
*/
bool IsExists(XBoxZone &box)
bool IsExists(XSignalBox &box)
{
//
bool result = false;
@@ -262,11 +262,11 @@ struct X121SMCStrategyXWZWorkingZone
if (has)
{
//
idx = FindIndex(
result = FindIndex(
idx,
box,
waitingBoxes //
);
result = IsValidIndex(idx);
if (result)
{
return result;
@@ -279,11 +279,11 @@ struct X121SMCStrategyXWZWorkingZone
if (has)
{
//
idx = FindIndex(
result = FindIndex(
idx,
box,
breakedBoxes //
);
result = IsValidIndex(idx);
if (result)
{
return result;
@@ -296,11 +296,11 @@ struct X121SMCStrategyXWZWorkingZone
if (has)
{
//
idx = FindIndex(
result = FindIndex(
idx,
box,
unavailableBoxes //
);
result = IsValidIndex(idx);
if (result)
{
return result;
@@ -514,233 +514,78 @@ struct X121SMCStrategyXWZWorkingZone
return result;
}
//
// Select Rejection Boxes ...
// //
// // Select Validate Rejection Boxes ...
// XBoxZone rejections[];
// int count = cHelper
// .DetectRejections(
// rejections,
// barIndex //
// );
// //
// result = IsValidSize(count);
// if (result)
// {
// //
// for (int i = 0; i < count; i++)
// {
// //
// has = IsExists(rejections[i]);
// if (!has)
// {
// //
// AddRef(
// rejections[i],
// waitingBoxes //
// );
// }
// }
// }
//
// Select Order Blocks ...
// if (cStateEvents.hasNewOrderBlock)
// {
// //
// idx = GetYoungest(cState.orderBlocks);
// has = IsValidIndex(idx);
// if (has)
// {
// //
// XCOrderBlock *iOB = cState.orderBlocks[idx];
// //
// XBoxZone iBox;
// has = ToBox(
// iBox,
// iOB //
// );
// if (has)
// {
// //
// has = IsExists(iBox);
// if (!has)
// {
// //
// AddRef(
// iBox,
// waitingBoxes //
// );
// }
// }
// }
// }
//
// Select Fair Value Gaps ...
// if (cStateEvents.hasNewFairValueGap)
// {
// //
// idx = GetYoungest(cState.fairValueGaps);
// has = IsValidIndex(idx);
// if (has)
// {
// //
// XCFVG *iOB = cState.fairValueGaps[idx];
// //
// XBoxZone iBox;
// has = ToBox(
// iBox,
// iOB //
// );
// if (has)
// {
// //
// has = IsExists(iBox);
// if (!has)
// {
// //
// AddRef(
// iBox,
// waitingBoxes //
// );
// }
// }
// }
// }
//
// Select Supply/Demand Zones ...
// if (cStateEvents.hasNewSupplyZone)
// {
// //
// idx = GetYoungest(cState.supplyZones);
// has = IsValidIndex(idx);
// if (has)
// {
// //
// XCSupplyZone *iSupply = cState.supplyZones[idx];
// //
// XBoxZone iBox;
// has = ToBox(
// iBox,
// iSupply //
// );
// if (has)
// {
// //
// has = IsExists(iBox);
// if (!has)
// {
// //
// AddRef(
// iBox,
// waitingBoxes //
// );
// }
// }
// }
// }
// if (cStateEvents.hasNewDemandZone)
// {
// //
// idx = GetYoungest(cState.demandZones);
// has = IsValidIndex(idx);
// if (has)
// {
// //
// XCDemandZone *iDemand = cState.demandZones[idx];
// //
// XBoxZone iBox;
// has = ToBox(
// iBox,
// iDemand //
// );
// if (has)
// {
// //
// has = IsExists(iBox);
// if (!has)
// {
// //
// AddRef(
// iBox,
// waitingBoxes //
// );
// }
// }
// }
// }
//
// Select Support/Resistance Zones ...
if (cStateEvents.hasNewSupportZone)
if (cStateEvents.hasNewOrderBlock)
{
//
idx = GetYoungest(cState.supportZones);
idx = GetYoungest(cState.orderBlocks);
has = IsValidIndex(idx);
if (has)
{
//
XCSupportZone *iSupport = cState.supportZones[idx];
XCOrderBlock *iOB = cState.orderBlocks[idx];
bool isBullish = iOB.IsBullish();
//
XBoxZone iBox;
XBoxZone iOBBox;
XBoxZone iFVGBox;
has = ToBox(
iBox,
iSupport //
iOBBox,
iOB //
);
if (has)
{
//
has = IsExists(iBox);
if (!has)
// Detect FVGs ...
if (cStateEvents.hasNewFairValueGap)
{
//
AddRef(
iBox,
waitingBoxes //
);
int idx =
isBullish
? GetLowest(cState.bullishFairValueGaps)
: GetHighest(cState.bearishFairValueGaps);
XCFVG *iFVG =
isBullish
? cState.bullishFairValueGaps[idx]
: cState.bearishFairValueGaps[idx];
has = IsValidIndex(idx);
if (has)
{
//
ToBox(
iFVGBox,
iFVG //
);
}
}
}
}
}
if (cStateEvents.hasNewResistanceZone)
{
//
idx = GetYoungest(cState.resistanceZones);
has = IsValidIndex(idx);
if (has)
{
//
XCResistanceZone *iResistance = cState.resistanceZones[idx];
//
XBoxZone iBox;
has = ToBox(
iBox,
iResistance //
);
has = iOBBox.IsValid() &&
iFVGBox.IsValid();
if (has)
{
//
has = IsExists(iBox);
if (!has)
{
//
AddRef(
iBox,
waitingBoxes //
);
}
XSignalBox iSignalBox;
//
iSignalBox.ob = iOBBox;
iSignalBox.fvg = iFVGBox;
//
AddRef(
iSignalBox,
waitingBoxes //
);
//
iSignalBox.Clean();
}
//
iOBBox.Clean();
iFVGBox.Clean();
}
}
@@ -805,21 +650,33 @@ struct X121SMCStrategyXWZWorkingZone
{
//
XOHCL iBar;
XBoxZone iBox = waitingBoxes[i];
bool isInite = iBar
.Init(
iBox.symbol,
iBox.period,
iBox.from //
);
XSignalBox iBox = waitingBoxes[i];
bool isInite = iBar.Init(
iBox.ob.symbol,
iBox.ob.period,
iBox.ob.from //
);
//
has = isInite &&
IsBoxBreaked(
iBox,
iBar.Index() - 1,
barIndex,
period //
(
//
IsBoxBreaked(
iBox.fvg,
iBar.Index() - 1,
barIndex,
period //
)
//
||
//
IsBoxBreaked(
iBox.ob,
iBar.Index() - 1,
barIndex,
period //
)
//
);
if (has)
{
@@ -837,7 +694,7 @@ struct X121SMCStrategyXWZWorkingZone
}
//
iBox.Clean();
// iBox.Clean();
iBar.Clean();
}
@@ -996,18 +853,6 @@ struct X121SMCStrategyXWZWorkingZone
//
// Waiting Boxes ...
ENUM_X_DIRECTION boxDir = X_DIRECTION_NONE;
XBoxZone tmpBoxes[];
Copy(
waitingBoxes,
tmpBoxes //
);
int count = ArraySize(tmpBoxes);
bool has = IsValidSize(count);
if (has)
{
//
}
//
@@ -1051,7 +896,14 @@ struct X121SMCStrategyXWZWorkingZone
count = CountWaitingBoxes();
for (int i = 0; i < count; i++)
{
waitingBoxes[i].to = value;
//
waitingBoxes[i].ob.to = value;
//
if (waitingBoxes[i].fvg.IsValid())
{
waitingBoxes[i].fvg.to = value;
}
}
}
@@ -1786,18 +1638,38 @@ struct X121SMCStrategyXWZWorkingZone
for (int i = 0; i < count; i++)
{
//
XCBoxObject *iBoxObj;
// OB ...
XCBoxObject *iOBBoxObj;
has = drawer.DrawBox(
waitingBoxes[i],
iBoxObj //
waitingBoxes[i].ob,
iOBBoxObj //
);
if (has)
{
mDrawnObjects.Add(iBoxObj);
mDrawnObjects.Add(iOBBoxObj);
}
//
ZeroMemory(iBoxObj);
// FVG ...
if (waitingBoxes[i].fvg.IsValid())
{
//
XCBoxObject *iFVGBoxObj;
has = drawer.DrawBox(
waitingBoxes[i].fvg,
iFVGBoxObj //
);
if (has)
{
mDrawnObjects.Add(iFVGBoxObj);
}
//
ZeroMemory(iFVGBoxObj);
}
//
ZeroMemory(iOBBoxObj);
}
}
}