This commit is contained in:
2025-02-12 03:34:46 +03:30
parent 8f1ab5f8bd
commit 6c3daccc94
4 changed files with 327 additions and 249 deletions
+217
View File
@@ -0,0 +1,217 @@
/////////////////////////////////////////////////////////////////////////////////////////////////////
else if (isPriceRejected)
{
//
bool hasRejectedOB = rejectedOB != NULL;
bool hasRejectedFVG = rejectedFVG != NULL;
// //
// if (hasRejectedOB)
// {
// //
// DrawX121SMCXSupDemOBSOrderBlock(
// rejectedOB,
// consolidationCycleHelper.mPOIDrawer //
// );
// }
// //
// if (hasRejectedFVG)
// {
// //
// DrawX121SMCXSupDemOBSFairValueGap(
// rejectedFVG,
// consolidationCycleHelper.mPOIDrawer //
// );
// }
// //
// if (!hasRejectedOB &&
// !hasRejectedFVG)
// {
// //
// if (hasInsideSupDemZone)
// {
// //
// double min = 0;
// double max = 0;
// bool canSetMin = false;
// bool canSetMax = false;
// //
// if (swingBar.IsValid())
// {
// //
// canSetMin =
// min == 0 || min > swingBar.low;
// if (canSetMin)
// {
// min = swingBar.low;
// }
// //
// canSetMax =
// max == 0 || max < swingBar.high;
// if (canSetMax)
// {
// max = swingBar.high;
// }
// }
// //
// if (rejectBar.IsValid())
// {
// //
// canSetMin =
// min == 0 || min > rejectBar.low;
// if (canSetMin)
// {
// min = rejectBar.low;
// }
// //
// canSetMax =
// max == 0 || max < rejectBar.high;
// if (canSetMax)
// {
// max = rejectBar.high;
// }
// }
// //
// if (breakerBar.IsValid())
// {
// //
// canSetMin =
// min == 0 || min > breakerBar.low;
// if (canSetMin)
// {
// min = breakerBar.low;
// }
// //
// canSetMax =
// max == 0 || max < breakerBar.high;
// if (canSetMax)
// {
// max = breakerBar.high;
// }
// }
// //
// if (momentumBar.IsValid())
// {
// //
// canSetMin =
// min == 0 || min > momentumBar.low;
// if (canSetMin)
// {
// min = momentumBar.low;
// }
// //
// canSetMax =
// max == 0 || max < momentumBar.high;
// if (canSetMax)
// {
// max = momentumBar.high;
// }
// }
// //
// upper = max;
// lower = min;
// //
// if (hasInsideSupplyZone)
// {
// //
// isInsideZoneDirectionBullish = false;
// isInsideZoneDirectionBearish = true;
// //
// lower = GetEntry(
// conditions.symbol,
// POSITION_TYPE_SELL //
// );
// }
// //
// if (hasInsideDemandZone)
// {
// //
// isInsideZoneDirectionBullish = true;
// isInsideZoneDirectionBearish = false;
// //
// upper = GetEntry(
// conditions.symbol,
// POSITION_TYPE_BUY //
// );
// }
// }
// }
}
/////////////////////////////////////////////////////////////////////////////////////////////////////
//
if (!hasInsideZone &&
!hasRejectedZone &&
hasInsideSupDemZone)
{
//
// Check Supply and Demand Zone Rejection ...
if (hasInsideSupplyZone)
{
//
isPriceRejected = IsReject(
X_DIRECTION_BEARISH,
decisionZBar,
insideSupplyZone,
decisionState,
swingBar,
rejectBar,
breakerBar,
momentumBar,
false //
);
}
else if (hasInsideDemandZone)
{
//
isPriceRejected = IsReject(
X_DIRECTION_BULLISH,
decisionZBar,
insideDemandZone,
decisionState,
swingBar,
rejectBar,
breakerBar,
momentumBar,
false //
);
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -645,6 +645,8 @@ bool DetectX121SMCGuards(
if (!isColseIgnored) if (!isColseIgnored)
{ {
// //
// TODO:
// - [] Implement Close on Nearest on TP ...
} }
// //
@@ -653,6 +655,8 @@ bool DetectX121SMCGuards(
if (!isColseAllIgnored) if (!isColseAllIgnored)
{ {
// //
// TODO:
// - [] Implement Close All Positions on Weekend ...
} }
// //
@@ -1756,6 +1756,9 @@ bool DetectX121SMCXSupDemOBSSignalSetup(
datetime cTime = TimeCurrent(); datetime cTime = TimeCurrent();
double points = GetPoints(symbol); double points = GetPoints(symbol);
//
double target = 0;
// //
// Cycles Conditions ... // Cycles Conditions ...
@@ -2308,6 +2311,9 @@ bool DetectX121SMCXSupDemOBSSignalSetup(
result = false; result = false;
conditions.Clean(); conditions.Clean();
RemoveX121SMCXSupDemOBSDraws(); RemoveX121SMCXSupDemOBSDraws();
RemoveX121SMCXSupDemOBSWorkingZoneDraws();
//
return result; return result;
} }
@@ -3042,40 +3048,6 @@ bool DetectX121SMCXSupDemOBSSignalSetup(
hasOBs = IsValidSize(obsCount); hasOBs = IsValidSize(obsCount);
hasFVGs = IsValidSize(fvgsCount); hasFVGs = IsValidSize(fvgsCount);
//
if (hasOBs)
{
//
for (int i = 0; i < obsCount; i++)
{
//
obs[i].To(cTime);
//
DrawX121SMCXSupDemOBSOrderBlock(
obs[i],
analyseCycleHelper.mPOIDrawer //
);
}
}
//
if (hasFVGs)
{
//
for (int i = 0; i < fvgsCount; i++)
{
//
fvgs[i].To(cTime);
//
DrawX121SMCXSupDemOBSFairValueGap(
fvgs[i],
analyseCycleHelper.mPOIDrawer //
);
}
}
// //
if (hasOBs || if (hasOBs ||
hasFVGs) hasFVGs)
@@ -3203,6 +3175,9 @@ bool DetectX121SMCXSupDemOBSSignalSetup(
Clean(fvgs); Clean(fvgs);
} }
//
conditions.UpdateTo(cTime);
// //
hasInsideOB = insideOB != NULL && hasInsideOB = insideOB != NULL &&
insideOB.IsValid(); insideOB.IsValid();
@@ -3218,52 +3193,90 @@ bool DetectX121SMCXSupDemOBSSignalSetup(
rejectedFVG.IsValid(); rejectedFVG.IsValid();
hasRejectedZone = hasRejectedOB || hasRejectedZone = hasRejectedOB ||
hasRejectedFVG; hasRejectedFVG;
}
//
if (!hasInsideZone &&
!hasRejectedZone &&
hasInsideSupDemZone)
{
// //
// Check Supply and Demand Zone Rejection ... if (hasInsideSupDemZone &&
if (hasInsideSupplyZone) (hasInsideZone ||
hasRejectedZone))
{ {
// //
isPriceRejected = IsReject( RemoveX121SMCXSupDemOBSDraws();
X_DIRECTION_BEARISH, RemoveX121SMCXSupDemOBSWorkingZoneDraws();
decisionZBar, DrawX121SMCXSupDemOBSWorkingZone(
insideSupplyZone, conditions,
decisionState, visionCycleHelper.mPOIDrawer //
swingBar,
rejectBar,
breakerBar,
momentumBar,
false //
); );
}
else if (hasInsideDemandZone)
{
// //
isPriceRejected = IsReject( // Set Target Based On Supply or Demand Zone ...
X_DIRECTION_BULLISH,
decisionZBar, //
insideDemandZone, // Supply Zone ...
decisionState, if (isPriceInsideSupplyZone)
swingBar, {
rejectBar, target = conditions.workingZone.quarter1;
breakerBar, }
momentumBar,
false // //
); // Demand Zone ...
if (isPriceInsideDemandZone)
{
target = conditions.workingZone.quarter3;
}
//
if (hasInsideZone)
{
//
if (hasInsideOB)
{
//
DrawX121SMCXSupDemOBSOrderBlock(
insideOB,
visionCycleHelper.mPOIDrawer //
);
}
//
if (hasInsideFVG)
{
//
DrawX121SMCXSupDemOBSFairValueGap(
insideFVG,
visionCycleHelper.mPOIDrawer //
);
}
}
//
if (hasRejectedZone)
{
//
if (hasRejectedOB)
{
//
DrawX121SMCXSupDemOBSOrderBlock(
rejectedOB,
visionCycleHelper.mPOIDrawer //
);
}
//
if (hasRejectedFVG)
{
//
DrawX121SMCXSupDemOBSFairValueGap(
rejectedFVG,
visionCycleHelper.mPOIDrawer //
);
}
}
} }
} }
// //
result = hasInsideZone || result = hasInsideZone ||
hasRejectedZone; hasRejectedZone;
// ||
// isPriceRejected;
if (!result) if (!result)
{ {
// //
@@ -3317,9 +3330,6 @@ bool DetectX121SMCXSupDemOBSSignalSetup(
return result; return result;
} }
//
conditions.UpdateTo(cTime);
// //
// Waiting for Price Breakes Inside Zone ... // Waiting for Price Breakes Inside Zone ...
@@ -3350,159 +3360,6 @@ bool DetectX121SMCXSupDemOBSSignalSetup(
isInsideZoneDirectionBullish = insideFVG.IsBullish(); isInsideZoneDirectionBullish = insideFVG.IsBullish();
isInsideZoneDirectionBearish = insideFVG.IsBearish(); isInsideZoneDirectionBearish = insideFVG.IsBearish();
} }
else if (isPriceRejected)
{
//
bool hasRejectedOB = rejectedOB != NULL;
bool hasRejectedFVG = rejectedFVG != NULL;
//
if (hasRejectedOB)
{
//
DrawX121SMCXSupDemOBSOrderBlock(
rejectedOB,
consolidationCycleHelper.mPOIDrawer //
);
}
//
if (hasRejectedFVG)
{
//
DrawX121SMCXSupDemOBSFairValueGap(
rejectedFVG,
consolidationCycleHelper.mPOIDrawer //
);
}
// //
// if (!hasRejectedOB &&
// !hasRejectedFVG)
// {
// //
// if (hasInsideSupDemZone)
// {
// //
// double min = 0;
// double max = 0;
// bool canSetMin = false;
// bool canSetMax = false;
// //
// if (swingBar.IsValid())
// {
// //
// canSetMin =
// min == 0 || min > swingBar.low;
// if (canSetMin)
// {
// min = swingBar.low;
// }
// //
// canSetMax =
// max == 0 || max < swingBar.high;
// if (canSetMax)
// {
// max = swingBar.high;
// }
// }
// //
// if (rejectBar.IsValid())
// {
// //
// canSetMin =
// min == 0 || min > rejectBar.low;
// if (canSetMin)
// {
// min = rejectBar.low;
// }
// //
// canSetMax =
// max == 0 || max < rejectBar.high;
// if (canSetMax)
// {
// max = rejectBar.high;
// }
// }
// //
// if (breakerBar.IsValid())
// {
// //
// canSetMin =
// min == 0 || min > breakerBar.low;
// if (canSetMin)
// {
// min = breakerBar.low;
// }
// //
// canSetMax =
// max == 0 || max < breakerBar.high;
// if (canSetMax)
// {
// max = breakerBar.high;
// }
// }
// //
// if (momentumBar.IsValid())
// {
// //
// canSetMin =
// min == 0 || min > momentumBar.low;
// if (canSetMin)
// {
// min = momentumBar.low;
// }
// //
// canSetMax =
// max == 0 || max < momentumBar.high;
// if (canSetMax)
// {
// max = momentumBar.high;
// }
// }
// //
// upper = max;
// lower = min;
// //
// if (hasInsideSupplyZone)
// {
// //
// isInsideZoneDirectionBullish = false;
// isInsideZoneDirectionBearish = true;
// //
// lower = GetEntry(
// conditions.symbol,
// POSITION_TYPE_SELL //
// );
// }
// //
// if (hasInsideDemandZone)
// {
// //
// isInsideZoneDirectionBullish = true;
// isInsideZoneDirectionBearish = false;
// //
// upper = GetEntry(
// conditions.symbol,
// POSITION_TYPE_BUY //
// );
// }
// }
// }
}
// //
// Cleanup Unused Objects ... // Cleanup Unused Objects ...
@@ -3553,7 +3410,8 @@ bool DetectX121SMCXSupDemOBSSignalSetup(
bool isCondition1Bullish = bool isCondition1Bullish =
// //
hasBullishTrend && hasBullishTrend &&
isInsideZoneDirectionBullish isInsideZoneDirectionBullish &&
bullishPriority != X121SMC_XSUPDEMOBS_PRIORITY_NONE
// //
; ;
@@ -3561,7 +3419,8 @@ bool DetectX121SMCXSupDemOBSSignalSetup(
bool isCondition1Bearish = bool isCondition1Bearish =
// //
hasBearishTrend && hasBearishTrend &&
isInsideZoneDirectionBearish isInsideZoneDirectionBearish &&
bearishPriority != X121SMC_XSUPDEMOBS_PRIORITY_NONE
// //
; ;
@@ -3606,25 +3465,7 @@ bool DetectX121SMCXSupDemOBSSignalSetup(
} }
// //
double reward; // Summarize Conditions ...
double amountPercent;
ENUM_X121SMC_XSUPDEMOBS_PRIORITY priority =
isBullish
? bullishPriority
: bearishPriority;
bool hasRewardAmount = CalculateX121SMCXSupDemOBSRiskReward(
priority,
reward,
amountPercent //
);
result = hasRewardAmount;
if (!result)
{
return result;
}
//
//
// //
// //
@@ -3649,6 +3490,24 @@ bool DetectX121SMCXSupDemOBSSignalSetup(
return result; return result;
} }
//
double reward;
double amountPercent;
ENUM_X121SMC_XSUPDEMOBS_PRIORITY priority =
isBullish
? bullishPriority
: bearishPriority;
bool hasRewardAmount = CalculateX121SMCXSupDemOBSRiskReward(
priority,
reward,
amountPercent //
);
result = hasRewardAmount;
if (!result)
{
return result;
}
// //
conditions.setupTime = cTime; conditions.setupTime = cTime;
conditions.dir = conditions.dir =
@@ -3658,6 +3517,7 @@ bool DetectX121SMCXSupDemOBSSignalSetup(
// //
conditions.reward = reward; conditions.reward = reward;
conditions.target = target;
conditions.priority = priority; conditions.priority = priority;
conditions.amountPercent = amountPercent; conditions.amountPercent = amountPercent;
@@ -4154,8 +4014,7 @@ bool DetectX121SMCXSupDemOBSGuards(
// //
ENUM_X_121_SMC_GUARD_ACTIONS ignoreGuards[1] = { ENUM_X_121_SMC_GUARD_ACTIONS ignoreGuards[1] = {
X_121_SMC_GUARD_ACTION_TRAIL_STOP X_121_SMC_GUARD_ACTION_TRAIL_STOP};
};
result = DetectX121SMCGuards( result = DetectX121SMCGuards(
provider, provider,
guards, guards,
@@ -463,10 +463,8 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
bool hasGuard = DetectX121SMCXSupDemOBSGuards( bool hasGuard = DetectX121SMCXSupDemOBSGuards(
guards, guards,
positions, positions,
// mTriggerCycleHelper,
mDecisionCycleHelper, mDecisionCycleHelper,
mAnalyseCycleHelper, mAnalyseCycleHelper,
// mVerificationCycleHelper,
mConsolidationCycleHelper, mConsolidationCycleHelper,
mVisionCycleHelper // mVisionCycleHelper //
); );