implement senario 1 ...

This commit is contained in:
2025-03-09 05:31:53 +03:30
parent d14f07ba80
commit 5c6dfd8bdf
4 changed files with 924 additions and 86 deletions
@@ -453,6 +453,7 @@ class XC121SMCCycleHelper : public XCBase
return result; return result;
} }
//
bool GeneratePVBox( bool GeneratePVBox(
XBoxZone &box, XBoxZone &box,
int barIndex = 0 // int barIndex = 0 //
@@ -487,7 +488,9 @@ class XC121SMCCycleHelper : public XCBase
datetime valesSameFrom = NULL; datetime valesSameFrom = NULL;
double vale = mX121Helper.xpvHelper.GetVale(index); double vale = mX121Helper.xpvHelper.GetVale(index);
double prevVale = mX121Helper.xpvHelper.GetVale(index + 1); double prevVale = mX121Helper.xpvHelper.GetVale(index + 1);
bool startsByVale = vale == prevVale; bool startsByVale =
!startsByPeak &&
vale == prevVale;
// //
bool canBreak = false; bool canBreak = false;
@@ -712,11 +715,33 @@ struct X121SMCStrategyConditionParser
// //
bool isX3MaInsidePeaksGoldenZone; bool isX3MaInsidePeaksGoldenZone;
bool isX3MaCrossedInsidePeaksGoldenZone; bool isX3MaCrossedInsidePeaksGoldenZone;
//
bool isX3MaInsideValesGoldenZone; bool isX3MaInsideValesGoldenZone;
bool isX3MaCrossedInsideValesGoldenZone; bool isX3MaCrossedInsideValesGoldenZone;
//
bool isX3MaBullishStateOverPeaksGoldenZone;
bool isX3MaBearishStateOverPeaksGoldenZone;
bool isX3MaSwitchedToBullishStateOverPeaksGoldenZone;
bool isX3MaSwitchedToBearishStateOverPeaksGoldenZone;
//
bool isX3MaBullishOrderedOverPeaksGoldenZone;
bool isX3MaBearishOrderedOverPeaksGoldenZone;
bool isX3MaSwitchedToBullishOrderedOverPeaksGoldenZone;
bool isX3MaSwitchedToBearishOrderedOverPeaksGoldenZone;
//
bool isX3MaBullishStateUnderValesGoldenZone;
bool isX3MaBearishStateUnderValesGoldenZone;
bool isX3MaSwitchedToBullishStateUnderValesGoldenZone;
bool isX3MaSwitchedToBearishStateUnderValesGoldenZone;
//
bool isX3MaBullishOrderedUnderValesGoldenZone;
bool isX3MaBearishOrderedUnderValesGoldenZone;
bool isX3MaSwitchedToBullishOrderedUnderValesGoldenZone;
bool isX3MaSwitchedToBearishOrderedUnderValesGoldenZone;
// //
// XVWAP ... // XVWAP ...
@@ -726,6 +751,36 @@ struct X121SMCStrategyConditionParser
bool isVWapFastOverPeaksGoldenZone; bool isVWapFastOverPeaksGoldenZone;
bool isVWapFastCrossedOverPeaksGoldenZone; bool isVWapFastCrossedOverPeaksGoldenZone;
//
bool isVWapInsidePeaksGoldenZone;
bool isVWapCrossedInsidePeaksGoldenZone;
bool isVWapInsideValesGoldenZone;
bool isVWapCrossedInsideValesGoldenZone;
//
bool isVWapBullishStateOverPeaksGoldenZone;
bool isVWapBearishStateOverPeaksGoldenZone;
bool isVWapSwitchedToBullishStateOverPeaksGoldenZone;
bool isVWapSwitchedToBearishStateOverPeaksGoldenZone;
//
bool isVWapBullishOrderedOverPeaksGoldenZone;
bool isVWapBearishOrderedOverPeaksGoldenZone;
bool isVWapSwitchedToBullishOrderedOverPeaksGoldenZone;
bool isVWapSwitchedToBearishOrderedOverPeaksGoldenZone;
//
bool isVWapBullishStateUnderValesGoldenZone;
bool isVWapBearishStateUnderValesGoldenZone;
bool isVWapSwitchedToBullishStateUnderValesGoldenZone;
bool isVWapSwitchedToBearishStateUnderValesGoldenZone;
//
bool isVWapBullishOrderedUnderValesGoldenZone;
bool isVWapBearishOrderedUnderValesGoldenZone;
bool isVWapSwitchedToBullishOrderedUnderValesGoldenZone;
bool isVWapSwitchedToBearishOrderedUnderValesGoldenZone;
// //
// XHK ... // XHK ...
@@ -748,8 +803,49 @@ struct X121SMCStrategyConditionParser
bool isSMHKSwitchedToBullishUnderValesGoldenZone; bool isSMHKSwitchedToBullishUnderValesGoldenZone;
// //
bool isXVwapMaOverPeaksGoldeZone; // XATR ...
bool isXVwapMaUnderValesGoldeZone;
//
bool isAtrUpperOverPeaksGoldenZone;
bool isAtrLowerOverPeaksGoldenZone;
bool isAtrOverPeaksGoldenZone;
bool isAtrCrossedOverPeaksGoldenZone;
//
bool isAtrUpperUnderValesGoldenZone;
bool isAtrLowerUnderValesGoldenZone;
bool isAtrUnderValesGoldenZone;
bool isAtrCrossedUnderValesGoldenZone;
//
// XSTR ...
//
bool isStrBullishOverPeaksGoldenZone;
bool isStrBearishOverPeaksGoldenZone;
bool isStrSwitchedToBullishOverPeaksGoldenZone;
bool isStrSwitchedToBearishOverPeaksGoldenZone;
//
bool isStrBullishUnderValesGoldenZone;
bool isStrBearishUnderValesGoldenZone;
bool isStrSwitchedToBullishUnderValesGoldenZone;
bool isStrSwitchedToBearishUnderValesGoldenZone;
//
// XCHE ...
//
bool isCheBullishOverPeaksGoldenZone;
bool isCheBearishOverPeaksGoldenZone;
bool isCheSwitchedBullishOverPeaksGoldenZone;
bool isCheSwitchedBearishOverPeaksGoldenZone;
//
bool isCheBullishUnderValesGoldenZone;
bool isCheBearishUnderValesGoldenZone;
bool isCheSwitchedBullishUnderValesGoldenZone;
bool isCheSwitchedBearishUnderValesGoldenZone;
// //
// Constructor ... // Constructor ...
@@ -764,6 +860,9 @@ struct X121SMCStrategyConditionParser
// //
void Clean() void Clean()
{ {
//
// XSAR ...
// //
isSarBullishOverPeaksGoldenZone = false; isSarBullishOverPeaksGoldenZone = false;
isSarSwitchedToBullishOverPeaksGoldenZone = false; isSarSwitchedToBullishOverPeaksGoldenZone = false;
@@ -774,6 +873,9 @@ struct X121SMCStrategyConditionParser
isSarBearishUnderValesGoldenZone = false; isSarBearishUnderValesGoldenZone = false;
isSarSwitchedToBearishUnderValesGoldenZone = false; isSarSwitchedToBearishUnderValesGoldenZone = false;
//
// X3MA ...
// //
isX3MaFastUnderValesGoldenZone = false; isX3MaFastUnderValesGoldenZone = false;
isX3MaFastCrossedUnderValesGoldenZone = false; isX3MaFastCrossedUnderValesGoldenZone = false;
@@ -783,23 +885,87 @@ struct X121SMCStrategyConditionParser
// //
isX3MaInsidePeaksGoldenZone = false; isX3MaInsidePeaksGoldenZone = false;
isX3MaCrossedInsidePeaksGoldenZone = false; isX3MaCrossedInsidePeaksGoldenZone = false;
//
isX3MaInsideValesGoldenZone = false; isX3MaInsideValesGoldenZone = false;
isX3MaCrossedInsideValesGoldenZone = false; isX3MaCrossedInsideValesGoldenZone = false;
//
isX3MaBullishStateOverPeaksGoldenZone = false;
isX3MaBearishStateOverPeaksGoldenZone = false;
isX3MaSwitchedToBullishStateOverPeaksGoldenZone = false;
isX3MaSwitchedToBearishStateOverPeaksGoldenZone = false;
//
isX3MaBullishOrderedOverPeaksGoldenZone = false;
isX3MaBearishOrderedOverPeaksGoldenZone = false;
isX3MaSwitchedToBullishOrderedOverPeaksGoldenZone = false;
isX3MaSwitchedToBearishOrderedOverPeaksGoldenZone = false;
//
isX3MaBullishStateUnderValesGoldenZone = false;
isX3MaBearishStateUnderValesGoldenZone = false;
isX3MaSwitchedToBullishStateUnderValesGoldenZone = false;
isX3MaSwitchedToBearishStateUnderValesGoldenZone = false;
//
isX3MaBullishOrderedUnderValesGoldenZone = false;
isX3MaBearishOrderedUnderValesGoldenZone = false;
isX3MaSwitchedToBullishOrderedUnderValesGoldenZone = false;
isX3MaSwitchedToBearishOrderedUnderValesGoldenZone = false;
//
// XVWAP ...
// //
isVWapFastUnderValesGoldenZone = false; isVWapFastUnderValesGoldenZone = false;
isVWapFastCrossedUnderValesGoldenZone = false; isVWapFastCrossedUnderValesGoldenZone = false;
isVWapFastOverPeaksGoldenZone = false; isVWapFastOverPeaksGoldenZone = false;
isVWapFastCrossedOverPeaksGoldenZone = false; isVWapFastCrossedOverPeaksGoldenZone = false;
//
isVWapInsidePeaksGoldenZone = false;
isVWapCrossedInsidePeaksGoldenZone = false;
isVWapInsideValesGoldenZone = false;
isVWapCrossedInsideValesGoldenZone = false;
//
isVWapBullishStateOverPeaksGoldenZone = false;
isVWapBearishStateOverPeaksGoldenZone = false;
isVWapSwitchedToBullishStateOverPeaksGoldenZone = false;
isVWapSwitchedToBearishStateOverPeaksGoldenZone = false;
//
isVWapBullishOrderedOverPeaksGoldenZone = false;
isVWapBearishOrderedOverPeaksGoldenZone = false;
isVWapSwitchedToBullishOrderedOverPeaksGoldenZone = false;
isVWapSwitchedToBearishOrderedOverPeaksGoldenZone = false;
//
isVWapBullishStateUnderValesGoldenZone = false;
isVWapBearishStateUnderValesGoldenZone = false;
isVWapSwitchedToBullishStateUnderValesGoldenZone = false;
isVWapSwitchedToBearishStateUnderValesGoldenZone = false;
//
isVWapBullishOrderedUnderValesGoldenZone = false;
isVWapBearishOrderedUnderValesGoldenZone = false;
isVWapSwitchedToBullishOrderedUnderValesGoldenZone = false;
isVWapSwitchedToBearishOrderedUnderValesGoldenZone = false;
//
// XHK ...
//
// XRWHK ...
// //
isRawHKBearishOverPeaksGoldenZone = false; isRawHKBearishOverPeaksGoldenZone = false;
isRawHKSwitchedToBearishOverPeaksGoldenZone = false; isRawHKSwitchedToBearishOverPeaksGoldenZone = false;
isRawHKBullishUnderValesGoldenZone = false; isRawHKBullishUnderValesGoldenZone = false;
isRawHKSwitchedToBullishUnderValesGoldenZone = false; isRawHKSwitchedToBullishUnderValesGoldenZone = false;
//
// XSMHK ...
// //
isSMHKBearishOverPeaksGoldenZone = false; isSMHKBearishOverPeaksGoldenZone = false;
isSMHKSwitchedToBearishOverPeaksGoldenZone = false; isSMHKSwitchedToBearishOverPeaksGoldenZone = false;
@@ -807,8 +973,49 @@ struct X121SMCStrategyConditionParser
isSMHKSwitchedToBullishUnderValesGoldenZone = false; isSMHKSwitchedToBullishUnderValesGoldenZone = false;
// //
isXVwapMaOverPeaksGoldeZone = false; // XATR ...
isXVwapMaUnderValesGoldeZone = false;
//
isAtrUpperOverPeaksGoldenZone = false;
isAtrLowerOverPeaksGoldenZone = false;
isAtrOverPeaksGoldenZone = false;
isAtrCrossedOverPeaksGoldenZone = false;
//
isAtrUpperUnderValesGoldenZone = false;
isAtrLowerUnderValesGoldenZone = false;
isAtrUnderValesGoldenZone = false;
isAtrCrossedUnderValesGoldenZone = false;
//
// XSTR ...
//
isStrBullishOverPeaksGoldenZone = false;
isStrBearishOverPeaksGoldenZone = false;
isStrSwitchedToBullishOverPeaksGoldenZone = false;
isStrSwitchedToBearishOverPeaksGoldenZone = false;
//
isStrBullishUnderValesGoldenZone = false;
isStrBearishUnderValesGoldenZone = false;
isStrSwitchedToBullishUnderValesGoldenZone = false;
isStrSwitchedToBearishUnderValesGoldenZone = false;
//
// XCHE ...
//
isCheBullishOverPeaksGoldenZone = false;
isCheBearishOverPeaksGoldenZone = false;
isCheSwitchedBullishOverPeaksGoldenZone = false;
isCheSwitchedBearishOverPeaksGoldenZone = false;
//
isCheBullishUnderValesGoldenZone = false;
isCheBearishUnderValesGoldenZone = false;
isCheSwitchedBullishUnderValesGoldenZone = false;
isCheSwitchedBearishUnderValesGoldenZone = false;
// //
ZeroMemory(this); ZeroMemory(this);
@@ -939,6 +1146,86 @@ struct X121SMCStrategyConditionParser
// //
); );
//
isX3MaBullishStateOverPeaksGoldenZone =
isX3MaInsidePeaksGoldenZone &&
conditions.isX3MaBullishState;
//
isX3MaBearishStateOverPeaksGoldenZone =
isX3MaInsidePeaksGoldenZone &&
conditions.isX3MaBearishState;
//
isX3MaSwitchedToBullishStateOverPeaksGoldenZone =
isX3MaInsidePeaksGoldenZone &&
conditions.isX3MaSwitchedToBullishState;
//
isX3MaSwitchedToBearishStateOverPeaksGoldenZone =
isX3MaInsidePeaksGoldenZone &&
conditions.isX3MaSwitchedToBearishState;
//
isX3MaBullishOrderedOverPeaksGoldenZone =
isX3MaInsidePeaksGoldenZone &&
conditions.isX3MaBullishOrdered;
//
isX3MaBearishOrderedOverPeaksGoldenZone =
isX3MaInsidePeaksGoldenZone &&
conditions.isX3MaBearishOrdered;
//
isX3MaSwitchedToBullishOrderedOverPeaksGoldenZone =
isX3MaInsidePeaksGoldenZone &&
conditions.isX3MaSwitchedToBullishOrdered;
//
isX3MaSwitchedToBearishOrderedOverPeaksGoldenZone =
isX3MaInsidePeaksGoldenZone &&
conditions.isX3MaSwitchedToBearishOrdered;
//
isX3MaBullishStateUnderValesGoldenZone =
isX3MaInsideValesGoldenZone &&
conditions.isX3MaBullishState;
//
isX3MaBearishStateUnderValesGoldenZone =
isX3MaInsideValesGoldenZone &&
conditions.isX3MaBearishState;
//
isX3MaSwitchedToBullishStateUnderValesGoldenZone =
isX3MaInsideValesGoldenZone &&
conditions.isX3MaSwitchedToBullishState;
//
isX3MaSwitchedToBearishStateUnderValesGoldenZone =
isX3MaInsideValesGoldenZone &&
conditions.isX3MaSwitchedToBearishState;
//
isX3MaBullishOrderedUnderValesGoldenZone =
isX3MaInsideValesGoldenZone &&
conditions.isX3MaBullishOrdered;
//
isX3MaBearishOrderedUnderValesGoldenZone =
isX3MaInsideValesGoldenZone &&
conditions.isX3MaBearishOrdered;
//
isX3MaSwitchedToBullishOrderedUnderValesGoldenZone =
isX3MaInsideValesGoldenZone &&
conditions.isX3MaSwitchedToBullishOrdered;
//
isX3MaSwitchedToBearishOrderedUnderValesGoldenZone =
isX3MaInsideValesGoldenZone &&
conditions.isX3MaSwitchedToBearishOrdered;
// //
// XVWAP ... // XVWAP ...
@@ -960,6 +1247,134 @@ struct X121SMCStrategyConditionParser
isVWapFastOverPeaksGoldenZone && isVWapFastOverPeaksGoldenZone &&
conditions.vwapFastBuffer[pIDX] <= conditions.peaksGoldenBuffer[pIDX]; conditions.vwapFastBuffer[pIDX] <= conditions.peaksGoldenBuffer[pIDX];
//
isVWapInsidePeaksGoldenZone =
//
conditions.vwapMin < conditions.peaksBuffer[cIDX] &&
conditions.vwapMin > conditions.peaksGoldenBuffer[cIDX] &&
//
conditions.vwapMax < conditions.peaksBuffer[cIDX] &&
conditions.vwapMax > conditions.peaksGoldenBuffer[cIDX]
//
;
//
isVWapCrossedInsidePeaksGoldenZone =
isVWapInsidePeaksGoldenZone &&
!(
//
conditions.vwapMin < conditions.peaksBuffer[pIDX] &&
conditions.vwapMin > conditions.peaksGoldenBuffer[pIDX] &&
//
conditions.vwapMax < conditions.peaksBuffer[pIDX] &&
conditions.vwapMax > conditions.peaksGoldenBuffer[pIDX]
//
);
//
isVWapInsideValesGoldenZone =
//
conditions.vwapMin > conditions.valesBuffer[cIDX] &&
conditions.vwapMin < conditions.valesGoldenBuffer[cIDX] &&
//
conditions.vwapMax > conditions.valesBuffer[cIDX] &&
conditions.vwapMax < conditions.valesGoldenBuffer[cIDX]
//
;
//
isVWapCrossedInsideValesGoldenZone =
isVWapInsideValesGoldenZone &&
!(
//
conditions.vwapMin > conditions.valesBuffer[pIDX] &&
conditions.vwapMin < conditions.valesGoldenBuffer[pIDX] &&
//
conditions.vwapMax > conditions.valesBuffer[pIDX] &&
conditions.vwapMax < conditions.valesGoldenBuffer[pIDX]
//
);
//
isVWapBullishStateOverPeaksGoldenZone =
isVWapInsidePeaksGoldenZone &&
conditions.isVWapBullishState;
//
isVWapBearishStateOverPeaksGoldenZone =
isVWapInsidePeaksGoldenZone &&
conditions.isVWapBearishState;
//
isVWapSwitchedToBullishStateOverPeaksGoldenZone =
isVWapInsidePeaksGoldenZone &&
conditions.isVWapSwitchedToBullishState;
//
isVWapSwitchedToBearishStateOverPeaksGoldenZone =
isVWapInsidePeaksGoldenZone &&
conditions.isVWapSwitchedToBearishState;
//
isVWapBullishOrderedOverPeaksGoldenZone =
isVWapInsidePeaksGoldenZone &&
conditions.isVWapBullishOrdered;
//
isVWapBearishOrderedOverPeaksGoldenZone =
isVWapInsidePeaksGoldenZone &&
conditions.isVWapBearishOrdered;
//
isVWapSwitchedToBullishOrderedOverPeaksGoldenZone =
isVWapInsidePeaksGoldenZone &&
conditions.isVWapSwitchedToBullishOrdered;
//
isVWapSwitchedToBearishOrderedOverPeaksGoldenZone =
isVWapInsidePeaksGoldenZone &&
conditions.isVWapSwitchedToBearishOrdered;
//
isVWapBullishStateUnderValesGoldenZone =
isVWapInsideValesGoldenZone &&
conditions.isVWapBullishState;
//
isVWapBearishStateUnderValesGoldenZone =
isVWapInsideValesGoldenZone &&
conditions.isVWapBearishState;
//
isVWapSwitchedToBullishStateUnderValesGoldenZone =
isVWapInsideValesGoldenZone &&
conditions.isVWapSwitchedToBullishState;
//
isVWapSwitchedToBearishStateUnderValesGoldenZone =
isVWapInsideValesGoldenZone &&
conditions.isVWapSwitchedToBearishState;
//
isVWapBullishOrderedUnderValesGoldenZone =
isVWapInsideValesGoldenZone &&
conditions.isVWapBullishOrdered;
//
isVWapBearishOrderedUnderValesGoldenZone =
isVWapInsideValesGoldenZone &&
conditions.isVWapBearishOrdered;
//
isVWapSwitchedToBullishOrderedUnderValesGoldenZone =
isVWapInsideValesGoldenZone &&
conditions.isVWapSwitchedToBullishOrdered;
//
isVWapSwitchedToBearishOrderedUnderValesGoldenZone =
isVWapInsideValesGoldenZone &&
conditions.isVWapSwitchedToBearishOrdered;
// //
// XHK ... // XHK ...
@@ -1010,41 +1425,185 @@ struct X121SMCStrategyConditionParser
conditions.xhkSMLowBuffer[cIDX] < conditions.valesGoldenBuffer[cIDX]; conditions.xhkSMLowBuffer[cIDX] < conditions.valesGoldenBuffer[cIDX];
// //
// COMBINED Conditions ... // XATR ...
// //
isXVwapMaOverPeaksGoldeZone = isAtrUpperOverPeaksGoldenZone =
// conditions.atrUpperBuffer[cIDX] < conditions.peaksBuffer[cIDX] &&
( conditions.atrUpperBuffer[cIDX] > conditions.peaksGoldenBuffer[cIDX];
//
(isX3MaFastOverPeaksGoldenZone &&
isVWapFastCrossedOverPeaksGoldenZone)
//
||
//
(isVWapFastOverPeaksGoldenZone &&
isX3MaFastCrossedOverPeaksGoldenZone)
//
)
//
;
// //
isXVwapMaUnderValesGoldeZone = isAtrLowerOverPeaksGoldenZone =
// conditions.atrLowerBuffer[cIDX] < conditions.peaksBuffer[cIDX] &&
( conditions.atrLowerBuffer[cIDX] > conditions.peaksGoldenBuffer[cIDX];
//
isAtrOverPeaksGoldenZone =
isAtrUpperOverPeaksGoldenZone &&
isAtrLowerOverPeaksGoldenZone;
//
isAtrCrossedOverPeaksGoldenZone =
isAtrOverPeaksGoldenZone &&
!(
// //
(isX3MaFastUnderValesGoldenZone && conditions.atrUpperBuffer[pIDX] < conditions.peaksBuffer[pIDX] &&
isVWapFastCrossedUnderValesGoldenZone) conditions.atrUpperBuffer[pIDX] > conditions.peaksGoldenBuffer[pIDX]
// //
|| &&
// //
(isVWapFastUnderValesGoldenZone && conditions.atrLowerBuffer[pIDX] < conditions.peaksBuffer[pIDX] &&
isX3MaFastCrossedUnderValesGoldenZone) conditions.atrLowerBuffer[pIDX] > conditions.peaksGoldenBuffer[pIDX]
// //
) );
//
; //
isAtrUpperUnderValesGoldenZone =
conditions.atrUpperBuffer[cIDX] > conditions.valesBuffer[cIDX] &&
conditions.atrUpperBuffer[cIDX] < conditions.valesGoldenBuffer[cIDX];
//
isAtrLowerUnderValesGoldenZone =
conditions.atrLowerBuffer[cIDX] > conditions.valesBuffer[cIDX] &&
conditions.atrLowerBuffer[cIDX] < conditions.valesGoldenBuffer[cIDX];
//
isAtrUnderValesGoldenZone =
isAtrUpperUnderValesGoldenZone &&
isAtrLowerUnderValesGoldenZone;
//
isAtrCrossedUnderValesGoldenZone =
isAtrUnderValesGoldenZone &&
!(
//
conditions.atrUpperBuffer[pIDX] > conditions.valesBuffer[pIDX] &&
conditions.atrUpperBuffer[pIDX] < conditions.valesGoldenBuffer[pIDX]
//
&&
//
conditions.atrLowerBuffer[pIDX] > conditions.valesBuffer[pIDX] &&
conditions.atrLowerBuffer[pIDX] < conditions.valesGoldenBuffer[pIDX]
//
);
//
// XSTR ...
//
isStrBullishOverPeaksGoldenZone =
conditions.isStrBullish &&
conditions.strBuffer[cIDX] < conditions.peaksBuffer[cIDX] &&
conditions.strBuffer[cIDX] > conditions.peaksGoldenBuffer[cIDX];
//
isStrBearishOverPeaksGoldenZone =
conditions.isStrBearish &&
conditions.strBuffer[cIDX] < conditions.peaksBuffer[cIDX] &&
conditions.strBuffer[cIDX] > conditions.peaksGoldenBuffer[cIDX];
//
isStrSwitchedToBullishOverPeaksGoldenZone =
conditions.isStrSwitchedToBullish &&
conditions.strBuffer[cIDX] < conditions.peaksBuffer[cIDX] &&
conditions.strBuffer[cIDX] > conditions.peaksGoldenBuffer[cIDX];
//
isStrSwitchedToBearishOverPeaksGoldenZone =
conditions.isStrSwitchedToBearish &&
conditions.strBuffer[cIDX] < conditions.peaksBuffer[cIDX] &&
conditions.strBuffer[cIDX] > conditions.peaksGoldenBuffer[cIDX];
//
isStrBullishUnderValesGoldenZone =
conditions.isStrBullish &&
conditions.strBuffer[cIDX] > conditions.valesBuffer[cIDX] &&
conditions.strBuffer[cIDX] < conditions.valesGoldenBuffer[cIDX];
//
isStrBearishUnderValesGoldenZone =
conditions.isStrBearish &&
conditions.strBuffer[cIDX] > conditions.valesBuffer[cIDX] &&
conditions.strBuffer[cIDX] < conditions.valesGoldenBuffer[cIDX];
//
isStrSwitchedToBullishUnderValesGoldenZone =
conditions.isStrSwitchedToBullish &&
conditions.strBuffer[cIDX] > conditions.valesBuffer[cIDX] &&
conditions.strBuffer[cIDX] < conditions.valesGoldenBuffer[cIDX];
//
isStrSwitchedToBearishUnderValesGoldenZone =
conditions.isStrSwitchedToBearish &&
conditions.strBuffer[cIDX] > conditions.valesBuffer[cIDX] &&
conditions.strBuffer[cIDX] < conditions.valesGoldenBuffer[cIDX];
//
// XCHE ...
//
isCheBullishOverPeaksGoldenZone =
conditions.isCheBullish &&
conditions.le1Buffer[cIDX] < conditions.peaksBuffer[cIDX] &&
conditions.le1Buffer[cIDX] > conditions.peaksGoldenBuffer[cIDX] &&
conditions.le2Buffer[cIDX] < conditions.peaksBuffer[cIDX] &&
conditions.le2Buffer[cIDX] > conditions.peaksGoldenBuffer[cIDX];
//
isCheBearishOverPeaksGoldenZone =
conditions.isCheSwitchedToBullish &&
conditions.se1Buffer[cIDX] < conditions.peaksBuffer[cIDX] &&
conditions.se1Buffer[cIDX] > conditions.peaksGoldenBuffer[cIDX] &&
conditions.se2Buffer[cIDX] < conditions.peaksBuffer[cIDX] &&
conditions.se2Buffer[cIDX] > conditions.peaksGoldenBuffer[cIDX];
//
isCheSwitchedBullishOverPeaksGoldenZone =
conditions.isCheSwitchedToBullish &&
conditions.le1Buffer[cIDX] < conditions.peaksBuffer[cIDX] &&
conditions.le1Buffer[cIDX] > conditions.peaksGoldenBuffer[cIDX] &&
conditions.le2Buffer[cIDX] < conditions.peaksBuffer[cIDX] &&
conditions.le2Buffer[cIDX] > conditions.peaksGoldenBuffer[cIDX];
//
isCheSwitchedBearishOverPeaksGoldenZone =
conditions.isCheSwitchedToBearish &&
conditions.se1Buffer[cIDX] < conditions.peaksBuffer[cIDX] &&
conditions.se1Buffer[cIDX] > conditions.peaksGoldenBuffer[cIDX] &&
conditions.se2Buffer[cIDX] < conditions.peaksBuffer[cIDX] &&
conditions.se2Buffer[cIDX] > conditions.peaksGoldenBuffer[cIDX];
//
isCheBullishUnderValesGoldenZone =
conditions.isCheBullish &&
conditions.cheMin > conditions.valesBuffer[cIDX] &&
conditions.cheMin < conditions.valesGoldenBuffer[cIDX] &&
conditions.cheMax > conditions.valesBuffer[cIDX] &&
conditions.cheMax < conditions.valesGoldenBuffer[cIDX];
//
isCheBearishUnderValesGoldenZone =
conditions.isCheBearish &&
conditions.cheMin > conditions.valesBuffer[cIDX] &&
conditions.cheMin < conditions.valesGoldenBuffer[cIDX] &&
conditions.cheMax > conditions.valesBuffer[cIDX] &&
conditions.cheMax < conditions.valesGoldenBuffer[cIDX];
//
isCheSwitchedBullishUnderValesGoldenZone =
conditions.isCheSwitchedToBullish &&
conditions.cheMin > conditions.valesBuffer[cIDX] &&
conditions.cheMin < conditions.valesGoldenBuffer[cIDX] &&
conditions.cheMax > conditions.valesBuffer[cIDX] &&
conditions.cheMax < conditions.valesGoldenBuffer[cIDX];
//
isCheSwitchedBearishUnderValesGoldenZone =
conditions.isCheSwitchedToBearish &&
conditions.cheMin > conditions.valesBuffer[cIDX] &&
conditions.cheMin < conditions.valesGoldenBuffer[cIDX] &&
conditions.cheMax > conditions.valesBuffer[cIDX] &&
conditions.cheMax < conditions.valesGoldenBuffer[cIDX];
} }
// //
@@ -450,51 +450,50 @@ class XCX121SMCXWZSignalDetector : public XCBase
signalBoxDir // signalBoxDir //
); );
//
// Selecting SL(s) ...
// //
double iSL = 0; double iSL = 0;
//
// Default SL ...
iSL = pivot;
//
Add(
iSL,
sls //
);
// //
// Select and Provide SL Based on ... // Select and Provide SL Based on ...
if (signalProvider == X121SMC_XWZ_PROVIDER_ACTIVATED_MA) if (signalProvider == X121SMC_XWZ_PROVIDER_ACTIVATED_MA)
{ {
//
// Default SL ...
iSL = pivot;
//
Add(
iSL,
sls //
);
} }
else if (signalProvider == X121SMC_XWZ_PROVIDER_ACTIVATED_BOX) else if (signalProvider == X121SMC_XWZ_PROVIDER_ACTIVATED_BOX)
{ {
// //
// Default SL ... iSL = MathMax(
iSL = pivot; provider.decisionXConditions.se1Buffer[1],
provider.decisionXConditions.se2Buffer[1] //
//
Add(
iSL,
sls //
); );
if (iSL > 0)
{
//
Add(
iSL,
sls //
);
}
} }
else if (signalProvider == X121SMC_XWZ_PROVIDER_ACTIVATED_AREA) else if (signalProvider == X121SMC_XWZ_PROVIDER_ACTIVATED_AREA)
{ {
//
// Default SL ...
iSL = pivot;
//
Add(
iSL,
sls //
);
} }
// //
double iAtr = provider.decisionXConditions.atrBuffer[1]; double iAtr = provider.decisionXConditions.atrBuffer[1];
iAtr *= 1.5; iAtr *= 0;
// //
// Select Condition SL ... // Select Condition SL ...
@@ -504,8 +503,8 @@ class XCX121SMCXWZSignalDetector : public XCBase
double slsMax = GetMax(sls); double slsMax = GetMax(sls);
// //
double longSL = slsMin - iAtr; double longSL = slsMax - iAtr;
double shortSL = slsMax + iAtr; double shortSL = slsMin + iAtr;
// //
sl = isBullish sl = isBullish
+292 -12
View File
@@ -2019,6 +2019,15 @@ struct X121SMCStrategyXWZWorkingZone
return result; return result;
} }
//
int zIDX = barIndex;
int cIDX = zIDX + 1;
int pIDX = cIDX + 1;
//
bool isBullish = false;
bool isBearish = false;
// //
XOHCL zBar; XOHCL zBar;
XOHCL cBar; XOHCL cBar;
@@ -2053,23 +2062,294 @@ struct X121SMCStrategyXWZWorkingZone
X121SMCStrategyConditionParser decisionParser; X121SMCStrategyConditionParser decisionParser;
decisionParser.Parse(provider.decisionXConditions); decisionParser.Parse(provider.decisionXConditions);
//
bool has =
//
// false
decisionParser.isX3MaCrossedInsideValesGoldenZone
//
;
if (has)
{
Print("Condition ...");
}
// //
// Senario 1: // Senario 1:
// ---------- // ----------
// //
// Senario 1 Bullish Conditions ...
bool isSenario1Bullish =
//
// X3Ma / XVwap Switched To Bulish ...
(
//
// X3Ma Switched To Bulish ...
(
//
(provider.decisionXConditions.isX3MaFastCrossedOverMid &&
decisionParser.isX3MaBullishStateUnderValesGoldenZone)
//
)
//
||
//
// XVWap Switched To Bulish ...
(
//
(provider.decisionXConditions.isVWapFastCrossedOverMid &&
decisionParser.isVWapBullishStateUnderValesGoldenZone)
//
)
//
)
//
&&
//
// Checking other Conditions ...
(
//
// XSTR ...
provider.decisionXConditions.isStrBullish &&
//
// XCHE ...
provider.decisionXConditions.isCheBullish &&
provider.decisionXConditions.le1Buffer[cIDX] < cBar.low &&
provider.decisionXConditions.le2Buffer[cIDX] < cBar.low
//
)
//
;
//
// Senario 1 Bearish Conditions ...
bool isSenario1Bearish =
//
// X3Ma / XVwap Switched To Bearish ...
(
//
// X3Ma Switched To Bearish ...
(
//
(provider.decisionXConditions.isX3MaFastCrossedUnderMid &&
decisionParser.isX3MaBearishStateOverPeaksGoldenZone)
//
)
//
||
//
// XVWap Switched To Bearish ...
(
//
(provider.decisionXConditions.isVWapFastCrossedUnderMid &&
decisionParser.isVWapBearishStateOverPeaksGoldenZone)
//
)
//
)
//
&&
//
// Checking other Conditions ...
(
//
// XSTR ...
provider.decisionXConditions.isStrBearish &&
//
// XCHE ...
provider.decisionXConditions.isCheBearish &&
provider.decisionXConditions.se1Buffer[cIDX] > cBar.high &&
provider.decisionXConditions.se2Buffer[cIDX] > cBar.high
//
)
//
;
//
// Filling Requirements using Senario 1 ...
bool isSenari1Happend =
isSenario1Bullish ||
isSenario1Bearish;
if (isSenari1Happend)
{
//
dir =
isSenario1Bullish
? X_DIRECTION_BULLISH
: X_DIRECTION_BEARISH;
//
box.dir = dir;
box.to = TimeCurrent();
box.symbol = provider
.decisionXConditions
.symbol;
box.period = provider
.decisionXConditions
.period;
//
int fromIDX = -1;
if (isSenario1Bullish)
{
//
double vale = provider
.decisionXConditions
.valesBuffer[cIDX];
//
box.lower = vale;
//
box.upper = provider
.decisionXConditions
.valesGoldenBuffer[cIDX];
//
int lowerValeIDX = -1;
double lowerVale = provider
.decisionCycleHelper
.mX121Helper
.xpvHelper
.GetLowerVale(
lowerValeIDX,
vale,
cBar.Index() //
);
//
int higherValeIDX = -1;
double higherVale = provider
.decisionCycleHelper
.mX121Helper
.xpvHelper
.GetHigherVale(
higherValeIDX,
vale,
cBar.Index() //
);
//
if (IsValidIndex(lowerValeIDX) &&
IsValidIndex(higherValeIDX))
{
//
fromIDX =
lowerValeIDX < higherValeIDX
? lowerValeIDX
: higherValeIDX;
}
else if (IsValidIndex(lowerValeIDX) &&
!IsValidIndex(higherValeIDX))
{
//
fromIDX = lowerValeIDX;
}
else if (!IsValidIndex(lowerValeIDX) &&
IsValidIndex(higherValeIDX))
{
//
fromIDX = higherValeIDX;
}
}
else
{
//
double peak = provider
.decisionXConditions
.peaksBuffer[cIDX];
//
box.upper = peak;
//
box.lower = provider
.decisionXConditions
.peaksGoldenBuffer[cIDX];
//
int lowerPeakIDX = -1;
double lowerPeak = provider
.decisionCycleHelper
.mX121Helper
.xpvHelper
.GetLowerPeak(
lowerPeakIDX,
peak,
cBar.Index() //
);
//
int higherPeakIDX = -1;
double higherPeak = provider
.decisionCycleHelper
.mX121Helper
.xpvHelper
.GetHigherPeak(
higherPeakIDX,
peak,
cBar.Index() //
);
//
if (IsValidIndex(lowerPeakIDX) &&
IsValidIndex(higherPeakIDX))
{
//
fromIDX =
lowerPeakIDX < higherPeakIDX
? lowerPeakIDX
: higherPeakIDX;
}
else if (IsValidIndex(lowerPeakIDX) &&
!IsValidIndex(higherPeakIDX))
{
//
fromIDX = lowerPeakIDX;
}
else if (!IsValidIndex(lowerPeakIDX) &&
IsValidIndex(higherPeakIDX))
{
//
fromIDX = higherPeakIDX;
}
}
//
if (IsValidIndex(fromIDX))
{
//
box.from = iTime(
zBar.symbol,
zBar.period,
fromIDX //
);
}
else
{
box.from = pBar.time;
}
//
signalProvider = X121SMC_XWZ_PROVIDER_ACTIVATED_BOX;
}
//
// Summarize All Senario(s) Conditions ...
//
isBullish =
//
isSenario1Bullish
//
;
//
isBearish =
//
isSenario1Bearish
//
;
//
// Check All Conditions ...
result =
box.IsValid() &&
HasDirection(dir) &&
(isBullish ||
isBearish);
//
// Cleanup Resources ...
// //
zBar.Clean(); zBar.Clean();
+10 -10
View File
@@ -778,7 +778,7 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
// //
// XCC ... // XCC ...
x121Inputs.xccInputs.showCandles = showAll || false; x121Inputs.xccInputs.showCandles = showAll || true;
// //
// XTREND ... // XTREND ...
@@ -797,8 +797,8 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
// XHK ... // XHK ...
// //
x121Inputs.xhkInputs.drawRawXHKCandles = showAll || false; x121Inputs.xhkInputs.drawRawXHKCandles = showAll || true;
x121Inputs.xhkInputs.drawSmoothedXHKCandles = showAll || false; x121Inputs.xhkInputs.drawSmoothedXHKCandles = showAll || true;
// //
// XATR ... // XATR ...
@@ -813,10 +813,10 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
// //
// XCHE ... // XCHE ...
x121Inputs.xcheInputs.showLE1 = showAll || false; x121Inputs.xcheInputs.showLE1 = showAll || true;
x121Inputs.xcheInputs.showLE2 = showAll || false; x121Inputs.xcheInputs.showLE2 = showAll || true;
x121Inputs.xcheInputs.showSE1 = showAll || false; x121Inputs.xcheInputs.showSE1 = showAll || true;
x121Inputs.xcheInputs.showSE2 = showAll || false; x121Inputs.xcheInputs.showSE2 = showAll || true;
// //
// XDON ... // XDON ...
@@ -833,9 +833,9 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
// //
// X3MA ... // X3MA ...
x121Inputs.x3maInputs.showX3MaFast = showAll || true; x121Inputs.x3maInputs.showX3MaFast = showAll || false;
x121Inputs.x3maInputs.showX3MaMid = showAll || true; x121Inputs.x3maInputs.showX3MaMid = showAll || false;
x121Inputs.x3maInputs.showX3MaSlow = showAll || true; x121Inputs.x3maInputs.showX3MaSlow = showAll || false;
// //
// Initialize Cycle Helpers ... // Initialize Cycle Helpers ...