last ...
This commit is contained in:
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -374,7 +374,9 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
|||||||
//
|
//
|
||||||
bool hasStartZone = mConditions.DetectStartZones(
|
bool hasStartZone = mConditions.DetectStartZones(
|
||||||
trend,
|
trend,
|
||||||
|
consolidationState,
|
||||||
analyseState,
|
analyseState,
|
||||||
|
decisionState,
|
||||||
decisionCycleHelper //
|
decisionCycleHelper //
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -639,8 +641,8 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
|||||||
result = hasConditions &&
|
result = hasConditions &&
|
||||||
hasRewardAmount &&
|
hasRewardAmount &&
|
||||||
isPriorityPassed &&
|
isPriorityPassed &&
|
||||||
trend == conditionsDir &&
|
trend == conditionsDir; // &&
|
||||||
isConsolidationZonePassed;
|
// isConsolidationZonePassed;
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -741,7 +743,7 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
|||||||
XC121SMCCycleHelper *consolidationCycleHelper,
|
XC121SMCCycleHelper *consolidationCycleHelper,
|
||||||
XC121SMCCycleHelper *visionCycleHelper,
|
XC121SMCCycleHelper *visionCycleHelper,
|
||||||
//
|
//
|
||||||
int maxAllowedSetupAge = 60
|
int maxAllowedSetupAge = 30
|
||||||
//
|
//
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@@ -896,7 +898,8 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
|||||||
isBullish =
|
isBullish =
|
||||||
//
|
//
|
||||||
isBullish &&
|
isBullish &&
|
||||||
isPointBreaked
|
isPointBreaked &&
|
||||||
|
cBar.IsBullish()
|
||||||
//
|
//
|
||||||
;
|
;
|
||||||
|
|
||||||
@@ -904,7 +907,8 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
|||||||
isBearish =
|
isBearish =
|
||||||
//
|
//
|
||||||
isBearish &&
|
isBearish &&
|
||||||
isPointBreaked
|
isPointBreaked &&
|
||||||
|
cBar.IsBearish()
|
||||||
//
|
//
|
||||||
;
|
;
|
||||||
|
|
||||||
@@ -961,6 +965,9 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
|||||||
sls //
|
sls //
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// TODO: Add Consolidation Zone for SLs ...
|
||||||
|
|
||||||
//
|
//
|
||||||
double iAtr = decisionXConditions.atrBuffer[1];
|
double iAtr = decisionXConditions.atrBuffer[1];
|
||||||
iAtr *= 2;
|
iAtr *= 2;
|
||||||
@@ -2315,77 +2322,77 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
// //
|
||||||
bool hasSupply = conditions.startZones[i].HasSupply();
|
// bool hasSupply = conditions.startZones[i].HasSupply();
|
||||||
if (hasSupply)
|
// if (hasSupply)
|
||||||
{
|
// {
|
||||||
//
|
// //
|
||||||
XCSupplyZoneObject *iObj;
|
// XCSupplyZoneObject *iObj;
|
||||||
isCreated = drawer.CreateSupplyZone(
|
// isCreated = drawer.CreateSupplyZone(
|
||||||
conditions.startZones[i].supply,
|
// conditions.startZones[i].supply,
|
||||||
iObj //
|
// iObj //
|
||||||
);
|
// );
|
||||||
|
|
||||||
//
|
// //
|
||||||
if (isCreated)
|
// if (isCreated)
|
||||||
{
|
// {
|
||||||
mObjects.Add(iObj);
|
// mObjects.Add(iObj);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
//
|
// //
|
||||||
bool hasDemand = conditions.startZones[i].HasDemand();
|
// bool hasDemand = conditions.startZones[i].HasDemand();
|
||||||
if (hasDemand)
|
// if (hasDemand)
|
||||||
{
|
// {
|
||||||
//
|
// //
|
||||||
XCDemandZoneObject *iObj;
|
// XCDemandZoneObject *iObj;
|
||||||
isCreated = drawer.CreateDemandZone(
|
// isCreated = drawer.CreateDemandZone(
|
||||||
conditions.startZones[i].demand,
|
// conditions.startZones[i].demand,
|
||||||
iObj //
|
// iObj //
|
||||||
);
|
// );
|
||||||
|
|
||||||
//
|
// //
|
||||||
if (isCreated)
|
// if (isCreated)
|
||||||
{
|
// {
|
||||||
mObjects.Add(iObj);
|
// mObjects.Add(iObj);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
//
|
// //
|
||||||
bool hasSupport = conditions.startZones[i].HasSupport();
|
// bool hasSupport = conditions.startZones[i].HasSupport();
|
||||||
if (hasSupport)
|
// if (hasSupport)
|
||||||
{
|
// {
|
||||||
//
|
// //
|
||||||
XCSupportZoneObject *iObj;
|
// XCSupportZoneObject *iObj;
|
||||||
isCreated = drawer.CreateSupportZone(
|
// isCreated = drawer.CreateSupportZone(
|
||||||
conditions.startZones[i].support,
|
// conditions.startZones[i].support,
|
||||||
iObj //
|
// iObj //
|
||||||
);
|
// );
|
||||||
|
|
||||||
//
|
// //
|
||||||
if (isCreated)
|
// if (isCreated)
|
||||||
{
|
// {
|
||||||
mObjects.Add(iObj);
|
// mObjects.Add(iObj);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
//
|
// //
|
||||||
bool hasResistance = conditions.startZones[i].HasResistance();
|
// bool hasResistance = conditions.startZones[i].HasResistance();
|
||||||
if (hasResistance)
|
// if (hasResistance)
|
||||||
{
|
// {
|
||||||
//
|
// //
|
||||||
XCResistanceZoneObject *iObj;
|
// XCResistanceZoneObject *iObj;
|
||||||
isCreated = drawer.CreateResistanceZone(
|
// isCreated = drawer.CreateResistanceZone(
|
||||||
conditions.startZones[i].resistance,
|
// conditions.startZones[i].resistance,
|
||||||
iObj //
|
// iObj //
|
||||||
);
|
// );
|
||||||
|
|
||||||
//
|
// //
|
||||||
if (isCreated)
|
// if (isCreated)
|
||||||
{
|
// {
|
||||||
mObjects.Add(iObj);
|
// mObjects.Add(iObj);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -235,6 +235,67 @@ struct X121SMCXWZZone
|
|||||||
IsBearish();
|
IsBearish();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool ValidateZone(
|
||||||
|
int barIndex = 0,
|
||||||
|
ENUM_TIMEFRAMES forPeriod = NULL //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
if (barIndex < 0)
|
||||||
|
{
|
||||||
|
barIndex = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
result = IsValid() &&
|
||||||
|
HasDirection();
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
string symbol = ob.GetSymbol();
|
||||||
|
if (forPeriod == NULL)
|
||||||
|
{
|
||||||
|
forPeriod = ob.GetPeriod();
|
||||||
|
}
|
||||||
|
ENUM_X_DIRECTION forDir = GetDirection();
|
||||||
|
|
||||||
|
//
|
||||||
|
XOHCL cBar;
|
||||||
|
result = cBar.Init(
|
||||||
|
symbol,
|
||||||
|
forPeriod,
|
||||||
|
barIndex + 1 //
|
||||||
|
);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
cBar.Clean();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isBreaked =
|
||||||
|
IsBullish(forDir)
|
||||||
|
? cBar.close < ob.Lower() ||
|
||||||
|
cBar.close < fvg.Lower()
|
||||||
|
: cBar.close > ob.Upper() ||
|
||||||
|
cBar.close > fvg.Upper();
|
||||||
|
result = !isBreaked;
|
||||||
|
|
||||||
|
//
|
||||||
|
cBar.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
ENUM_X_DIRECTION GetDirection()
|
ENUM_X_DIRECTION GetDirection()
|
||||||
{
|
{
|
||||||
@@ -265,7 +326,9 @@ struct X121SMCXWZZone
|
|||||||
bool IsPriceInside(
|
bool IsPriceInside(
|
||||||
XBoxZone &box,
|
XBoxZone &box,
|
||||||
int barIndex = 0,
|
int barIndex = 0,
|
||||||
ENUM_TIMEFRAMES forPeriod = NULL //
|
ENUM_TIMEFRAMES forPeriod = NULL,
|
||||||
|
bool forceOB = false,
|
||||||
|
bool forceFVG = false //
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -382,49 +445,82 @@ struct X121SMCXWZZone
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
bool isPriceInsideOB =
|
bool isPriceInsideOB = X121SMCXWZCheckPriceInside(
|
||||||
isBullish
|
zBar,
|
||||||
? (
|
cBar,
|
||||||
//
|
ob.Upper(),
|
||||||
pBar.low > ob.Upper() &&
|
ob.Lower() //
|
||||||
cBar.low <= ob.Upper() &&
|
);
|
||||||
zBar.open <= ob.Upper()
|
|
||||||
//
|
|
||||||
)
|
|
||||||
: (
|
|
||||||
//
|
|
||||||
pBar.high < ob.Lower() &&
|
|
||||||
cBar.high >= ob.Lower() &&
|
|
||||||
zBar.open >= ob.Lower()
|
|
||||||
//
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
bool isPriceInsideFVG =
|
// isBullish
|
||||||
isBullish
|
// ? (
|
||||||
? (
|
// //
|
||||||
//
|
// pBar.close > ob.Upper() &&
|
||||||
pBar.low > fvg.Upper() &&
|
// cBar.low <= ob.Upper() &&
|
||||||
cBar.low <= fvg.Upper() &&
|
// cBar.close <= ob.Upper() &&
|
||||||
zBar.open <= fvg.Upper()
|
// zBar.open <= ob.Upper()
|
||||||
//
|
// //
|
||||||
)
|
// )
|
||||||
: (
|
// : (
|
||||||
//
|
// //
|
||||||
pBar.high < fvg.Lower() &&
|
// pBar.close < ob.Lower() &&
|
||||||
cBar.high >= fvg.Lower() &&
|
// cBar.high >= ob.Lower() &&
|
||||||
zBar.open >= fvg.Lower()
|
// cBar.close >= ob.Lower() &&
|
||||||
//
|
// zBar.open >= ob.Lower()
|
||||||
);
|
// //
|
||||||
|
// );
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isPriceInsideFVG = X121SMCXWZCheckPriceInside(
|
||||||
|
zBar,
|
||||||
|
cBar,
|
||||||
|
fvg.Upper(),
|
||||||
|
fvg.Lower() //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// isBullish
|
||||||
|
// ? (
|
||||||
|
// //
|
||||||
|
// pBar.close > fvg.Upper() &&
|
||||||
|
// cBar.low <= fvg.Upper() &&
|
||||||
|
// cBar.close <= fvg.Upper() &&
|
||||||
|
// zBar.open <= fvg.Upper()
|
||||||
|
// //
|
||||||
|
// )
|
||||||
|
// : (
|
||||||
|
// //
|
||||||
|
// pBar.close < fvg.Lower() &&
|
||||||
|
// cBar.high >= fvg.Lower() &&
|
||||||
|
// cBar.close >= fvg.Lower() &&
|
||||||
|
// zBar.open >= fvg.Lower()
|
||||||
|
// //
|
||||||
|
// );
|
||||||
|
|
||||||
|
//
|
||||||
|
if ((forceOB && forceFVG) ||
|
||||||
|
(!forceOB && !forceFVG))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
result =
|
||||||
|
isPriceInsideOB ||
|
||||||
|
isPriceInsideFVG;
|
||||||
|
}
|
||||||
|
else if (forceOB)
|
||||||
|
{
|
||||||
|
result = isPriceInsideOB;
|
||||||
|
}
|
||||||
|
else if (forceFVG)
|
||||||
|
{
|
||||||
|
result = isPriceInsideFVG;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
result =
|
|
||||||
isPriceInsideOB ||
|
|
||||||
isPriceInsideFVG;
|
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
if (isPriceInsideOB)
|
if (isPriceInsideOB && !isPriceInsideFVG)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
result = ToBox(
|
result = ToBox(
|
||||||
@@ -432,7 +528,7 @@ struct X121SMCXWZZone
|
|||||||
ob //
|
ob //
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else if (isPriceInsideFVG)
|
else if (isPriceInsideFVG && !isPriceInsideOB)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
result = ToBox(
|
result = ToBox(
|
||||||
@@ -440,6 +536,10 @@ struct X121SMCXWZZone
|
|||||||
fvg //
|
fvg //
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
else if (isPriceInsideOB && isPriceInsideFVG)
|
||||||
|
{
|
||||||
|
result = AsBox(box);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -2462,7 +2562,9 @@ struct X121SMCStrategyXWZSignalConditions
|
|||||||
//
|
//
|
||||||
bool DetectStartZones(
|
bool DetectStartZones(
|
||||||
ENUM_X_DIRECTION forDir,
|
ENUM_X_DIRECTION forDir,
|
||||||
XPOIState &state,
|
XPOIState &obState,
|
||||||
|
XPOIState &fvgState,
|
||||||
|
XPOIState &otherState,
|
||||||
XC121SMCCycleHelper *cycleHelper //
|
XC121SMCCycleHelper *cycleHelper //
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@@ -2470,8 +2572,12 @@ struct X121SMCStrategyXWZSignalConditions
|
|||||||
bool result = false;
|
bool result = false;
|
||||||
|
|
||||||
//
|
//
|
||||||
result = state.IsValid() &&
|
result = obState.IsValid() &&
|
||||||
state.HasChild() &&
|
obState.HasChild() &&
|
||||||
|
fvgState.IsValid() &&
|
||||||
|
fvgState.HasChild() &&
|
||||||
|
otherState.IsValid() &&
|
||||||
|
otherState.HasChild() &&
|
||||||
HasDirection(forDir);
|
HasDirection(forDir);
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
@@ -2501,15 +2607,15 @@ struct X121SMCStrategyXWZSignalConditions
|
|||||||
if (isBullish)
|
if (isBullish)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
has = state.HasBullishOrderBlocks();
|
has = obState.HasBullishOrderBlocks();
|
||||||
if (has)
|
if (has)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
count = state.CountBullishOrderBlocks();
|
count = obState.CountBullishOrderBlocks();
|
||||||
for (int i = 0; i < count; i++)
|
for (int i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
XCOrderBlock *iOB = state.bullishOrderBlocks[i];
|
XCOrderBlock *iOB = obState.bullishOrderBlocks[i];
|
||||||
|
|
||||||
//
|
//
|
||||||
bool isFromPassed =
|
bool isFromPassed =
|
||||||
@@ -2556,24 +2662,48 @@ struct X121SMCStrategyXWZSignalConditions
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Validate Zone Iverse Breake ...
|
||||||
|
XOHCL breakedBar;
|
||||||
|
ENUM_X_DIRECTION breakedDir;
|
||||||
|
bool isBreaked = iOB.IsBreaked(
|
||||||
|
Opposit(forDir),
|
||||||
|
breakedBar,
|
||||||
|
breakedDir,
|
||||||
|
true // Ignore Activation ...
|
||||||
|
);
|
||||||
|
if (isBreaked)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
ZeroMemory(iOB);
|
||||||
|
startedBar.Clean();
|
||||||
|
breakedBar.Clean();
|
||||||
|
activatedBar.Clean();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
bool isPlacePassed =
|
bool isPlacePassed =
|
||||||
!hasLastStartZone
|
!IsInsideDiff(
|
||||||
? workingZone.IsValid() &&
|
iOB,
|
||||||
HasOrderBlock() &&
|
demandZone //
|
||||||
forDir == orderBlock.GetDirection()
|
) &&
|
||||||
? IsAbove(
|
(!hasLastStartZone
|
||||||
iOB,
|
? workingZone.IsValid() &&
|
||||||
orderBlock,
|
HasOrderBlock() &&
|
||||||
true // Ignore Inside ...
|
forDir == orderBlock.GetDirection()
|
||||||
)
|
? IsAbove(
|
||||||
: true
|
iOB,
|
||||||
: lastStartZone.HasOB() &&
|
orderBlock,
|
||||||
IsAbove(
|
true // Ignore Inside ...
|
||||||
iOB,
|
)
|
||||||
lastStartZone.ob,
|
: true
|
||||||
true // Ignore Inside ...
|
: lastStartZone.HasOB() &&
|
||||||
);
|
IsAbove(
|
||||||
|
iOB,
|
||||||
|
lastStartZone.ob,
|
||||||
|
true // Ignore Inside ...
|
||||||
|
));
|
||||||
if (!isPlacePassed)
|
if (!isPlacePassed)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -2589,15 +2719,15 @@ struct X121SMCStrategyXWZSignalConditions
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Now we Have to Find Specified FVG ...
|
// Now we Have to Find Specified FVG ...
|
||||||
has = state.HasBullishFairValueGaps();
|
has = fvgState.HasBullishFairValueGaps();
|
||||||
if (has)
|
if (has)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
int jCount = state.CountBullishFairValueGaps();
|
int jCount = fvgState.CountBullishFairValueGaps();
|
||||||
for (int j = 0; j < jCount; j++)
|
for (int j = 0; j < jCount; j++)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
XCFVG *jFVG = state.bullishFairValueGaps[j];
|
XCFVG *jFVG = fvgState.bullishFairValueGaps[j];
|
||||||
|
|
||||||
//
|
//
|
||||||
startedBar.Clean();
|
startedBar.Clean();
|
||||||
@@ -2632,9 +2762,33 @@ struct X121SMCStrategyXWZSignalConditions
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Validate Zone Iverse Breake ...
|
||||||
|
breakedBar.Clean();
|
||||||
|
breakedDir = X_DIRECTION_NONE;
|
||||||
|
bool isBreaked = jFVG.IsBreaked(
|
||||||
|
Opposit(forDir),
|
||||||
|
breakedBar,
|
||||||
|
breakedDir,
|
||||||
|
true // Ignore Activation ...
|
||||||
|
);
|
||||||
|
if (isBreaked)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
ZeroMemory(jFVG);
|
||||||
|
startedBar.Clean();
|
||||||
|
breakedBar.Clean();
|
||||||
|
activatedBar.Clean();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
isPlacePassed =
|
isPlacePassed =
|
||||||
//
|
//
|
||||||
|
!IsInsideDiff(
|
||||||
|
jFVG,
|
||||||
|
demandZone //
|
||||||
|
) &&
|
||||||
IsAboveDiff(
|
IsAboveDiff(
|
||||||
jFVG,
|
jFVG,
|
||||||
iOB,
|
iOB,
|
||||||
@@ -2664,15 +2818,15 @@ struct X121SMCStrategyXWZSignalConditions
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
has = state.HasBearishOrderBlocks();
|
has = obState.HasBearishOrderBlocks();
|
||||||
if (has)
|
if (has)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
count = state.CountBearishOrderBlocks();
|
count = obState.CountBearishOrderBlocks();
|
||||||
for (int i = 0; i < count; i++)
|
for (int i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
XCOrderBlock *iOB = state.bearishOrderBlocks[i];
|
XCOrderBlock *iOB = obState.bearishOrderBlocks[i];
|
||||||
|
|
||||||
//
|
//
|
||||||
bool isFromPassed =
|
bool isFromPassed =
|
||||||
@@ -2719,24 +2873,48 @@ struct X121SMCStrategyXWZSignalConditions
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Validate Zone Iverse Breake ...
|
||||||
|
XOHCL breakedBar;
|
||||||
|
ENUM_X_DIRECTION breakedDir;
|
||||||
|
bool isBreaked = iOB.IsBreaked(
|
||||||
|
Opposit(forDir),
|
||||||
|
breakedBar,
|
||||||
|
breakedDir,
|
||||||
|
true // Ignore Activation ...
|
||||||
|
);
|
||||||
|
if (isBreaked)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
ZeroMemory(iOB);
|
||||||
|
startedBar.Clean();
|
||||||
|
breakedBar.Clean();
|
||||||
|
activatedBar.Clean();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
bool isPlacePassed =
|
bool isPlacePassed =
|
||||||
!hasLastStartZone
|
!IsInsideDiff(
|
||||||
? workingZone.IsValid() &&
|
iOB,
|
||||||
HasOrderBlock() &&
|
supplyZone //
|
||||||
forDir == orderBlock.GetDirection()
|
) &&
|
||||||
? IsBelow(
|
(!hasLastStartZone
|
||||||
iOB,
|
? workingZone.IsValid() &&
|
||||||
orderBlock,
|
HasOrderBlock() &&
|
||||||
true // Ignore Inside ...
|
forDir == orderBlock.GetDirection()
|
||||||
)
|
? IsBelow(
|
||||||
: true
|
iOB,
|
||||||
: lastStartZone.HasOB() &&
|
orderBlock,
|
||||||
IsBelow(
|
true // Ignore Inside ...
|
||||||
iOB,
|
)
|
||||||
lastStartZone.ob,
|
: true
|
||||||
true // Ignore Inside ...
|
: lastStartZone.HasOB() &&
|
||||||
);
|
IsBelow(
|
||||||
|
iOB,
|
||||||
|
lastStartZone.ob,
|
||||||
|
true // Ignore Inside ...
|
||||||
|
));
|
||||||
if (!isPlacePassed)
|
if (!isPlacePassed)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -2752,15 +2930,15 @@ struct X121SMCStrategyXWZSignalConditions
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Now we Have to Find Specified FVG ...
|
// Now we Have to Find Specified FVG ...
|
||||||
has = state.HasBearishFairValueGaps();
|
has = fvgState.HasBearishFairValueGaps();
|
||||||
if (has)
|
if (has)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
int jCount = state.CountBearishFairValueGaps();
|
int jCount = fvgState.CountBearishFairValueGaps();
|
||||||
for (int j = 0; j < jCount; j++)
|
for (int j = 0; j < jCount; j++)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
XCFVG *jFVG = state.bearishFairValueGaps[j];
|
XCFVG *jFVG = fvgState.bearishFairValueGaps[j];
|
||||||
|
|
||||||
//
|
//
|
||||||
startedBar.Clean();
|
startedBar.Clean();
|
||||||
@@ -2795,9 +2973,33 @@ struct X121SMCStrategyXWZSignalConditions
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Validate Zone Iverse Breake ...
|
||||||
|
breakedBar.Clean();
|
||||||
|
breakedDir = X_DIRECTION_NONE;
|
||||||
|
bool isBreaked = jFVG.IsBreaked(
|
||||||
|
Opposit(forDir),
|
||||||
|
breakedBar,
|
||||||
|
breakedDir,
|
||||||
|
true // Ignore Activation ...
|
||||||
|
);
|
||||||
|
if (isBreaked)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
ZeroMemory(jFVG);
|
||||||
|
startedBar.Clean();
|
||||||
|
breakedBar.Clean();
|
||||||
|
activatedBar.Clean();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
isPlacePassed =
|
isPlacePassed =
|
||||||
//
|
//
|
||||||
|
!IsInsideDiff(
|
||||||
|
jFVG,
|
||||||
|
supplyZone //
|
||||||
|
) &&
|
||||||
IsBelowDiff(
|
IsBelowDiff(
|
||||||
jFVG,
|
jFVG,
|
||||||
iOB,
|
iOB,
|
||||||
@@ -2860,12 +3062,12 @@ struct X121SMCStrategyXWZSignalConditions
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Supply Zones ...
|
// Supply Zones ...
|
||||||
has = state.HasSupplyZones();
|
has = otherState.HasSupplyZones();
|
||||||
if (has)
|
if (has)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
count = ToBox(
|
count = ToBox(
|
||||||
state.supplyZones,
|
otherState.supplyZones,
|
||||||
tmpBoxes //
|
tmpBoxes //
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -2898,7 +3100,7 @@ struct X121SMCStrategyXWZSignalConditions
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
startZone.supply = state.supplyZones[i];
|
startZone.supply = otherState.supplyZones[i];
|
||||||
|
|
||||||
//
|
//
|
||||||
iBox.Clean();
|
iBox.Clean();
|
||||||
@@ -2910,12 +3112,12 @@ struct X121SMCStrategyXWZSignalConditions
|
|||||||
//
|
//
|
||||||
// Demand Zones ...
|
// Demand Zones ...
|
||||||
Clean(tmpBoxes);
|
Clean(tmpBoxes);
|
||||||
has = state.HasDemandZones();
|
has = otherState.HasDemandZones();
|
||||||
if (has)
|
if (has)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
count = ToBox(
|
count = ToBox(
|
||||||
state.demandZones,
|
otherState.demandZones,
|
||||||
tmpBoxes //
|
tmpBoxes //
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -2948,7 +3150,7 @@ struct X121SMCStrategyXWZSignalConditions
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
startZone.demand = state.demandZones[i];
|
startZone.demand = otherState.demandZones[i];
|
||||||
|
|
||||||
//
|
//
|
||||||
iBox.Clean();
|
iBox.Clean();
|
||||||
@@ -2960,12 +3162,12 @@ struct X121SMCStrategyXWZSignalConditions
|
|||||||
//
|
//
|
||||||
// Support Zones ...
|
// Support Zones ...
|
||||||
Clean(tmpBoxes);
|
Clean(tmpBoxes);
|
||||||
has = state.HasSupportZones();
|
has = otherState.HasSupportZones();
|
||||||
if (has)
|
if (has)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
count = ToBox(
|
count = ToBox(
|
||||||
state.supportZones,
|
otherState.supportZones,
|
||||||
tmpBoxes //
|
tmpBoxes //
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -2998,7 +3200,7 @@ struct X121SMCStrategyXWZSignalConditions
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
startZone.support = state.supportZones[i];
|
startZone.support = otherState.supportZones[i];
|
||||||
|
|
||||||
//
|
//
|
||||||
iBox.Clean();
|
iBox.Clean();
|
||||||
@@ -3010,12 +3212,12 @@ struct X121SMCStrategyXWZSignalConditions
|
|||||||
//
|
//
|
||||||
// Resistance Zones ...
|
// Resistance Zones ...
|
||||||
Clean(tmpBoxes);
|
Clean(tmpBoxes);
|
||||||
has = state.HasResistanceZones();
|
has = otherState.HasResistanceZones();
|
||||||
if (has)
|
if (has)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
count = ToBox(
|
count = ToBox(
|
||||||
state.resistanceZones,
|
otherState.resistanceZones,
|
||||||
tmpBoxes //
|
tmpBoxes //
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -3048,7 +3250,7 @@ struct X121SMCStrategyXWZSignalConditions
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
startZone.resistance = state.resistanceZones[i];
|
startZone.resistance = otherState.resistanceZones[i];
|
||||||
|
|
||||||
//
|
//
|
||||||
iBox.Clean();
|
iBox.Clean();
|
||||||
@@ -3079,6 +3281,48 @@ struct X121SMCStrategyXWZSignalConditions
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
void ValidateStartZones(
|
||||||
|
int barIndex = 0,
|
||||||
|
ENUM_TIMEFRAMES forPeriod = NULL //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool has = HasStartZones();
|
||||||
|
if (!has)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
X121SMCXWZZone tmpZones[];
|
||||||
|
int count = CountStartZones();
|
||||||
|
Copy(
|
||||||
|
startZones,
|
||||||
|
tmpZones //
|
||||||
|
);
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool isValid = tmpZones[i].ValidateZone(
|
||||||
|
barIndex,
|
||||||
|
forPeriod //
|
||||||
|
);
|
||||||
|
if (!isValid)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
ArrayRemove(
|
||||||
|
startZones,
|
||||||
|
i,
|
||||||
|
1 //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
Clean(tmpZones);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
void DetectPriority(
|
void DetectPriority(
|
||||||
ENUM_X121SMC_XWZ_PRIORITY &bullish,
|
ENUM_X121SMC_XWZ_PRIORITY &bullish,
|
||||||
@@ -3255,6 +3499,12 @@ struct X121SMCStrategyXWZSignalConditions
|
|||||||
//
|
//
|
||||||
result = false;
|
result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
ValidateStartZones(
|
||||||
|
barIndex,
|
||||||
|
forPeriod //
|
||||||
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Detect Conditions Based On Start Zones ...
|
// Detect Conditions Based On Start Zones ...
|
||||||
bool hasStartZones = HasStartZones();
|
bool hasStartZones = HasStartZones();
|
||||||
@@ -3278,16 +3528,21 @@ struct X121SMCStrategyXWZSignalConditions
|
|||||||
bool isPriceInside = iStartZone.IsPriceInside(
|
bool isPriceInside = iStartZone.IsPriceInside(
|
||||||
selectedBox,
|
selectedBox,
|
||||||
barIndex,
|
barIndex,
|
||||||
forPeriod //
|
forPeriod,
|
||||||
|
false,
|
||||||
|
false //
|
||||||
);
|
);
|
||||||
if (isPriceInside)
|
if (isPriceInside)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
hasConditions = iStartZone.HasInsideConditions(
|
// hasConditions = iStartZone.HasInsideConditions(
|
||||||
state,
|
// state,
|
||||||
barIndex,
|
// barIndex,
|
||||||
period //
|
// period //
|
||||||
);
|
// );
|
||||||
|
|
||||||
|
//
|
||||||
|
hasConditions = true;
|
||||||
|
|
||||||
//
|
//
|
||||||
if (hasConditions)
|
if (hasConditions)
|
||||||
@@ -3318,96 +3573,96 @@ struct X121SMCStrategyXWZSignalConditions
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
// //
|
||||||
// Order Block Rejection Conditions ...
|
// // Order Block Rejection Conditions ...
|
||||||
bool hasOBBox = ToBox(
|
// bool hasOBBox = ToBox(
|
||||||
selectedBox,
|
// selectedBox,
|
||||||
iStartZone.ob //
|
// iStartZone.ob //
|
||||||
);
|
// );
|
||||||
if (hasOBBox &&
|
// if (hasOBBox &&
|
||||||
!hasConditions)
|
// !hasConditions)
|
||||||
{
|
// {
|
||||||
//
|
// //
|
||||||
hasConditions = iStartZone.HasBoxConitions(
|
// hasConditions = iStartZone.HasBoxConitions(
|
||||||
selectedBox,
|
// selectedBox,
|
||||||
state,
|
// state,
|
||||||
barIndex,
|
// barIndex,
|
||||||
forPeriod //
|
// forPeriod //
|
||||||
);
|
// );
|
||||||
|
|
||||||
//
|
// //
|
||||||
if (hasConditions)
|
// if (hasConditions)
|
||||||
{
|
// {
|
||||||
//
|
// //
|
||||||
_pivot =
|
// _pivot =
|
||||||
//
|
// //
|
||||||
isBullish
|
// isBullish
|
||||||
? selectedBox.lower
|
// ? selectedBox.lower
|
||||||
: selectedBox.upper
|
// : selectedBox.upper
|
||||||
//
|
// //
|
||||||
;
|
// ;
|
||||||
|
|
||||||
//
|
// //
|
||||||
_point =
|
// _point =
|
||||||
//
|
// //
|
||||||
isBullish
|
// isBullish
|
||||||
? selectedBox.upper
|
// ? selectedBox.upper
|
||||||
: selectedBox.lower
|
// : selectedBox.lower
|
||||||
//
|
// //
|
||||||
;
|
// ;
|
||||||
|
|
||||||
//
|
// //
|
||||||
conditionsDir = selectedBox.dir;
|
// conditionsDir = selectedBox.dir;
|
||||||
result = hasConditions;
|
// result = hasConditions;
|
||||||
iStartZone.Clean();
|
// iStartZone.Clean();
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
//
|
// //
|
||||||
// Fair Value Gap Rejection Conditions ...
|
// // Fair Value Gap Rejection Conditions ...
|
||||||
bool hasFVGBox = ToBox(
|
// bool hasFVGBox = ToBox(
|
||||||
selectedBox,
|
// selectedBox,
|
||||||
iStartZone.fvg //
|
// iStartZone.fvg //
|
||||||
);
|
// );
|
||||||
if (hasFVGBox)
|
// if (hasFVGBox)
|
||||||
{
|
// {
|
||||||
//
|
// //
|
||||||
hasConditions = iStartZone.HasBoxConitions(
|
// hasConditions = iStartZone.HasBoxConitions(
|
||||||
selectedBox,
|
// selectedBox,
|
||||||
state,
|
// state,
|
||||||
barIndex,
|
// barIndex,
|
||||||
forPeriod //
|
// forPeriod //
|
||||||
);
|
// );
|
||||||
|
|
||||||
//
|
// //
|
||||||
if (hasConditions)
|
// if (hasConditions)
|
||||||
{
|
// {
|
||||||
//
|
// //
|
||||||
_pivot =
|
// _pivot =
|
||||||
//
|
// //
|
||||||
isBullish
|
// isBullish
|
||||||
? selectedBox.lower
|
// ? selectedBox.lower
|
||||||
: selectedBox.upper
|
// : selectedBox.upper
|
||||||
//
|
// //
|
||||||
;
|
// ;
|
||||||
|
|
||||||
//
|
// //
|
||||||
_point =
|
// _point =
|
||||||
//
|
// //
|
||||||
isBullish
|
// isBullish
|
||||||
? selectedBox.upper
|
// ? selectedBox.upper
|
||||||
: selectedBox.lower
|
// : selectedBox.lower
|
||||||
//
|
// //
|
||||||
;
|
// ;
|
||||||
|
|
||||||
//
|
// //
|
||||||
conditionsDir = selectedBox.dir;
|
// conditionsDir = selectedBox.dir;
|
||||||
result = hasConditions;
|
// result = hasConditions;
|
||||||
iStartZone.Clean();
|
// iStartZone.Clean();
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
//
|
//
|
||||||
iStartZone.Clean();
|
iStartZone.Clean();
|
||||||
@@ -3452,3 +3707,43 @@ struct X121SMCStrategyXWZSignalConditions
|
|||||||
|
|
||||||
//
|
//
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//
|
||||||
|
bool X121SMCXWZCheckPriceInside(
|
||||||
|
XOHCL &zBar,
|
||||||
|
XOHCL &cBar,
|
||||||
|
double upper,
|
||||||
|
double lower //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
result = zBar.IsValid() &&
|
||||||
|
cBar.IsValid() &&
|
||||||
|
upper > 0 &&
|
||||||
|
lower > 0 &&
|
||||||
|
upper > lower &&
|
||||||
|
zBar.time > cBar.time;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
result =
|
||||||
|
//
|
||||||
|
zBar.high < upper &&
|
||||||
|
cBar.high < upper &&
|
||||||
|
//
|
||||||
|
zBar.low > lower &&
|
||||||
|
cBar.low > lower
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
Reference in New Issue
Block a user