last ...
This commit is contained in:
@@ -55,6 +55,16 @@ struct X121SMCStrategyXOBSSignalConditions
|
||||
double point;
|
||||
|
||||
//
|
||||
// Extwnsion ...
|
||||
|
||||
//
|
||||
datetime vOBAt;
|
||||
XCOrderBlock *vOB;
|
||||
bool isVOBActivated;
|
||||
|
||||
//
|
||||
datetime cOBAt;
|
||||
XCOrderBlock *cOB;
|
||||
|
||||
//
|
||||
// Constructor ...
|
||||
@@ -178,6 +188,15 @@ struct X121SMCStrategyXOBSSignalConditions
|
||||
point = 0;
|
||||
|
||||
//
|
||||
vOB = NULL;
|
||||
cOB = NULL;
|
||||
|
||||
//
|
||||
vOBAt = NULL;
|
||||
cOBAt = NULL;
|
||||
|
||||
//
|
||||
isVOBActivated = false;
|
||||
}
|
||||
|
||||
//
|
||||
@@ -414,6 +433,21 @@ bool DetectX121SMCXOBSSignalSetup(
|
||||
//
|
||||
// Detect Trend ...
|
||||
|
||||
//
|
||||
// Vision ...
|
||||
ENUM_X_DIRECTION visionTrendDir;
|
||||
bool hasVisionTrend =
|
||||
visionCycleHelper
|
||||
.DetectMarketStructure(
|
||||
visionTrendDir //
|
||||
);
|
||||
bool hasVisionBullishTrend =
|
||||
hasVisionTrend &&
|
||||
IsBullish(visionTrendDir);
|
||||
bool hasVisionBearishTrend =
|
||||
hasVisionTrend &&
|
||||
IsBearish(visionTrendDir);
|
||||
|
||||
//
|
||||
// Consolidation ...
|
||||
ENUM_X_DIRECTION consolidationTrendDir;
|
||||
@@ -692,7 +726,167 @@ bool DetectX121SMCXOBSSignalSetup(
|
||||
;
|
||||
|
||||
//
|
||||
// Detect Cycle State ...
|
||||
// Detect OrderBlocks ...
|
||||
|
||||
//
|
||||
bool hasVOB =
|
||||
conditions.vOB != NULL &&
|
||||
conditions.vOB.IsValid() &&
|
||||
IsValid(conditions.vOBAt);
|
||||
|
||||
//
|
||||
bool hasCOB =
|
||||
conditions.cOB != NULL &&
|
||||
conditions.cOB.IsValid() &&
|
||||
IsValid(conditions.cOBAt);
|
||||
|
||||
//
|
||||
if (!hasVOB)
|
||||
{
|
||||
//
|
||||
int poiEvntsCount = ArraySize(visionPoiEvents);
|
||||
bool hasEvent = IsValidSize(poiEvntsCount);
|
||||
if (hasEvent)
|
||||
{
|
||||
//
|
||||
bool hasNewBullOB = Contains(
|
||||
X_BULLISH_ORDERBLOCK_DETECTED,
|
||||
visionPoiEvents //
|
||||
);
|
||||
|
||||
//
|
||||
bool hasNewBearOB = Contains(
|
||||
X_BEARISH_ORDERBLOCK_DETECTED,
|
||||
visionPoiEvents //
|
||||
);
|
||||
|
||||
//
|
||||
bool hasNewOB =
|
||||
hasNewBullOB ||
|
||||
hasNewBearOB;
|
||||
|
||||
//
|
||||
if (hasNewOB)
|
||||
{
|
||||
//
|
||||
if (hasNewBullOB)
|
||||
{
|
||||
//
|
||||
int lastIDX = visionState.CountBullishOrderBlocks() - 1;
|
||||
conditions.vOB = visionState.bullishOrderBlocks[lastIDX];
|
||||
}
|
||||
else if (hasNewBearOB)
|
||||
{
|
||||
//
|
||||
int lastIDX = visionState.CountBearishOrderBlocks() - 1;
|
||||
conditions.vOB = visionState.bearishOrderBlocks[lastIDX];
|
||||
}
|
||||
|
||||
//
|
||||
conditions.vOBAt = cTime;
|
||||
|
||||
//
|
||||
hasVOB =
|
||||
conditions.vOB != NULL &&
|
||||
conditions.vOB.IsValid() &&
|
||||
IsValid(conditions.vOBAt);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
X121SMCCycleState vState;
|
||||
bool hasVState = visionCycleHelper.GetCycleState(vState);
|
||||
|
||||
//
|
||||
bool hasYoungestOB = vState.GetYoungestOB(conditions.vOB);
|
||||
if (hasYoungestOB)
|
||||
{
|
||||
//
|
||||
conditions.vOBAt = cTime;
|
||||
|
||||
//
|
||||
hasVOB =
|
||||
conditions.vOB != NULL &&
|
||||
conditions.vOB.IsValid() &&
|
||||
IsValid(conditions.vOBAt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Update To Time ...
|
||||
if (hasVOB)
|
||||
{
|
||||
//
|
||||
conditions.vOB.To(cTime);
|
||||
}
|
||||
|
||||
//
|
||||
// Vait for Order Block Activation ...
|
||||
if (hasVOB &&
|
||||
!conditions.isVOBActivated)
|
||||
{
|
||||
//
|
||||
conditions.isVOBActivated =
|
||||
//
|
||||
cBar.low >= conditions.vOB.Lower() &&
|
||||
cBar.high <= conditions.vOB.Upper() &&
|
||||
//
|
||||
bid >= conditions.vOB.Lower() &&
|
||||
bid <= conditions.vOB.Upper()
|
||||
//
|
||||
;
|
||||
}
|
||||
|
||||
//
|
||||
// Check Result ...
|
||||
result = hasVOB &&
|
||||
conditions.isVOBActivated;
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Check Market Trend ...
|
||||
bool isTrendOveralBullish = hasVisionBullishTrend &&
|
||||
hasConsolidationBullishTrend;
|
||||
bool isTrendOveralBearish = hasVisionBearishTrend &&
|
||||
hasConsolidationBearishTrend;
|
||||
result = (isTrendOveralBullish &&
|
||||
!isTrendOveralBearish) ||
|
||||
(!isTrendOveralBullish &&
|
||||
isTrendOveralBearish);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
bool isBullishOB = conditions.vOB.IsBullish();
|
||||
if (isBullishOB)
|
||||
{
|
||||
//
|
||||
XCBullishOrderBlockObject *iObj;
|
||||
bool isCreated = visionCycleHelper
|
||||
.mPOIDrawer
|
||||
.CreateBullishOrderBlock(
|
||||
conditions.vOB,
|
||||
iObj //
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
XCBearishOrderBlockObject *iObj;
|
||||
bool isCreated = visionCycleHelper
|
||||
.mPOIDrawer
|
||||
.CreateBearishOrderBlock(
|
||||
conditions.vOB,
|
||||
iObj //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
double upper = 0;
|
||||
|
||||
Reference in New Issue
Block a user