last ...
This commit is contained in:
@@ -71,6 +71,7 @@ struct X121SMCStrategyXWZWorkingZone
|
||||
|
||||
//
|
||||
XOBFVG waitingZones[];
|
||||
XOBFVG unavailableZones[];
|
||||
|
||||
//
|
||||
CArrayObj mDrawnObjects;
|
||||
@@ -449,7 +450,8 @@ struct X121SMCStrategyXWZWorkingZone
|
||||
// Detect OB FVG ...
|
||||
result =
|
||||
hasNewOrderBlock &&
|
||||
hasNewFairValueGap;
|
||||
hasNewFairValueGap &&
|
||||
ob.GetDirection() == fvg.GetDirection();
|
||||
if (result)
|
||||
{
|
||||
//
|
||||
@@ -461,13 +463,8 @@ struct X121SMCStrategyXWZWorkingZone
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
// Check Item Is not Exists ...
|
||||
idx = FindIndex(
|
||||
obFVG,
|
||||
waitingZones //
|
||||
);
|
||||
has = !IsValidIndex(idx);
|
||||
if (has)
|
||||
has = IsExists(obFVG);
|
||||
if (!has)
|
||||
{
|
||||
//
|
||||
// New Waiting Zone ...
|
||||
@@ -479,8 +476,18 @@ struct X121SMCStrategyXWZWorkingZone
|
||||
else
|
||||
{
|
||||
//
|
||||
// Update Exists Waiting Zone ...
|
||||
waitingZones[idx].AddFVG(fvg);
|
||||
// Check Item Is not Exists ...
|
||||
idx = FindIndex(
|
||||
obFVG,
|
||||
waitingZones //
|
||||
);
|
||||
has = !IsValidIndex(idx);
|
||||
if (!has)
|
||||
{
|
||||
//
|
||||
// Update Exists Waiting Zone ...
|
||||
waitingZones[idx].AddFVG(fvg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -591,8 +598,177 @@ struct X121SMCStrategyXWZWorkingZone
|
||||
//
|
||||
ZeroMemory(ob);
|
||||
ZeroMemory(fvg);
|
||||
ZeroMemory(supplyZone);
|
||||
ZeroMemory(demandZone);
|
||||
ZeroMemory(supply);
|
||||
ZeroMemory(demand);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
bool IsZoneRejected(
|
||||
XOBFVG &zone,
|
||||
int barIndex = 0 //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
// Cleanup Result ...
|
||||
zone.Clean();
|
||||
|
||||
//
|
||||
// Normalize Bar Index ...
|
||||
if (barIndex < 0)
|
||||
{
|
||||
barIndex = 0;
|
||||
}
|
||||
|
||||
//
|
||||
// Validate ...
|
||||
result = IsValid() &&
|
||||
HasWaitingZones();
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Detecting Rejected Waiting Zone ...
|
||||
int count = CountWaitingZones();
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
// Detecting XBoxZone Area of Waiting Zone ...
|
||||
XBoxZone iBox;
|
||||
bool hasBox = waitingZones[i]
|
||||
.ToZone(iBox);
|
||||
if (hasBox)
|
||||
{
|
||||
//
|
||||
// Check Zone Rejection ...
|
||||
int fromIDX = iBarShift(
|
||||
iBox.symbol,
|
||||
period,
|
||||
iBox.from //
|
||||
);
|
||||
bool has = IsValidIndex(fromIDX);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
// Looking for Rejection ...
|
||||
bool isBullish = iBox.IsBullish();
|
||||
for (int j = barIndex; j < fromIDX; j++)
|
||||
{
|
||||
//
|
||||
XOHCL iBar;
|
||||
has = iBar.Init(
|
||||
iBox.symbol,
|
||||
period,
|
||||
j //
|
||||
);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
// Checking Box Rejected ...
|
||||
|
||||
//
|
||||
bool isLowerReject =
|
||||
//
|
||||
isBullish &&
|
||||
(iBar.low < iBox.upper &&
|
||||
iBar.GetDown() > iBox.upper)
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
bool isUpperReject =
|
||||
//
|
||||
!isBullish &&
|
||||
(iBar.high > iBox.lower &&
|
||||
iBar.GetUp() < iBox.lower)
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
bool isRejected =
|
||||
isLowerReject ||
|
||||
isUpperReject;
|
||||
result = isRejected;
|
||||
if (result)
|
||||
{
|
||||
//
|
||||
iBar.Clean();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
iBar.Clean();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Validate Result ...
|
||||
if (result)
|
||||
{
|
||||
//
|
||||
iBox.Clean();
|
||||
zone = waitingZones[i];
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
iBox.Clean();
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
bool IsExists(XOBFVG &zone)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
// Check Validation ...
|
||||
result = HasWaitingZones() ||
|
||||
HasUnavailableZones();
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
int idx = -1;
|
||||
|
||||
//
|
||||
// Check Index in Waiting Zones ...
|
||||
idx = FindIndex(
|
||||
zone,
|
||||
waitingZones //
|
||||
);
|
||||
result = !IsValidIndex(idx);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Check Index in Unavailable Zones ...
|
||||
idx = FindIndex(
|
||||
zone,
|
||||
unavailableZones //
|
||||
);
|
||||
result = !IsValidIndex(idx);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
@@ -957,7 +1133,8 @@ struct X121SMCStrategyXWZWorkingZone
|
||||
XCPOIDrawer *drawer,
|
||||
bool drawSupplyZone = false,
|
||||
bool drawDemandZone = false,
|
||||
bool drawWaitingZones = false //
|
||||
bool drawWaitingZones = false,
|
||||
bool drawWaitingZonesBoxArea = false //
|
||||
)
|
||||
{
|
||||
//
|
||||
@@ -1220,6 +1397,32 @@ struct X121SMCStrategyXWZWorkingZone
|
||||
mDrawnObjects.Add(iObjects[j]);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
if (drawWaitingZonesBoxArea)
|
||||
{
|
||||
//
|
||||
XBoxZone iBox;
|
||||
has = waitingZones[i].ToZone(
|
||||
iBox //
|
||||
);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
XCBoxObject *iBoxObj;
|
||||
has = drawer.DrawBox(
|
||||
iBox,
|
||||
iBoxObj //
|
||||
);
|
||||
if (has)
|
||||
{
|
||||
mDrawnObjects.Add(iBoxObj);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
iBox.Clean();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1257,6 +1460,18 @@ struct X121SMCStrategyXWZWorkingZone
|
||||
return ArraySize(waitingZones);
|
||||
}
|
||||
|
||||
//
|
||||
bool HasUnavailableZones()
|
||||
{
|
||||
return HasChild(unavailableZones);
|
||||
}
|
||||
|
||||
//
|
||||
int CounUnavailableZones()
|
||||
{
|
||||
return ArraySize(unavailableZones);
|
||||
}
|
||||
|
||||
//
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user