last ...
This commit is contained in:
@@ -3855,6 +3855,9 @@ bool ToZoneBox(
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
bool isBullish = fvg.IsBullish();
|
||||
|
||||
//
|
||||
// Retrieve Main Fair Value Gap's Started Bar ...
|
||||
XOHCL startedBar;
|
||||
@@ -3893,11 +3896,37 @@ bool ToZoneBox(
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Validate Start Bar ...
|
||||
result =
|
||||
isBullish
|
||||
? startedBar.high >= fvg.Upper() &&
|
||||
startedBar.low < fvg.Upper()
|
||||
: startedBar.low <= fvg.Lower() &&
|
||||
startedBar.high > fvg.Lower();
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
box.Clean();
|
||||
ZeroMemory(fvg);
|
||||
startedBar.Clean();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Update Box using Started Bar ...
|
||||
box.lower = startedBar.low;
|
||||
box.upper = startedBar.high;
|
||||
box.from = startedBar.NextAt();
|
||||
box.lower = isBullish
|
||||
? box.lower
|
||||
: startedBar.low;
|
||||
box.upper =
|
||||
isBullish
|
||||
? startedBar.high
|
||||
: box.upper;
|
||||
|
||||
//
|
||||
box.from = startedBar.time;
|
||||
|
||||
//
|
||||
// Check Box Validation ...
|
||||
|
||||
@@ -399,12 +399,12 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
||||
//
|
||||
hasWaitingZones = workingZone.DetectZone(
|
||||
drawer,
|
||||
consolidationPoiEvents,
|
||||
analysePoiEvents,
|
||||
decisionPoiEvents,
|
||||
analysePoiEvents,
|
||||
consolidationPoiEvents,
|
||||
consolidationState,
|
||||
analyseState,
|
||||
decisionState,
|
||||
analyseState //
|
||||
consolidationState //
|
||||
);
|
||||
|
||||
//
|
||||
@@ -466,13 +466,14 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
||||
|
||||
//
|
||||
// Detect Signal Box ...
|
||||
hasSignalBox = hasWorkingZone &&
|
||||
hasWaitingZones &&
|
||||
workingZone.IsZoneOBRejected(
|
||||
activatedZone,
|
||||
decisionXConditions,
|
||||
zIndex //
|
||||
);
|
||||
hasSignalBox =
|
||||
hasWorkingZone &&
|
||||
hasWaitingZones &&
|
||||
workingZone.IsZoneValidForSignal(
|
||||
activatedZone,
|
||||
decisionXConditions,
|
||||
zIndex //
|
||||
);
|
||||
if (hasSignalBox)
|
||||
{
|
||||
//
|
||||
|
||||
@@ -729,6 +729,7 @@ struct X121SMCStrategyXWZWorkingZone
|
||||
}
|
||||
|
||||
//
|
||||
// TODO: Remove this ...
|
||||
bool IsZoneOBRejected(
|
||||
XOBFVG &zone,
|
||||
X121Conditions &conditions,
|
||||
@@ -797,7 +798,7 @@ struct X121SMCStrategyXWZWorkingZone
|
||||
|
||||
//
|
||||
result = delta == 0 ||
|
||||
delta < points * 2;
|
||||
delta < points * 2;
|
||||
}
|
||||
|
||||
//
|
||||
@@ -821,6 +822,129 @@ struct X121SMCStrategyXWZWorkingZone
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
bool IsZoneValidForSignal(
|
||||
XOBFVG &zone,
|
||||
X121Conditions &conditions,
|
||||
int barIndex = 0 //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
// Cleanup Result ...
|
||||
zone.Clean();
|
||||
|
||||
//
|
||||
// Normalize Bar Index ...
|
||||
if (barIndex < 0)
|
||||
{
|
||||
barIndex = 0;
|
||||
}
|
||||
|
||||
//
|
||||
if (barIndex == 0)
|
||||
{
|
||||
barIndex = 1;
|
||||
}
|
||||
|
||||
//
|
||||
// Validate ...
|
||||
result = IsValid() &&
|
||||
HasWaitingZones();
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
XOHCL bar;
|
||||
result = bar.Init(
|
||||
symbol,
|
||||
period,
|
||||
barIndex //
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
bar.Clean();
|
||||
zone.Clean();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
double peak = conditions.peaksBuffer[1];
|
||||
double vale = conditions.valesBuffer[1];
|
||||
|
||||
//
|
||||
int count = CountWaitingZones();
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
XOBFVG iOBFVG = waitingZones[i];
|
||||
|
||||
//
|
||||
ENUM_X_DIRECTION iDir = iOBFVG.GetDirection();
|
||||
bool isBullish = iOBFVG.IsBullish();
|
||||
|
||||
//
|
||||
XBoxZone iBox;
|
||||
result = iOBFVG.ToZone(iBox);
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
iBox.Clean();
|
||||
iOBFVG.Clean();
|
||||
|
||||
//
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
// XCFVG *fvg;
|
||||
// result = iOBFVG.GetMainFVG(fvg);
|
||||
// if (!result)
|
||||
// {
|
||||
// //
|
||||
// iOBFVG.Clean();
|
||||
// ZeroMemory(fvg);
|
||||
|
||||
// //
|
||||
// continue;
|
||||
// }
|
||||
|
||||
//
|
||||
result =
|
||||
isBullish
|
||||
? vale < iBox.upper &&
|
||||
vale > iBox.lower
|
||||
: peak < iBox.upper &&
|
||||
peak > iBox.lower;
|
||||
if (result)
|
||||
{
|
||||
//
|
||||
zone = iOBFVG;
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
iBox.Clean();
|
||||
iOBFVG.Clean();
|
||||
}
|
||||
|
||||
//
|
||||
result = zone.IsValid();
|
||||
|
||||
//
|
||||
bar.Clean();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
bool IsExists(XOBFVG &zone)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user