last works ...

This commit is contained in:
2024-11-24 13:48:12 +03:30
parent 0e2e474d46
commit 042fa88d3a
6 changed files with 701 additions and 203 deletions
@@ -30,7 +30,7 @@
#include "../Classes/x-121.smc.base.strategy.class.mq5"
//
// Helper(s) ...
// Definitions ...
//
// XStrategy Class Implementation(s) ...
@@ -392,6 +392,13 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
pBar.high > lastPivot.lower)
//
;
//
if (hasBOS)
{
mLastBOSOn = TimeCurrent();
}
bool hasCHOCH =
isOrderFlowBullish
?
@@ -412,6 +419,45 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
//
;
//
if (hasCHOCH)
{
// RedrawOrderFlow();
mLastCHOCHOn = TimeCurrent();
// ClearDraws();
}
//
// 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];
//
bool hasNewPeak =
conditions.xpvConditions.peaks[0] != conditions.xpvConditions.peaks[1];
bool hasNewPeakOverLast =
hasNewPeak &&
conditions.xpvConditions.peaks[0] > conditions.xpvConditions.peaks[1];
bool hasNewPeakUnderLast =
hasNewPeak &&
conditions.xpvConditions.peaks[0] < conditions.xpvConditions.peaks[1];
//
bool hasNewVale =
conditions.xpvConditions.vales[0] != conditions.xpvConditions.vales[1];
bool hasNewValeOverLast =
hasNewVale &&
conditions.xpvConditions.vales[0] > conditions.xpvConditions.vales[1];
bool hasNewValeUnderLast =
hasNewVale &&
conditions.xpvConditions.vales[0] < conditions.xpvConditions.vales[1];
//
// START Signalling ...
//
//
// BOS Signals ...
bool has_BOS_Long = false;
@@ -433,172 +479,192 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
bool has_PULLBK_Short = false;
//
// Detect BOS Or CHOCH Signals ...
if (hasBOS || hasCHOCH)
// PV Signals ...
bool has_PV_Long = false;
bool has_PV_Short = false;
//
// BOS Signals ...
//
has_BOS_Long =
//
hasBOS &&
isOrderFlowBullish &&
isCRMEBullish &&
cBar.IsBullish() &&
conditions.xchsarConditions.cSars[0] < cBar.low
//
;
//
if (has_BOS_Long)
{
//
// Do on CHOCH ...
if (hasCHOCH)
{
//
has_CHOCH_Long =
//
!isOrderFlowBullish &&
cBar.IsBullish() &&
(isCBullishMomentumBar ||
isCBullishRejectionBar) &&
conditions.xchsarConditions.cSars[0] < cBar.low
//
;
if (has_CHOCH_Long)
{
//
provider = "CHOCH-Long";
selectedSL = cBar.low;
}
//
has_CHOCH_Short =
//
isOrderFlowBullish &&
cBar.IsBearish() &&
(isCBearishMomentumBar ||
isCBearishRejectionBar) &&
conditions.xchsarConditions.cSars[0] > cBar.high
//
;
if (has_CHOCH_Short)
{
//
provider = "CHOCH-Short";
selectedSL = cBar.high;
}
//
mLastCHOCHOn = TimeCurrent();
}
//
// Do on BOS ...
if (hasBOS)
{
//
has_BOS_Long =
//
isOrderFlowBullish &&
isCRMEBullish &&
cBar.IsBullish() &&
conditions.xchsarConditions.cSars[0] < cBar.low
//
;
//
if (has_BOS_Long)
{
//
provider = "BOS-Long";
selectedSL = cBar.low;
}
//
has_BOS_Short =
//
!isOrderFlowBullish &&
isCRMEBearish &&
cBar.IsBearish() &&
conditions.xchsarConditions.cSars[0] > cBar.high
//
;
if (has_BOS_Short)
{
//
provider = "BOS-Short";
selectedSL = cBar.high;
}
//
mLastBOSOn = TimeCurrent();
}
selectedSL = cBar.low;
provider = ToString(X_121_SMC_PROVIDER_BOS);
}
else
//
has_BOS_Short =
//
hasBOS &&
!isOrderFlowBullish &&
isCRMEBearish &&
cBar.IsBearish() &&
conditions.xchsarConditions.cSars[0] > cBar.high
//
;
if (has_BOS_Short)
{
//
// 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;
}
selectedSL = cBar.high;
provider = ToString(X_121_SMC_PROVIDER_BOS);
}
//
// CHOCH Signals ...
//
has_CHOCH_Long =
//
hasCHOCH &&
isCRMEBullish &&
cBar.IsBullish() &&
!isOrderFlowBullish &&
conditions.xchsarConditions.cSars[0] < cBar.low
//
;
if (has_CHOCH_Long)
{
//
selectedSL = cBar.low;
provider = ToString(X_121_SMC_PROVIDER_CHOCH);
}
//
has_CHOCH_Short =
//
hasCHOCH &&
isCRMEBearish &&
cBar.IsBearish() &&
isOrderFlowBullish &&
conditions.xchsarConditions.cSars[0] > cBar.high
//
;
if (has_CHOCH_Short)
{
//
selectedSL = cBar.high;
provider = ToString(X_121_SMC_PROVIDER_CHOCH);
}
//
// SAR Signals ...
//
has_SAR_Long =
//
isSAREqualsToVale &&
isOrderFlowBullish &&
isPSarInDirectionOfOrderFlow
//
;
if (has_SAR_Long)
{
//
provider = ToString(X_121_SMC_PROVIDER_SAR);
selectedSL = conditions.xchsarConditions.cSars[0];
}
//
has_SAR_Short =
//
isSAREqualsToPeak &&
!isOrderFlowBullish &&
isPSarInDirectionOfOrderFlow
//
;
if (has_SAR_Short)
{
//
provider = ToString(X_121_SMC_PROVIDER_SAR);
selectedSL = conditions.xchsarConditions.cSars[0];
}
//
// PULLBK Signals ...
//
has_PULLBK_Long =
//
isCRMEBullish &&
isPSarInDirectionOfOrderFlow &&
(cBar.low < conditions.x3maConditions.fasts[0] &&
cBar.GetDown() > conditions.x3maConditions.fasts[0])
//
;
if (has_PULLBK_Long)
{
//
selectedSL = cBar.low;
provider = ToString(X_121_SMC_PROVIDER_PULLBK);
}
//
has_PULLBK_Short =
//
isCRMEBearish &&
isPSarInDirectionOfOrderFlow &&
(cBar.high > conditions.x3maConditions.fasts[0] &&
cBar.GetUp() < conditions.x3maConditions.fasts[0])
//
;
if (has_PULLBK_Short)
{
//
selectedSL = cBar.high;
provider = ToString(X_121_SMC_PROVIDER_PULLBK);
}
//
// PV Signals ...
//
has_PV_Long =
//
isCRMEBullish &&
isOrderFlowBullish &&
!hasNewValeUnderLast &&
cBar.low == conditions.xpvConditions.vales[0]
//
;
if (has_PV_Long)
{
//
selectedSL = cBar.low;
provider = ToString(X_121_SMC_PROVIDER_PV);
}
//
has_PV_Short =
//
isCRMEBearish &&
!isOrderFlowBullish &&
!hasNewPeakOverLast &&
cBar.high == conditions.xpvConditions.peaks[0]
//
;
if (has_PV_Short)
{
//
selectedSL = cBar.high;
provider = ToString(X_121_SMC_PROVIDER_PV);
}
//
// END Signalling ...
//
//
// Combine all Signals Conditions ...
@@ -610,18 +676,18 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
||
//
has_CHOCH_Long
// //
// ||
// //
// // has_SAR_Long
// //
// ||
// //
// has_PULLBK_Long
// //
// ||
//
// false
||
//
has_SAR_Long
//
||
//
has_PULLBK_Long
//
||
//
has_PV_Long
//
;
@@ -633,18 +699,18 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
||
//
has_CHOCH_Short
// //
// ||
// //
// // has_SAR_Short
// //
// ||
// //
// has_PULLBK_Short
// //
// ||
//
// false
||
//
has_SAR_Short
//
||
//
has_PULLBK_Short
//
||
//
has_PV_Short
//
;
@@ -652,6 +718,17 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
result = hasLong ||
hasShort;
//
// Reset Order Flow ...
if (hasCHOCH && !result)
{
ResetOrderFlow();
}
else if (hasBOS && !result)
{
UpdateOrderFlow();
}
//
// Rmove Signal Condition ...
if (result)
@@ -702,11 +779,6 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
? entry + reward
: entry - reward;
//
Print("PRV: ", provider);
RedrawOrderFlow();
ClearDraws();
//
signal.sl = sl;
signal.tp = tp;
@@ -717,13 +789,20 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
signal.symbol = _symbol;
signal.period = _period;
signal.pushers = pushers;
signal.provider = GetTag();
signal.provider = provider;
signal.time = TimeCurrent();
//
result = PrepareSignal(signal);
if (result)
{
//
Print("PRV: ", provider);
RedrawOrderFlow();
DrawSignal(signal);
ClearDraws();
//
ResetOrderFlow();
}
@@ -1425,10 +1504,9 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
* When a BOS Happens ...
* we have to Update Order Flow ...
*/
void UpdateOrderFlowOnBOS()
void UpdateOrderFlow()
{
//
Print("UpdateOrderFlowOnBOS");
ResetOrderFlow();
}
/**