139 lines
3.4 KiB
Plaintext
139 lines
3.4 KiB
Plaintext
//
|
|
// Detect New Order Blocks ...
|
|
bool hasNewBullishOB = Contains(
|
|
X_BULLISH_ORDERBLOCK_DETECTED,
|
|
consolidationPoiEvents //
|
|
);
|
|
bool hasNewBearishOB = Contains(
|
|
X_BEARISH_ORDERBLOCK_DETECTED,
|
|
consolidationPoiEvents //
|
|
);
|
|
bool hasNewOB = hasNewBullishOB ||
|
|
hasNewBearishOB;
|
|
result = hasNewOB;
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Make Sure New Order Block Detected ...
|
|
XCOrderBlock *liveOB = NULL;
|
|
if (hasNewBullishOB)
|
|
{
|
|
//
|
|
bool hasBullishOBs = consolidationState.HasBullishOrderBlocks();
|
|
int bullishOBsCount = consolidationState.CountBullishOrderBlocks();
|
|
if (hasBullishOBs)
|
|
{
|
|
liveOB = consolidationState.bullishOrderBlocks[bullishOBsCount - 1];
|
|
}
|
|
}
|
|
else if (hasNewBearishOB)
|
|
{
|
|
//
|
|
bool hasBearishOBs = consolidationState.HasBearishOrderBlocks();
|
|
int bearishOBsCount = consolidationState.CountBearishOrderBlocks();
|
|
if (hasBearishOBs)
|
|
{
|
|
liveOB = consolidationState.bearishOrderBlocks[bearishOBsCount - 1];
|
|
}
|
|
}
|
|
bool hasLiveOB = liveOB != NULL &&
|
|
liveOB.IsValid();
|
|
result = hasLiveOB;
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
bool isLiveOBBullish = liveOB.IsBullish();
|
|
bool isLiveOBBearish = liveOB.IsBearish();
|
|
|
|
//
|
|
ENUM_X_DIRECTION forDir =
|
|
isLiveOBBullish
|
|
? X_DIRECTION_BULLISH
|
|
: X_DIRECTION_BEARISH;
|
|
|
|
//
|
|
XOHCL startedBar;
|
|
ENUM_X_DIRECTION startedDir;
|
|
bool isLiveOBStarted = liveOB.IsStarted(
|
|
forDir,
|
|
startedBar,
|
|
startedDir //
|
|
);
|
|
|
|
//
|
|
XOHCL activatedBar;
|
|
ENUM_X_DIRECTION activatedDir;
|
|
bool isLiveOBActivated = liveOB.IsActivated(
|
|
forDir,
|
|
activatedBar,
|
|
activatedDir //
|
|
);
|
|
|
|
//
|
|
// DRAW ...
|
|
//
|
|
|
|
//
|
|
if (isLiveOBStarted)
|
|
{
|
|
//
|
|
XCOHCLObject *barObj;
|
|
bool isCreated = consolidationCycleHelper
|
|
.mPOIDrawer
|
|
.CreateBar(
|
|
startedBar,
|
|
barObj //
|
|
);
|
|
}
|
|
|
|
//
|
|
if (isLiveOBActivated)
|
|
{
|
|
//
|
|
XCOHCLObject *barObj;
|
|
bool isCreated = consolidationCycleHelper
|
|
.mPOIDrawer
|
|
.CreateBar(
|
|
activatedBar,
|
|
barObj //
|
|
);
|
|
if (isCreated)
|
|
{
|
|
//
|
|
barObj.BodyColor(clrGold);
|
|
barObj.HighShadowColor(clrGold);
|
|
barObj.LowShadowColor(clrGold);
|
|
}
|
|
}
|
|
|
|
//
|
|
// Draw Live OB ...
|
|
if (isLiveOBBullish)
|
|
{
|
|
//
|
|
XCBullishOrderBlockObject *iObj;
|
|
bool isCreated = consolidationCycleHelper
|
|
.mPOIDrawer
|
|
.CreateBullishOrderBlock(
|
|
liveOB,
|
|
iObj //
|
|
);
|
|
}
|
|
else
|
|
{
|
|
//
|
|
XCBearishOrderBlockObject *iObj;
|
|
bool isCreated = consolidationCycleHelper
|
|
.mPOIDrawer
|
|
.CreateBearishOrderBlock(
|
|
liveOB,
|
|
iObj //
|
|
);
|
|
}
|