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