last ...
This commit is contained in:
@@ -386,6 +386,132 @@ struct XOBFVG
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
bool IsValidZone(
|
||||
XOHCL &invalidBar,
|
||||
int barIndex = 0 //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
if (barIndex < 0)
|
||||
{
|
||||
barIndex = 0;
|
||||
}
|
||||
|
||||
//
|
||||
invalidBar.Clean();
|
||||
|
||||
//
|
||||
result = IsValid();
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
XCFVG *fvg;
|
||||
result = GetMainFVG(fvg);
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
ZeroMemory(fvg);
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
XOHCL startedBar;
|
||||
bool isBodyOut = false;
|
||||
result = fvg.IsStarted(
|
||||
fvg.GetDirection(),
|
||||
startedBar,
|
||||
isBodyOut //
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
ZeroMemory(fvg);
|
||||
startedBar.Clean();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
XOHCL bar;
|
||||
bool isBullish = fvg.IsBullish();
|
||||
|
||||
//
|
||||
int fromIndex = iBarShift(
|
||||
fvg.GetSymbol(),
|
||||
fvg.GetPeriod(),
|
||||
startedBar.NextAt() //
|
||||
);
|
||||
result = IsValidIndex(fromIndex);
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
bar.Clean();
|
||||
ZeroMemory(fvg);
|
||||
startedBar.Clean();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
bool isInited = false;
|
||||
for (int i = barIndex; i < fromIndex; i++)
|
||||
{
|
||||
//
|
||||
isInited = bar.Init(
|
||||
fvg.GetSymbol(),
|
||||
fvg.GetPeriod(),
|
||||
i //
|
||||
);
|
||||
if (!isInited)
|
||||
{
|
||||
//
|
||||
bar.Clean();
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
bool isBarAbove =
|
||||
bar.low > fvg.Upper();
|
||||
bool isBarBelow =
|
||||
bar.high < fvg.Lower();
|
||||
|
||||
//
|
||||
result =
|
||||
isBullish
|
||||
? isBarAbove
|
||||
: isBarBelow;
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
invalidBar = bar;
|
||||
bar.Clean();
|
||||
|
||||
//
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
bar.Clean();
|
||||
}
|
||||
|
||||
//
|
||||
bar.Clean();
|
||||
ZeroMemory(fvg);
|
||||
startedBar.Clean();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
bool ToZone(XBoxZone &box)
|
||||
{
|
||||
@@ -3926,7 +4052,7 @@ bool ToZoneBox(
|
||||
: box.upper;
|
||||
|
||||
//
|
||||
box.from = startedBar.time;
|
||||
box.from = startedBar.NextAt();
|
||||
|
||||
//
|
||||
// Check Box Validation ...
|
||||
|
||||
@@ -406,6 +406,13 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
||||
analyseState,
|
||||
consolidationState //
|
||||
);
|
||||
if (hasWaitingZones)
|
||||
{
|
||||
//
|
||||
// Validate Waiting Zones ...
|
||||
workingZone.ValidateWaitingZones(zIndex);
|
||||
hasWaitingZones = HasChild(workingZone.waitingZones);
|
||||
}
|
||||
|
||||
//
|
||||
// Checking Working Zone Destory or not ...
|
||||
|
||||
@@ -605,6 +605,83 @@ struct X121SMCStrategyXWZWorkingZone
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
int ValidateWaitingZones(
|
||||
int barIndex = 0 //
|
||||
)
|
||||
{
|
||||
//
|
||||
int result = 0;
|
||||
|
||||
//
|
||||
bool has = false;
|
||||
|
||||
//
|
||||
if (barIndex < 0)
|
||||
{
|
||||
barIndex = 0;
|
||||
}
|
||||
|
||||
//
|
||||
has = IsValid() &&
|
||||
HasWaitingZones();
|
||||
if (!has)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
int removeIDX[];
|
||||
result = CountWaitingZones();
|
||||
for (int i = 0; i < result; i++)
|
||||
{
|
||||
//
|
||||
XOBFVG iOBFVG = waitingZones[i];
|
||||
|
||||
//
|
||||
XOHCL iInvalidBar;
|
||||
has = iOBFVG.IsValidZone(
|
||||
iInvalidBar,
|
||||
barIndex //
|
||||
);
|
||||
if (!has)
|
||||
{
|
||||
//
|
||||
Add(
|
||||
i,
|
||||
removeIDX //
|
||||
);
|
||||
|
||||
//
|
||||
AddRef(
|
||||
iOBFVG,
|
||||
unavailableZones //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
iInvalidBar.Clean();
|
||||
}
|
||||
|
||||
//
|
||||
has = HasChild(removeIDX);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
CleanupArray(
|
||||
removeIDX,
|
||||
waitingZones //
|
||||
);
|
||||
}
|
||||
Clean(removeIDX);
|
||||
|
||||
//
|
||||
result = CountWaitingZones();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
bool IsZoneRejected(
|
||||
XOBFVG &zone,
|
||||
|
||||
Reference in New Issue
Block a user