last ...
This commit is contained in:
@@ -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)
|
||||
{
|
||||
//
|
||||
// TODO:
|
||||
// - [] Implement Close on Nearest on TP ...
|
||||
}
|
||||
|
||||
//
|
||||
@@ -653,6 +655,8 @@ bool DetectX121SMCGuards(
|
||||
if (!isColseAllIgnored)
|
||||
{
|
||||
//
|
||||
// TODO:
|
||||
// - [] Implement Close All Positions on Weekend ...
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
@@ -1756,6 +1756,9 @@ bool DetectX121SMCXSupDemOBSSignalSetup(
|
||||
datetime cTime = TimeCurrent();
|
||||
double points = GetPoints(symbol);
|
||||
|
||||
//
|
||||
double target = 0;
|
||||
|
||||
//
|
||||
// Cycles Conditions ...
|
||||
|
||||
@@ -2308,6 +2311,9 @@ bool DetectX121SMCXSupDemOBSSignalSetup(
|
||||
result = false;
|
||||
conditions.Clean();
|
||||
RemoveX121SMCXSupDemOBSDraws();
|
||||
RemoveX121SMCXSupDemOBSWorkingZoneDraws();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -3042,40 +3048,6 @@ bool DetectX121SMCXSupDemOBSSignalSetup(
|
||||
hasOBs = IsValidSize(obsCount);
|
||||
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 ||
|
||||
hasFVGs)
|
||||
@@ -3203,6 +3175,9 @@ bool DetectX121SMCXSupDemOBSSignalSetup(
|
||||
Clean(fvgs);
|
||||
}
|
||||
|
||||
//
|
||||
conditions.UpdateTo(cTime);
|
||||
|
||||
//
|
||||
hasInsideOB = insideOB != NULL &&
|
||||
insideOB.IsValid();
|
||||
@@ -3218,52 +3193,90 @@ bool DetectX121SMCXSupDemOBSSignalSetup(
|
||||
rejectedFVG.IsValid();
|
||||
hasRejectedZone = hasRejectedOB ||
|
||||
hasRejectedFVG;
|
||||
|
||||
//
|
||||
if (hasInsideSupDemZone &&
|
||||
(hasInsideZone ||
|
||||
hasRejectedZone))
|
||||
{
|
||||
//
|
||||
RemoveX121SMCXSupDemOBSDraws();
|
||||
RemoveX121SMCXSupDemOBSWorkingZoneDraws();
|
||||
DrawX121SMCXSupDemOBSWorkingZone(
|
||||
conditions,
|
||||
visionCycleHelper.mPOIDrawer //
|
||||
);
|
||||
|
||||
//
|
||||
// Set Target Based On Supply or Demand Zone ...
|
||||
|
||||
//
|
||||
// Supply Zone ...
|
||||
if (isPriceInsideSupplyZone)
|
||||
{
|
||||
target = conditions.workingZone.quarter1;
|
||||
}
|
||||
|
||||
//
|
||||
if (!hasInsideZone &&
|
||||
!hasRejectedZone &&
|
||||
hasInsideSupDemZone)
|
||||
// Demand Zone ...
|
||||
if (isPriceInsideDemandZone)
|
||||
{
|
||||
target = conditions.workingZone.quarter3;
|
||||
}
|
||||
|
||||
//
|
||||
if (hasInsideZone)
|
||||
{
|
||||
//
|
||||
// Check Supply and Demand Zone Rejection ...
|
||||
if (hasInsideSupplyZone)
|
||||
if (hasInsideOB)
|
||||
{
|
||||
//
|
||||
isPriceRejected = IsReject(
|
||||
X_DIRECTION_BEARISH,
|
||||
decisionZBar,
|
||||
insideSupplyZone,
|
||||
decisionState,
|
||||
swingBar,
|
||||
rejectBar,
|
||||
breakerBar,
|
||||
momentumBar,
|
||||
false //
|
||||
DrawX121SMCXSupDemOBSOrderBlock(
|
||||
insideOB,
|
||||
visionCycleHelper.mPOIDrawer //
|
||||
);
|
||||
}
|
||||
else if (hasInsideDemandZone)
|
||||
|
||||
//
|
||||
if (hasInsideFVG)
|
||||
{
|
||||
//
|
||||
isPriceRejected = IsReject(
|
||||
X_DIRECTION_BULLISH,
|
||||
decisionZBar,
|
||||
insideDemandZone,
|
||||
decisionState,
|
||||
swingBar,
|
||||
rejectBar,
|
||||
breakerBar,
|
||||
momentumBar,
|
||||
false //
|
||||
DrawX121SMCXSupDemOBSFairValueGap(
|
||||
insideFVG,
|
||||
visionCycleHelper.mPOIDrawer //
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
if (hasRejectedZone)
|
||||
{
|
||||
//
|
||||
if (hasRejectedOB)
|
||||
{
|
||||
//
|
||||
DrawX121SMCXSupDemOBSOrderBlock(
|
||||
rejectedOB,
|
||||
visionCycleHelper.mPOIDrawer //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
if (hasRejectedFVG)
|
||||
{
|
||||
//
|
||||
DrawX121SMCXSupDemOBSFairValueGap(
|
||||
rejectedFVG,
|
||||
visionCycleHelper.mPOIDrawer //
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
result = hasInsideZone ||
|
||||
hasRejectedZone;
|
||||
// ||
|
||||
// isPriceRejected;
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
@@ -3317,9 +3330,6 @@ bool DetectX121SMCXSupDemOBSSignalSetup(
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
conditions.UpdateTo(cTime);
|
||||
|
||||
//
|
||||
// Waiting for Price Breakes Inside Zone ...
|
||||
|
||||
@@ -3350,159 +3360,6 @@ bool DetectX121SMCXSupDemOBSSignalSetup(
|
||||
isInsideZoneDirectionBullish = insideFVG.IsBullish();
|
||||
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 ...
|
||||
@@ -3553,7 +3410,8 @@ bool DetectX121SMCXSupDemOBSSignalSetup(
|
||||
bool isCondition1Bullish =
|
||||
//
|
||||
hasBullishTrend &&
|
||||
isInsideZoneDirectionBullish
|
||||
isInsideZoneDirectionBullish &&
|
||||
bullishPriority != X121SMC_XSUPDEMOBS_PRIORITY_NONE
|
||||
//
|
||||
;
|
||||
|
||||
@@ -3561,7 +3419,8 @@ bool DetectX121SMCXSupDemOBSSignalSetup(
|
||||
bool isCondition1Bearish =
|
||||
//
|
||||
hasBearishTrend &&
|
||||
isInsideZoneDirectionBearish
|
||||
isInsideZoneDirectionBearish &&
|
||||
bearishPriority != X121SMC_XSUPDEMOBS_PRIORITY_NONE
|
||||
//
|
||||
;
|
||||
|
||||
@@ -3606,25 +3465,7 @@ bool DetectX121SMCXSupDemOBSSignalSetup(
|
||||
}
|
||||
|
||||
//
|
||||
double reward;
|
||||
double amountPercent;
|
||||
ENUM_X121SMC_XSUPDEMOBS_PRIORITY priority =
|
||||
isBullish
|
||||
? bullishPriority
|
||||
: bearishPriority;
|
||||
bool hasRewardAmount = CalculateX121SMCXSupDemOBSRiskReward(
|
||||
priority,
|
||||
reward,
|
||||
amountPercent //
|
||||
);
|
||||
result = hasRewardAmount;
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
//
|
||||
// Summarize Conditions ...
|
||||
//
|
||||
|
||||
//
|
||||
@@ -3649,6 +3490,24 @@ bool DetectX121SMCXSupDemOBSSignalSetup(
|
||||
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.dir =
|
||||
@@ -3658,6 +3517,7 @@ bool DetectX121SMCXSupDemOBSSignalSetup(
|
||||
|
||||
//
|
||||
conditions.reward = reward;
|
||||
conditions.target = target;
|
||||
conditions.priority = priority;
|
||||
conditions.amountPercent = amountPercent;
|
||||
|
||||
@@ -4154,8 +4014,7 @@ bool DetectX121SMCXSupDemOBSGuards(
|
||||
|
||||
//
|
||||
ENUM_X_121_SMC_GUARD_ACTIONS ignoreGuards[1] = {
|
||||
X_121_SMC_GUARD_ACTION_TRAIL_STOP
|
||||
};
|
||||
X_121_SMC_GUARD_ACTION_TRAIL_STOP};
|
||||
result = DetectX121SMCGuards(
|
||||
provider,
|
||||
guards,
|
||||
|
||||
@@ -463,10 +463,8 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
||||
bool hasGuard = DetectX121SMCXSupDemOBSGuards(
|
||||
guards,
|
||||
positions,
|
||||
// mTriggerCycleHelper,
|
||||
mDecisionCycleHelper,
|
||||
mAnalyseCycleHelper,
|
||||
// mVerificationCycleHelper,
|
||||
mConsolidationCycleHelper,
|
||||
mVisionCycleHelper //
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user