last ...
This commit is contained in:
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -538,64 +538,9 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
result = hasStartZone;
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
Clean(visionPoiEvents);
|
||||
Clean(analysePoiEvents);
|
||||
Clean(decisionPoiEvents);
|
||||
Clean(visionCycleEvents);
|
||||
Clean(analyseCycleEvents);
|
||||
Clean(decisionCycleEvents);
|
||||
Clean(consolidationPoiEvents);
|
||||
Clean(consolidationCycleEvents);
|
||||
|
||||
//
|
||||
visionState.Clean();
|
||||
analyseState.Clean();
|
||||
decisionZBar.Clean();
|
||||
decisionCBar.Clean();
|
||||
decisionPBar.Clean();
|
||||
decisionState.Clean();
|
||||
visionConditions.Clean();
|
||||
analyseConditions.Clean();
|
||||
visionXConditions.Clean();
|
||||
consolidationState.Clean();
|
||||
decisionConditions.Clean();
|
||||
analyseXConditions.Clean();
|
||||
decisionXConditions.Clean();
|
||||
consolidationConditions.Clean();
|
||||
consolidationXConditions.Clean();
|
||||
|
||||
//
|
||||
RemoveDraws();
|
||||
RemoveWorkingZoneDraws();
|
||||
|
||||
//
|
||||
mConditions.Clean();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
mConditions.UpdateTo(cTime);
|
||||
|
||||
//
|
||||
// Detect Start Zone Conditions ...
|
||||
bool hasCondition = mConditions
|
||||
.startZone
|
||||
.HasCondition(
|
||||
decisionState,
|
||||
zIndex,
|
||||
period //
|
||||
);
|
||||
ENUM_X_DIRECTION conditionsDir = mConditions
|
||||
.startZone
|
||||
.GetDirection();
|
||||
|
||||
//
|
||||
// Detect Condition Priority ...
|
||||
ENUM_X121SMC_XWZ_PRIORITY bullishPriority;
|
||||
@@ -617,8 +562,77 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
||||
? canLookupShort
|
||||
: false;
|
||||
|
||||
//
|
||||
bool hasCondition = false;
|
||||
ENUM_X_DIRECTION conditionsDir = X_DIRECTION_NONE;
|
||||
|
||||
//
|
||||
// Detect Start Zone Based Conditions ...
|
||||
if (hasStartZone)
|
||||
{
|
||||
//
|
||||
// Detect Start Zone Conditions ...
|
||||
hasCondition = mConditions
|
||||
.startZone
|
||||
.HasCondition(
|
||||
decisionState,
|
||||
zIndex,
|
||||
NULL // period //
|
||||
);
|
||||
conditionsDir = mConditions
|
||||
.startZone
|
||||
.GetDirection();
|
||||
}
|
||||
|
||||
//
|
||||
RemoveWorkingZoneDraws();
|
||||
DrawWorkingZone(mConditions, visionCycleHelper.mPOIDrawer);
|
||||
|
||||
//
|
||||
// Detect Supply and Deman Zone Based Conditions ...
|
||||
if (!hasCondition)
|
||||
{
|
||||
//
|
||||
bool isPriceInsideSupplyZone =
|
||||
bearishPriority == X121SMC_XWZ_PRIORITY_STRONG_HIGH;
|
||||
|
||||
//
|
||||
bool isPriceInsideDemandZone =
|
||||
bullishPriority == X121SMC_XWZ_PRIORITY_STRONG_HIGH;
|
||||
|
||||
//
|
||||
bool isPriceInsideSupDem = isPriceInsideSupplyZone ||
|
||||
isPriceInsideDemandZone;
|
||||
if (isPriceInsideSupDem)
|
||||
{
|
||||
//
|
||||
hasCondition = mConditions.HasWorkingZoneConditions(
|
||||
conditionsDir,
|
||||
decisionState //
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
isBullish = IsBullish(conditionsDir);
|
||||
isBearish = IsBearish(conditionsDir);
|
||||
|
||||
//
|
||||
double reward;
|
||||
double amountPercent;
|
||||
ENUM_X121SMC_XWZ_PRIORITY priority =
|
||||
isBullish
|
||||
? bullishPriority
|
||||
: bearishPriority;
|
||||
bool hasRewardAmount = CalculateRiskReward(
|
||||
priority,
|
||||
reward,
|
||||
amountPercent //
|
||||
);
|
||||
|
||||
//
|
||||
result = hasCondition &&
|
||||
hasRewardAmount &&
|
||||
isPriorityPassed &&
|
||||
trend == conditionsDir;
|
||||
if (!result)
|
||||
@@ -658,14 +672,60 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
||||
}
|
||||
|
||||
//
|
||||
// Apply Traget ...
|
||||
switch (priority)
|
||||
{
|
||||
//
|
||||
case X121SMC_XWZ_PRIORITY_STRONG_HIGH:
|
||||
//
|
||||
target =
|
||||
isBullish
|
||||
? mConditions.workingZone.quarter3
|
||||
: mConditions.workingZone.quarter1;
|
||||
break;
|
||||
|
||||
//
|
||||
case X121SMC_XWZ_PRIORITY_HIGH:
|
||||
//
|
||||
target =
|
||||
isBullish
|
||||
? mConditions.workingZone.quarter3
|
||||
: mConditions.workingZone.quarter1;
|
||||
break;
|
||||
|
||||
//
|
||||
case X121SMC_XWZ_PRIORITY_REGULAR:
|
||||
//
|
||||
target =
|
||||
isBullish
|
||||
? mConditions.workingZone.quarter2
|
||||
: mConditions.workingZone.quarter2;
|
||||
break;
|
||||
|
||||
//
|
||||
case X121SMC_XWZ_PRIORITY_LOW:
|
||||
//
|
||||
target =
|
||||
isBullish
|
||||
? mConditions.workingZone.quarter1
|
||||
: mConditions.workingZone.quarter3;
|
||||
break;
|
||||
|
||||
//
|
||||
default:
|
||||
target = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
mConditions.reward = reward;
|
||||
mConditions.target = target;
|
||||
mConditions.setupTime = cTime;
|
||||
mConditions.priority = priority;
|
||||
mConditions.dir = conditionsDir;
|
||||
mConditions.amountPercent = amountPercent;
|
||||
mConditions.pivot = mConditions.GetExit();
|
||||
mConditions.point = mConditions.GetPoint();
|
||||
isBullish = mConditions.startZone.IsBullish();
|
||||
isBearish = mConditions.startZone.IsBearish();
|
||||
result = isBullish ||
|
||||
isBearish;
|
||||
|
||||
//
|
||||
mConditions.UpdateTo(cTime);
|
||||
@@ -869,18 +929,16 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
||||
//
|
||||
isBullish =
|
||||
//
|
||||
isBullish
|
||||
// &&
|
||||
// isPointBreaked
|
||||
isBullish &&
|
||||
isPointBreaked
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
isBearish =
|
||||
//
|
||||
isBearish
|
||||
// &&
|
||||
// isPointBreaked
|
||||
isBearish &&
|
||||
isPointBreaked
|
||||
//
|
||||
;
|
||||
|
||||
@@ -939,7 +997,7 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
||||
|
||||
//
|
||||
double iAtr = decisionXConditions.atrBuffer[1];
|
||||
iAtr *= 1.5;
|
||||
iAtr *= 2;
|
||||
|
||||
//
|
||||
double slsMin = GetMin(sls);
|
||||
@@ -2701,30 +2759,37 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
||||
switch (priority)
|
||||
{
|
||||
//
|
||||
case X121SMC_XWZ_PRIORITY_HIGH:
|
||||
case X121SMC_XWZ_PRIORITY_STRONG_HIGH:
|
||||
//
|
||||
reward = 6;
|
||||
amountPercent = 2;
|
||||
break;
|
||||
|
||||
//
|
||||
case X121SMC_XWZ_PRIORITY_HIGH:
|
||||
//
|
||||
reward = 4;
|
||||
amountPercent = 2;
|
||||
break;
|
||||
|
||||
//
|
||||
case X121SMC_XWZ_PRIORITY_REGULAR:
|
||||
//
|
||||
reward = 6;
|
||||
reward = 3;
|
||||
amountPercent = 1.5;
|
||||
break;
|
||||
|
||||
//
|
||||
case X121SMC_XWZ_PRIORITY_LOW:
|
||||
//
|
||||
reward = 4;
|
||||
reward = 2;
|
||||
amountPercent = 1;
|
||||
break;
|
||||
|
||||
//
|
||||
case X121SMC_XWZ_PRIORITY_WEAK:
|
||||
//
|
||||
reward = 2;
|
||||
reward = 1;
|
||||
amountPercent = 0.5;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -678,6 +678,7 @@ struct X121SMCXWZZone
|
||||
isBullish
|
||||
? supResBoxes[j].lower
|
||||
: supResBoxes[j].upper;
|
||||
|
||||
//
|
||||
// Check Swing Low ...
|
||||
bool isSwingLow =
|
||||
@@ -1167,6 +1168,13 @@ struct X121SMCXWZWorkingZone
|
||||
datetime to;
|
||||
datetime from;
|
||||
|
||||
//
|
||||
XOHCL swingBar;
|
||||
XOHCL breakerBar;
|
||||
XOHCL momentumBar;
|
||||
XOHCL rejectionBar;
|
||||
XBoxZone appliedBox;
|
||||
|
||||
//
|
||||
X121SMCXWZWorkingZone()
|
||||
{
|
||||
@@ -1190,10 +1198,24 @@ struct X121SMCXWZWorkingZone
|
||||
symbol = NULL;
|
||||
period = NULL;
|
||||
|
||||
//
|
||||
CleanConditionBars();
|
||||
|
||||
//
|
||||
ZeroMemory(this);
|
||||
}
|
||||
|
||||
//
|
||||
void CleanConditionBars()
|
||||
{
|
||||
//
|
||||
swingBar.Clean();
|
||||
breakerBar.Clean();
|
||||
appliedBox.Clean();
|
||||
momentumBar.Clean();
|
||||
rejectionBar.Clean();
|
||||
}
|
||||
|
||||
//
|
||||
bool IsValid()
|
||||
{
|
||||
@@ -2004,7 +2026,7 @@ struct X121SMCStrategyXWZSignalConditions
|
||||
//
|
||||
hasTrend =
|
||||
//
|
||||
IsValid(supplyTouch) &&
|
||||
IsValid(supplyTouch) ||
|
||||
IsValid(demandTouch)
|
||||
//
|
||||
;
|
||||
@@ -2037,6 +2059,10 @@ struct X121SMCStrategyXWZSignalConditions
|
||||
//
|
||||
// Find Order Block and FVG for Trend Approve ...
|
||||
|
||||
//
|
||||
bool isBullishTrendApproved = false;
|
||||
bool isBearishTrendApproved = false;
|
||||
|
||||
//
|
||||
// Now We Have to Detect at least One OrderBlock with FVG ...
|
||||
// for Trend Approvement ...
|
||||
@@ -2054,192 +2080,205 @@ struct X121SMCStrategyXWZSignalConditions
|
||||
XCOrderBlock *ob = NULL;
|
||||
|
||||
//
|
||||
if (hasBullishTrend)
|
||||
has = mtfState.HasBullishOrderBlocks();
|
||||
count = mtfState.CountBullishOrderBlocks();
|
||||
|
||||
//
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
has = mtfState.HasBullishOrderBlocks();
|
||||
count = mtfState.CountBullishOrderBlocks();
|
||||
|
||||
//
|
||||
if (has)
|
||||
// Check Order Block ...
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
// Check Order Block ...
|
||||
for (int i = 0; i < count; i++)
|
||||
XCOrderBlock *iOB = mtfState.bullishOrderBlocks[i];
|
||||
|
||||
//
|
||||
iOB.To(cTime);
|
||||
|
||||
//
|
||||
// Check From Passes ...
|
||||
bool isFromPassed = iOB.From() > demandZone.From();
|
||||
if (!isFromPassed)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
// Must inside DemandZone ...
|
||||
bool isInsideDemand = IsInsideDiff(
|
||||
iOB,
|
||||
demandZone //
|
||||
);
|
||||
if (!isInsideDemand)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
// Check Started ...
|
||||
XOHCL startedBar;
|
||||
ENUM_X_DIRECTION startedDir;
|
||||
bool isStarted = iOB.IsStarted(
|
||||
X_DIRECTION_BULLISH,
|
||||
startedBar,
|
||||
startedDir //
|
||||
);
|
||||
if (!isStarted)
|
||||
{
|
||||
//
|
||||
XCOrderBlock *iOB = mtfState.bullishOrderBlocks[i];
|
||||
|
||||
//
|
||||
iOB.To(cTime);
|
||||
|
||||
//
|
||||
// Check From Passes ...
|
||||
bool isFromPassed = iOB.From() > demandZone.From();
|
||||
if (!isFromPassed)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
// Must inside DemandZone ...
|
||||
bool isInsideDemand = IsInsideDiff(
|
||||
iOB,
|
||||
demandZone //
|
||||
);
|
||||
if (!isInsideDemand)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
// Check Started ...
|
||||
XOHCL startedBar;
|
||||
ENUM_X_DIRECTION startedDir;
|
||||
bool isStarted = iOB.IsStarted(
|
||||
X_DIRECTION_BULLISH,
|
||||
startedBar,
|
||||
startedDir //
|
||||
);
|
||||
if (!isStarted)
|
||||
{
|
||||
//
|
||||
startedBar.Clean();
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
// Converts to Box ...
|
||||
XBoxZone obBox;
|
||||
bool hasOBBox = ToBox(
|
||||
obBox,
|
||||
iOB //
|
||||
);
|
||||
if (!hasOBBox)
|
||||
{
|
||||
//
|
||||
obBox.Clean();
|
||||
startedBar.Clean();
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
// Check Zone Must not Used before ...
|
||||
bool isUsed = IsBoxUsed(
|
||||
obBox,
|
||||
startedBar.Index() - 1,
|
||||
zIndex //
|
||||
);
|
||||
if (isUsed)
|
||||
{
|
||||
//
|
||||
obBox.Clean();
|
||||
startedBar.Clean();
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
ob = iOB;
|
||||
startedBar.Clean();
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
// Converts to Box ...
|
||||
XBoxZone obBox;
|
||||
bool hasOBBox = ToBox(
|
||||
obBox,
|
||||
iOB //
|
||||
);
|
||||
if (!hasOBBox)
|
||||
{
|
||||
//
|
||||
obBox.Clean();
|
||||
startedBar.Clean();
|
||||
|
||||
//
|
||||
break;
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
// Detect Fair Value Gap ...
|
||||
if (ob != NULL &&
|
||||
ob.IsValid())
|
||||
// Check Zone Must not Used before ...
|
||||
bool isUsed = IsBoxUsed(
|
||||
obBox,
|
||||
startedBar.Index() - 1,
|
||||
zIndex //
|
||||
);
|
||||
if (isUsed)
|
||||
{
|
||||
//
|
||||
has = stfState.HasBullishFairValueGaps();
|
||||
count = stfState.CountBullishFairValueGaps();
|
||||
if (has)
|
||||
obBox.Clean();
|
||||
startedBar.Clean();
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
ob = iOB;
|
||||
|
||||
//
|
||||
obBox.Clean();
|
||||
startedBar.Clean();
|
||||
|
||||
//
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Detect Fair Value Gap ...
|
||||
if (ob != NULL &&
|
||||
ob.IsValid())
|
||||
{
|
||||
//
|
||||
has = stfState.HasBullishFairValueGaps();
|
||||
count = stfState.CountBullishFairValueGaps();
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
// Check Fir Value Gap ...
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
// Check Fir Value Gap ...
|
||||
for (int i = 0; i < count; i++)
|
||||
XCFVG *iFVG = stfState.bullishFairValueGaps[i];
|
||||
|
||||
//
|
||||
iFVG.To(cTime);
|
||||
|
||||
//
|
||||
// Check From Passes ...
|
||||
bool isFromPassed = iFVG.From() > ob.From();
|
||||
if (!isFromPassed)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
// Check Started ...
|
||||
XOHCL startedBar;
|
||||
ENUM_X_DIRECTION startedDir;
|
||||
bool isStarted = iFVG.IsStarted(
|
||||
X_DIRECTION_BULLISH,
|
||||
startedBar,
|
||||
startedDir //
|
||||
);
|
||||
if (!isStarted)
|
||||
{
|
||||
//
|
||||
XCFVG *iFVG = stfState.bullishFairValueGaps[i];
|
||||
|
||||
//
|
||||
iFVG.To(cTime);
|
||||
|
||||
//
|
||||
// Check From Passes ...
|
||||
bool isFromPassed = iFVG.From() > ob.From();
|
||||
if (!isFromPassed)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
// Check Started ...
|
||||
XOHCL startedBar;
|
||||
ENUM_X_DIRECTION startedDir;
|
||||
bool isStarted = iFVG.IsStarted(
|
||||
X_DIRECTION_BULLISH,
|
||||
startedBar,
|
||||
startedDir //
|
||||
);
|
||||
if (!isStarted)
|
||||
{
|
||||
//
|
||||
startedBar.Clean();
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
// Converts to Box ...
|
||||
XBoxZone fvgBox;
|
||||
bool hasFVGBox = ToBox(
|
||||
fvgBox,
|
||||
iFVG //
|
||||
);
|
||||
if (!hasFVGBox)
|
||||
{
|
||||
//
|
||||
fvgBox.Clean();
|
||||
startedBar.Clean();
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
// Check Inside Order Block ...
|
||||
bool isInside = IsInsideDiff(
|
||||
iFVG,
|
||||
ob,
|
||||
true // Force Side Out ...
|
||||
);
|
||||
if (!isInside)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
fvg = iFVG;
|
||||
startedBar.Clean();
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
// Converts to Box ...
|
||||
XBoxZone fvgBox;
|
||||
bool hasFVGBox = ToBox(
|
||||
fvgBox,
|
||||
iFVG //
|
||||
);
|
||||
if (!hasFVGBox)
|
||||
{
|
||||
//
|
||||
fvgBox.Clean();
|
||||
startedBar.Clean();
|
||||
|
||||
//
|
||||
break;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
//
|
||||
ob = NULL;
|
||||
// Check Inside Order Block ...
|
||||
bool isInside = IsInsideDiff(
|
||||
iFVG,
|
||||
ob,
|
||||
true // Force Side Out ...
|
||||
);
|
||||
if (!isInside)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
fvg = iFVG;
|
||||
|
||||
//
|
||||
fvgBox.Clean();
|
||||
startedBar.Clean();
|
||||
|
||||
//
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
ob = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
if (ob != NULL &&
|
||||
fvg != NULL)
|
||||
{
|
||||
//
|
||||
orderBlock = ob;
|
||||
fairValueGap = fvg;
|
||||
}
|
||||
|
||||
//
|
||||
hasOrderBlock = HasOrderBlock();
|
||||
hasFairValueGap = HasFairValueGap();
|
||||
isBullishTrendApproved = hasOrderBlock &&
|
||||
hasFairValueGap;
|
||||
}
|
||||
else if (hasBearishTrend)
|
||||
|
||||
//
|
||||
if (!isBullishTrendApproved)
|
||||
{
|
||||
//
|
||||
has = mtfState.HasBearishOrderBlocks();
|
||||
@@ -2422,28 +2461,32 @@ struct X121SMCStrategyXWZSignalConditions
|
||||
ob = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
if (ob != NULL &&
|
||||
fvg != NULL)
|
||||
{
|
||||
//
|
||||
orderBlock = ob;
|
||||
fairValueGap = fvg;
|
||||
}
|
||||
|
||||
//
|
||||
hasOrderBlock = HasOrderBlock();
|
||||
hasFairValueGap = HasFairValueGap();
|
||||
isBearishTrendApproved = hasOrderBlock &&
|
||||
hasFairValueGap;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
if (ob != NULL &&
|
||||
fvg != NULL)
|
||||
{
|
||||
//
|
||||
orderBlock = ob;
|
||||
fairValueGap = fvg;
|
||||
}
|
||||
|
||||
//
|
||||
hasOrderBlock = HasOrderBlock();
|
||||
hasFairValueGap = HasFairValueGap();
|
||||
}
|
||||
|
||||
//
|
||||
// Check Trend Approved ...
|
||||
bool isTrendApproved =
|
||||
hasOrderBlock &&
|
||||
hasFairValueGap;
|
||||
hasFairValueGap &&
|
||||
(isBullishTrendApproved ||
|
||||
isBearishTrendApproved);
|
||||
result = isTrendApproved;
|
||||
if (!result)
|
||||
{
|
||||
@@ -2634,7 +2677,7 @@ struct X121SMCStrategyXWZSignalConditions
|
||||
//
|
||||
result =
|
||||
//
|
||||
IsValid(supplyTouch) &&
|
||||
IsValid(supplyTouch) ||
|
||||
IsValid(demandTouch)
|
||||
//
|
||||
;
|
||||
@@ -2819,10 +2862,54 @@ struct X121SMCStrategyXWZSignalConditions
|
||||
//
|
||||
bool hasOBFVG = startZone.HasOB() &&
|
||||
startZone.HasFVG();
|
||||
bool isOBStarted = false;
|
||||
bool isFVGStarted = false;
|
||||
bool isOBActivated = false;
|
||||
bool isFVGActivated = false;
|
||||
bool isOBInsideFVG = false;
|
||||
bool isFVGInsideOB = false;
|
||||
if (hasOBFVG)
|
||||
{
|
||||
//
|
||||
|
||||
//
|
||||
ENUM_X_DIRECTION forDir = startZone.ob.GetDirection();
|
||||
|
||||
//
|
||||
XOHCL startedBar;
|
||||
ENUM_X_DIRECTION startedDir;
|
||||
|
||||
//
|
||||
isOBStarted = startZone.ob.IsStarted(
|
||||
forDir,
|
||||
startedBar,
|
||||
startedDir //
|
||||
);
|
||||
|
||||
//
|
||||
isOBActivated = startZone.ob.IsActivated(
|
||||
forDir,
|
||||
startedBar,
|
||||
startedDir //
|
||||
);
|
||||
|
||||
//
|
||||
forDir = startZone.fvg.GetDirection();
|
||||
|
||||
//
|
||||
isFVGStarted = startZone.fvg.IsStarted(
|
||||
forDir,
|
||||
startedBar,
|
||||
startedDir //
|
||||
);
|
||||
|
||||
//
|
||||
isFVGActivated = startZone.fvg.IsActivated(
|
||||
forDir,
|
||||
startedBar,
|
||||
startedDir //
|
||||
);
|
||||
|
||||
//
|
||||
isOBInsideFVG =
|
||||
IsInsideDiff(
|
||||
@@ -2857,10 +2944,17 @@ struct X121SMCStrategyXWZSignalConditions
|
||||
startZone.ob,
|
||||
true // IgnoreInside
|
||||
));
|
||||
|
||||
//
|
||||
startedBar.Clean();
|
||||
}
|
||||
|
||||
//
|
||||
result =
|
||||
isOBStarted &&
|
||||
isFVGStarted &&
|
||||
isOBActivated &&
|
||||
isFVGActivated &&
|
||||
startZone.IsValid() &&
|
||||
(isOBInsideFVG ||
|
||||
isFVGInsideOB) &&
|
||||
@@ -3008,6 +3102,150 @@ struct X121SMCStrategyXWZSignalConditions
|
||||
cBar.Clean();
|
||||
}
|
||||
|
||||
//
|
||||
bool HasWorkingZoneConditions(
|
||||
ENUM_X_DIRECTION &conditionsDir,
|
||||
XPOIState &state,
|
||||
int barIndex = 0,
|
||||
ENUM_TIMEFRAMES forPeriod = NULL //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
if (barIndex < 0)
|
||||
{
|
||||
barIndex = 0;
|
||||
}
|
||||
|
||||
//
|
||||
conditionsDir = X_DIRECTION_NONE;
|
||||
|
||||
//
|
||||
result = HasWorkingZone();
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
XBoxZone appliedBox;
|
||||
|
||||
//
|
||||
// Clean Condition Bars ...
|
||||
workingZone.CleanConditionBars();
|
||||
|
||||
//
|
||||
// Validate ...
|
||||
result = state.IsValid() &&
|
||||
state.HasChild();
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
workingZone.CleanConditionBars();
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
if (!IsValid(forPeriod))
|
||||
{
|
||||
forPeriod = period;
|
||||
}
|
||||
|
||||
//
|
||||
datetime cTime = iTime(
|
||||
symbol,
|
||||
forPeriod,
|
||||
barIndex //
|
||||
);
|
||||
|
||||
//
|
||||
// Check Supply Zone ...
|
||||
|
||||
//
|
||||
XBoxZone supplyBox;
|
||||
bool hasSupplyBox =
|
||||
supplyZone != NULL &&
|
||||
supplyZone.IsValid() &&
|
||||
ToBox(
|
||||
supplyBox,
|
||||
supplyZone //
|
||||
);
|
||||
if (hasSupplyBox)
|
||||
{
|
||||
//
|
||||
result = CheckBoxForTradeConditions(
|
||||
supplyBox,
|
||||
appliedBox,
|
||||
workingZone.swingBar,
|
||||
workingZone.breakerBar,
|
||||
workingZone.rejectionBar,
|
||||
workingZone.momentumBar,
|
||||
state,
|
||||
barIndex,
|
||||
forPeriod //
|
||||
);
|
||||
|
||||
//
|
||||
if (result)
|
||||
{
|
||||
conditionsDir = X_DIRECTION_BEARISH;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Check Demand Zone ...
|
||||
XBoxZone demandBox;
|
||||
bool hasDemandBox = false;
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
hasDemandBox =
|
||||
demandZone != NULL &&
|
||||
demandZone.IsValid() &&
|
||||
ToBox(
|
||||
demandBox,
|
||||
demandZone //
|
||||
);
|
||||
if (hasDemandBox)
|
||||
{
|
||||
//
|
||||
result = CheckBoxForTradeConditions(
|
||||
demandBox,
|
||||
appliedBox,
|
||||
workingZone.swingBar,
|
||||
workingZone.breakerBar,
|
||||
workingZone.rejectionBar,
|
||||
workingZone.momentumBar,
|
||||
state,
|
||||
barIndex,
|
||||
forPeriod //
|
||||
);
|
||||
|
||||
//
|
||||
if (result)
|
||||
{
|
||||
conditionsDir = X_DIRECTION_BULLISH;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
if (!result)
|
||||
{
|
||||
workingZone.CleanConditionBars();
|
||||
}
|
||||
|
||||
//
|
||||
supplyBox.Clean();
|
||||
demandBox.Clean();
|
||||
appliedBox.Clean();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
double GetEntry()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user