This commit is contained in:
2025-02-26 14:52:31 +03:30
parent 727888d783
commit 959ef1fee4
8 changed files with 508 additions and 196 deletions
@@ -322,6 +322,7 @@ class XCX121SMCXWZSignalDetector : public XCBase
hasWorkingZone = workingZone.Init(
symbol,
period,
zIndex,
visionState,
consolidationState,
analyseState //
@@ -331,14 +332,35 @@ class XCX121SMCXWZSignalDetector : public XCBase
//
if (hasWorkingZone)
{
//
visionCycleHelper.mPOIDetector.MaxRequiredPOIs(50);
analyseCycleHelper.mPOIDetector.MaxRequiredPOIs(50);
decisionCycleHelper.mPOIDetector.MaxRequiredPOIs(50);
consolidationCycleHelper.mPOIDetector.MaxRequiredPOIs(50);
//
visionCycleHelper.mPOIDetector.MaxAllowedLoopbackForInit(578);
analyseCycleHelper.mPOIDetector.MaxAllowedLoopbackForInit(578);
decisionCycleHelper.mPOIDetector.MaxAllowedLoopbackForInit(578);
consolidationCycleHelper.mPOIDetector.MaxAllowedLoopbackForInit(578);
//
workingZone.Update(
zIndex,
visionState,
consolidationState,
analyseState //
);
}
//
bool hasInsideZones = hasWorkingZone &&
workingZone.HasInsideZones();
if (hasInsideZones)
{
Print("Has Inside Zones");
}
//
UpdateTo(cTime);
@@ -348,7 +370,14 @@ class XCX121SMCXWZSignalDetector : public XCBase
//
workingZone.Draw(
drawer,
true // Force Clean ...
true, // Force Clean ...
true,
true,
true,
true,
true,
true,
true //
);
}
+241 -58
View File
@@ -74,6 +74,7 @@ struct X121SMCStrategyXWZWorkingZone
XCResistanceZone *resistanceZones[];
//
XOBFVG insideZones[];
XOBFVG waitingZones[];
//
@@ -106,6 +107,7 @@ struct X121SMCStrategyXWZWorkingZone
Clean(demandZones);
//
Clean(insideZones);
Clean(waitingZones);
//
@@ -147,6 +149,7 @@ struct X121SMCStrategyXWZWorkingZone
bool Init(
string _symbol,
ENUM_TIMEFRAMES _period,
int barIndex,
XPOIState &htfState,
XPOIState &mtfState,
XPOIState &stfState //
@@ -155,6 +158,12 @@ struct X121SMCStrategyXWZWorkingZone
//
bool result = false;
//
if (barIndex < 0)
{
barIndex = 0;
}
//
result =
//
@@ -184,6 +193,23 @@ struct X121SMCStrategyXWZWorkingZone
int count = 0;
bool has = false;
//
XOHCL zBar;
has = zBar.Init(
symbol,
period,
barIndex //
);
result = has;
if (!result)
{
zBar.Clean();
return result;
}
double ll5 = zBar.FindLowest(5, MODE_LOW);
double hh5 = zBar.FindHighest(5, MODE_HIGH);
zBar.Clean();
//
// Supply Zone ...
has = HasSupplyZone();
@@ -194,7 +220,13 @@ struct X121SMCStrategyXWZWorkingZone
has = IsValidIndex(idx);
if (has)
{
//
supplyZone = htfState.supplyZones[idx];
has = hh5 < supplyZone.Lower();
if (!has)
{
supplyZone = NULL;
}
}
}
@@ -208,7 +240,13 @@ struct X121SMCStrategyXWZWorkingZone
has = IsValidIndex(idx);
if (has)
{
//
demandZone = htfState.demandZones[idx];
has = ll5 > demandZone.Upper();
if (!has)
{
demandZone = NULL;
}
}
}
@@ -331,15 +369,23 @@ struct X121SMCStrategyXWZWorkingZone
//
void Update(
int barIndex,
XPOIState &htfState,
XPOIState &mtfState,
XPOIState &stfState //
)
{
//
int idx = -1;
int count = 0;
bool has = false;
//
if (barIndex < 0)
{
barIndex = 0;
}
//
has =
//
@@ -354,75 +400,200 @@ struct X121SMCStrategyXWZWorkingZone
stfState.HasChild()
//
;
if (!has)
{
return;
}
//
//
// Supply Zones ...
count = mtfState.FilterSupplyZones(
supplyZones,
NULL,
XZONE_STATE_PASSED,
false,
XZONE_STATE_FAILED,
false,
XZONE_STATE_FAILED,
false,
XZONE_STATE_IGNORED,
false //
);
//
// Demand Zones ...
count = mtfState.FilterDemandZones(
demandZones,
NULL,
XZONE_STATE_PASSED,
false,
XZONE_STATE_FAILED,
false,
XZONE_STATE_FAILED,
false,
XZONE_STATE_IGNORED,
false //
);
//
// Support Zones ...
count = stfState.FilterSupportZones(
supportZones,
XOHCL zBar;
has = zBar.Init(
symbol,
period,
XZONE_STATE_PASSED,
false,
XZONE_STATE_FAILED,
false,
XZONE_STATE_FAILED,
false,
XZONE_STATE_IGNORED,
false //
barIndex //
);
if (!has)
{
//
zBar.Clean();
return;
}
//
// Resistance Zones ...
count = stfState.FilterResistanceZones(
resistanceZones,
period,
XZONE_STATE_PASSED,
false,
XZONE_STATE_FAILED,
false,
XZONE_STATE_FAILED,
false,
XZONE_STATE_IGNORED,
false //
);
XOHCL cBar;
has = zBar.GetPreviousBar(cBar);
if (!has)
{
//
zBar.Clean();
cBar.Clean();
//
return;
}
// //
// // Supply Zones ...
// count = mtfState.FilterSupplyZones(
// supplyZones,
// NULL,
// XZONE_STATE_PASSED,
// false,
// XZONE_STATE_FAILED,
// false,
// XZONE_STATE_FAILED,
// false,
// XZONE_STATE_IGNORED,
// false //
// );
// //
// // Demand Zones ...
// count = mtfState.FilterDemandZones(
// demandZones,
// NULL,
// XZONE_STATE_PASSED,
// false,
// XZONE_STATE_FAILED,
// false,
// XZONE_STATE_FAILED,
// false,
// XZONE_STATE_IGNORED,
// false //
// );
// //
// // Support Zones ...
// count = stfState.FilterSupportZones(
// supportZones,
// period,
// XZONE_STATE_PASSED,
// false,
// XZONE_STATE_FAILED,
// false,
// XZONE_STATE_FAILED,
// false,
// XZONE_STATE_IGNORED,
// false //
// );
// //
// // Resistance Zones ...
// count = stfState.FilterResistanceZones(
// resistanceZones,
// period,
// XZONE_STATE_PASSED,
// false,
// XZONE_STATE_FAILED,
// false,
// XZONE_STATE_FAILED,
// false,
// XZONE_STATE_IGNORED,
// false //
// );
//
ExtractOBFVGs(
waitingZones,
// Detect price Inside Zones ...
//
has = HasWaitingZones();
if (has)
{
//
int mustRemove[];
count = CountWaitingZones();
for (int i = 0; i < count; i++)
{
//
XOBFVG iOBFVG = waitingZones[i];
//
bool isInside =
//
zBar.high < iOBFVG.ob.Upper() &&
zBar.low > iOBFVG.ob.Lower() &&
//
cBar.high < iOBFVG.ob.Upper() &&
cBar.low > iOBFVG.ob.Lower()
//
;
if (isInside)
{
//
Add(
i,
mustRemove //
);
//
AddRef(
iOBFVG,
insideZones //
);
}
}
//
has = HasChild(mustRemove);
if (has)
{
//
count = ArraySize(mustRemove);
for (int i = 0; i < count; i++)
{
//
ArrayRemove(
waitingZones,
mustRemove[i],
1 //
);
}
}
}
//
XOBFVG tmpWaitingZones[];
count = ExtractOBFVGs(
tmpWaitingZones,
mtfState,
stfState //
);
has = IsValidSize(count);
if (has)
{
//
for (int i = 0; i < count; i++)
{
//
XOBFVG iOBFVG = tmpWaitingZones[i];
//
idx = FindIndex(
iOBFVG,
waitingZones //
);
has = IsValidIndex(idx);
if (has)
{
//
iOBFVG.Clean();
continue;
}
//
AddRef(
iOBFVG,
waitingZones //
);
//
iOBFVG.Clean();
}
}
//
zBar.Clean();
cBar.Clean();
}
//
@@ -499,6 +670,18 @@ struct X121SMCStrategyXWZWorkingZone
return ArraySize(waitingZones);
}
//
bool HasInsideZones()
{
return HasChild(insideZones);
}
//
int CountInsideZones()
{
return ArraySize(insideZones);
}
//
//
//