This commit is contained in:
2024-11-23 23:44:19 +03:30
parent a5e1f601d3
commit 0e2e474d46
3 changed files with 420 additions and 31 deletions
@@ -181,31 +181,147 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
//
// Check Momentum Bar ...
ENUM_X_DIRECTION momentumBarDir;
ENUM_X_DIRECTION momentumCBarDir;
bool isCMomentumBar = mBarAnalyser.IsMomentumBar(
cBar,
momentumBarDir //
momentumCBarDir //
);
bool isCBullishMomentumBar =
isCMomentumBar &&
IsBullish(momentumBarDir);
IsBullish(momentumCBarDir);
bool isCBearishMomentumBar =
isCMomentumBar &&
IsBearish(momentumBarDir);
IsBearish(momentumCBarDir);
//
// Check Momentum Bar ...
ENUM_X_DIRECTION momentumPBarDir;
bool isPMomentumBar = mBarAnalyser.IsMomentumBar(
pBar,
momentumPBarDir //
);
bool isPBullishMomentumBar =
isPMomentumBar &&
IsBullish(momentumPBarDir);
bool isPBearishMomentumBar =
isPMomentumBar &&
IsBearish(momentumPBarDir);
//
// Check Rejection Bar ...
ENUM_X_DIRECTION rejectionBarDir;
ENUM_X_DIRECTION rejectionCBarDir;
bool isCRejectionBar = mBarAnalyser.IsRejectionBar(
cBar,
rejectionBarDir //
rejectionCBarDir //
);
bool isCBullishRejectionBar =
isCRejectionBar &&
IsBullish(rejectionBarDir);
IsBullish(rejectionCBarDir);
bool isCBearishRejectionBar =
isCRejectionBar &&
IsBearish(rejectionBarDir);
IsBearish(rejectionCBarDir);
//
// Check Rejection Bar ...
ENUM_X_DIRECTION rejectionPBarDir;
bool isPRejectionBar = mBarAnalyser.IsRejectionBar(
pBar,
rejectionPBarDir //
);
bool isPBullishRejectionBar =
isPRejectionBar &&
IsBullish(rejectionPBarDir);
bool isPBearishRejectionBar =
isPRejectionBar &&
IsBearish(rejectionPBarDir);
//
// Check Engulfing ...
ENUM_X_DIRECTION engulfCBarDir;
bool isCEngulfed = mBarAnalyser.IsEngulfBar(
cBar,
engulfCBarDir //
);
bool isCBullishEngulfed =
isCEngulfed &&
IsBullish(engulfCBarDir);
bool isCBearishEngulfed =
isCEngulfed &&
IsBearish(engulfCBarDir);
//
// Check Engulfing ...
ENUM_X_DIRECTION engulfPBarDir;
bool isPEngulfed = mBarAnalyser.IsEngulfBar(
pBar,
engulfPBarDir //
);
bool isPBullishEngulfed =
isPEngulfed &&
IsBullish(engulfPBarDir);
bool isPBearishEngulfed =
isPEngulfed &&
IsBearish(engulfPBarDir);
//
bool isCRMEBullish =
//
isCBullishEngulfed
//
||
//
isCBullishMomentumBar
//
||
//
isCBullishRejectionBar
//
;
//
bool isPRMEBullish =
//
isPBullishEngulfed
//
||
//
isPBullishMomentumBar
//
||
//
isPBullishRejectionBar
//
;
//
bool isCRMEBearish =
//
isCBearishEngulfed
//
||
//
isCBearishMomentumBar
//
||
//
isCBearishRejectionBar
//
;
//
bool isPRMEBearish =
//
isPBearishEngulfed
//
||
//
isPBearishMomentumBar
//
||
//
isPBearishRejectionBar
//
;
//
bool isSpreadPassed = IsSpreadPass();
@@ -263,13 +379,17 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
//
// Price Close Over Pivot's High ...
cBar.IsBullish() &&
cBar.close > lastPivot.upper
cBar.close > lastPivot.upper &&
(pBar.close < lastPivot.upper ||
pBar.low < lastPivot.upper)
//
:
//
// Price Must Close Under Pivots Low ...
cBar.IsBearish() &&
cBar.close < lastPivot.lower
cBar.close < lastPivot.lower &&
(pBar.close > lastPivot.lower ||
pBar.high > lastPivot.lower)
//
;
bool hasCHOCH =
@@ -278,25 +398,50 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
//
// Price Close Under Pivot's Low ...
cBar.IsBearish() &&
cBar.close < lastPivot.lower
cBar.close < lastPivot.lower &&
(pBar.close > lastPivot.lower ||
pBar.high > lastPivot.lower)
//
:
//
// Price Must Close Over Pivots High ...
cBar.IsBullish() &&
cBar.close > lastPivot.upper
cBar.close > lastPivot.upper &&
(pBar.close < lastPivot.upper ||
pBar.low < lastPivot.upper)
//
;
//
// BOS Signals ...
bool has_BOS_Long = false;
bool has_BOS_Short = false;
//
// CHOCH Signals ...
bool has_CHOCH_Long = false;
bool has_CHOCH_Short = false;
//
// SAR Signals ...
bool has_SAR_Long = false;
bool has_SAR_Short = false;
//
// PULLBACK Signals ...
bool has_PULLBK_Long = false;
bool has_PULLBK_Short = false;
//
// Detect BOS Or CHOCH Signals ...
if (hasBOS || hasCHOCH)
{
//
// Do on CHOCH ...
if (hasCHOCH)
{
hasLong =
//
has_CHOCH_Long =
//
!isOrderFlowBullish &&
cBar.IsBullish() &&
@@ -305,7 +450,7 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
conditions.xchsarConditions.cSars[0] < cBar.low
//
;
if (hasLong)
if (has_CHOCH_Long)
{
//
provider = "CHOCH-Long";
@@ -313,7 +458,7 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
}
//
hasShort =
has_CHOCH_Short =
//
isOrderFlowBullish &&
cBar.IsBearish() &&
@@ -322,12 +467,15 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
conditions.xchsarConditions.cSars[0] > cBar.high
//
;
if (hasShort)
if (has_CHOCH_Short)
{
//
provider = "CHOCH-Short";
selectedSL = cBar.high;
}
//
mLastCHOCHOn = TimeCurrent();
}
//
@@ -335,18 +483,17 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
if (hasBOS)
{
//
hasLong =
has_BOS_Long =
//
isOrderFlowBullish &&
isCRMEBullish &&
cBar.IsBullish() &&
(isCBullishMomentumBar ||
isCBullishRejectionBar) &&
conditions.xchsarConditions.cSars[0] < cBar.low
//
;
//
if (hasLong)
if (has_BOS_Long)
{
//
provider = "BOS-Long";
@@ -354,23 +501,152 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
}
//
hasShort =
has_BOS_Short =
//
!isOrderFlowBullish &&
isCRMEBearish &&
cBar.IsBearish() &&
(isCBearishMomentumBar ||
isCBearishRejectionBar) &&
conditions.xchsarConditions.cSars[0] > cBar.high
//
;
if (hasShort)
if (has_BOS_Short)
{
//
provider = "BOS-Short";
selectedSL = cBar.high;
}
//
mLastBOSOn = TimeCurrent();
}
}
else
{
//
// Check PSar is Equals to Peak or Vale ...
bool isSAREqualsToPeak =
conditions.xchsarConditions.cSars[0] == conditions.xpvConditions.peaks[1];
bool isSAREqualsToVale =
conditions.xchsarConditions.cSars[0] == conditions.xpvConditions.vales[1];
//
has_SAR_Long =
//
isSAREqualsToVale &&
isOrderFlowBullish &&
isPSarInDirectionOfOrderFlow
//
;
if (has_SAR_Long)
{
//
provider = "SAR_Long";
selectedSL = conditions.xchsarConditions.cSars[0];
}
//
has_SAR_Short =
//
isSAREqualsToPeak &&
!isOrderFlowBullish &&
isPSarInDirectionOfOrderFlow
//
;
if (has_SAR_Short)
{
//
provider = "SAR_Short";
selectedSL = conditions.xchsarConditions.cSars[0];
}
//
// Check PULLBK Conditions ...
//
has_PULLBK_Long =
//
isCRMEBullish &&
isPSarInDirectionOfOrderFlow &&
(cBar.low < conditions.x3maConditions.fasts[0] &&
cBar.GetDown() > conditions.x3maConditions.fasts[0]) &&
!(pBar.low < conditions.x3maConditions.fasts[1] &&
pBar.GetDown() > conditions.x3maConditions.fasts[1])
//
;
if (has_PULLBK_Long)
{
//
provider = "PULLBK-Long";
selectedSL = cBar.low;
}
//
has_PULLBK_Short =
//
isCRMEBearish &&
isPSarInDirectionOfOrderFlow &&
(cBar.high > conditions.x3maConditions.fasts[0] &&
cBar.GetUp() < conditions.x3maConditions.fasts[0]) &&
!(pBar.high > conditions.x3maConditions.fasts[1] &&
pBar.GetUp() < conditions.x3maConditions.fasts[1])
//
;
if (has_PULLBK_Short)
{
//
provider = "PULLBK-Short";
selectedSL = cBar.high;
}
}
//
// Combine all Signals Conditions ...
//
hasLong =
//
has_BOS_Long
//
||
//
has_CHOCH_Long
// //
// ||
// //
// // has_SAR_Long
// //
// ||
// //
// has_PULLBK_Long
// //
// ||
//
// false
//
;
//
hasShort =
//
has_BOS_Short
//
||
//
has_CHOCH_Short
// //
// ||
// //
// // has_SAR_Short
// //
// ||
// //
// has_PULLBK_Short
// //
// ||
//
// false
//
;
//
result = hasLong ||
@@ -428,6 +704,7 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
//
Print("PRV: ", provider);
RedrawOrderFlow();
ClearDraws();
//
@@ -568,6 +845,11 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
XPVPivot mOrderFlow[];
ENUM_X_DIRECTION mOrderFlowDir;
//
// Holds Last CHOCH and BOS time ...
datetime mLastBOSOn;
datetime mLastCHOCHOn;
//
// Actions ...