From 53ad7b092a53b6a34a0aa44c91049545dda09880 Mon Sep 17 00:00:00 2001 From: Hadi Khazaee Asl Date: Mon, 31 Mar 2025 07:04:12 +0330 Subject: [PATCH] cleanup x121 helper, apply all cleanup and buffers and conditions on helpers and try to complete x121 new helper ... --- Documents/BKP/1.mq5 | 2 + Documents/BKP/X121HelperTMPs/1.mq5 | 27 + Documents/BKP/X121HelperTMPs/2.mq5 | 82 + Documents/BKP/X121HelperTMPs/3.mq5 | 359 ++ Documents/BKP/X121HelperTMPs/4.mq5 | 408 ++ Documents/BKP/X121HelperTMPs/5.mq5 | 96 + ...121.smc.market.cycle.helper.class copy.mq5 | 4783 ++++++++++++++++ Documents/BKP/x-cycle.helper.tmp.mq5 | 580 ++ Documents/BKP/x-saherelm.x121.helper.mq5 | 4949 +++++++++++++++++ Documents/BKP/x121.helper.bkp.mq5 | 393 ++ Helpers/x-saherelm.x121.helper.mq5 | 4509 +++++---------- Helpers/x-saherelm.x121.x3ma.helper.mq5 | 98 +- Helpers/x-saherelm.x121.xatr.helper.mq5 | 1082 +++- Helpers/x-saherelm.x121.xche.helper.mq5 | 125 +- Helpers/x-saherelm.x121.xdelta.helper.mq5 | 97 +- Helpers/x-saherelm.x121.xdon.helper.mq5 | 41 - Helpers/x-saherelm.x121.xhk.helper.mq5 | 69 +- Helpers/x-saherelm.x121.xich.helper.mq5 | 43 +- Helpers/x-saherelm.x121.xmas.helper.mq5 | 6 + Helpers/x-saherelm.x121.xpv.helper.mq5 | 29 +- Helpers/x-saherelm.x121.xstr.helper.mq5 | 31 +- Helpers/x-saherelm.x121.xtrend.helper.mq5 | 27 +- Helpers/x-saherelm.x121.xvolume.helper.mq5 | 115 +- Helpers/x-saherelm.x121.xvwap.helper.mq5 | 94 +- Indicators/x-saherelm.x121.xpv.mq5 | 6 +- .../x-121.smc.market.cycle.helper.class.mq5 | 2852 +--------- .../Signals/x-121.smc.xwz.signal.lib.mq5 | 45 +- .../Strategy/x-121.smc.strategy.class.mq5 | 172 +- 28 files changed, 14572 insertions(+), 6548 deletions(-) create mode 100644 Documents/BKP/X121HelperTMPs/1.mq5 create mode 100644 Documents/BKP/X121HelperTMPs/2.mq5 create mode 100644 Documents/BKP/X121HelperTMPs/3.mq5 create mode 100644 Documents/BKP/X121HelperTMPs/4.mq5 create mode 100644 Documents/BKP/X121HelperTMPs/5.mq5 create mode 100644 Documents/BKP/x-121.smc.market.cycle.helper.class copy.mq5 create mode 100644 Documents/BKP/x-cycle.helper.tmp.mq5 create mode 100644 Documents/BKP/x-saherelm.x121.helper.mq5 create mode 100644 Documents/BKP/x121.helper.bkp.mq5 diff --git a/Documents/BKP/1.mq5 b/Documents/BKP/1.mq5 index 678c768e..3c3ccf69 100644 --- a/Documents/BKP/1.mq5 +++ b/Documents/BKP/1.mq5 @@ -158,3 +158,5 @@ // isNearestTenkensSenCrossedUnderKijunSen // ; + + \ No newline at end of file diff --git a/Documents/BKP/X121HelperTMPs/1.mq5 b/Documents/BKP/X121HelperTMPs/1.mq5 new file mode 100644 index 00000000..b4b6876a --- /dev/null +++ b/Documents/BKP/X121HelperTMPs/1.mq5 @@ -0,0 +1,27 @@ + + // + // XCC ... + + // + // XPV ... + + // + // XHK ... + + // + // XMAS ... + + // + // XATR ... + + // + // XSTR ... + + // + // XCHE ... + + // + // X3MA ... + + // + // XVWAP ... diff --git a/Documents/BKP/X121HelperTMPs/2.mq5 b/Documents/BKP/X121HelperTMPs/2.mq5 new file mode 100644 index 00000000..f9ee217a --- /dev/null +++ b/Documents/BKP/X121HelperTMPs/2.mq5 @@ -0,0 +1,82 @@ + + // + // XCC ... + + // + // Buffers ... + + // + // Conditions ... + + // + // XPV ... + + // + // Buffers ... + + // + // Conditions ... + + // + // XHK ... + + // + // Buffers ... + + // + // Conditions ... + + // + // XMAS ... + + // + // Buffers ... + + // + // Conditions ... + + // + // XATR ... + + // + // Buffers ... + + // + // Conditions ... + + // + // XSTR ... + + // + // Buffers ... + + // + // Conditions ... + + // + // XCHE ... + + // + // Buffers ... + + // + // Conditions ... + + // + // X3MA ... + + // + // Buffers ... + + // + // Conditions ... + + // + // XVWAP ... + + // + // Buffers ... + + // + // Conditions ... + diff --git a/Documents/BKP/X121HelperTMPs/3.mq5 b/Documents/BKP/X121HelperTMPs/3.mq5 new file mode 100644 index 00000000..235ec404 --- /dev/null +++ b/Documents/BKP/X121HelperTMPs/3.mq5 @@ -0,0 +1,359 @@ + + // + // XCC ... + + // + // Buffers ... + + // + // Conditions ... + + // + // XPV ... + + // + // Buffers ... + + // + double sarBuffer[]; + double cHHBuffer[]; + double cLLBuffer[]; + double sHHBuffer[]; + double sLLBuffer[]; + double mHHBuffer[]; + double mLLBuffer[]; + double lHHBuffer[]; + double lLLBuffer[]; + double hHHBuffer[]; + double hLLBuffer[]; + double peaksBuffer[]; + double valesBuffer[]; + double supportsBuffer[]; + double peaksGoldenBuffer[]; + double valesGoldenBuffer[]; + double resistancesBuffer[]; + double fractalsUpperBuffer[]; + double fractalsLowerBuffer[]; + + // + // Conditions ... + + // + bool isSarBullish; + bool isSarBearish; + + // + bool isSarSwitchedToBullish; + bool isSarSwitchedToBearish; + + // + bool isNewPeak; + bool isNewPeakOverLast; + bool isNewPeakUnderLast; + + // + bool isNewVale; + bool isNewValeOverLast; + bool isNewValeUnderLast; + + // + // XHK ... + + // + // Buffers ... + + // + double xhkSMLowBuffer[]; + double xhkRawLowBuffer[]; + double xhkSMOpenBuffer[]; + double xhkSMHighBuffer[]; + double xhkRawOpenBuffer[]; + double xhkRawHighBuffer[]; + double xhkSMCloseBuffer[]; + double xhkRawCloseBuffer[]; + + // + // Conditions ... + + // + bool isSMHKBullish; + bool isRawHKBullish; + bool isSMHKSwitchedToBullish; + bool isRawHKSwitchedToBullish; + + // + bool isSMHKBearish; + bool isRawHKBearish; + bool isSMHKSwitchedToBearish; + bool isRawHKSwitchedToBearish; + + // + bool isClosedOverSMHK; + bool isClosedUnderSMHK; + bool isClosedOverRawHK; + bool isClosedUnderRawHK; + + // + bool isRawHKClosedOverSMHK; + bool isRawHKClosedUnderSMHK; + + // + // XMAS ... + + // + // Buffers ... + + // + double midBuffer[]; + double upperBuffer[]; + double lowerBuffer[]; + + // + // Conditions ... + + // + // XATR ... + + // + // Buffers ... + + // + double rsiBuffer[]; + double atrBuffer[]; + double atrUpperBuffer[]; + double atrLowerBuffer[]; + double atrUpperSMBuffer[]; + double atrLowerSMBuffer[]; + double rsiChangeBuffer[]; + double rsiChangeSMBuffer[]; + double priceChangeBuffer[]; + double priceChangeSMBuffer[]; + + // + // Conditions ... + + // + bool isRsiInRange; + bool isRsiOverSold; + bool isRsiOverBought; + bool isRsiCrossedOverOverSold; + bool isRsiCrossedUnderOverSold; + bool isRsiCrossedOverOverBought; + bool isRsiCrossedUnderOverBought; + + // + bool isRsiSMOverPriceChange; + bool isRsiSMUnderPriceChange; + + // + bool isRsiSMCrossedOverPriceChange; + bool isRsiSMCrossedUnderPriceChange; + + // + bool isPriceChangeSMOverRsi; + bool isPriceChangeSMUnderRsi; + + // + bool isPriceChangeSMCrossedOverRsi; + bool isPriceChangeSMCrossedUnderRsi; + + // + bool isRsiOverRsiSM; + bool isRsiUnderRsiSM; + + // + bool isRsiCrossedOverRsiSM; + bool isRsiCrossedUnderRsiSM; + + // + bool isPriceChangeOverPriceChangeSM; + bool isPriceChangeUnderPriceChangeSM; + + // + bool isPriceChangeCrossedOverPriceChangeSM; + bool isPriceChangeCrossedUnderPriceChangeSM; + + // + // XSTR ... + + // + // Buffers ... + + // + double strBuffer[]; + double strUpBuffer[]; + double strDownBuffer[]; + double strPriceBuffer[]; + double strStateBuffer[]; + + // + // Conditions ... + + // + bool isStrBullish; + bool isStrBearish; + + // + bool isStrSwitchedToBullish; + bool isStrSwitchedToBearish; + + // + // XCHE ... + + // + // Buffers ... + + // + double le1Buffer[]; + double se1Buffer[]; + double le2Buffer[]; + double se2Buffer[]; + double le1StartBuffer[]; + double se1StartBuffer[]; + double le2StartBuffer[]; + double se2StartBuffer[]; + + // + // Conditions ... + + // + bool isChe1Bullish; + bool isChe1Bearish; + + // + bool isChe1SwitchedToBullish; + bool isChe1SwitchedToBearish; + + // + bool isChe2Bullish; + bool isChe2Bearish; + + // + bool isChe2SwitchedToBullish; + bool isChe2SwitchedToBearish; + + // + bool isCheBullish; + bool isCheBearish; + + // + bool isCheSwitchedToBullish; + bool isCheSwitchedToBearish; + + // + // X3MA ... + + // + // Buffers ... + + // + double x3maMidBuffer[]; + double x3maFastBuffer[]; + double x3maSlowBuffer[]; + double x3maMidStateBuffer[]; + double x3maFastStateBuffer[]; + double x3maSlowStateBuffer[]; + + // + // Conditions ... + + // + bool isX3MaFastBullish; + bool isX3MaFastBearish; + bool isX3MaFastNeutural; + + // + bool isX3MaMidBullish; + bool isX3MaMidBearish; + bool isX3MaMidNeutural; + + // + bool isX3MaSlowBullish; + bool isX3MaSlowBearish; + bool isX3MaSlowNeutural; + + // + bool isX3MaFastOverMid; + bool isX3MaMidOverSlow; + + // + bool isX3MaFastUnderMid; + bool isX3MaMidUnderSlow; + + // + bool isX3MaBullishState; + bool isX3MaBearishState; + bool isX3MaNeuturalState; + + // + bool isX3MaBullishOrdered; + bool isX3MaBearishOrdered; + + // + bool isX3MaSwitchedToBullishOrdered; + bool isX3MaSwitchedToBearishOrdered; + + // + bool isX3MaSwitchedToBullishState; + bool isX3MaSwitchedToBearishState; + bool isX3MaSwitchedToNeuturalState; + + // + // XVWAP ... + + // + // Buffers ... + + // + double vwapMidBuffer[]; + double vwapFastBuffer[]; + double vwapSlowBuffer[]; + double vwapPriceBuffer[]; + double vwapVolumeBuffer[]; + double vwapMidStateBuffer[]; + double vwapFastStateBuffer[]; + double vwapSlowStateBuffer[]; + + // + // Conditions ... + + // + bool isVWapFastBullish; + bool isVWapFastBearish; + bool isVWapFastNeutural; + + // + bool isVWapMidBullish; + bool isVWapMidBearish; + bool isVWapMidNeutural; + + // + bool isVWapSlowBullish; + bool isVWapSlowBearish; + bool isVWapSlowNeutural; + + // + bool isVWapFastOverMid; + bool isVWapMidOverSlow; + + // + bool isVWapFastUnderMid; + bool isVWapMidUnderSlow; + + // + bool isVWapBullishState; + bool isVWapBearishState; + bool isVWapNeuturalState; + + // + bool isVWapBullishOrdered; + bool isVWapBearishOrdered; + + // + bool isVWapSwitchedToBullishOrdered; + bool isVWapSwitchedToBearishOrdered; + + // + bool isVWapSwitchedToBullishState; + bool isVWapSwitchedToBearishState; + bool isVWapSwitchedToNeuturalState; diff --git a/Documents/BKP/X121HelperTMPs/4.mq5 b/Documents/BKP/X121HelperTMPs/4.mq5 new file mode 100644 index 00000000..47b89585 --- /dev/null +++ b/Documents/BKP/X121HelperTMPs/4.mq5 @@ -0,0 +1,408 @@ + // + // XPV ... + + // + // Buffers ... + + // + // Clean ... + + // + Clean(sarBuffer); + Clean(cHHBuffer); + Clean(cLLBuffer); + Clean(sHHBuffer); + Clean(sLLBuffer); + Clean(mHHBuffer); + Clean(mLLBuffer); + Clean(lHHBuffer); + Clean(lLLBuffer); + Clean(hHHBuffer); + Clean(hLLBuffer); + Clean(peaksBuffer); + Clean(valesBuffer); + Clean(supportsBuffer); + Clean(peaksGoldenBuffer); + Clean(valesGoldenBuffer); + Clean(resistancesBuffer); + Clean(fractalsUpperBuffer); + Clean(fractalsLowerBuffer); + + // + // Set As Series ... + + // + ArraySetAsSeries(sarBuffer, true); + ArraySetAsSeries(cHHBuffer, true); + ArraySetAsSeries(cLLBuffer, true); + ArraySetAsSeries(sHHBuffer, true); + ArraySetAsSeries(sLLBuffer, true); + ArraySetAsSeries(mHHBuffer, true); + ArraySetAsSeries(mLLBuffer, true); + ArraySetAsSeries(lHHBuffer, true); + ArraySetAsSeries(lLLBuffer, true); + ArraySetAsSeries(hHHBuffer, true); + ArraySetAsSeries(hLLBuffer, true); + ArraySetAsSeries(peaksBuffer, true); + ArraySetAsSeries(valesBuffer, true); + ArraySetAsSeries(supportsBuffer, true); + ArraySetAsSeries(peaksGoldenBuffer, true); + ArraySetAsSeries(valesGoldenBuffer, true); + ArraySetAsSeries(resistancesBuffer, true); + ArraySetAsSeries(fractalsUpperBuffer, true); + ArraySetAsSeries(fractalsLowerBuffer, true); + + // + // Conditions ... + + // + isNewPeak = false; + isNewVale = false; + isSarBullish = false; + isSarBearish = false; + isNewPeakOverLast = false; + isNewValeOverLast = false; + isNewPeakUnderLast = false; + isNewValeUnderLast = false; + isSarSwitchedToBullish = false; + isSarSwitchedToBearish = false; + + // + // XHK ... + + // + // Buffers ... + + // + // Clean ... + + // + Clean(xhkSMLowBuffer); + Clean(xhkRawLowBuffer); + Clean(xhkSMOpenBuffer); + Clean(xhkSMHighBuffer); + Clean(xhkRawOpenBuffer); + Clean(xhkRawHighBuffer); + Clean(xhkSMCloseBuffer); + Clean(xhkRawCloseBuffer); + + // + // Set As Series ... + + // + ArraySetAsSeries(xhkSMLowBuffer, true); + ArraySetAsSeries(xhkRawLowBuffer, true); + ArraySetAsSeries(xhkSMOpenBuffer, true); + ArraySetAsSeries(xhkSMHighBuffer, true); + ArraySetAsSeries(xhkRawOpenBuffer, true); + ArraySetAsSeries(xhkRawHighBuffer, true); + ArraySetAsSeries(xhkSMCloseBuffer, true); + ArraySetAsSeries(xhkRawCloseBuffer, true); + + // + // Conditions ... + + // + isSMHKBullish = false; + isSMHKBearish = false; + isRawHKBullish = false; + isRawHKBearish = false; + isClosedOverSMHK = false; + isClosedUnderSMHK = false; + isClosedOverRawHK = false; + isClosedUnderRawHK = false; + isRawHKClosedOverSMHK = false; + isRawHKClosedUnderSMHK = false; + isSMHKSwitchedToBearish = false; + isSMHKSwitchedToBullish = false; + isRawHKSwitchedToBullish = false; + isRawHKSwitchedToBearish = false; + + // + // XMAS ... + + // + // Buffers ... + + // + // Clean ... + + // + Clean(midBuffer); + Clean(upperBuffer); + Clean(lowerBuffer); + + // + // Set As Series ... + + // + ArraySetAsSeries(midBuffer, true); + ArraySetAsSeries(upperBuffer, true); + ArraySetAsSeries(lowerBuffer, true); + + // + // Conditions ... + + // + // XATR ... + + // + // Buffers ... + + // + // Clean ... + + // + Clean(rsiBuffer); + Clean(atrBuffer); + Clean(atrUpperBuffer); + Clean(atrLowerBuffer); + Clean(rsiChangeBuffer); + Clean(atrUpperSMBuffer); + Clean(atrLowerSMBuffer); + Clean(rsiChangeSMBuffer); + Clean(priceChangeBuffer); + Clean(priceChangeSMBuffer); + + // + // Set As Series ... + + // + ArraySetAsSeries(rsiBuffer, true); + ArraySetAsSeries(atrBuffer, true); + ArraySetAsSeries(atrUpperBuffer, true); + ArraySetAsSeries(atrLowerBuffer, true); + ArraySetAsSeries(rsiChangeBuffer, true); + ArraySetAsSeries(atrUpperSMBuffer, true); + ArraySetAsSeries(atrLowerSMBuffer, true); + ArraySetAsSeries(rsiChangeSMBuffer, true); + ArraySetAsSeries(priceChangeBuffer, true); + ArraySetAsSeries(priceChangeSMBuffer, true); + + // + // Conditions ... + + // + isRsiInRange = false; + isRsiOverSold = false; + isRsiOverRsiSM = false; + isRsiUnderRsiSM = false; + isRsiOverBought = false; + isRsiCrossedOverRsiSM = false; + isRsiCrossedUnderRsiSM = false; + isPriceChangeSMOverRsi = false; + isRsiSMOverPriceChange = false; + isRsiSMUnderPriceChange = false; + isPriceChangeSMUnderRsi = false; + isRsiCrossedOverOverSold = false; + isRsiCrossedUnderOverSold = false; + isRsiCrossedOverOverBought = false; + isRsiCrossedUnderOverBought = false; + isRsiSMCrossedOverPriceChange = false; + isPriceChangeSMCrossedOverRsi = false; + isRsiSMCrossedUnderPriceChange = false; + isPriceChangeSMCrossedUnderRsi = false; + isPriceChangeOverPriceChangeSM = false; + isPriceChangeUnderPriceChangeSM = false; + isPriceChangeCrossedOverPriceChangeSM = false; + isPriceChangeCrossedUnderPriceChangeSM = false; + + // + // XSTR ... + + // + // Buffers ... + + // + // Clean ... + + // + Clean(strBuffer); + Clean(strUpBuffer); + Clean(strDownBuffer); + Clean(strPriceBuffer); + Clean(strStateBuffer); + + // + // Set As Series ... + + // + ArraySetAsSeries(strBuffer, true); + ArraySetAsSeries(strUpBuffer, true); + ArraySetAsSeries(strDownBuffer, true); + ArraySetAsSeries(strPriceBuffer, true); + ArraySetAsSeries(strStateBuffer, true); + + // + // Conditions ... + + // + isStrBullish = false; + isStrBearish = false; + isStrSwitchedToBullish = false; + isStrSwitchedToBearish = false; + + // + // XCHE ... + + // + // Buffers ... + + // + // Clean ... + + // + Clean(le1Buffer); + Clean(se1Buffer); + Clean(le2Buffer); + Clean(se2Buffer); + Clean(le1StartBuffer); + Clean(se1StartBuffer); + Clean(le2StartBuffer); + Clean(se2StartBuffer); + + // + // Set As Series ... + + // + ArraySetAsSeries(le1Buffer, true); + ArraySetAsSeries(se1Buffer, true); + ArraySetAsSeries(le2Buffer, true); + ArraySetAsSeries(se2Buffer, true); + ArraySetAsSeries(le1StartBuffer, true); + ArraySetAsSeries(se1StartBuffer, true); + ArraySetAsSeries(le2StartBuffer, true); + ArraySetAsSeries(se2StartBuffer, true); + + // + // Conditions ... + + // + isCheBullish = false; + isCheBearish = false; + isChe1Bullish = false; + isChe1Bearish = false; + isChe2Bullish = false; + isChe2Bearish = false; + isCheSwitchedToBullish = false; + isCheSwitchedToBearish = false; + isChe1SwitchedToBullish = false; + isChe1SwitchedToBearish = false; + isChe2SwitchedToBullish = false; + isChe2SwitchedToBearish = false; + + // + // X3MA ... + + // + // Buffers ... + + // + // Clean ... + + // + Clean(x3maMidBuffer); + Clean(x3maFastBuffer); + Clean(x3maSlowBuffer); + Clean(x3maMidStateBuffer); + Clean(x3maFastStateBuffer); + Clean(x3maSlowStateBuffer); + + // + // Set As Series ... + + // + ArraySetAsSeries(x3maMidBuffer, true); + ArraySetAsSeries(x3maFastBuffer, true); + ArraySetAsSeries(x3maSlowBuffer, true); + ArraySetAsSeries(x3maMidStateBuffer, true); + ArraySetAsSeries(x3maFastStateBuffer, true); + ArraySetAsSeries(x3maSlowStateBuffer, true); + + // + // Conditions ... + + // + isX3MaMidBullish = false; + isX3MaMidBearish = false; + isX3MaFastBullish = false; + isX3MaFastBearish = false; + isX3MaMidNeutural = false; + isX3MaSlowBullish = false; + isX3MaSlowBearish = false; + isX3MaFastOverMid = false; + isX3MaMidOverSlow = false; + isX3MaFastNeutural = false; + isX3MaSlowNeutural = false; + isX3MaFastUnderMid = false; + isX3MaMidUnderSlow = false; + isX3MaBullishState = false; + isX3MaBearishState = false; + isX3MaNeuturalState = false; + isX3MaBullishOrdered = false; + isX3MaBearishOrdered = false; + isX3MaSwitchedToBullishState = false; + isX3MaSwitchedToBearishState = false; + isX3MaSwitchedToNeuturalState = false; + isX3MaSwitchedToBullishOrdered = false; + isX3MaSwitchedToBearishOrdered = false; + + // + // XVWAP ... + + // + // Buffers ... + + // + // Clean ... + + // + Clean(vwapMidBuffer); + Clean(vwapFastBuffer); + Clean(vwapSlowBuffer); + Clean(vwapPriceBuffer); + Clean(vwapVolumeBuffer); + Clean(vwapMidStateBuffer); + Clean(vwapFastStateBuffer); + Clean(vwapSlowStateBuffer); + + // + // Set As Series ... + + // + ArraySetAsSeries(vwapMidBuffer, true); + ArraySetAsSeries(vwapFastBuffer, true); + ArraySetAsSeries(vwapSlowBuffer, true); + ArraySetAsSeries(vwapPriceBuffer, true); + ArraySetAsSeries(vwapVolumeBuffer, true); + ArraySetAsSeries(vwapMidStateBuffer, true); + ArraySetAsSeries(vwapFastStateBuffer, true); + ArraySetAsSeries(vwapSlowStateBuffer, true); + + // + // Conditions ... + + // + isVWapMidBullish = false; + isVWapMidBearish = false; + isVWapMidNeutural = false; + isVWapFastBullish = false; + isVWapFastBearish = false; + isVWapSlowBullish = false; + isVWapSlowBearish = false; + isVWapFastOverMid = false; + isVWapMidOverSlow = false; + isVWapFastNeutural = false; + isVWapSlowNeutural = false; + isVWapFastUnderMid = false; + isVWapMidUnderSlow = false; + isVWapBullishState = false; + isVWapBearishState = false; + isVWapNeuturalState = false; + isVWapBullishOrdered = false; + isVWapBearishOrdered = false; + isVWapSwitchedToBullishState = false; + isVWapSwitchedToBearishState = false; + isVWapSwitchedToNeuturalState = false; + isVWapSwitchedToBullishOrdered = false; + isVWapSwitchedToBearishOrdered = false; diff --git a/Documents/BKP/X121HelperTMPs/5.mq5 b/Documents/BKP/X121HelperTMPs/5.mq5 new file mode 100644 index 00000000..e8d2ee61 --- /dev/null +++ b/Documents/BKP/X121HelperTMPs/5.mq5 @@ -0,0 +1,96 @@ + + // + // XDON ... + x121Inputs.xdonInputs.showOpen = showAll || false; + x121Inputs.xdonInputs.showClose = showAll || false; + x121Inputs.xdonInputs.showLow = showAll || false; + x121Inputs.xdonInputs.showHigh = showAll || false; + + // + // XICH ... + x121Inputs.xichInputs.showTenkanSen = showAll || false; + x121Inputs.xichInputs.showKijunSen = showAll || false; + x121Inputs.xichInputs.showChikouSpan = showAll || false; + x121Inputs.xichInputs.showSenkouSpanA = showAll || false; + x121Inputs.xichInputs.showSenkouSpanB = showAll || false; + x121Inputs.xichInputs.showKumo = showAll || false; + + // + // XCC ... + x121Inputs.xccInputs.showCandles = showAll || true; + + // + // XPV ... + + // + x121Inputs.xpvInputs.showSar = showAll || false; + x121Inputs.xpvInputs.showPeaks = showAll || true; + x121Inputs.xpvInputs.showVales = showAll || true; + x121Inputs.xpvInputs.showSupports = showAll || false; + x121Inputs.xpvInputs.showResistances = showAll || false; + x121Inputs.xpvInputs.showGoldenZones = showAll || true; + + // + // XHK ... + + // + x121Inputs.xhkInputs.drawRawXHKCandles = showAll || false; + x121Inputs.xhkInputs.drawSmoothedXHKCandles = showAll || false; + + // + // XMAS ... + + // + x121Inputs.xmasInputs.showUpper = showAll || false; + x121Inputs.xmasInputs.showMid = showAll || false; + x121Inputs.xmasInputs.showLower = showAll || false; + + // + // XATR ... + x121Inputs.xatrInputs.showATRUpper = showAll || false; + x121Inputs.xatrInputs.showATRLower = showAll || false; + + // + // XSTR ... + x121Inputs.xstrInputs.showStr = showAll || true; + x121Inputs.xstrInputs.showStrUpper = showAll || false; + x121Inputs.xstrInputs.showStrLower = showAll || false; + + // + // XCHE ... + x121Inputs.xcheInputs.showLE1 = showAll || false; + x121Inputs.xcheInputs.showLE2 = showAll || false; + x121Inputs.xcheInputs.showSE1 = showAll || false; + x121Inputs.xcheInputs.showSE2 = showAll || false; + + // + // XVWAP ... + x121Inputs.xvwapInputs.showVWapFast = showAll || false; + x121Inputs.xvwapInputs.showVWapMedium = showAll || false; + x121Inputs.xvwapInputs.showVWapSlow = showAll || false; + + // + // X3MA ... + x121Inputs.x3maInputs.showX3MaFast = showAll || true; + x121Inputs.x3maInputs.showX3MaMid = showAll || false; + x121Inputs.x3maInputs.showX3MaSlow = showAll || false; + + // + + // + // x121Inputs.xcheInputs.cheLength = 14; + // x121Inputs.xcheInputs.cheLoopback = 7; + // x121Inputs.xcheInputs.cheMultiplier1 = 1.5; + // x121Inputs.xcheInputs.cheMultiplier2 = 2; + + // + // x121Inputs.xstrInputs.strLength = 14; + // x121Inputs.xstrInputs.strMultiplier = 1.5; + + // + // x121Inputs.xccInputs.upColor = clrLime; + // x121Inputs.xccInputs.downColor = clrRed; + // x121Inputs.xccInputs.lineColor = CLR_NONE; + // x121Inputs.xccInputs.bearishColor = clrRed; + // x121Inputs.xccInputs.bullishColor = clrLime; + // x121Inputs.xccInputs.volumesColor = clrGreen; diff --git a/Documents/BKP/x-121.smc.market.cycle.helper.class copy.mq5 b/Documents/BKP/x-121.smc.market.cycle.helper.class copy.mq5 new file mode 100644 index 00000000..827b5c81 --- /dev/null +++ b/Documents/BKP/x-121.smc.market.cycle.helper.class copy.mq5 @@ -0,0 +1,4783 @@ +/////////////////////////////////////////////////////// +// +// SaherElm IT Center MQL5 Class Library +// -------------------------------------- +// Name: XC121SMCCycleHelper +// Description: provides all based classes for use ... +// +// +// Maintainer: +// ------------ +// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com) +// +////////////////////////////////////////////////////// +// +// Global Properties ... +#property library +#property copyright "Copyright 2023, SaherElm IT Center" +#property link "https://www.saherelm.ir" +#property version "1.00" +#property strict + +// +// Imports ... +#include "../../Classes/x-saherelm.x-bar.analyser.class.mq5" +#include "../../Classes/x-saherelm.x-poi.class.mq5" +#include "../Libraries/x-121.smc.lib.mq5" + +// +// Definitions ... + +// +// Implementations ... + +// +// Cycles Enumeration ... +enum ENUM_X_CYCLES +{ + X_CYCLE_NONE, + X_CYCLE_TRIGGER, + X_CYCLE_DECISION, + X_CYCLE_ANALYSE, + X_CYCLE_VERIFICATION, + X_CYCLE_CONSOLIDATION, + X_CYCLE_VISION, +}; + +// +// String Representation of Cycles Enumeration ... +string ToString(ENUM_X_CYCLES value) +{ + // + string result = EnumToString(value); + + // + StringReplace(result, "X_CYCLE_", ""); + + // + return result; +} + +// +// Validate a Cycle ... +bool IsValid(ENUM_X_CYCLES value) +{ + // + bool result = false; + + // + result = + value != X_CYCLE_NONE; + + // + return result; +} + +// +// Cycle Events Enumeration ... +enum ENUM_X_CYCLE_EVENTS +{ + SAR_CHANGE_DETECTED, + NEW_PEAK_DETECTED, + NEW_VALE_DETECTED, + PIVOT_POINT_DETECTED, + VWAP_ORDER_CHANGE_ETECTED, + VWAP_STATE_CHANGE_DETCTED, + CONSOLIDATION_BREAKED_DETECTED, + PEAK_PIVOT_STARTED, + PEAK_PIVOT_ENDED, + VALE_PIVOT_STARTED, + VALE_PIVOT_ENDED, +}; + +// +// Cycle Helper ... +class XC121SMCCycleHelper : public XCBase +{ + // + public: + // + // Props ... + + // + // X121 ... + XCX121Helper *mX121Helper; + + // + // POI Detector ... + XCPOIDrawer *mPOIDrawer; + XCPOIDetector *mPOIDetector; + + // + // Bar Analyser + XCBarAnalyser *mBarAnalyser; + + // + // Constructor(s) ... + XC121SMCCycleHelper() + { + Default(); + } + + // + // Deconstructor ... + ~XC121SMCCycleHelper() + { + DeInit(); + } + + // + // Getter/Setter(s) ... + + // + // Actions ... + + /** + * Initialize ... + * + * @param symbol: String ... + * @param period: ENUM_TIMEFRAMES member ... + * @param x121Inputs: X121Inputs instance ... + * + * @return ( bool ) + */ + bool Init( + string symbol, + ENUM_TIMEFRAMES period, + X121Inputs &x121Inputs, + int requiredPOIs = 50 // + ) + { + // + bool result = false; + + // + if (requiredPOIs < 0) + { + requiredPOIs = 0; + } + + // + result = IsValid(symbol) && + IsValid(period); + if (!result) + { + return result; + } + + // + mSymbol = symbol; + mPeriod = period; + + // + // X121 ... + mX121Helper = new XCX121Helper(); + result = mX121Helper.Init( + symbol, + period, + x121Inputs // + ); + if (!result) + { + return result; + } + + // + mPOIDetector = new XCPOIDetector( + symbol, + period // + ); + mPOIDetector.MaxRequiredPOIs(requiredPOIs); + + // + int maxLoopbackBars = mPOIDetector.MaxAllowedLoopbackForInit(); + int periodSeconds = PeriodSeconds(period); + if (periodSeconds > PeriodSeconds(PERIOD_M15)) + { + // + int multiplier = periodSeconds / PeriodSeconds(PERIOD_M15); + + // + if (multiplier >= 1) + { + maxLoopbackBars *= 2; + } + } + mPOIDetector.MaxAllowedLoopbackForInit(maxLoopbackBars); + mPOIDetector.Init(); + + // + // Initialize Bar Analyser Class Instance ... + mBarAnalyser = new XCBarAnalyser(); + + // + // Initial and Configure POI Drawer if Required ... + mPOIDrawer = new XCPOIDrawer(); + mPOIDrawer.ChartIdentification(0); + mPOIDrawer.SubWindowIdentification(0); + + // + mPOIDrawer.DemandZoneFill(false); + mPOIDrawer.SupplyZoneFill(false); + mPOIDrawer.BullishFVGFill(false); + mPOIDrawer.BearishFVGFill(false); + mPOIDrawer.SupportZoneFill(false); + mPOIDrawer.ResistanceZoneFill(false); + mPOIDrawer.BullishOrderBlockFill(false); + mPOIDrawer.BearishOrderBlockFill(false); + + // + // Set Chart Style ... + ApplyChartStyle(); + + // + return result; + } + + /** + * Retrieve Symbol ... + * + * @return ( string ) + */ + string GetSymbol() + { + return mSymbol; + } + + /** + * Retrieve TimeFrame (Period) ... + * + * @return ( ENUM_TIMEFRAMES ) + */ + ENUM_TIMEFRAMES GetPeriod() + { + return mPeriod; + } + + /** + * Get Specified Bar ... + * + * @param source: XOHCL instance, Source Bar ... + * @param bar: XOHCL instance, Dest Bar ... + * + * @return ( bool ) + */ + bool GetBar( + XOHCL &source, + XOHCL &bar // + ) + { + // + bool result = false; + + // + bar.Clean(); + + // + string symbol = GetSymbol(); + ENUM_TIMEFRAMES period = GetPeriod(); + + // + result = + IsValid(symbol) && + IsValid(period) && + source.IsValid(); + if (!result) + { + return result; + } + + // + int index = iBarShift( + symbol, + period, + source.time // + ); + result = bar.Init( + symbol, + period, + index // + ); + if (!result) + { + // + bar.Clean(); + return result; + } + + // + return result; + } + + /** + * Retrieve Specified Bar ... + * + * @param bar: XOHCL instance ... + * @param index: Integer ... + * + * @return ( bool ) + */ + bool GetBar( + XOHCL &bar, + int index = 0 // + ) + { + // + bool result = false; + + // + bar.Clean(); + + // + if (index < 0) + { + index = 0; + } + + // + string symbol = GetSymbol(); + ENUM_TIMEFRAMES period = GetPeriod(); + + // + result = bar.Init( + symbol, + period, + index // + ); + + // + return result; + } + + /** + * Retrieve Specified Bar ... + * + * @param bar: XOHCL instance ... + * @param time: Datetime ... + * + * @return ( bool ) + */ + bool GetBar( + XOHCL &bar, + datetime time = NULL // + ) + { + // + bool result = false; + + // + int index = GetBarIndex(time); + result = GetBar(bar, + index // + ); + + // + return result; + } + + /** + * Retrieve Specified Time Bar Index ... + * + * @param time: DateTime ... + * + * @return ( int ) + */ + int GetBarIndex(datetime time = NULL) + { + // + int result = -1; + + // + time = NormalizeTime(time); + + // + string symbol = GetSymbol(); + ENUM_TIMEFRAMES period = GetPeriod(); + + // + result = iBarShift( + symbol, + period, + time // + ); + + // + return result; + } + + /** + * Retrieve Cycle Conditions ... + * + * @param events: ENUM_X_CYCLE_EVENTS member, Array ... + * @param conditions: X121SMCCycleConditions instance ... + * @param barIndex: Integer ... + * @param loopback: Integer ... + * + * @return ( bool ) + */ + bool GetConditions( + ENUM_X_CYCLE_EVENTS &events[], + ENUM_XPOI_EVENTS &poiEvents[], + X121SMCCycleConditions &conditions, + int barIndex = 0, + int loopback = 7 // + ) + { + // + bool result = false; + + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + if (loopback < 5) + { + loopback = 5; + } + + // + Clean(events); + Clean(poiEvents); + conditions.Clean(); + + // + result = mX121Helper.GetConditions( + conditions.x121Conditions, + barIndex, + loopback // + ); + if (!result) + { + // + conditions.Clean(); + return result; + } + + // + mPOIDetector.Update(poiEvents); + mPOIDetector.GetState(conditions.state); + + // + conditions.symbol = GetSymbol(); + conditions.period = GetPeriod(); + conditions.time = TimeCurrent(); + + // + // Update(); + + // + result = conditions.IsValid(); + + // + return result; + } + + // + // Tools ... + + // + bool GeneratePVBox( + XBoxZone &box, + int barIndex = 0 // + ) + { + // + bool result = false; + + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + box.Clean(); + box.symbol = GetSymbol(); + box.period = GetPeriod(); + + // + int index = barIndex; + + // + // Peak ... + datetime peaksSameFrom = NULL; + double peak = mX121Helper.xpvHelper.GetPeak(index); + double prevPeak = mX121Helper.xpvHelper.GetPeak(index + 1); + bool startsByPeak = peak == prevPeak; + + // + // Vale ... + datetime valesSameFrom = NULL; + double vale = mX121Helper.xpvHelper.GetVale(index); + double prevVale = mX121Helper.xpvHelper.GetVale(index + 1); + bool startsByVale = + !startsByPeak && + vale == prevVale; + + // + bool canBreak = false; + while (!canBreak) + { + // + index++; + + // + datetime cTime = iTime( + box.symbol, + box.period, + index // + ); + + // + // Peak ... + double iPeak = mX121Helper.xpvHelper.GetPeak(index); + + // + // Vale ... + double iVale = mX121Helper.xpvHelper.GetVale(index); + + // + // Start By Peak or Value ... + bool isSame = false; + if (startsByPeak) + { + // + isSame = iPeak == peak; + bool canSetVale = vale == 0 + ? true + : iVale > vale; + if (canSetVale) + { + vale = iVale; + } + } + else if (startsByVale) + { + // + isSame = iVale == vale; + bool canSetPeak = peak == 0 + ? true + : iPeak < peak; + if (canSetPeak) + { + peak = iPeak; + } + } + + // + if (isSame) + { + // + box.from = cTime; + box.upper = peak; + box.lower = vale; + } + else if (IsValid(box.from)) + { + // + // Complete Box ... + box.to = iTime( + box.symbol, + box.period, + barIndex // + ); + + // + box.type = "XPVBox"; + box.dir = startsByPeak + ? X_DIRECTION_BEARISH + : startsByVale + ? X_DIRECTION_BULLISH + : X_DIRECTION_NONE; + } + + // + canBreak = !isSame; + } + + // + result = box.IsValid(); + if (!result) + { + box.Clean(); + } + + // + return result; + } + + // + int DetectRejections( + XBoxZone &rejections[], + int barIndex = 0, + bool forceBarType = true, + bool forceFiboPressure = true, + bool forceUnUsedRejections = true, + int maxAllowedLoopback = 587 // + ) + { + // + int result = 0; + + // + // Normalize Args ... + Clean(rejections); + + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + int idx = -1; + bool has = false; + for (int i = barIndex + 1; i < barIndex + maxAllowedLoopback; i++) + { + // + // Init Indexed Bar ... + XOHCL iBar; + XOHCL iCBar; + XOHCL iPBar; + has = GetBar(iBar, i); + has = + has && + iBar.GetPreviousBar(iCBar); + has = + has && + iCBar.GetPreviousBar(iPBar); + if (!has) + { + // + iBar.Clean(); + iCBar.Clean(); + iPBar.Clean(); + break; + } + + // + // Check CBar Bullish Fibo Pressure ... + bool cBarHasBullishFiboPressure = + mBarAnalyser + .HasFiboPressure( + iCBar, + X_DIRECTION_BULLISH, + X_FIBO_LEVEL_382 // + ); + + // + // Check CBar Bearish Fibo Pressure ... + bool cBarHasBearishFiboPressure = + mBarAnalyser + .HasFiboPressure( + iCBar, + X_DIRECTION_BEARISH, + X_FIBO_LEVEL_382 // + ); + + // + // Check Bar is Bullish Rejection Swing ... + bool isBullishRejection = + // + iCBar.low < iBar.low && + iCBar.low < iPBar.low && + // + iCBar.low < iCBar.GetDown() && + iCBar.GetLowShadow() > iCBar.GetBody() && + iCBar.GetLowShadow() > iCBar.GetHighShadow() + // + ; + + // + // Check Bar is Bearish Rejection Swing ... + bool isBearishRejection = + // + iCBar.high > iBar.high && + iCBar.high > iPBar.high && + // + iCBar.high > iCBar.GetUp() && + iCBar.GetHighShadow() > iCBar.GetBody() && + iCBar.GetHighShadow() > iCBar.GetLowShadow() + // + ; + + // + // Apply Fibo Pressure ... + if (forceFiboPressure) + { + // + isBullishRejection = + isBullishRejection && + cBarHasBullishFiboPressure; + + // + isBearishRejection = + isBearishRejection && + cBarHasBearishFiboPressure; + } + + // + // Apply Force Bar Type ... + if (forceBarType) + { + // + isBullishRejection = + isBullishRejection && + iCBar.IsBullish(); + + // + isBearishRejection = + isBearishRejection && + iCBar.IsBearish(); + } + + // + // Summarize Result ... + has = isBullishRejection || + isBearishRejection; + if (has) + { + // + XBoxZone iBox; + + // + iBox.to = iBar.time; + iBox.from = iCBar.time; + iBox.period = iBar.period; + iBox.symbol = iBar.symbol; + + // + iBox.dir = + isBullishRejection + ? X_DIRECTION_BULLISH + : X_DIRECTION_BEARISH; + + // + iBox.upper = + isBullishRejection + ? iCBar.GetDown() + : iCBar.high; + + // + iBox.lower = + isBullishRejection + ? iCBar.low + : iCBar.GetUp(); + + // + iBox.type = + isBullishRejection + ? "XSwingLow" + : "XSwingHigh"; + + // + // Validate Box ... + has = iBox.IsValid(); + if (has) + { + // + // Apply Force Unused Rejections ... + if (forceUnUsedRejections) + { + // + has = !IsBoxBreaked( + iBox, + iCBar.Index() + 1, + barIndex // + ); + } + + // + if (has) + { + // + idx = FindIndex( + iBox, + rejections // + ); + has = !IsValidIndex(idx); + if (has) + { + // + AddRef( + iBox, + rejections // + ); + } + } + } + + // + iBox.Clean(); + } + + // + iBar.Clean(); + iCBar.Clean(); + iPBar.Clean(); + } + + // + result = ArraySize(rejections); + + // + return result; + } + + // + datetime DetectNearestCloseOverX3MAFast( + XOHCL &bar, + int maxAllowedBars = 20 // + ) + { + // + datetime result = NULL; + + // + if (!bar.IsValid()) + { + return result; + } + + // + bool has = false; + int idx = bar.Index(); + int start = idx; + int end = start + maxAllowedBars; + bool canContinue = true; + while (canContinue) + { + // + XOHCL iBar; + has = iBar.Init( + bar.symbol, + bar.period, + start // + ); + if (!has) + { + // + iBar.Clean(); + break; + } + + // + double iFast = mX121Helper + .x3maHelper + .GetX3MaFast(start); + + // + has = iBar.close > iFast && + iBar.open < iFast; + if (has) + { + result = iBar.time; + } + + // + canContinue = + start < end && + !IsValid(result); + + // + start++; + + // + iBar.Clean(); + } + + // + return result; + } + + // + datetime DetectNearestCloseUnderX3MAFast( + XOHCL &bar, + int maxAllowedBars = 20 // + ) + { + // + datetime result = NULL; + + // + if (!bar.IsValid()) + { + return result; + } + + // + bool has = false; + int idx = bar.Index(); + int start = idx; + int end = start + maxAllowedBars; + bool canContinue = true; + while (canContinue) + { + // + XOHCL iBar; + has = iBar.Init( + bar.symbol, + bar.period, + start // + ); + if (!has) + { + // + iBar.Clean(); + break; + } + + // + double iFast = mX121Helper + .x3maHelper + .GetX3MaFast(start); + + // + has = iBar.close < iFast && + iBar.open > iFast; + if (has) + { + result = iBar.time; + } + + // + canContinue = + start < end && + !IsValid(result); + + // + start++; + + // + iBar.Clean(); + } + + // + return result; + } + + // + bool DetectNearestStrSwitched( + XOHCL &bar, + ENUM_X_DIRECTION &dir, + int barIndex = 0, + int maxAllowedBars = 20 // + ) + { + // + bool result = false; + + // + bar.Clean(); + dir = X_DIRECTION_NONE; + barIndex = NormalizeInt(barIndex, 0); + maxAllowedBars = NormalizeInt(maxAllowedBars, 20); + + // + // Looping Through LoopBack Period ... + // for Detecting Result ... + for (int i = barIndex; i < barIndex + maxAllowedBars; i++) + { + // + XOHCL iBar; + result = iBar.Init( + GetSymbol(), + GetPeriod(), + i // + ); + if (!result) + { + // + iBar.Clean(); + break; + } + + // + double iStrState = mX121Helper.xstrHelper.GetSTRState(i); + double iStrStateP = mX121Helper.xstrHelper.GetSTRState(i + 1); + + // + bool isStrBullish = iStrState > 0; + bool isStrBullishP = iStrStateP > 0; + + // + bool isStrBearish = iStrState < 0; + bool isStrBearishP = iStrStateP < 0; + + // + bool isBullish = isStrBullish && + !isStrBullishP; + + // + bool isBearish = isStrBearish && + !isStrBearishP; + + // + result = isBullish || + isBearish; + if (result) + { + // + bar = iBar; + + // + dir = isBullish + ? X_DIRECTION_BULLISH + : X_DIRECTION_BEARISH; + + // + iBar.Clean(); + break; + } + + // + iBar.Clean(); + } + + // + return result; + } + + // + // Virtuals ... + + /** + * Set Default Properties Values ... + */ + virtual void Default() + { + } + + // + protected: + // + + // + private: + // + // Props ... + string mSymbol; + ENUM_TIMEFRAMES mPeriod; + + // + // Actions ... + + /** + * Release All Resources ... + */ + void DeInit() + { + // + ZeroMemory(mX121Helper); + ZeroMemory(mPOIDetector); + ZeroMemory(mBarAnalyser); + + // + delete mX121Helper; + delete mPOIDetector; + delete mBarAnalyser; + } + + /** + * Apply Chart Style ... + */ + void ApplyChartStyle() + { + // + // Retrieve Current Chart ID ... + long chartId = ChartID(); + + // + ENUM_CHART_MODE mMode = CHART_CANDLES; // chart's mMode + bool mShowBidLine = true; // show bid line + bool mShowAskLine = true; // show ask line + bool mShowGrid = false; // show grids on chart + bool mShowVolumes = true; // show volumes + bool mShowTradeLevels = true; // Displaying trade levels in the chart (levels of open positions, Stop Loss, Take Profit and pending orders) + bool mAutoScroll = true; // chart autoscroll + bool mQuickNavigation = true; // chart quick navigation state + color mForeGroundColor = clrWhite; // chart's foreground color + color mBackGroundColor = clrBlack; // chart's background color + color mUpColor = clrGreen; // Up Color + color mDownColor = clrRed; // Down Color + color mBullishColor = clrGreen; // Bullish color + color mBearishColor = clrRed; // Bearish color + color mGridColor = clrGray; // grid color + color mBidLineColor = clrGray; // bid line color + color mAskLineColor = clrRed; // ask line color + color mLineColor = clrLime; // line mMode and doji candlestick color + color mStopColor = clrGold; // Color of stop order levels (Stop Loss and Take Profit) + color mVolumesColor = clrGreen; // volumes color + + // + ChartSetInteger(chartId, CHART_SHOW_BID_LINE, mShowBidLine); + ChartSetInteger(chartId, CHART_SHOW_ASK_LINE, mShowAskLine); + ChartSetInteger(chartId, CHART_SHOW_GRID, mShowGrid); + ChartSetInteger(chartId, CHART_SHOW_VOLUMES, mShowVolumes); + ChartSetInteger(chartId, CHART_SHOW_TRADE_LEVELS, mShowTradeLevels); + ChartSetInteger(chartId, CHART_AUTOSCROLL, mAutoScroll); + ChartSetInteger(chartId, CHART_QUICK_NAVIGATION, mQuickNavigation); + ChartSetInteger(chartId, CHART_COLOR_FOREGROUND, mForeGroundColor); + ChartSetInteger(chartId, CHART_COLOR_BACKGROUND, mBackGroundColor); + ChartSetInteger(chartId, CHART_COLOR_GRID, mGridColor); + ChartSetInteger(chartId, CHART_COLOR_BID, mBidLineColor); + ChartSetInteger(chartId, CHART_COLOR_ASK, mAskLineColor); + ChartSetInteger(chartId, CHART_COLOR_STOP_LEVEL, mStopColor); + ChartSetInteger(chartId, CHART_COLOR_VOLUME, mVolumesColor); + + // + // For Enabling XCC ... + // ChartSetInteger(chartId, CHART_MODE, mMode); + // ChartSetInteger(chartId, CHART_COLOR_CHART_UP, mUpColor); + // ChartSetInteger(chartId, CHART_COLOR_CHART_DOWN, mDownColor); + // ChartSetInteger(chartId, CHART_COLOR_CANDLE_BULL, mBullishColor); + // ChartSetInteger(chartId, CHART_COLOR_CANDLE_BEAR, mBearishColor); + // ChartSetInteger(chartId, CHART_COLOR_CHART_LINE, mLineColor); + } + + // +}; + +// +// Signal Provider Data ... +struct X121SMCStrategySignalProviderData +{ + // + // Props ... + + // + // Trigger ... + XPOIState triggerState; + double triggerBullishScore; + double triggerBearishScore; + X121Conditions triggerXConditions; + ENUM_XPOI_EVENTS triggerPoiEvents[]; + XC121SMCCycleHelper *triggerCycleHelper; + ENUM_X_CYCLE_EVENTS triggerCycleEvents[]; + X121SMCCycleConditions triggerConditions; + + // + // Decision ... + XPOIState decisionState; + double decisionBullishScore; + double decisionBearishScore; + X121Conditions decisionXConditions; + ENUM_XPOI_EVENTS decisionPoiEvents[]; + XC121SMCCycleHelper *decisionCycleHelper; + ENUM_X_CYCLE_EVENTS decisionCycleEvents[]; + X121SMCCycleConditions decisionConditions; + + // + // Analyse ... + XPOIState analyseState; + double analyseBullishScore; + double analyseBearishScore; + X121Conditions analyseXConditions; + ENUM_XPOI_EVENTS analysePoiEvents[]; + XC121SMCCycleHelper *analyseCycleHelper; + ENUM_X_CYCLE_EVENTS analyseCycleEvents[]; + X121SMCCycleConditions analyseConditions; + + // + // Verification ... + XPOIState verificationState; + double verificationBullishScore; + double verificationBearishScore; + X121Conditions verificationXConditions; + ENUM_XPOI_EVENTS verificationPoiEvents[]; + XC121SMCCycleHelper *verificationCycleHelper; + ENUM_X_CYCLE_EVENTS verificationCycleEvents[]; + X121SMCCycleConditions verificationConditions; + + // + // Consolidation ... + XPOIState consolidationState; + double consolidationBullishScore; + double consolidationBearishScore; + X121Conditions consolidationXConditions; + ENUM_XPOI_EVENTS consolidationPoiEvents[]; + XC121SMCCycleHelper *consolidationCycleHelper; + ENUM_X_CYCLE_EVENTS consolidationCycleEvents[]; + X121SMCCycleConditions consolidationConditions; + + // + // Vision ... + XPOIState visionState; + double visionBullishScore; + double visionBearishScore; + X121Conditions visionXConditions; + ENUM_XPOI_EVENTS visionPoiEvents[]; + XC121SMCCycleHelper *visionCycleHelper; + ENUM_X_CYCLE_EVENTS visionCycleEvents[]; + X121SMCCycleConditions visionConditions; + + // + // Constructor ... + X121SMCStrategySignalProviderData() + { + Clean(); + } + + // + // Tools ... + + // + // Cleanup ... + void Clean() + { + // + // Trigger ... + triggerState.Clean(); + triggerBullishScore = 0; + triggerBearishScore = 0; + Clean(triggerPoiEvents); + Clean(triggerCycleEvents); + triggerConditions.Clean(); + triggerXConditions.Clean(); + + // + // Decision ... + decisionState.Clean(); + decisionBullishScore = 0; + decisionBearishScore = 0; + Clean(decisionPoiEvents); + Clean(decisionCycleEvents); + decisionConditions.Clean(); + decisionXConditions.Clean(); + + // + // Analyse ... + analyseState.Clean(); + analyseBullishScore = 0; + analyseBearishScore = 0; + Clean(analysePoiEvents); + Clean(analyseCycleEvents); + analyseConditions.Clean(); + analyseXConditions.Clean(); + + // + // Verification ... + verificationState.Clean(); + verificationBullishScore = 0; + verificationBearishScore = 0; + Clean(verificationPoiEvents); + Clean(verificationCycleEvents); + verificationConditions.Clean(); + verificationXConditions.Clean(); + + // + // Consolidation ... + consolidationState.Clean(); + consolidationBullishScore = 0; + consolidationBearishScore = 0; + Clean(consolidationPoiEvents); + Clean(consolidationCycleEvents); + consolidationConditions.Clean(); + consolidationXConditions.Clean(); + + // + // Vision ... + visionState.Clean(); + visionBullishScore = 0; + visionBearishScore = 0; + Clean(visionPoiEvents); + Clean(visionCycleEvents); + visionConditions.Clean(); + visionXConditions.Clean(); + } + + // + void Destroy() + { + // + Clean(); + + // + ZeroMemory(visionCycleHelper); + ZeroMemory(triggerCycleHelper); + ZeroMemory(analyseCycleHelper); + ZeroMemory(decisionCycleHelper); + ZeroMemory(verificationCycleHelper); + ZeroMemory(consolidationCycleHelper); + + // + ZeroMemory(this); + } + + // + bool IsValid() + { + // + bool result = false; + + // + result = + visionCycleHelper != NULL && + triggerCycleHelper != NULL && + analyseCycleHelper != NULL && + decisionCycleHelper != NULL && + verificationCycleHelper != NULL && + consolidationCycleHelper != NULL; + + // + return result; + } + + // + // Initialize ... + bool Init( + XC121SMCCycleHelper *_triggerCycleHelper, + XC121SMCCycleHelper *_decisionCycleHelper, + XC121SMCCycleHelper *_analyseCycleHelper, + XC121SMCCycleHelper *_verificationCycleHelper, + XC121SMCCycleHelper *_consolidationCycleHelper, + XC121SMCCycleHelper *_visionCycleHelper // + ) + { + // + bool result = false; + + // + // Validate Cycle Helpers ... + result = + // + _visionCycleHelper != NULL && + _triggerCycleHelper != NULL && + _analyseCycleHelper != NULL && + _decisionCycleHelper != NULL && + _verificationCycleHelper != NULL && + _consolidationCycleHelper != NULL + // + ; + if (!result) + { + return result; + } + + // + visionCycleHelper = _visionCycleHelper; + triggerCycleHelper = _triggerCycleHelper; + analyseCycleHelper = _analyseCycleHelper; + decisionCycleHelper = _decisionCycleHelper; + verificationCycleHelper = _verificationCycleHelper; + consolidationCycleHelper = _consolidationCycleHelper; + + // + result = IsValid(); + + // + return result; + } + + // + // Prepare all ... + bool Prepare( + int barIndex = 0, + int loopback = 10, + bool trigger = false, + bool decision = true, + bool analyse = true, + bool verification = false, + bool consolidation = true, + bool vision = true // + ) + { + // + bool result = false; + + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + if (loopback < 7) + { + loopback = 7; + } + + // + result = IsValid(); + if (!result) + { + return result; + } + + // + // Trigger ... + if (trigger) + { + // + result = triggerCycleHelper.GetConditions( + triggerCycleEvents, + triggerPoiEvents, + triggerConditions, + barIndex, + loopback // + ); + if (!result) + { + // + Clean(triggerPoiEvents); + Clean(triggerCycleEvents); + + // + triggerConditions.Clean(); + + // + return result; + } + } + + // + // Decision ... + if (decision) + { + // + result = decisionCycleHelper.GetConditions( + decisionCycleEvents, + decisionPoiEvents, + decisionConditions, + barIndex, + loopback // + ); + if (!result) + { + // + Clean(triggerPoiEvents); + Clean(decisionPoiEvents); + Clean(triggerCycleEvents); + triggerConditions.Clean(); + Clean(decisionCycleEvents); + decisionConditions.Clean(); + + // + return result; + } + } + + // + // Analyse ... + if (analyse) + { + // + result = analyseCycleHelper.GetConditions( + analyseCycleEvents, + analysePoiEvents, + analyseConditions, + barIndex, + loopback // + ); + if (!result) + { + // + Clean(triggerPoiEvents); + Clean(analysePoiEvents); + Clean(decisionPoiEvents); + Clean(triggerCycleEvents); + Clean(analyseCycleEvents); + triggerConditions.Clean(); + analyseConditions.Clean(); + Clean(decisionCycleEvents); + decisionConditions.Clean(); + + // + return result; + } + } + + // + // Verification ... + if (verification) + { + // + result = verificationCycleHelper.GetConditions( + verificationCycleEvents, + verificationPoiEvents, + verificationConditions, + barIndex, + loopback // + ); + if (!result) + { + // + Clean(triggerPoiEvents); + Clean(analysePoiEvents); + Clean(decisionPoiEvents); + Clean(triggerCycleEvents); + Clean(analyseCycleEvents); + triggerConditions.Clean(); + analyseConditions.Clean(); + Clean(decisionCycleEvents); + decisionConditions.Clean(); + Clean(verificationPoiEvents); + Clean(verificationCycleEvents); + verificationConditions.Clean(); + + // + return result; + } + } + + // + // Consolidation ... + if (consolidation) + { + // + result = consolidationCycleHelper.GetConditions( + consolidationCycleEvents, + consolidationPoiEvents, + consolidationConditions, + barIndex, + loopback // + ); + if (!result) + { + // + Clean(triggerPoiEvents); + Clean(analysePoiEvents); + Clean(decisionPoiEvents); + Clean(triggerCycleEvents); + Clean(analyseCycleEvents); + triggerConditions.Clean(); + analyseConditions.Clean(); + Clean(decisionCycleEvents); + decisionConditions.Clean(); + Clean(verificationPoiEvents); + Clean(consolidationPoiEvents); + Clean(verificationCycleEvents); + verificationConditions.Clean(); + Clean(consolidationCycleEvents); + consolidationConditions.Clean(); + + // + return result; + } + } + + // + // Vision ... + if (vision) + { + result = visionCycleHelper.GetConditions( + visionCycleEvents, + visionPoiEvents, + visionConditions, + barIndex, + loopback // + ); + if (!result) + { + // + Clean(visionPoiEvents); + Clean(triggerPoiEvents); + Clean(analysePoiEvents); + Clean(visionCycleEvents); + visionConditions.Clean(); + Clean(decisionPoiEvents); + Clean(triggerCycleEvents); + Clean(analyseCycleEvents); + triggerConditions.Clean(); + analyseConditions.Clean(); + Clean(decisionCycleEvents); + decisionConditions.Clean(); + Clean(verificationPoiEvents); + Clean(consolidationPoiEvents); + Clean(verificationCycleEvents); + verificationConditions.Clean(); + Clean(consolidationCycleEvents); + consolidationConditions.Clean(); + + // + return result; + } + } + + // + // Cycles POI States ... + visionState = visionConditions.state; + triggerState = triggerConditions.state; + analyseState = analyseConditions.state; + decisionState = decisionConditions.state; + verificationState = verificationConditions.state; + consolidationState = consolidationConditions.state; + + // + // Cycle X121Conditions ... + visionXConditions = visionConditions.x121Conditions; + triggerXConditions = triggerConditions.x121Conditions; + analyseXConditions = analyseConditions.x121Conditions; + decisionXConditions = decisionConditions.x121Conditions; + verificationXConditions = verificationConditions.x121Conditions; + consolidationXConditions = consolidationConditions.x121Conditions; + + // + // Trigger ... + triggerXConditions.GenerateScore( + triggerBullishScore, + triggerBearishScore // + ); + + // + // Decision ... + decisionXConditions.GenerateScore( + decisionBullishScore, + decisionBearishScore // + ); + + // + // Analyse ... + analyseXConditions.GenerateScore( + analyseBullishScore, + analyseBearishScore // + ); + + // + // Verification ... + verificationXConditions.GenerateScore( + verificationBullishScore, + verificationBearishScore // + ); + + // + // Consolidation ... + consolidationXConditions.GenerateScore( + consolidationBullishScore, + consolidationBearishScore // + ); + + // + // Vision ... + visionXConditions.GenerateScore( + visionBullishScore, + visionBearishScore // + ); + + // + return result; + } + + // + bool SelectCycle( + ENUM_X_CYCLES cycle, + XPOIState &cState, + XPOIStateEvents &cStateEvents, + X121Conditions &cXConditions, + XC121SMCCycleHelper *&cHelper, + X121SMCCycleConditions &cConditions // + ) + { + // + bool result = false; + + // + cState.Clean(); + ZeroMemory(cHelper); + cConditions.Clean(); + cStateEvents.Clean(); + cXConditions.Clean(); + + // + result = cycle != X_CYCLE_NONE; + if (!result) + { + return result; + } + + // + if (cycle == X_CYCLE_TRIGGER) + { + // + cState = triggerState; + cHelper = triggerCycleHelper; + cConditions = triggerConditions; + cXConditions = triggerXConditions; + cStateEvents.Init(triggerPoiEvents); + } + else if (cycle == X_CYCLE_DECISION) + { + // + cState = decisionState; + cHelper = decisionCycleHelper; + cConditions = decisionConditions; + cXConditions = decisionXConditions; + cStateEvents.Init(decisionPoiEvents); + } + else if (cycle == X_CYCLE_ANALYSE) + { + // + cState = analyseState; + cHelper = analyseCycleHelper; + cConditions = analyseConditions; + cXConditions = analyseXConditions; + cStateEvents.Init(analysePoiEvents); + } + else if (cycle == X_CYCLE_VERIFICATION) + { + // + cState = verificationState; + cHelper = verificationCycleHelper; + cConditions = verificationConditions; + cXConditions = verificationXConditions; + cStateEvents.Init(verificationPoiEvents); + } + else if (cycle == X_CYCLE_CONSOLIDATION) + { + // + cState = consolidationState; + cHelper = consolidationCycleHelper; + cConditions = consolidationConditions; + cXConditions = consolidationXConditions; + cStateEvents.Init(consolidationPoiEvents); + } + else if (cycle == X_CYCLE_VISION) + { + // + cState = visionState; + cHelper = visionCycleHelper; + cConditions = visionConditions; + cXConditions = visionXConditions; + cStateEvents.Init(visionPoiEvents); + } + + // + result = cState.IsValid() && + cHelper != NULL; + + // + return result; + } + + // + void MaxRequiredPOIs(int value) + { + // + if (!IsValid()) + { + return; + } + + // + visionCycleHelper.mPOIDetector.MaxRequiredPOIs(value); + analyseCycleHelper.mPOIDetector.MaxRequiredPOIs(value); + decisionCycleHelper.mPOIDetector.MaxRequiredPOIs(value); + consolidationCycleHelper.mPOIDetector.MaxRequiredPOIs(value); + } + + // + void MaxAllowedLoopbackForInit(int value) + { + // + if (!IsValid()) + { + return; + } + + // + visionCycleHelper.mPOIDetector.MaxAllowedLoopbackForInit(value); + analyseCycleHelper.mPOIDetector.MaxAllowedLoopbackForInit(value); + decisionCycleHelper.mPOIDetector.MaxAllowedLoopbackForInit(value); + consolidationCycleHelper.mPOIDetector.MaxAllowedLoopbackForInit(value); + } + + // +}; + +// +// Condition Parser ... +struct X121SMCStrategyConditionParser +{ + // + // Props ... + + // + // XMA ... + + // + bool isX3MaFastUnderValesGoldenZone; + bool isX3MaMidUnderValesGoldenZone; + bool isX3MaSlowUnderValesGoldenZone; + + // + bool isX3MaFastCrossedUnderValesGoldenZone; + bool isX3MaMidCrossedUnderValesGoldenZone; + bool isX3MaSlowCrossedUnderValesGoldenZone; + + // + bool isX3MaFastOverPeaksGoldenZone; + bool isX3MaMidOverPeaksGoldenZone; + bool isX3MaSlowOverPeaksGoldenZone; + + // + bool isX3MaFastCrossedOverPeaksGoldenZone; + bool isX3MaMidCrossedOverPeaksGoldenZone; + bool isX3MaSlowCrossedOverPeaksGoldenZone; + + // + // XVWAP ... + + // + bool isVWapFastUnderValesGoldenZone; + bool isVWapMidUnderValesGoldenZone; + bool isVWapSlowUnderValesGoldenZone; + + // + bool isVWapFastCrossedUnderValesGoldenZone; + bool isVWapMidCrossedUnderValesGoldenZone; + bool isVWapSlowCrossedUnderValesGoldenZone; + + // + bool isVWapFastOverPeaksGoldenZone; + bool isVWapMidOverPeaksGoldenZone; + bool isVWapSlowOverPeaksGoldenZone; + + // + bool isVWapFastCrossedOverPeaksGoldenZone; + bool isVWapMidCrossedOverPeaksGoldenZone; + bool isVWapSlowCrossedOverPeaksGoldenZone; + + // + // XHK ... + + // + bool isSMHKUnderValesGoldenZone; + bool isRawHKUnderValesGoldenZone; + + // + bool isSMHKCrossedUnderValesGoldenZone; + bool isRawHKCrossedUnderValesGoldenZone; + + // + bool isSMHKOverPeaksGoldenZone; + bool isRawHKOverPeaksGoldenZone; + + // + bool isSMHKCrossedOverPeaksGoldenZone; + bool isRawHKCrossedOverPeaksGoldenZone; + + // + // XSTR ... + + // + bool isStrUnderValesGoldenZone; + bool isStrCrossedUnderValesGoldenZone; + + // + bool isStrOverPeaksGoldenZone; + bool isStrCrossedOverPeaksGoldenZone; + + // + + // + // Constructor ... + X121SMCStrategyConditionParser() + { + Clean(); + } + + // + // Tools ... + + // + void Clean() + { + // + isX3MaFastUnderValesGoldenZone = false; + isX3MaFastCrossedUnderValesGoldenZone = false; + + // + isX3MaMidUnderValesGoldenZone = false; + isX3MaMidCrossedUnderValesGoldenZone = false; + + // + isX3MaSlowUnderValesGoldenZone = false; + isX3MaSlowCrossedUnderValesGoldenZone = false; + + // + isX3MaFastOverPeaksGoldenZone = false; + isX3MaFastCrossedOverPeaksGoldenZone = false; + + // + isX3MaMidOverPeaksGoldenZone = false; + isX3MaMidCrossedOverPeaksGoldenZone = false; + + // + isX3MaSlowOverPeaksGoldenZone = false; + isX3MaSlowCrossedOverPeaksGoldenZone = false; + + // + isVWapFastUnderValesGoldenZone = false; + isVWapFastCrossedUnderValesGoldenZone = false; + + // + isVWapMidUnderValesGoldenZone = false; + isVWapMidCrossedUnderValesGoldenZone = false; + + // + isVWapSlowUnderValesGoldenZone = false; + isVWapSlowCrossedUnderValesGoldenZone = false; + + // + isVWapFastOverPeaksGoldenZone = false; + isVWapFastCrossedOverPeaksGoldenZone = false; + + // + isVWapMidOverPeaksGoldenZone = false; + isVWapMidCrossedOverPeaksGoldenZone = false; + + // + isVWapSlowOverPeaksGoldenZone = false; + isVWapSlowCrossedOverPeaksGoldenZone = false; + + // + isSMHKUnderValesGoldenZone = false; + isSMHKCrossedUnderValesGoldenZone = false; + + // + isRawHKUnderValesGoldenZone = false; + isRawHKCrossedUnderValesGoldenZone = false; + + // + isSMHKOverPeaksGoldenZone = false; + isSMHKCrossedOverPeaksGoldenZone = false; + + // + isRawHKOverPeaksGoldenZone = false; + isRawHKCrossedOverPeaksGoldenZone = false; + + // + isStrUnderValesGoldenZone = false; + isStrCrossedUnderValesGoldenZone = false; + + // + isStrOverPeaksGoldenZone = false; + isStrCrossedOverPeaksGoldenZone = false; + + // + ZeroMemory(this); + } + + // + void Parse( + X121Conditions &conditions // + ) + { + // + Clean(); + + // + // + int zIDX = 0; + int cIDX = zIDX + 1; + int pIDX = cIDX + 1; + + // + // Reading Required Materials ... + + // + // + + // + double peak = conditions.peaksBuffer[cIDX]; + double vale = conditions.valesBuffer[cIDX]; + + // + double peakP = conditions.peaksBuffer[pIDX]; + double valeP = conditions.valesBuffer[pIDX]; + + // + // + + // + double str = conditions.strBuffer[cIDX]; + double strP = conditions.strBuffer[pIDX]; + + // + // + + // + double smhkO = conditions.xhkSMOpenBuffer[cIDX]; + double smhkC = conditions.xhkSMCloseBuffer[cIDX]; + + // + double smhkMax = MathMax(smhkO, smhkC); + double smhkMin = MathMin(smhkO, smhkC); + + // + double smhkOP = conditions.xhkSMOpenBuffer[pIDX]; + double smhkCP = conditions.xhkSMCloseBuffer[pIDX]; + + // + double smhkMaxP = MathMax(smhkOP, smhkCP); + double smhkMinP = MathMin(smhkOP, smhkCP); + + // + double rawhkO = conditions.xhkRawOpenBuffer[cIDX]; + double rawhkH = conditions.xhkRawHighBuffer[cIDX]; + double rawhkC = conditions.xhkRawCloseBuffer[cIDX]; + double rawhkL = conditions.xhkRawLowBuffer[cIDX]; + + // + double rawhkOP = conditions.xhkRawOpenBuffer[pIDX]; + double rawhkHP = conditions.xhkRawHighBuffer[pIDX]; + double rawhkCP = conditions.xhkRawCloseBuffer[pIDX]; + double rawhkLP = conditions.xhkRawLowBuffer[pIDX]; + + // + // + + // + double support = conditions.supportsBuffer[cIDX]; + double resistance = conditions.resistancesBuffer[cIDX]; + + // + double supportP = conditions.supportsBuffer[pIDX]; + double resistanceP = conditions.resistancesBuffer[pIDX]; + + // + double peakGolden = conditions.peaksGoldenBuffer[cIDX]; + double valeGolden = conditions.valesGoldenBuffer[cIDX]; + + // + double peakGoldenP = conditions.peaksGoldenBuffer[pIDX]; + double valeGoldenP = conditions.valesGoldenBuffer[pIDX]; + + // + // + + // + double x3maFast = conditions.x3maFastBuffer[cIDX]; + double x3maMid = conditions.x3maMidBuffer[cIDX]; + double x3maSlow = conditions.x3maSlowBuffer[cIDX]; + + // + double x3maFastP = conditions.x3maFastBuffer[pIDX]; + double x3maMidP = conditions.x3maMidBuffer[pIDX]; + double x3maSlowP = conditions.x3maSlowBuffer[pIDX]; + + // + double vwapFast = conditions.vwapFastBuffer[cIDX]; + double vwapMid = conditions.vwapMidBuffer[cIDX]; + double vwapSlow = conditions.vwapSlowBuffer[cIDX]; + + // + double vwapFastP = conditions.vwapFastBuffer[pIDX]; + double vwapMidP = conditions.vwapMidBuffer[pIDX]; + double vwapSlowP = conditions.vwapSlowBuffer[pIDX]; + + // + // X3MA ... + + // + isX3MaFastUnderValesGoldenZone = + x3maFast >= vale && + x3maFast <= valeGolden; + + // + bool isX3MaFastUnderValesGoldenZoneP = + x3maFastP >= valeP && + x3maFastP <= valeGoldenP; + + // + isX3MaFastCrossedUnderValesGoldenZone = + isX3MaFastUnderValesGoldenZone && + !isX3MaFastUnderValesGoldenZoneP; + + // + // + + // + isX3MaMidUnderValesGoldenZone = + x3maMid >= vale && + x3maMid <= valeGolden; + + // + bool isX3MaMidUnderValesGoldenZoneP = + x3maMidP >= valeP && + x3maMidP <= valeGoldenP; + + // + isX3MaMidCrossedUnderValesGoldenZone = + isX3MaMidUnderValesGoldenZone && + !isX3MaMidUnderValesGoldenZoneP; + + // + // + + // + isX3MaSlowUnderValesGoldenZone = + x3maSlow >= vale && + x3maSlow <= valeGolden; + + // + bool isX3MaSlowUnderValesGoldenZoneP = + x3maSlowP >= valeP && + x3maSlowP <= valeGoldenP; + + // + isX3MaSlowCrossedUnderValesGoldenZone = + isX3MaSlowUnderValesGoldenZone && + !isX3MaSlowUnderValesGoldenZoneP; + + // + // + + // + isX3MaFastOverPeaksGoldenZone = + x3maFast <= peak && + x3maFast >= peakGolden; + + // + bool isX3MaFastOverPeaksGoldenZoneP = + x3maFastP <= peakP && + x3maFastP >= peakGoldenP; + + // + isX3MaFastCrossedOverPeaksGoldenZone = + isX3MaFastOverPeaksGoldenZone && + !isX3MaFastOverPeaksGoldenZoneP; + + // + // + + // + isX3MaMidOverPeaksGoldenZone = + x3maMid <= peak && + x3maMid >= peakGolden; + + // + bool isX3MaMidOverPeaksGoldenZoneP = + x3maMidP <= peakP && + x3maMidP >= peakGoldenP; + + // + isX3MaMidCrossedOverPeaksGoldenZone = + isX3MaMidOverPeaksGoldenZone && + !isX3MaMidOverPeaksGoldenZoneP; + + // + // + + // + isX3MaSlowOverPeaksGoldenZone = + x3maSlow <= peak && + x3maSlow >= peakGolden; + + // + bool isX3MaSlowOverPeaksGoldenZoneP = + x3maSlowP <= peakP && + x3maSlowP >= peakGoldenP; + + // + isX3MaSlowCrossedOverPeaksGoldenZone = + isX3MaSlowOverPeaksGoldenZone && + !isX3MaSlowOverPeaksGoldenZoneP; + + // + // XVWAP ... + + // + // + + // + isVWapFastUnderValesGoldenZone = + vwapFast >= vale && + vwapFast <= valeGolden; + + // + bool isVWapFastUnderValesGoldenZoneP = + vwapFastP >= valeP && + vwapFastP <= valeGoldenP; + + // + isVWapFastCrossedUnderValesGoldenZone = + isVWapFastUnderValesGoldenZone && + !isVWapFastUnderValesGoldenZoneP; + + // + // + + // + isVWapMidUnderValesGoldenZone = + vwapMid >= vale && + vwapMid <= valeGolden; + + // + bool isVWapMidUnderValesGoldenZoneP = + vwapMidP >= valeP && + vwapMidP <= valeGoldenP; + + // + isVWapMidCrossedUnderValesGoldenZone = + isVWapMidUnderValesGoldenZone && + !isVWapMidUnderValesGoldenZoneP; + + // + // + + // + isVWapSlowUnderValesGoldenZone = + vwapSlow >= vale && + vwapSlow <= valeGolden; + + // + bool isVWapSlowUnderValesGoldenZoneP = + vwapSlowP >= valeP && + vwapSlowP <= valeGoldenP; + + // + isVWapSlowCrossedUnderValesGoldenZone = + isVWapSlowUnderValesGoldenZone && + !isVWapSlowUnderValesGoldenZoneP; + + // + // + + // + isVWapFastOverPeaksGoldenZone = + vwapFast <= peak && + vwapFast >= peakGolden; + + // + bool isVWapFastOverPeaksGoldenZoneP = + vwapFastP <= peakP && + vwapFastP >= peakGoldenP; + + // + isVWapFastCrossedOverPeaksGoldenZone = + isVWapFastOverPeaksGoldenZone && + !isVWapFastOverPeaksGoldenZoneP; + + // + // + + // + isVWapMidOverPeaksGoldenZone = + vwapMid <= peak && + vwapMid >= peakGolden; + + // + bool isVWapMidOverPeaksGoldenZoneP = + vwapMidP <= peakP && + vwapMidP >= peakGoldenP; + + // + isVWapMidCrossedOverPeaksGoldenZone = + isVWapMidOverPeaksGoldenZone && + !isVWapMidOverPeaksGoldenZoneP; + + // + // + + // + isVWapSlowOverPeaksGoldenZone = + vwapSlow <= peak && + vwapSlow >= peakGolden; + + // + bool isVWapSlowOverPeaksGoldenZoneP = + vwapSlowP <= peakP && + vwapSlowP >= peakGoldenP; + + // + isVWapSlowCrossedOverPeaksGoldenZone = + isVWapSlowOverPeaksGoldenZone && + !isVWapSlowOverPeaksGoldenZoneP; + + // + // XHK ... + + // + // + + // + isSMHKUnderValesGoldenZone = + smhkMax >= vale && + smhkMax <= valeGolden; + + // + bool isSMHKUnderValesGoldenZoneP = + smhkMaxP >= valeP && + smhkMaxP <= valeGoldenP; + + // + isSMHKCrossedUnderValesGoldenZone = + isSMHKUnderValesGoldenZone && + !isSMHKUnderValesGoldenZoneP; + + // + // + + // + isRawHKUnderValesGoldenZone = + rawhkH >= vale && + rawhkH <= valeGolden; + + // + bool isRawHKUnderValesGoldenZoneP = + rawhkHP >= valeP && + rawhkHP <= valeGoldenP; + + // + isRawHKCrossedUnderValesGoldenZone = + isRawHKUnderValesGoldenZone && + !isRawHKUnderValesGoldenZoneP; + + // + // + + // + isSMHKOverPeaksGoldenZone = + smhkMin <= peak && + smhkMin >= peakGolden; + + // + bool isSMHKOverPeaksGoldenZoneP = + smhkMinP <= peakP && + smhkMinP >= peakGoldenP; + + // + isSMHKCrossedOverPeaksGoldenZone = + isSMHKOverPeaksGoldenZone && + !isSMHKOverPeaksGoldenZoneP; + + // + // + + // + isRawHKOverPeaksGoldenZone = + rawhkL <= peak && + rawhkL >= peakGolden; + + // + bool isRawHKOverPeaksGoldenZoneP = + rawhkLP <= peakP && + rawhkLP >= peakGoldenP; + + // + isRawHKCrossedOverPeaksGoldenZone = + isRawHKOverPeaksGoldenZone && + !isRawHKOverPeaksGoldenZoneP; + + // + // XSTR ... + + // + // + + // + isStrUnderValesGoldenZone = + str >= vale && + str <= valeGolden; + + // + bool isStrUnderValesGoldenZoneP = + strP >= valeP && + strP <= valeGoldenP; + + // + isStrCrossedUnderValesGoldenZone = + isStrUnderValesGoldenZone && + !isStrUnderValesGoldenZoneP; + + // + // + + // + isStrOverPeaksGoldenZone = + str <= peak && + str >= peakGolden; + + // + bool isStrOverPeaksGoldenZoneP = + strP <= peakP && + strP >= peakGoldenP; + + // + isStrCrossedOverPeaksGoldenZone = + isStrOverPeaksGoldenZone && + !isStrOverPeaksGoldenZoneP; + } + + // + // Rejected Boxes ... + bool HasRejectedBoxConditions( + ENUM_X_CYCLES cycle, + XSignalBox &box, + ENUM_X_DIRECTION &dir, + XSignalBox &waitingBoxes[], + X121SMCStrategySignalProviderData &provider, + int barIndex = 0 // + ) + { + // + bool result = false; + + // + box.Clean(); + dir = X_DIRECTION_NONE; + + // + // Checking Waiting Baoxes Exists ... + result = HasChild(waitingBoxes); + if (!result) + { + return result; + } + + // + // Fil Selected Data ... + XPOIState cState; + X121Conditions cXConditions; + XPOIStateEvents cStateEvents; + XC121SMCCycleHelper *cHelper; + X121SMCCycleConditions cConditions; + result = provider.SelectCycle( + cycle, + cState, + cStateEvents, + cXConditions, + cHelper, + cConditions // + ); + if (!result) + { + // + cState.Clean(); + ZeroMemory(cHelper); + cConditions.Clean(); + cXConditions.Clean(); + cStateEvents.Clean(); + + // + return result; + } + Parse(cXConditions); + + // + // Normalize Args ... + + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + int idx = -1; + int count = 0; + bool has = false; + + // + int zIDX = barIndex; + int cIDX = zIDX + 1; + int pIDX = cIDX + 1; + int ppIDX = pIDX + 1; + + // + bool isBullish = false; + bool isBearish = false; + + // + XOHCL zBar; + XOHCL cBar; + XOHCL pBar; + + // + // Initial Bars ... + result = zBar.Init( + cState.symbol, + cState.period, + barIndex // + ); + result = + result && + zBar.GetPreviousBar(cBar); + result = + result && + cBar.GetPreviousBar(pBar); + if (!result) + { + // + zBar.Clean(); + cBar.Clean(); + pBar.Clean(); + cState.Clean(); + ZeroMemory(cHelper); + cConditions.Clean(); + cXConditions.Clean(); + + // + return result; + } + + // + // Checking Bar Based on Positions State ... + ENUM_X_DIRECTION iBarPosDir; + bool isBarValidForDir = cHelper + .mBarAnalyser + .IsValidForPosition( + cBar, + iBarPosDir // + ); + bool isBarValidForBullish = + isBarValidForDir && + IsBullish(iBarPosDir); + bool isBarValidForBearish = + isBarValidForDir && + IsBearish(iBarPosDir); + + // + // Extract Selected Boxes ... + XBoxZone selectedBox; + XSignalBox iSignalBox; + count = ArraySize(waitingBoxes); + has = IsValidSize(count); + if (has) + { + // + for (int i = 0; i < count; i++) + { + // + XSignalBox iBox = waitingBoxes[i]; + + // + bool isBullish = iBox.ob.IsBullish(); + + // + bool isOBBullishRejected = + // + cBar.low < iBox.ob.upper && + cBar.GetDown() > iBox.ob.upper + // + ; + + // + bool isOBBearishRejected = + // + cBar.high > iBox.ob.lower && + cBar.GetUp() < iBox.ob.lower + // + ; + + // + has = + isBullish + ? isOBBullishRejected + : isOBBearishRejected; + + // + // Force Using OB ... + if (has) + { + // + iSignalBox = iBox; + if (!selectedBox.IsValid()) + { + selectedBox = iBox.ob; + } + iBox.Clean(); + break; + } + + // + iBox.Clean(); + } + } + result = + iSignalBox.IsValid() && + selectedBox.IsValid(); + if (!result) + { + // + zBar.Clean(); + cBar.Clean(); + pBar.Clean(); + cState.Clean(); + iSignalBox.Clean(); + selectedBox.Clean(); + ZeroMemory(cHelper); + cConditions.Clean(); + cXConditions.Clean(); + + // + return result; + } + + // + bool hasSignalBox = iSignalBox.IsValid(); + bool isSignalBoxBullish = IsBullish(iSignalBox.ob.dir); + + // + // Checking Other Conditions ... + bool isVWapSlowPassed = + isSignalBoxBullish + ? cXConditions.isVWapSlowBullish + : cXConditions.isVWapSlowBearish; + + // + // Bullish Conditions ... + isBullish = + // + // Base Condition ... + ( + // + hasSignalBox && + isVWapSlowPassed && + isSignalBoxBullish && + isBarValidForBullish + // + ) + // + ; + + // + // Bearish Conditions ... + isBearish = + // + // Base Condition ... + ( + // + hasSignalBox && + isVWapSlowPassed && + !isSignalBoxBullish && + isBarValidForBearish + // + ) + // + ; + + // + // Filling Requirements ... + result = + isBullish || + isBearish; + if (result) + { + // + dir = + isBullish + ? X_DIRECTION_BULLISH + : X_DIRECTION_BEARISH; + + // + box = iSignalBox; + box.UpdateTo(TimeCurrent()); + } + + // + // Check All Conditions ... + result = + box.IsValid() && + HasDirection(dir) && + (isBullish || + isBearish); + + // + // Cleanup Resources ... + zBar.Clean(); + cBar.Clean(); + pBar.Clean(); + cState.Clean(); + iSignalBox.Clean(); + selectedBox.Clean(); + ZeroMemory(cHelper); + cConditions.Clean(); + cStateEvents.Clean(); + cXConditions.Clean(); + + // + return result; + } + + // + // Activated Boxes ... + bool HasActivatedBoxConditions( + ENUM_X_CYCLES cycle, + XSignalBox &box, + ENUM_X_DIRECTION &dir, + XSignalBox &waitingBoxes[], + X121SMCStrategySignalProviderData &provider, + int barIndex = 0 // + ) + { + // + bool result = false; + + // + box.Clean(); + dir = X_DIRECTION_NONE; + + // + // Checking Waiting Baoxes Exists ... + result = HasChild(waitingBoxes); + if (!result) + { + return result; + } + + // + // Fil Selected Data ... + XPOIState cState; + X121Conditions cXConditions; + XPOIStateEvents cStateEvents; + XC121SMCCycleHelper *cHelper; + X121SMCCycleConditions cConditions; + result = provider.SelectCycle( + cycle, + cState, + cStateEvents, + cXConditions, + cHelper, + cConditions // + ); + if (!result) + { + // + cState.Clean(); + ZeroMemory(cHelper); + cConditions.Clean(); + cXConditions.Clean(); + cStateEvents.Clean(); + + // + return result; + } + Parse(cXConditions); + + // + // Normalize Args ... + + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + int idx = -1; + int count = 0; + bool has = false; + + // + int zIDX = barIndex; + int cIDX = zIDX + 1; + int pIDX = cIDX + 1; + int ppIDX = pIDX + 1; + + // + bool isBullish = false; + bool isBearish = false; + + // + XOHCL zBar; + XOHCL cBar; + XOHCL pBar; + + // + // Initial Bars ... + result = zBar.Init( + cState.symbol, + cState.period, + barIndex // + ); + result = + result && + zBar.GetPreviousBar(cBar); + result = + result && + cBar.GetPreviousBar(pBar); + if (!result) + { + // + zBar.Clean(); + cBar.Clean(); + pBar.Clean(); + cState.Clean(); + ZeroMemory(cHelper); + cConditions.Clean(); + cXConditions.Clean(); + + // + return result; + } + + // + // Checking Bar Based on Positions State ... + ENUM_X_DIRECTION iBarPosDir; + bool isBarValidForDir = cHelper + .mBarAnalyser + .IsValidForPosition( + cBar, + iBarPosDir // + ); + bool isBarValidForBullish = + isBarValidForDir && + IsBullish(iBarPosDir); + bool isBarValidForBearish = + isBarValidForDir && + IsBearish(iBarPosDir); + + // + // Extract Selected Boxes ... + XBoxZone selectedBox; + XSignalBox iSignalBox; + count = ArraySize(waitingBoxes); + has = IsValidSize(count); + if (has) + { + // + for (int i = 0; i < count; i++) + { + // + XSignalBox iBox = waitingBoxes[i]; + + // + bool isBullish = iBox.ob.IsBullish(); + + // + has = cBar.low < iBox.sharp.upper && + cBar.low > iBox.sharp.lower && + cBar.high > iBox.sharp.lower && + cBar.high < iBox.sharp.upper; + + // + // Force Using OB ... + if (has) + { + // + iSignalBox = iBox; + if (!selectedBox.IsValid()) + { + selectedBox = iBox.ob; + } + iBox.Clean(); + break; + } + + // + iBox.Clean(); + } + } + result = + iSignalBox.IsValid() && + selectedBox.IsValid(); + if (!result) + { + // + zBar.Clean(); + cBar.Clean(); + pBar.Clean(); + cState.Clean(); + iSignalBox.Clean(); + selectedBox.Clean(); + ZeroMemory(cHelper); + cConditions.Clean(); + cXConditions.Clean(); + + // + return result; + } + + // + bool hasSignalBox = iSignalBox.IsValid(); + bool isSignalBoxBullish = IsBullish(iSignalBox.ob.dir); + + // + // Checking Other Conditions ... + + // + // XVWAP ... + + // + bool isVWapSlopeBullish = + cXConditions.isVwapFastSlopeBullish && + cXConditions.isVwapMidSlopeBullish && + cXConditions.isVwapSlowSlopeBullish; + + // + bool isVWapSlopeBearish = + cXConditions.isVwapFastSlopeBearish && + cXConditions.isVwapMidSlopeBearish && + cXConditions.isVwapSlowSlopeBearish; + + // + bool isVWapBullishCondition = + (cXConditions.isVWapBullishOrdered && + cXConditions.isVWapSwitchedToBullishState) || + (cXConditions.isVWapBullishState && + cXConditions.isVWapSwitchedToBullishOrdered); + + // + bool isVWapBearishCondition = + (cXConditions.isVWapBearishOrdered && + cXConditions.isVWapSwitchedToBearishState) || + (cXConditions.isVWapBearishState && + cXConditions.isVWapSwitchedToBearishOrdered); + + // + // Bullish Conditions ... + isBullish = + // + // Base Condition ... + ( + // + hasSignalBox && + isSignalBoxBullish && + isVWapSlopeBullish && + isBarValidForBullish && + isVWapBullishCondition + // + ) + // + ; + + // + // Bearish Conditions ... + isBearish = + // + // Base Condition ... + ( + // + hasSignalBox && + isVWapSlopeBearish && + !isSignalBoxBullish && + isBarValidForBearish && + isVWapBearishCondition + // + ) + // + ; + + // + // Filling Requirements ... + result = + isBullish || + isBearish; + if (result) + { + // + dir = + isBullish + ? X_DIRECTION_BULLISH + : X_DIRECTION_BEARISH; + + // + box = iSignalBox; + box.UpdateTo(TimeCurrent()); + + // + // Provide TP/SL ... + + // + box.sl = isBullish + ? cXConditions.vwapMin + : cXConditions.vwapMax; + + // + box.tp = isBullish + ? box.sharp.upper + : box.sharp.lower; + } + + // + // Check All Conditions ... + result = + box.IsValid() && + HasDirection(dir) && + (isBullish || + isBearish); + + // + // Cleanup Resources ... + zBar.Clean(); + cBar.Clean(); + pBar.Clean(); + cState.Clean(); + iSignalBox.Clean(); + selectedBox.Clean(); + ZeroMemory(cHelper); + cConditions.Clean(); + cStateEvents.Clean(); + cXConditions.Clean(); + + // + return result; + } + + // + // Breaked Boxes ... + bool HasBreakedBoxConditions( + ENUM_X_CYCLES cycle, + XSignalBox &box, + ENUM_X_DIRECTION &dir, + XSignalBox &breakedBoxes[], + X121SMCStrategySignalProviderData &provider, + int barIndex = 0 // + ) + { + // + bool result = false; + + // + box.Clean(); + dir = X_DIRECTION_NONE; + + // + // Checking Waiting Baoxes Exists ... + result = HasChild(breakedBoxes); + if (!result) + { + return result; + } + + // + // Fil Selected Data ... + XPOIState cState; + X121Conditions cXConditions; + XPOIStateEvents cStateEvents; + XC121SMCCycleHelper *cHelper; + X121SMCCycleConditions cConditions; + result = provider.SelectCycle( + cycle, + cState, + cStateEvents, + cXConditions, + cHelper, + cConditions // + ); + if (!result) + { + // + cState.Clean(); + ZeroMemory(cHelper); + cConditions.Clean(); + cXConditions.Clean(); + cStateEvents.Clean(); + + // + return result; + } + Parse(cXConditions); + + // + // Normalize Args ... + + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + int idx = -1; + int count = 0; + bool has = false; + + // + int zIDX = barIndex; + int cIDX = zIDX + 1; + int pIDX = cIDX + 1; + int ppIDX = pIDX + 1; + + // + bool isBullish = false; + bool isBearish = false; + + // + XOHCL zBar; + XOHCL cBar; + XOHCL pBar; + + // + // Initial Bars ... + result = zBar.Init( + cState.symbol, + cState.period, + barIndex // + ); + result = + result && + zBar.GetPreviousBar(cBar); + result = + result && + cBar.GetPreviousBar(pBar); + if (!result) + { + // + zBar.Clean(); + cBar.Clean(); + pBar.Clean(); + cState.Clean(); + ZeroMemory(cHelper); + cConditions.Clean(); + cXConditions.Clean(); + + // + return result; + } + + // + // Checking Bar Based on Positions State ... + ENUM_X_DIRECTION iBarPosDir; + bool isBarValidForDir = cHelper + .mBarAnalyser + .IsValidForPosition( + cBar, + iBarPosDir // + ); + bool isBarValidForBullish = + isBarValidForDir && + IsBullish(iBarPosDir); + bool isBarValidForBearish = + isBarValidForDir && + IsBearish(iBarPosDir); + + // + // Extract Selected Boxes ... + XBoxZone selectedBox; + XSignalBox iSignalBox; + count = ArraySize(breakedBoxes); + has = IsValidSize(count); + if (has) + { + // + for (int i = 0; i < count; i++) + { + // + XSignalBox iBox = breakedBoxes[i]; + + // + bool isBullish = iBox.ob.IsBullish(); + + // + has = cBar.low < iBox.sharp.upper && + cBar.low > iBox.sharp.lower && + cBar.high > iBox.sharp.lower && + cBar.high < iBox.sharp.upper; + + // + // Force Using OB ... + if (has) + { + // + iSignalBox = iBox; + if (!selectedBox.IsValid()) + { + selectedBox = iBox.ob; + } + iBox.Clean(); + break; + } + + // + iBox.Clean(); + } + } + result = + iSignalBox.IsValid() && + selectedBox.IsValid(); + if (!result) + { + // + zBar.Clean(); + cBar.Clean(); + pBar.Clean(); + cState.Clean(); + iSignalBox.Clean(); + selectedBox.Clean(); + ZeroMemory(cHelper); + cConditions.Clean(); + cXConditions.Clean(); + + // + return result; + } + + // + bool hasSignalBox = iSignalBox.IsValid(); + bool isSignalBoxBullish = IsBullish(iSignalBox.ob.dir); + + // + // Checking Other Conditions ... + + // + // XVWAP ... + + // + bool isVWapSlopeBullish = + cXConditions.isVwapFastSlopeBullish && + cXConditions.isVwapMidSlopeBullish && + cXConditions.isVwapSlowSlopeBullish; + + // + bool isVWapSlopeBearish = + cXConditions.isVwapFastSlopeBearish && + cXConditions.isVwapMidSlopeBearish && + cXConditions.isVwapSlowSlopeBearish; + + // + bool isVWapBullishCondition = + (cXConditions.isVWapBullishOrdered && + cXConditions.isVWapSwitchedToBullishState) || + (cXConditions.isVWapBullishState && + cXConditions.isVWapSwitchedToBullishOrdered); + + // + bool isVWapBearishCondition = + (cXConditions.isVWapBearishOrdered && + cXConditions.isVWapSwitchedToBearishState) || + (cXConditions.isVWapBearishState && + cXConditions.isVWapSwitchedToBearishOrdered); + + // + // Bullish Conditions ... + isBullish = + // + // Base Condition ... + ( + // + hasSignalBox && + isSignalBoxBullish && + isVWapSlopeBullish && + isBarValidForBullish && + isVWapBullishCondition + // + ) + // + ; + + // + // Bearish Conditions ... + isBearish = + // + // Base Condition ... + ( + // + hasSignalBox && + isVWapSlopeBearish && + !isSignalBoxBullish && + isBarValidForBearish && + isVWapBearishCondition + // + ) + // + ; + + // + // Filling Requirements ... + result = + isBullish || + isBearish; + if (result) + { + // + dir = + isBullish + ? X_DIRECTION_BULLISH + : X_DIRECTION_BEARISH; + + // + box = iSignalBox; + box.UpdateTo(TimeCurrent()); + + // + // Provide TP/SL ... + + // + box.sl = isBullish + ? cXConditions.vwapMin + : cXConditions.vwapMax; + + // + box.tp = isBullish + ? box.sharp.upper + : box.sharp.lower; + } + + // + // Check All Conditions ... + result = + box.IsValid() && + HasDirection(dir) && + (isBullish || + isBearish); + + // + // Cleanup Resources ... + zBar.Clean(); + cBar.Clean(); + pBar.Clean(); + cState.Clean(); + iSignalBox.Clean(); + selectedBox.Clean(); + ZeroMemory(cHelper); + cConditions.Clean(); + cStateEvents.Clean(); + cXConditions.Clean(); + + // + return result; + } + + // + // XFVGMA ... + bool HasXFVGMAConditions( + ENUM_X_CYCLES cycle, + XSignalBox &box, + ENUM_X_DIRECTION &dir, + XSignalBox &waitingBoxes[], + X121SMCStrategySignalProviderData &provider, + int barIndex = 0 // + ) + { + // + bool result = false; + + // + box.Clean(); + dir = X_DIRECTION_NONE; + + // + result = HasChild(waitingBoxes); + if (!result) + { + return result; + } + + // + // Fil Selected Data ... + XPOIState cState; + X121Conditions cXConditions; + XPOIStateEvents cStateEvents; + XC121SMCCycleHelper *cHelper; + X121SMCCycleConditions cConditions; + result = provider.SelectCycle( + cycle, + cState, + cStateEvents, + cXConditions, + cHelper, + cConditions // + ); + if (!result) + { + // + cState.Clean(); + ZeroMemory(cHelper); + cConditions.Clean(); + cXConditions.Clean(); + cStateEvents.Clean(); + + // + return result; + } + Parse(cXConditions); + + // + // Normalize Args ... + + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + int idx = -1; + int count = 0; + bool has = false; + + // + int zIDX = barIndex; + int cIDX = zIDX + 1; + int pIDX = cIDX + 1; + int ppIDX = pIDX + 1; + + // + bool isBullish = false; + bool isBearish = false; + + // + XOHCL zBar; + XOHCL cBar; + XOHCL pBar; + + // + // Initial Bars ... + result = zBar.Init( + cState.symbol, + cState.period, + barIndex // + ); + result = + result && + zBar.GetPreviousBar(cBar); + result = + result && + cBar.GetPreviousBar(pBar); + if (!result) + { + // + zBar.Clean(); + cBar.Clean(); + pBar.Clean(); + cState.Clean(); + ZeroMemory(cHelper); + cConditions.Clean(); + cXConditions.Clean(); + + // + return result; + } + + // + // Select Waiting Box ... + XBoxZone selectedBox; + XSignalBox selectedSignalBox; + count = ArraySize(waitingBoxes); + for (int i = 0; i < count; i++) + { + // + XSignalBox iSBox = waitingBoxes[i]; + bool isBullish = iSBox.ob.IsBullish(); + + // + bool isInsidePassed = + isBullish + ? cBar.low < iSBox.ob.upper && + cBar.low > iSBox.ob.lower + : cBar.high > iSBox.ob.lower && + cBar.high < iSBox.ob.upper; + + // + bool isTypePassed = iSBox.sharp.type == "XSHPOBX"; + + // + has = isTypePassed && + isInsidePassed; + if (has) + { + // + selectedBox = iSBox.ob; + selectedSignalBox = iSBox; + break; + } + } + result = selectedBox.IsValid() && + selectedSignalBox.IsValid(); + if (!result) + { + // + zBar.Clean(); + cBar.Clean(); + pBar.Clean(); + cState.Clean(); + ZeroMemory(cHelper); + cConditions.Clean(); + selectedBox.Clean(); + cXConditions.Clean(); + selectedSignalBox.Clean(); + + // + return result; + } + + // + bool isSignalBoxBullish = selectedBox.IsBullish(); + + // + // Checking Other Conditions ... + + // + // Checking Bar Based on Positions State ... + ENUM_X_DIRECTION iBarPosDir; + bool isBarValidForDir = cHelper + .mBarAnalyser + .IsValidForPosition( + cBar, + iBarPosDir // + ); + bool isBarValidForBullish = + isBarValidForDir && + IsBullish(iBarPosDir); + bool isBarValidForBearish = + isBarValidForDir && + IsBearish(iBarPosDir); + + // + // Bullish Conditions ... + isBullish = + // + // Base Condition ... + ( + // + isSignalBoxBullish && + isBarValidForBullish + // + ) + // + ; + + // + // Bearish Conditions ... + isBearish = + // + // Base Condition ... + ( + // + !isSignalBoxBullish && + isBarValidForBearish + // + ) + // + ; + + // + // Filling Requirements ... + result = + isBullish || + isBearish; + if (result) + { + // + dir = + isBullish + ? X_DIRECTION_BULLISH + : X_DIRECTION_BEARISH; + + // + box = selectedSignalBox; + box.ob.to = TimeCurrent(); + } + + // + // Check All Conditions ... + result = + box.IsValid() && + HasDirection(dir) && + (isBullish || + isBearish); + + // + // Cleanup Resources ... + zBar.Clean(); + cBar.Clean(); + pBar.Clean(); + cState.Clean(); + selectedBox.Clean(); + ZeroMemory(cHelper); + cConditions.Clean(); + cStateEvents.Clean(); + cXConditions.Clean(); + selectedSignalBox.Clean(); + + // + return result; + } + + // + // XWPVZ ... + bool HasXWPVZConditions( + ENUM_X_CYCLES cycle, + ENUM_X_CYCLES vCycle, + XSignalBox &box, + ENUM_X_DIRECTION &dir, + X121SMCStrategySignalProviderData &provider, + int barIndex = 0 // + ) + { + // + bool result = false; + + // + box.Clean(); + dir = X_DIRECTION_NONE; + + // + // Fil Selected Data ... + XPOIState cState; + X121Conditions cXConditions; + XPOIStateEvents cStateEvents; + XC121SMCCycleHelper *cHelper; + X121SMCCycleConditions cConditions; + result = provider.SelectCycle( + cycle, + cState, + cStateEvents, + cXConditions, + cHelper, + cConditions // + ); + if (!result) + { + // + cState.Clean(); + ZeroMemory(cHelper); + cConditions.Clean(); + cXConditions.Clean(); + cStateEvents.Clean(); + + // + return result; + } + Parse(cXConditions); + + // + // Fil Selected Data ... + XPOIState vState; + X121Conditions vXConditions; + XPOIStateEvents vStateEvents; + XC121SMCCycleHelper *vHelper; + X121SMCCycleConditions vConditions; + result = provider.SelectCycle( + vCycle, + vState, + vStateEvents, + vXConditions, + vHelper, + vConditions // + ); + if (!result) + { + // + cState.Clean(); + ZeroMemory(cHelper); + cConditions.Clean(); + cXConditions.Clean(); + cStateEvents.Clean(); + + // + vState.Clean(); + ZeroMemory(vHelper); + cConditions.Clean(); + vXConditions.Clean(); + vStateEvents.Clean(); + + // + return result; + } + Parse(vXConditions); + + // + // Normalize Args ... + + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + int idx = -1; + int count = 0; + bool has = false; + + // + int zIDX = barIndex; + int cIDX = zIDX + 1; + int pIDX = cIDX + 1; + int ppIDX = pIDX + 1; + + // + bool isBullish = false; + bool isBearish = false; + + // + XOHCL zBar; + XOHCL cBar; + XOHCL pBar; + XOHCL pPBar; + + // + // Initial Bars ... + result = zBar.Init( + cState.symbol, + cState.period, + barIndex // + ); + result = + result && + zBar.GetPreviousBar(cBar); + result = + result && + cBar.GetPreviousBar(pBar); + result = + result && + pBar.GetPreviousBar(pPBar); + if (!result) + { + // + zBar.Clean(); + cBar.Clean(); + pBar.Clean(); + cState.Clean(); + ZeroMemory(cHelper); + cConditions.Clean(); + cXConditions.Clean(); + + // + return result; + } + + // + XCPOIDrawer *drawer = provider.visionCycleHelper.mPOIDrawer; + + // + // Checking Other Conditions ... + + // + // Checking Bar Based on Positions State ... + ENUM_X_DIRECTION iBarPosDir; + bool isBarValidForDir = cHelper + .mBarAnalyser + .IsValidForPosition( + cBar, + iBarPosDir // + ); + bool isBarValidForBullish = + isBarValidForDir && + IsBullish(iBarPosDir); + bool isBarValidForBearish = + isBarValidForDir && + IsBearish(iBarPosDir); + + // + // Senkou Span A/B Rejections ... + + // + bool forceType = false; + bool forcePressure = true; + + // + bool isBullishRejectSenkouAB = cBar.IsRejected( + cXConditions.senkouMax, + X_DIRECTION_BULLISH, + forceType, // Force Type ... + forcePressure // Force Pressure ... + ); + + // + bool isBearishRejectSenkouAB = cBar.IsRejected( + cXConditions.senkouMin, + X_DIRECTION_BEARISH, + forceType, // Force Type ... + forcePressure // Force Pressure ... + ); + + // + // TenkanSen/KijunSen Rejections ... + + // + bool isBullishRejectTenKij = cBar.IsRejected( + cXConditions.tenKijMax, + X_DIRECTION_BULLISH, + forceType, // Force Type ... + forcePressure // Force Pressure ... + ); + + // + bool isBearishRejectTenKij = cBar.IsRejected( + cXConditions.tenKijMin, + X_DIRECTION_BEARISH, + forceType, // Force Type ... + forcePressure // Force Pressure ... + ); + + // + // X3MaFast Rejections ... + + // + bool isBullishRejectedFastMa = cBar.IsRejected( + cXConditions.x3maFastBuffer[cIDX], + X_DIRECTION_BULLISH, + forceType, // Force Type ... + forcePressure // Force Pressure ... + ); + + // + bool isBearishRejectedFastMa = cBar.IsRejected( + cXConditions.x3maFastBuffer[cIDX], + X_DIRECTION_BEARISH, + forceType, // Force Type ... + forcePressure // Force Pressure ... + ); + + // + bool isValidBullishRejectedFastMa = + isBullishRejectedFastMa && + cBar.low > cXConditions.senkouMax; + + // + bool isValidBearishRejectedFastMa = + isBearishRejectedFastMa && + cBar.high < cXConditions.senkouMin; + + // + // Bigger Cycle Verification ... + + // + double vBullishScore = 0; + double vBearishScore = 0; + vXConditions.GenerateScore( + vBullishScore, + vBearishScore // + ); + + // + bool isVBUllishPassed = + cBar.low > vXConditions.senkouMax && + vBullishScore > (vBearishScore * 1.5); + + // + bool isVBearishPassed = + cBar.high < vXConditions.senkouMin && + vBearishScore > (vBullishScore * 1.5); + + // + // ichimokou ... + + // + // Bullish Conditions ... + isBullish = + // + isVBUllishPassed && + isBullishRejectSenkouAB + // + ; + + // + // Bearish Conditions ... + isBearish = + // + isVBearishPassed && + isBearishRejectSenkouAB + // + ; + + // + result = isBullish || + isBearish; + if (result) + { + // + dir = + isBullish + ? X_DIRECTION_BULLISH + : X_DIRECTION_BEARISH; + } + + // + // Detecting a Zone and Validate it ... + + // + XBoxZone tmpBoxes[]; + + // + XBoxZone obBox; + XBoxZone fvgBox; + XBoxZone supResBox; + bool hasOB = false; + bool hasFVG = false; + bool hasSupRes = false; + + // + // Select Support and Resistance ... + if (result) + { + // + if (!hasSupRes) + { + // + cState.OrderBlocksAsBox(tmpBoxes); + cState.FairValueGapsAsBox(tmpBoxes); + cState.SupplyDemandsAsBox(tmpBoxes); + cState.SupportResistancesAsBox(tmpBoxes); + + // + has = HasChild(tmpBoxes); + if (has) + { + // + while (HasChild(tmpBoxes)) + { + // + idx = GetOldest(tmpBoxes); + has = IsValidIndex(idx); + if (!has) + { + break; + } + + // + XBoxZone iBox = tmpBoxes[idx]; + ArrayRemove( + tmpBoxes, + idx, + 1 // + ); + iBox.to = TimeCurrent(); + + // + // Try to Validate Support and Resistance ... + int retests = CountBoxRetest( + iBox, + dir, + cBar.period // + ); + bool isTyped = + isBullish + ? iBox.IsBullish() + : iBox.IsBearish(); + bool isRetested = retests >= 1; + bool isPlaced = + isBullish + ? ( + // + (cBar.low < iBox.upper && + cBar.low > iBox.lower) + // + ) + : ( + // + (cBar.high < iBox.upper && + cBar.high > iBox.lower) + // + ); + + // + has = + isTyped && + isPlaced && + isRetested; + if (has) + { + // + supResBox = iBox; + iBox.Clean(); + break; + } + + // + iBox.Clean(); + } + } + + // + hasSupRes = supResBox.IsValid(); + Clean(tmpBoxes); + } + } + + // + Clean(tmpBoxes); + + // + // Bullish Conditions ... + isBullish = + // + isBullish && + hasSupRes + // + ; + + // + // Bearish Conditions ... + isBearish = + // + isBearish && + hasSupRes + // + ; + + // + // Filling Requirements ... + result = + isBullish || + isBearish; + if (result) + { + // + bool drawBoxes = true; + if (drawBoxes) + { + // + if (hasSupRes) + { + // + supResBox.to = TimeCurrent(); + + // + XCBoxObject *iObj; + has = drawer.DrawBox( + supResBox, + iObj // + ); + + // + if (has) + { + iObj.BoxWidth(2); + iObj.BoxStyle(STYLE_DOT); + } + } + } + + // + Print("Signal ..."); + result = false; + isBearish = false; + isBullish = false; + } + + // + // Check All Conditions ... + result = + box.IsValid() && + HasDirection(dir) && + (isBullish || + isBearish); + + // + // Cleanup Resources ... + zBar.Clean(); + cBar.Clean(); + pBar.Clean(); + pPBar.Clean(); + cState.Clean(); + vState.Clean(); + cConditions.Clean(); + cConditions.Clean(); + ZeroMemory(cHelper); + ZeroMemory(vHelper); + cStateEvents.Clean(); + cXConditions.Clean(); + vXConditions.Clean(); + vStateEvents.Clean(); + + // + return result; + } + + // + bool HasXICHConditions( + ENUM_X_CYCLES cycle, + XBoxZone &box, + ENUM_X_DIRECTION &dir, + X121SMCStrategySignalProviderData &provider, + int barIndex = 0 // + ) + { + // + bool result = false; + + // + box.Clean(); + dir = X_DIRECTION_NONE; + + // + // Fil Selected Data ... + XPOIState cState; + X121Conditions cXConditions; + XPOIStateEvents cStateEvents; + XC121SMCCycleHelper *cHelper; + X121SMCCycleConditions cConditions; + result = provider.SelectCycle( + cycle, + cState, + cStateEvents, + cXConditions, + cHelper, + cConditions // + ); + if (!result) + { + // + cState.Clean(); + ZeroMemory(cHelper); + cConditions.Clean(); + cXConditions.Clean(); + cStateEvents.Clean(); + + // + return result; + } + Parse(cXConditions); + + // + // Normalize Args ... + + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + int idx = -1; + int count = 0; + bool has = false; + + // + int zIDX = barIndex; + int cIDX = zIDX + 1; + int pIDX = cIDX + 1; + int ppIDX = pIDX + 1; + + // + bool isBullish = false; + bool isBearish = false; + + // + XOHCL zBar; + XOHCL cBar; + XOHCL pBar; + XOHCL pPBar; + + // + // Initial Bars ... + result = zBar.Init( + cState.symbol, + cState.period, + barIndex // + ); + result = + result && + zBar.GetPreviousBar(cBar); + result = + result && + cBar.GetPreviousBar(pBar); + result = + result && + pBar.GetPreviousBar(pPBar); + if (!result) + { + // + zBar.Clean(); + cBar.Clean(); + pBar.Clean(); + cState.Clean(); + ZeroMemory(cHelper); + cConditions.Clean(); + cXConditions.Clean(); + + // + return result; + } + + // + // Checking Conditions ... + // + // XDELTA ... + + // + bool isDeltaSwitchedToBullish = + (cXConditions.isDeltaCrossedOverMa && + cXConditions.isDeltaSwitchedToBullish); + bool isDeltaBullish = + (cXConditions.isDeltaOverMa && + cXConditions.isDeltaBullish); + bool isDeltaIsBullish = + isDeltaBullish || + isDeltaSwitchedToBullish; + + // + bool isDeltaSwitchedToBearish = + (cXConditions.isDeltaCrossedUnderMa && + cXConditions.isDeltaSwitchedToBearish); + bool isDeltaBearish = + (cXConditions.isDeltaUnderMa && + cXConditions.isDeltaBearish); + bool isDeltaIsBearish = + isDeltaBearish || + isDeltaSwitchedToBearish; + + // + // XVOLUME ... + + // + bool isVolumeSwitchedToBullish = + (cXConditions.isVolumeSwitchedToBullish && + cXConditions.isBullishVolumeSwitchedToIncreased); + bool isVolumeBullish = + (cXConditions.isBullishVolumeIncreased && + cXConditions.isBullishVolumeMaOverBearishVolumeMa); + bool isVolumeIsBullish = + isVolumeBullish || + isVolumeSwitchedToBullish; + + // + bool isVolumeSwitchedToBearish = + (cXConditions.isVolumeSwitchedToBearish && + cXConditions.isBearishVolumeSwitchedToIncreased); + bool isVolumeBearish = + (cXConditions.isBullishVolumeMaUnderBearishVolumeMa && + cXConditions.isBearishVolumeIncreased); + bool isVolumeIsBearish = + isVolumeBearish || + isVolumeSwitchedToBearish; + + // + // XSTR ... + bool isStrIsBullish = + (cXConditions.isStrBullish || + cXConditions.isStrSwitchedToBullish); + bool isStrIsBearish = + (cXConditions.isStrBearish || + cXConditions.isStrSwitchedToBearish); + + // + // XICH ... + bool isIchIsBullish = + (cXConditions.isTenkanSenOverKijunSen || + cXConditions.isTenkanSenCrossedOverKijunSen); + bool isIchIsBearish = + (cXConditions.isTenkanSenUnderKijunSen || + cXConditions.isTenkanSenCrossedUnderKijunSen); + + // + // Checking TK Zone ... + + // + bool isBullishTKZone = + isIchIsBullish && + cBar.low < cXConditions.tenkanSenBuffer[cIDX] && + cBar.low > cXConditions.kijunSenBuffer[cIDX] && + cBar.low < pBar.low && + zBar.open > cBar.low; + + // + bool isBearishTKZone = + isIchIsBearish && + cBar.high > cXConditions.tenkanSenBuffer[cIDX] && + cBar.high < cXConditions.kijunSenBuffer[cIDX] && + cBar.high > pBar.high && + zBar.open < cBar.high; + + // + // Summarize Conditions ... + + // + isBullish = + // + // false + isStrIsBullish && + isIchIsBullish && + isBullishTKZone && + isDeltaIsBullish && + isVolumeIsBullish + // + // + ; + + // + isBearish = + // + // false + isStrIsBearish && + isIchIsBearish && + isBearishTKZone && + isDeltaIsBearish && + isVolumeIsBearish + // + ; + + // + // Filling Requirements ... + result = + isBullish || + isBearish; + if (result) + { + // + dir = + isBullish + ? X_DIRECTION_BULLISH + : X_DIRECTION_BEARISH; + + // + box.dir = dir; + box.from = pPBar.time; + box.to = TimeCurrent(); + box.symbol = cBar.symbol; + box.period = cBar.period; + + // + double points = GetPoints(box.symbol); + + // + double pivot = isBullish + ? cBar.low - (points * 5) + : cBar.high + (points * 5); + + // + double point = GetEntry( + cBar.symbol, + dir // + ); + + // + box.upper = + isBullish + ? point + : pivot; + + // + box.lower = + isBullish + ? pivot + : point; + + // + bool drawBoxes = true; + if (drawBoxes) + { + // + } + } + + // + // Check All Conditions ... + result = + box.IsValid() && + HasDirection(dir) && + (isBullish || + isBearish); + + // + // Cleanup Resources ... + zBar.Clean(); + cBar.Clean(); + pBar.Clean(); + pPBar.Clean(); + cState.Clean(); + cConditions.Clean(); + cConditions.Clean(); + ZeroMemory(cHelper); + cStateEvents.Clean(); + cXConditions.Clean(); + + // + return result; + } + + // + bool HasXSTRConditions( + ENUM_X_CYCLES cycle, + XBoxZone &box, + ENUM_X_DIRECTION &dir, + X121SMCStrategySignalProviderData &provider, + int barIndex = 0 // + ) + { + // + bool result = false; + + // + box.Clean(); + dir = X_DIRECTION_NONE; + + // + // Fil Selected Data ... + XPOIState cState; + X121Conditions cXConditions; + XPOIStateEvents cStateEvents; + XC121SMCCycleHelper *cHelper; + X121SMCCycleConditions cConditions; + result = provider.SelectCycle( + cycle, + cState, + cStateEvents, + cXConditions, + cHelper, + cConditions // + ); + if (!result) + { + // + cState.Clean(); + ZeroMemory(cHelper); + cConditions.Clean(); + cXConditions.Clean(); + cStateEvents.Clean(); + + // + return result; + } + Parse(cXConditions); + + // + // Normalize Args ... + + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + int idx = -1; + int count = 0; + bool has = false; + + // + int zIDX = barIndex; + int cIDX = zIDX + 1; + int pIDX = cIDX + 1; + int ppIDX = pIDX + 1; + + // + bool isBullish = false; + bool isBearish = false; + + // + XOHCL zBar; + XOHCL cBar; + XOHCL pBar; + XOHCL pPBar; + + // + // Initial Bars ... + result = zBar.Init( + cState.symbol, + cState.period, + barIndex // + ); + result = + result && + zBar.GetPreviousBar(cBar); + result = + result && + cBar.GetPreviousBar(pBar); + result = + result && + pBar.GetPreviousBar(pPBar); + if (!result) + { + // + zBar.Clean(); + cBar.Clean(); + pBar.Clean(); + cState.Clean(); + ZeroMemory(cHelper); + cConditions.Clean(); + cXConditions.Clean(); + + // + return result; + } + + // + // Checking Conditions ... + // + // XDELTA ... + + // + bool isDeltaSwitchedToBullish = + (cXConditions.isDeltaCrossedOverMa && + cXConditions.isDeltaSwitchedToBullish); + bool isDeltaBullish = + (cXConditions.isDeltaOverMa && + cXConditions.isDeltaBullish); + bool isDeltaIsBullish = + isDeltaBullish || + isDeltaSwitchedToBullish; + + // + bool isDeltaSwitchedToBearish = + (cXConditions.isDeltaCrossedUnderMa && + cXConditions.isDeltaSwitchedToBearish); + bool isDeltaBearish = + (cXConditions.isDeltaUnderMa && + cXConditions.isDeltaBearish); + bool isDeltaIsBearish = + isDeltaBearish || + isDeltaSwitchedToBearish; + + // + // XVOLUME ... + + // + bool isVolumeSwitchedToBullish = + (cXConditions.isVolumeSwitchedToBullish && + cXConditions.isBullishVolumeSwitchedToIncreased); + bool isVolumeBullish = + (cXConditions.isBullishVolumeIncreased && + cXConditions.isBullishVolumeMaOverBearishVolumeMa); + bool isVolumeIsBullish = + isVolumeBullish || + isVolumeSwitchedToBullish; + + // + bool isVolumeSwitchedToBearish = + (cXConditions.isVolumeSwitchedToBearish && + cXConditions.isBearishVolumeSwitchedToIncreased); + bool isVolumeBearish = + (cXConditions.isBullishVolumeMaUnderBearishVolumeMa && + cXConditions.isBearishVolumeIncreased); + bool isVolumeIsBearish = + isVolumeBearish || + isVolumeSwitchedToBearish; + + // + // XSTR ... + bool isStrIsBullish = + (cXConditions.isStrBullish || + cXConditions.isStrSwitchedToBullish); + bool isStrIsBearish = + (cXConditions.isStrBearish || + cXConditions.isStrSwitchedToBearish); + + // + // Detecting Str Box ... + XBoxZone strBox; + bool hasStrBox = false; + if (!hasStrBox) + { + // + hasStrBox = + cXConditions.isStrBullish || + cXConditions.isStrBearish; + if (hasStrBox) + { + // + ENUM_X_DIRECTION strDir = + cXConditions.isStrBullish + ? X_DIRECTION_BULLISH + : X_DIRECTION_BEARISH; + + // + XOHCL lastBar; + ENUM_X_DIRECTION lastDir; + bool hasLast = + cHelper + .DetectNearestStrSwitched( + lastBar, + lastDir, + zIDX // + ); + + // + XOHCL prevBar; + ENUM_X_DIRECTION prevDir; + bool hasPrev = + hasLast && + cHelper + .DetectNearestStrSwitched( + prevBar, + prevDir, + lastBar.Index() + 1 // + ); + + // + hasStrBox = + hasLast && + hasPrev; + if (hasStrBox) + { + // + int fromIDX = MathMax( + lastBar.Index(), + prevBar.Index() // + ); + + // + string symbol = cBar.symbol; + ENUM_TIMEFRAMES period = cBar.period; + + // + datetime from = GetBarTime( + symbol, + period, + fromIDX // + ); + + // + int length = fromIDX - barIndex; + + // + double upper = zBar.FindHighest( + length, + MODE_HIGH // + ); + + // + double lower = zBar.FindLowest( + length, + MODE_LOW // + ); + + // + strBox.from = from; + strBox.dir = strDir; + strBox.lower = lower; + strBox.upper = upper; + strBox.symbol = symbol; + strBox.period = period; + strBox.type = "XSTRBox"; + strBox.to = TimeCurrent(); + + // + hasStrBox =strBox.IsValid(); + } + + // + lastBar.Clean(); + prevBar.Clean(); + } + } + + // + // XFastMa ... + + // + bool isFastMaOverStr = + (cXConditions.x3maFastBuffer[cIDX] > cXConditions.strBuffer[cIDX]); + + // + bool isFastMaUnderStr = + (cXConditions.x3maFastBuffer[cIDX] < cXConditions.strBuffer[cIDX]); + + // + bool isFastMaBullishReject = + cBar.low < pBar.low && + cBar.low > cXConditions.strBuffer[cIDX] && + cBar.low < cXConditions.x3maFastBuffer[cIDX] && + cBar.GetDown() > cXConditions.x3maFastBuffer[cIDX]; + + // + bool isFastMaBearishReject = + cBar.high > pBar.high && + cBar.high < cXConditions.strBuffer[cIDX] && + cBar.high > cXConditions.x3maFastBuffer[cIDX] && + cBar.GetUp() < cXConditions.x3maFastBuffer[cIDX]; + + // + // Summarize Conditions ... + + // + isBullish = + // + // false + hasStrBox && + isStrIsBullish && + isFastMaOverStr && + // isDeltaIsBullish && + // isVolumeIsBullish && + isFastMaBullishReject + // + // + ; + + // + isBearish = + // + // false + hasStrBox && + isStrIsBearish && + isFastMaUnderStr && + // isDeltaIsBearish && + // isVolumeIsBearish && + isFastMaBearishReject + // + ; + + // + // Filling Requirements ... + result = + isBullish || + isBearish; + if (result) + { + // + XCPOIDrawer *drawer = provider.visionCycleHelper.mPOIDrawer; + XCBoxObject *iObj; + bool isCreated = drawer.DrawBox( + strBox, + iObj // + ); + if (isCreated) { + // + Print("STRBox"); + } + + // + dir = + isBullish + ? X_DIRECTION_BULLISH + : X_DIRECTION_BEARISH; + + // + box.dir = dir; + box.from = pPBar.time; + box.to = TimeCurrent(); + box.symbol = cBar.symbol; + box.period = cBar.period; + + // + double points = GetPoints(box.symbol); + + // + double pivot = cXConditions.strBuffer[cIDX]; + // isBullish + // ? cBar.low - (points * 5) + // : cBar.high + (points * 5); + + // + double point = GetEntry( + cBar.symbol, + dir // + ); + + // + box.upper = + isBullish + ? point + : pivot; + + // + box.lower = + isBullish + ? pivot + : point; + + // + bool drawBoxes = true; + if (drawBoxes) + { + // + } + } + + // + // Check All Conditions ... + result = + box.IsValid() && + HasDirection(dir) && + (isBullish || + isBearish); + + // + // Cleanup Resources ... + zBar.Clean(); + cBar.Clean(); + pBar.Clean(); + pPBar.Clean(); + cState.Clean(); + strBox.Clean(); + cConditions.Clean(); + cConditions.Clean(); + ZeroMemory(cHelper); + cStateEvents.Clean(); + cXConditions.Clean(); + + // + return result; + } + + // +}; diff --git a/Documents/BKP/x-cycle.helper.tmp.mq5 b/Documents/BKP/x-cycle.helper.tmp.mq5 new file mode 100644 index 00000000..0ce99ea3 --- /dev/null +++ b/Documents/BKP/x-cycle.helper.tmp.mq5 @@ -0,0 +1,580 @@ + + // + bool DetectNearestTenKijCross( + XOHCL &bar, + ENUM_X_DIRECTION &dir, + int barIndex = 0, + int maxAllowedBars = 20 // + ) + { + // + bool result = false; + + // + bar.Clean(); + dir = X_DIRECTION_NONE; + barIndex = NormalizeInt(barIndex, 0); + maxAllowedBars = NormalizeInt(maxAllowedBars, 20); + + // + // Looping Through LoopBack Period ... + // for Detecting Result ... + for (int i = barIndex; i < barIndex + maxAllowedBars; i++) + { + // + XOHCL iBar; + result = iBar.Init( + GetSymbol(), + GetPeriod(), + i // + ); + if (!result) + { + // + iBar.Clean(); + break; + } + + // + double iTSen = mX121Helper.xichHelper.GetTenkanSen(i); + double iTSenP = mX121Helper.xichHelper.GetTenkanSen(i + 1); + + // + double iKSen = mX121Helper.xichHelper.GetKijunSen(i); + double iKSenP = mX121Helper.xichHelper.GetKijunSen(i + 1); + + // + bool isTSenOverKSen = iTSen > iKSen; + bool isTSenOverKSenP = iTSenP > iKSenP; + + // + bool isTSenUnderKSen = iTSen < iKSen; + bool isTSenUnderKSenP = iTSenP < iKSenP; + + // + + // + bool isTSenCrossedOverKSen = isTSenOverKSen && + !isTSenOverKSenP; + + // + bool isTSenCrossedUnderKSen = isTSenUnderKSen && + !isTSenUnderKSenP; + + // + result = isTSenCrossedOverKSen || + isTSenCrossedUnderKSen; + if (result) + { + // + bar = iBar; + + // + dir = isTSenCrossedOverKSen + ? X_DIRECTION_BULLISH + : X_DIRECTION_BEARISH; + + // + iBar.Clean(); + break; + } + + // + iBar.Clean(); + } + + // + return result; + } + + // + bool DetectNearestVolumeSwitched( + XOHCL &bar, + ENUM_X_DIRECTION &dir, + int barIndex = 0, + int maxAllowedBars = 20 // + ) + { + // + bool result = false; + + // + bar.Clean(); + dir = X_DIRECTION_NONE; + barIndex = NormalizeInt(barIndex, 0); + maxAllowedBars = NormalizeInt(maxAllowedBars, 20); + + // + // Looping Through LoopBack Period ... + // for Detecting Result ... + for (int i = barIndex; i < barIndex + maxAllowedBars; i++) + { + // + XOHCL iBar; + result = iBar.Init( + GetSymbol(), + GetPeriod(), + i // + ); + if (!result) + { + // + iBar.Clean(); + break; + } + + // + double iBullVMa = mX121Helper.xvolumeHelper.GetBullishVolumeMa(i); + double iBullVMaP = mX121Helper.xvolumeHelper.GetBullishVolumeMa(i + 1); + + // + double iBearVMa = mX121Helper.xvolumeHelper.GetBearishVolumeMa(i); + double iBearVMaP = mX121Helper.xvolumeHelper.GetBearishVolumeMa(i + 1); + + // + bool isBullVMaOverBearVMa = iBullVMa > iBearVMa; + bool isBullVMaOverBearVMaP = iBullVMaP > iBearVMaP; + bool isCrossOver = isBullVMaOverBearVMa && + !isBullVMaOverBearVMaP; + + // + bool isBullVMaUnderBearVMa = iBullVMa < iBearVMa; + bool isBullVMaUnderBearVMaP = iBullVMaP < iBearVMaP; + bool isCrossUnder = isBullVMaUnderBearVMa && + !isBullVMaUnderBearVMaP; + + // + result = isCrossOver || + isCrossUnder; + if (result) + { + // + bar = iBar; + + // + dir = isCrossOver + ? X_DIRECTION_BULLISH + : X_DIRECTION_BEARISH; + + // + iBar.Clean(); + break; + } + + // + iBar.Clean(); + } + + // + return result; + } + + // + bool DetectNearestDeltaSwitched( + XOHCL &bar, + ENUM_X_DIRECTION &dir, + int barIndex = 0, + int maxAllowedBars = 20 // + ) + { + // + bool result = false; + + // + bar.Clean(); + dir = X_DIRECTION_NONE; + barIndex = NormalizeInt(barIndex, 0); + maxAllowedBars = NormalizeInt(maxAllowedBars, 20); + + // + // Looping Through LoopBack Period ... + // for Detecting Result ... + for (int i = barIndex; i < barIndex + maxAllowedBars; i++) + { + // + XOHCL iBar; + result = iBar.Init( + GetSymbol(), + GetPeriod(), + i // + ); + if (!result) + { + // + iBar.Clean(); + break; + } + + // + double iDelta = mX121Helper.xdeltaHelper.GetDelta(i); + double iDeltaP = mX121Helper.xdeltaHelper.GetDelta(i + 1); + + // + double iDeltaMa = mX121Helper.xdeltaHelper.GetDeltaMa(i); + double iDeltaMaP = mX121Helper.xdeltaHelper.GetDeltaMa(i + 1); + + // + bool isDeltaOverMa = iDelta > iDeltaMa; + bool isDeltaOverMaP = iDeltaP > iDeltaMaP; + + // + bool isDeltaUnderMa = iDelta < iDeltaMa; + bool isDeltaUnderMaP = iDeltaP < iDeltaMaP; + + // + bool isCrossOver = isDeltaOverMa && + !isDeltaOverMaP; + + // + bool isCrossUnder = isDeltaUnderMa && + !isDeltaUnderMaP; + + // + result = isCrossOver || + isCrossUnder; + if (result) + { + // + bar = iBar; + + // + dir = isCrossOver + ? X_DIRECTION_BULLISH + : X_DIRECTION_BEARISH; + + // + iBar.Clean(); + break; + } + + // + iBar.Clean(); + } + + // + return result; + } + + + //////////////////////////////////////////////////////////////////////////// + + + + // + // Activated Boxes ... + bool HasActivatedBoxConditions( + ENUM_X_CYCLES cycle, + XSignalBox &box, + ENUM_X_DIRECTION &dir, + XSignalBox &waitingBoxes[], + X121SMCStrategySignalProviderData &provider, + int barIndex = 0 // + ) + { + // + bool result = false; + + // + box.Clean(); + dir = X_DIRECTION_NONE; + + // + // Checking Waiting Baoxes Exists ... + result = HasChild(waitingBoxes); + if (!result) + { + return result; + } + + // + // Fil Selected Data ... + XPOIState cState; + X121Conditions cXConditions; + XPOIStateEvents cStateEvents; + XC121SMCCycleHelper *cHelper; + X121SMCCycleConditions cConditions; + result = provider.SelectCycle( + cycle, + cState, + cStateEvents, + cXConditions, + cHelper, + cConditions // + ); + if (!result) + { + // + cState.Clean(); + ZeroMemory(cHelper); + cConditions.Clean(); + cXConditions.Clean(); + cStateEvents.Clean(); + + // + return result; + } + Parse(cXConditions); + + // + // Normalize Args ... + + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + int idx = -1; + int count = 0; + bool has = false; + + // + int zIDX = barIndex; + int cIDX = zIDX + 1; + int pIDX = cIDX + 1; + int ppIDX = pIDX + 1; + + // + bool isBullish = false; + bool isBearish = false; + + // + XOHCL zBar; + XOHCL cBar; + XOHCL pBar; + + // + // Initial Bars ... + result = zBar.Init( + cState.symbol, + cState.period, + barIndex // + ); + result = + result && + zBar.GetPreviousBar(cBar); + result = + result && + cBar.GetPreviousBar(pBar); + if (!result) + { + // + zBar.Clean(); + cBar.Clean(); + pBar.Clean(); + cState.Clean(); + ZeroMemory(cHelper); + cConditions.Clean(); + cXConditions.Clean(); + + // + return result; + } + + // + // Checking Bar Based on Positions State ... + ENUM_X_DIRECTION iBarPosDir; + bool isBarValidForDir = cHelper + .mBarAnalyser + .IsValidForPosition( + cBar, + iBarPosDir // + ); + bool isBarValidForBullish = + isBarValidForDir && + IsBullish(iBarPosDir); + bool isBarValidForBearish = + isBarValidForDir && + IsBearish(iBarPosDir); + + // + // Extract Selected Boxes ... + XBoxZone selectedBox; + XSignalBox iSignalBox; + count = ArraySize(waitingBoxes); + has = IsValidSize(count); + if (has) + { + // + for (int i = 0; i < count; i++) + { + // + XSignalBox iBox = waitingBoxes[i]; + + // + bool isBullish = iBox.ob.IsBullish(); + + // + has = cBar.low < iBox.sharp.upper && + cBar.low > iBox.sharp.lower && + cBar.high > iBox.sharp.lower && + cBar.high < iBox.sharp.upper; + + // + // Force Using OB ... + if (has) + { + // + iSignalBox = iBox; + if (!selectedBox.IsValid()) + { + selectedBox = iBox.ob; + } + iBox.Clean(); + break; + } + + // + iBox.Clean(); + } + } + result = + iSignalBox.IsValid() && + selectedBox.IsValid(); + if (!result) + { + // + zBar.Clean(); + cBar.Clean(); + pBar.Clean(); + cState.Clean(); + iSignalBox.Clean(); + selectedBox.Clean(); + ZeroMemory(cHelper); + cConditions.Clean(); + cXConditions.Clean(); + + // + return result; + } + + // + bool hasSignalBox = iSignalBox.IsValid(); + bool isSignalBoxBullish = IsBullish(iSignalBox.ob.dir); + + // + // Checking Other Conditions ... + + // + // XVWAP ... + + // + bool isVWapSlopeBullish = + cXConditions.isVwapFastSlopeBullish && + cXConditions.isVwapMidSlopeBullish && + cXConditions.isVwapSlowSlopeBullish; + + // + bool isVWapSlopeBearish = + cXConditions.isVwapFastSlopeBearish && + cXConditions.isVwapMidSlopeBearish && + cXConditions.isVwapSlowSlopeBearish; + + // + bool isVWapBullishCondition = + (cXConditions.isVWapBullishOrdered && + cXConditions.isVWapSwitchedToBullishState) || + (cXConditions.isVWapBullishState && + cXConditions.isVWapSwitchedToBullishOrdered); + + // + bool isVWapBearishCondition = + (cXConditions.isVWapBearishOrdered && + cXConditions.isVWapSwitchedToBearishState) || + (cXConditions.isVWapBearishState && + cXConditions.isVWapSwitchedToBearishOrdered); + + // + // Bullish Conditions ... + isBullish = + // + // Base Condition ... + ( + // + hasSignalBox && + isSignalBoxBullish && + isVWapSlopeBullish && + isBarValidForBullish && + isVWapBullishCondition + // + ) + // + ; + + // + // Bearish Conditions ... + isBearish = + // + // Base Condition ... + ( + // + hasSignalBox && + isVWapSlopeBearish && + !isSignalBoxBullish && + isBarValidForBearish && + isVWapBearishCondition + // + ) + // + ; + + // + // Filling Requirements ... + result = + isBullish || + isBearish; + if (result) + { + // + dir = + isBullish + ? X_DIRECTION_BULLISH + : X_DIRECTION_BEARISH; + + // + box = iSignalBox; + box.UpdateTo(TimeCurrent()); + + // + // Provide TP/SL ... + + // + box.sl = isBullish + ? cXConditions.vwapMin + : cXConditions.vwapMax; + + // + box.tp = isBullish + ? box.sharp.upper + : box.sharp.lower; + } + + // + // Check All Conditions ... + result = + box.IsValid() && + HasDirection(dir) && + (isBullish || + isBearish); + + // + // Cleanup Resources ... + zBar.Clean(); + cBar.Clean(); + pBar.Clean(); + cState.Clean(); + iSignalBox.Clean(); + selectedBox.Clean(); + ZeroMemory(cHelper); + cConditions.Clean(); + cStateEvents.Clean(); + cXConditions.Clean(); + + // + return result; + } + + ///////////////////////////////////////////////////////////////////////////////////// + + \ No newline at end of file diff --git a/Documents/BKP/x-saherelm.x121.helper.mq5 b/Documents/BKP/x-saherelm.x121.helper.mq5 new file mode 100644 index 00000000..5dbfce6d --- /dev/null +++ b/Documents/BKP/x-saherelm.x121.helper.mq5 @@ -0,0 +1,4949 @@ +/////////////////////////////////////////////////////// +// +// SaherElm IT Center MQL5 Helper Class Library +// ---------------------------------------------- +// Name: XCX121Helper +// Description: provides all Indicator +// Helper requirements ... +// +// +// Maintainer: +// ------------ +// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com) +// +////////////////////////////////////////////////////// +// +// Global Properties ... +#property library +#property copyright "Copyright 2023, SaherElm IT Center" +#property link "https://www.saherelm.ir" +#property version "1.00" +#property strict + +// +// Imports ... +#include "../Helpers/x-saherelm.x121.x3ma.helper.mq5" +#include "../Helpers/x-saherelm.x121.xatr.helper.mq5" +#include "../Helpers/x-saherelm.x121.xcc.helper.mq5" +#include "../Helpers/x-saherelm.x121.xche.helper.mq5" +#include "../Helpers/x-saherelm.x121.xdelta.helper.mq5" +#include "../Helpers/x-saherelm.x121.xdon.helper.mq5" +#include "../Helpers/x-saherelm.x121.xhk.helper.mq5" +#include "../Helpers/x-saherelm.x121.xich.helper.mq5" +#include "../Helpers/x-saherelm.x121.xmas.helper.mq5" +#include "../Helpers/x-saherelm.x121.xpv.helper.mq5" +#include "../Helpers/x-saherelm.x121.xstr.helper.mq5" +#include "../Helpers/x-saherelm.x121.xvolume.helper.mq5" +#include "../Helpers/x-saherelm.x121.xvwap.helper.mq5" + +// +// Inputs ... +struct X121Inputs +{ + // + // Props ... + bool showRSI; + X121XCCInputs xccInputs; + X121XPVInputs xpvInputs; + X121XHKInputs xhkInputs; + X121XICHInputs xichInputs; + X121XMASInputs xmasInputs; + X121XATRInputs xatrInputs; + X121XSTRInputs xstrInputs; + X121XCHEInputs xcheInputs; + X121XDONInputs xdonInputs; + X121X3MAInputs x3maInputs; + X121XVWAPInputs xvwapInputs; + X121XDELTAInputs xdeltaInputs; + X121XVOLUMEInputs xvolumeInputs; + + // + // Constructor ... + X121Inputs() + { + Clean(); + } + + // + // Tools ... + + /** + * Cleaning Up ... + */ + void Clean() + { + // + xccInputs.Clean(); + xpvInputs.Clean(); + xhkInputs.Clean(); + xichInputs.Clean(); + xmasInputs.Clean(); + xatrInputs.Clean(); + xstrInputs.Clean(); + xcheInputs.Clean(); + xdonInputs.Clean(); + xvwapInputs.Clean(); + xdeltaInputs.Clean(); + xvolumeInputs.Clean(); + + // + ZeroMemory(this); + } + + /** + * Set Default Values ... + */ + void Default() + { + // + xccInputs.Default(); + xpvInputs.Default(); + xhkInputs.Default(); + xichInputs.Default(); + xmasInputs.Default(); + xatrInputs.Default(); + xstrInputs.Default(); + xcheInputs.Default(); + xdonInputs.Default(); + x3maInputs.Default(); + xvwapInputs.Default(); + xdeltaInputs.Default(); + xvolumeInputs.Default(); + } + + /** + * Validate ... + * + * @return ( bool ) + */ + bool IsValid() + { + // + bool result = false; + + // + result = + // + xccInputs.IsValid() && + xpvInputs.IsValid() && + xhkInputs.IsValid() && + xichInputs.IsValid() && + xmasInputs.IsValid() && + xatrInputs.IsValid() && + xstrInputs.IsValid() && + xcheInputs.IsValid() && + xdonInputs.IsValid() && + xvwapInputs.IsValid() && + xdeltaInputs.IsValid() && + xvolumeInputs.IsValid() + // + ; + + // + return result; + } + + /** + * Extract Max Input Length ... + * + * @return ( int ) + */ + int Max() + { + // + int result = 0; + + // + int xpvMax = xpvInputs.Max(); + int xhkMax = xhkInputs.Max(); + int xmasMax = xmasInputs.Max(); + int xatrMax = xatrInputs.Max(); + int xstrMax = xstrInputs.Max(); + int xcheMax = xcheInputs.Max(); + int xdonMax = xdonInputs.Max(); + int xichMax = xichInputs.Max(); + int xvwapMax = xvwapInputs.Max(); + int xdeltaMax = xdeltaInputs.Max(); + int xvolumeMax = xvolumeInputs.Max(); + + // + result = MathMax(xpvMax, xhkMax); + result = MathMax(result, xmasMax); + result = MathMax(result, xatrMax); + result = MathMax(result, xstrMax); + result = MathMax(result, xcheMax); + result = MathMax(result, xdonMax); + result = MathMax(result, xichMax); + result = MathMax(result, xvwapMax); + result = MathMax(result, xdeltaMax); + result = MathMax(result, xvolumeMax); + + // + return result; + } +}; + +// +// Conditions ... +struct X121Conditions +{ + // + // Common ... + string symbol; + ENUM_TIMEFRAMES period; + datetime time; + + // + // Buffers ... + double maBuffer[]; + double rsiBuffer[]; + double atrBuffer[]; + double strBuffer[]; + double le1Buffer[]; + double se1Buffer[]; + double le2Buffer[]; + double se2Buffer[]; + double sarBuffer[]; + double cHHBuffer[]; + double cLLBuffer[]; + double sHHBuffer[]; + double sLLBuffer[]; + double mHHBuffer[]; + double mLLBuffer[]; + double lHHBuffer[]; + double lLLBuffer[]; + double hHHBuffer[]; + double hLLBuffer[]; + double upTBuffer[]; + double adxBuffer[]; + double adxPBuffer[]; + double adxMBuffer[]; + long volumeBuffer[]; + double peaksBuffer[]; + double valesBuffer[]; + double strUpBuffer[]; + double downTBuffer[]; + double deltaBuffer[]; + double masMidBuffer[]; + double deltaMaBuffer[]; + double strDownBuffer[]; + double vwapMidBuffer[]; + double upTrendBuffer[]; + double x3maMidBuffer[]; + double masUpperBuffer[]; + double masLowerBuffer[]; + double kijunSenBuffer[]; + double le1StartBuffer[]; + double se1StartBuffer[]; + double le2StartBuffer[]; + double se2StartBuffer[]; + double strPriceBuffer[]; + double atrUpperBuffer[]; + double atrLowerBuffer[]; + double strStateBuffer[]; + double vwapFastBuffer[]; + double vwapSlowBuffer[]; + double xhkSMLowBuffer[]; + double x3maFastBuffer[]; + double x3maSlowBuffer[]; + double supportsBuffer[]; + double tenkanSenBuffer[]; + double downTrendBuffer[]; + double vwapPriceBuffer[]; + double xhkRawLowBuffer[]; + double xhkSMOpenBuffer[]; + double xhkSMHighBuffer[]; + double deltaStateBuffer[]; + double xhkRawOpenBuffer[]; + double xhkRawHighBuffer[]; + double xhkSMCloseBuffer[]; + double vwapVolumeBuffer[]; + double chikouSpanBuffer[]; + double senkouSpanABuffer[]; + double senkouSpanBBuffer[]; + double peaksGoldenBuffer[]; + double valesGoldenBuffer[]; + double xhkRawCloseBuffer[]; + double atrUpperRawBuffer[]; + double atrLowerRawBuffer[]; + double donLowUpperBuffer[]; + double donLowLowerBuffer[]; + double resistancesBuffer[]; + double vwapMidStateBuffer[]; + double donOpenUpperBuffer[]; + double donOpenLowerBuffer[]; + double donHighUpperBuffer[]; + double donHighLowerBuffer[]; + double x3maMidStateBuffer[]; + double bullishVolumeBuffer[]; + double bearishVolumeBuffer[]; + double fractalsUpperBuffer[]; + double fractalsLowerBuffer[]; + double vwapFastStateBuffer[]; + double vwapSlowStateBuffer[]; + double donCloseUpperBuffer[]; + double donCloseLowerBuffer[]; + double x3maFastStateBuffer[]; + double x3maSlowStateBuffer[]; + double bullishVolumeMaBuffer[]; + double bearishVolumeMaBuffer[]; + + // + double rsiSlope; + double strSlope; + double atrUpperSlope; + double atrLowerSlope; + double vwapFastSlope; + double vwapMidSlope; + double vwapSlowSlope; + + // + // Conditions ... + + // + bool isRsiSlopeBullish; + bool isStrSlopeBullish; + bool isAtrUpperSlopeBullish; + bool isAtrLowerSlopeBullish; + bool isVwapFastSlopeBullish; + bool isVwapMidSlopeBullish; + bool isVwapSlowSlopeBullish; + + // + bool isRsiSlopeBearish; + bool isStrSlopeBearish; + bool isAtrUpperSlopeBearish; + bool isAtrLowerSlopeBearish; + bool isVwapFastSlopeBearish; + bool isVwapMidSlopeBearish; + bool isVwapSlowSlopeBearish; + + // + bool isRsiOverSold; + bool isRsiOverBought; + bool isRsiCrossedOverOverSold; + bool isRsiCrossedUnderOverSold; + bool isRsiCrossedOverOverBought; + bool isRsiCrossedUnderOverBought; + + // + bool isClosedOverAtrUpper; + bool isClosedOverAtrLower; + bool isClosedUnderAtrUpper; + bool isClosedUnderAtrLower; + + // + bool isSarBullish; + bool isSarBearish; + bool isSarSwitchedToBullish; + bool isSarSwitchedToBearish; + + // + bool isNewPeak; + bool isNewPeakOverLast; + bool isNewPeakUnderLast; + + // + bool isNewVale; + bool isNewValeOverLast; + bool isNewValeUnderLast; + + // + bool isStrBullish; + bool isStrBearish; + bool isStrSwitchedToBullish; + bool isStrSwitchedToBearish; + + // + bool isChe1Bullish; + bool isChe1Bearish; + bool isChe1SwitchedToBullish; + bool isChe1SwitchedToBearish; + + // + bool isChe2Bullish; + bool isChe2Bearish; + bool isChe2SwitchedToBullish; + bool isChe2SwitchedToBearish; + + // + bool isCheBullish; + bool isCheBearish; + bool isCheSwitchedToBullish; + bool isCheSwitchedToBearish; + + // + bool isVWapMidBullish; + bool isVWapMidBearish; + bool isVWapFastBullish; + bool isVWapFastBearish; + bool isVWapMidNeutural; + bool isVWapSlowBullish; + bool isVWapSlowBearish; + bool isVWapFastOverMid; + bool isVWapMidOverSlow; + bool isVWapFastNeutural; + bool isVWapSlowNeutural; + bool isVWapFastUnderMid; + bool isVWapMidUnderSlow; + bool isVWapBullishState; + bool isVWapBearishState; + bool isVWapNeuturalState; + bool isVWapBullishOrdered; + bool isVWapBearishOrdered; + bool isVWapSwitchedToBullishState; + bool isVWapSwitchedToBearishState; + bool isVWapSwitchedToNeuturalState; + bool isVWapSwitchedToBullishOrdered; + bool isVWapSwitchedToBearishOrdered; + + // + bool isX3MaMidBullish; + bool isX3MaMidBearish; + bool isX3MaFastBullish; + bool isX3MaFastBearish; + bool isX3MaMidNeutural; + bool isX3MaSlowBullish; + bool isX3MaSlowBearish; + bool isX3MaFastOverMid; + bool isX3MaMidOverSlow; + bool isX3MaFastNeutural; + bool isX3MaSlowNeutural; + bool isX3MaFastUnderMid; + bool isX3MaMidUnderSlow; + bool isX3MaBullishState; + bool isX3MaBearishState; + bool isX3MaNeuturalState; + bool isX3MaBullishOrdered; + bool isX3MaBearishOrdered; + bool isX3MaSwitchedToBullishState; + bool isX3MaSwitchedToBearishState; + bool isX3MaSwitchedToNeuturalState; + bool isX3MaSwitchedToBullishOrdered; + bool isX3MaSwitchedToBearishOrdered; + + // + bool isSMHKBullish; + bool isRawHKBullish; + bool isSMHKBearish; + bool isRawHKBearish; + bool isClosedOverSMHK; + bool isClosedUnderSMHK; + bool isClosedOverRawHK; + bool isClosedUnderRawHK; + bool isRawHKClosedOverSMHK; + bool isRawHKClosedUnderSMHK; + bool isSMHKSwitchedToBullish; + bool isSMHKSwitchedToBearish; + bool isRawHKSwitchedToBearish; + bool isRawHKSwitchedToBullish; + + // + // XICH ... + + // + bool isSenkouSpanAOverB; + bool isSenkouSpanAUnderB; + bool isTenkanSenOverKijunSen; + bool isTenkanSenUnderKijunSen; + bool isSenkouSpanACrossedOverB; + bool isSenkouSpanACrossedUnderB; + bool isTenkanSenCrossedOverKijunSen; + bool isTenkanSenCrossedUnderKijunSen; + + // + // XDELTA ... + + // + bool isDeltaBullish; + bool isDeltaBearish; + bool isDeltaSwitchedToBullish; + bool isDeltaSwitchedToBearish; + + // + bool isDeltaOverMa; + bool isDeltaUnderMa; + bool isDeltaCrossedOverMa; + bool isDeltaCrossedUnderMa; + + // + // XVOLUME ... + + bool isBullishVolumeOverMa; + bool isBullishVolumeCrossedOverMa; + + // + bool isBullishVolumeUnderMa; + bool isBullishVolumeCrossedUnderMa; + + // + bool isBullishVolumeIncreased; + bool isBullishVolumeSwitchedToIncreased; + + // + bool isBullishVolumeDecreased; + bool isBullishVolumeSwitchedToDecreased; + + // + bool isBearishVolumeOverMa; + bool isBearishVolumeCrossedOverMa; + + // + bool isBearishVolumeUnderMa; + bool isBearishVolumeCrossedUnderMa; + + // + bool isBearishVolumeIncreased; + bool isBearishVolumeSwitchedToIncreased; + + // + bool isBearishVolumeDecreased; + bool isBearishVolumeSwitchedToDecreased; + + // + bool isVolumeSwitchedToBullish; + bool isVolumeSwitchedToBearish; + + // + bool isBullishVolumeMaOverBearishVolumeMa; + bool isBullishVolumeMaUnderBearishVolumeMa; + + // + // Complex Conditions ... + + // + double cheMin; + double cheMax; + double x3maMin; + double x3maMax; + double vwapMin; + double vwapMax; + double senkouMax; + double senkouMin; + double tenKijMax; + double tenKijMin; + + // + bool isSarIncreased; + bool isSarDecreased; + bool isX3MaFatsOverMid; + bool isSarEqualsToPeak; + bool isSarEqualsToVale; + bool isStrEqualsToPeak; + bool isStrEqualsToVale; + bool isX3MaFatsUnderMid; + bool isX3MaFatsOverSlow; + bool isAtrUpperOverPeak; + bool isPeakOverAtrUpper; + bool isStrUpperOverPeak; + bool isStrLowerOverVale; + bool isClosedOverCheMin; + bool isClosedOverCheMax; + bool isX3MaFatsUnderSlow; + bool isAtrLowerUnderVale; + bool isClosedOverX3MaMin; + bool isClosedOverX3MaMax; + bool isValeUnderAtrLower; + bool isStrUpperUnderPeak; + bool isStrLowerUnderVale; + bool isClosedUnderCheMin; + bool isClosedUnderCheMax; + bool isClosedOverVWapMin; + bool isClosedOverVWapMax; + bool isClosedUnderX3MaMin; + bool isClosedUnderX3MaMax; + bool isStrCrossedOverVale; + bool isSarCrossedOverVale; + bool isClosedUnderVWapMin; + bool isClosedUnderVWapMax; + bool isX3MaFatsOverMidPrev; + bool isSarCrossedUnderPeak; + bool isStrCrossedUnderPeak; + bool isNewPeakOverAtrUpper; + bool isX3MaFatsUnderMidPrev; + bool isX3MaFatsOverSlowPrev; + bool isAtrUpperEqualsToPeak; + bool isAtrLowerEqualsToVale; + bool isStrUpperOverAtrUpper; + bool isStrLowerOverAtrLower; + bool isNewValeUnderAtrLower; + bool isAtrUpperCrossedUpPeak; + bool isAtrLowerCrossedUpVale; + bool isStrUpperUnderAtrUpper; + bool isStrLowerUnderAtrLower; + bool isX3MaFatsUnderSlowPrev; + bool isX3MaFastCrossedOverMid; + bool isVWapFastCrossedOverMid; + bool isX3MaFastCrossedUnderMid; + bool isX3MaFastCrossedOverSlow; + bool isAtrUpperCrossedDownPeak; + bool isAtrLowerCrossedDownVale; + bool isStrLowerOverDonLowLower; + bool isVWapFastCrossedUnderMid; + bool isStrUpperCrossedOverPeak; + bool isStrLowerCrossedOverVale; + bool isDonLowLowerEqualsToVale; + bool isVWapFastCrossedOverSlow; + bool isX3MaFastCrossedUnderSlow; + bool isStrUpperOverDonHighUpper; + bool isStrLowerUnderDonLowLower; + bool isVWapFastCrossedUnderSlow; + bool isStrUpperCrossedUnderPeak; + bool isStrLowerCrossedUnderVale; + bool isDonHighUpperEqualsToPeak; + bool isStrUpperUnderDonHighUpper; + bool isStrUpperCrossedOverAtrUpper; + bool isStrLowerCrossedOverAtrLower; + bool isStrUpperCrossedUnderAtrUpper; + bool isStrLowerCrossedUnderAtrLower; + bool isStrLowerCrossedOverDonLowLower; + bool isStrUpperCrossedOverDonHighUpper; + bool isStrLowerCrossedUnderDonLowLower; + bool isStrUpperCrossedUnderDonHighUpper; + + // + // Constructor ... + X121Conditions() + { + Clean(); + } + + // + // Tools ... + + /** + * Cleaning Up ... + */ + void Clean() + { + // + // Commons ... + symbol = NULL; + period = NULL; + time = NULL; + + // + // Buffers ... + + // + Clean(maBuffer); + Clean(rsiBuffer); + Clean(atrBuffer); + Clean(strBuffer); + Clean(le1Buffer); + Clean(se1Buffer); + Clean(le2Buffer); + Clean(se2Buffer); + Clean(sarBuffer); + Clean(cHHBuffer); + Clean(cLLBuffer); + Clean(sHHBuffer); + Clean(sLLBuffer); + Clean(mHHBuffer); + Clean(mLLBuffer); + Clean(lHHBuffer); + Clean(lLLBuffer); + Clean(hHHBuffer); + Clean(hLLBuffer); + Clean(upTBuffer); + Clean(adxBuffer); + Clean(adxPBuffer); + Clean(adxMBuffer); + Clean(peaksBuffer); + Clean(valesBuffer); + Clean(strUpBuffer); + Clean(downTBuffer); + Clean(deltaBuffer); + Clean(volumeBuffer); + Clean(masMidBuffer); + Clean(strDownBuffer); + Clean(vwapMidBuffer); + Clean(upTrendBuffer); + Clean(x3maMidBuffer); + Clean(deltaMaBuffer); + Clean(masUpperBuffer); + Clean(masLowerBuffer); + Clean(le1StartBuffer); + Clean(se1StartBuffer); + Clean(le2StartBuffer); + Clean(se2StartBuffer); + Clean(strPriceBuffer); + Clean(atrUpperBuffer); + Clean(atrLowerBuffer); + Clean(strStateBuffer); + Clean(vwapFastBuffer); + Clean(vwapSlowBuffer); + Clean(xhkSMLowBuffer); + Clean(x3maFastBuffer); + Clean(x3maSlowBuffer); + Clean(supportsBuffer); + Clean(kijunSenBuffer); + Clean(tenkanSenBuffer); + Clean(downTrendBuffer); + Clean(vwapPriceBuffer); + Clean(xhkRawLowBuffer); + Clean(xhkSMOpenBuffer); + Clean(xhkSMHighBuffer); + Clean(chikouSpanBuffer); + Clean(xhkRawOpenBuffer); + Clean(xhkRawHighBuffer); + Clean(xhkSMCloseBuffer); + Clean(vwapVolumeBuffer); + Clean(deltaStateBuffer); + Clean(senkouSpanABuffer); + Clean(senkouSpanBBuffer); + Clean(peaksGoldenBuffer); + Clean(valesGoldenBuffer); + Clean(xhkRawCloseBuffer); + Clean(atrUpperRawBuffer); + Clean(atrLowerRawBuffer); + Clean(donLowUpperBuffer); + Clean(donLowLowerBuffer); + Clean(resistancesBuffer); + Clean(vwapMidStateBuffer); + Clean(donOpenUpperBuffer); + Clean(donOpenLowerBuffer); + Clean(donHighUpperBuffer); + Clean(donHighLowerBuffer); + Clean(x3maMidStateBuffer); + Clean(bullishVolumeBuffer); + Clean(bearishVolumeBuffer); + Clean(fractalsUpperBuffer); + Clean(fractalsLowerBuffer); + Clean(vwapFastStateBuffer); + Clean(vwapSlowStateBuffer); + Clean(donCloseUpperBuffer); + Clean(donCloseLowerBuffer); + Clean(x3maFastStateBuffer); + Clean(x3maSlowStateBuffer); + Clean(bullishVolumeMaBuffer); + Clean(bearishVolumeMaBuffer); + + // + ArraySetAsSeries(maBuffer, true); + ArraySetAsSeries(rsiBuffer, true); + ArraySetAsSeries(atrBuffer, true); + ArraySetAsSeries(strBuffer, true); + ArraySetAsSeries(le1Buffer, true); + ArraySetAsSeries(se1Buffer, true); + ArraySetAsSeries(le2Buffer, true); + ArraySetAsSeries(se2Buffer, true); + ArraySetAsSeries(sarBuffer, true); + ArraySetAsSeries(cHHBuffer, true); + ArraySetAsSeries(cLLBuffer, true); + ArraySetAsSeries(sHHBuffer, true); + ArraySetAsSeries(sLLBuffer, true); + ArraySetAsSeries(mHHBuffer, true); + ArraySetAsSeries(mLLBuffer, true); + ArraySetAsSeries(lHHBuffer, true); + ArraySetAsSeries(lLLBuffer, true); + ArraySetAsSeries(hHHBuffer, true); + ArraySetAsSeries(hLLBuffer, true); + ArraySetAsSeries(upTBuffer, true); + ArraySetAsSeries(adxBuffer, true); + ArraySetAsSeries(adxPBuffer, true); + ArraySetAsSeries(adxMBuffer, true); + ArraySetAsSeries(peaksBuffer, true); + ArraySetAsSeries(valesBuffer, true); + ArraySetAsSeries(strUpBuffer, true); + ArraySetAsSeries(downTBuffer, true); + ArraySetAsSeries(deltaBuffer, true); + ArraySetAsSeries(volumeBuffer, true); + ArraySetAsSeries(masMidBuffer, true); + ArraySetAsSeries(deltaMaBuffer, true); + ArraySetAsSeries(strDownBuffer, true); + ArraySetAsSeries(vwapMidBuffer, true); + ArraySetAsSeries(upTrendBuffer, true); + ArraySetAsSeries(x3maMidBuffer, true); + ArraySetAsSeries(masUpperBuffer, true); + ArraySetAsSeries(masLowerBuffer, true); + ArraySetAsSeries(le1StartBuffer, true); + ArraySetAsSeries(se1StartBuffer, true); + ArraySetAsSeries(le2StartBuffer, true); + ArraySetAsSeries(se2StartBuffer, true); + ArraySetAsSeries(strPriceBuffer, true); + ArraySetAsSeries(atrUpperBuffer, true); + ArraySetAsSeries(atrLowerBuffer, true); + ArraySetAsSeries(strStateBuffer, true); + ArraySetAsSeries(vwapFastBuffer, true); + ArraySetAsSeries(vwapSlowBuffer, true); + ArraySetAsSeries(xhkSMLowBuffer, true); + ArraySetAsSeries(x3maFastBuffer, true); + ArraySetAsSeries(x3maSlowBuffer, true); + ArraySetAsSeries(supportsBuffer, true); + ArraySetAsSeries(kijunSenBuffer, true); + ArraySetAsSeries(tenkanSenBuffer, true); + ArraySetAsSeries(downTrendBuffer, true); + ArraySetAsSeries(vwapPriceBuffer, true); + ArraySetAsSeries(xhkRawLowBuffer, true); + ArraySetAsSeries(xhkSMOpenBuffer, true); + ArraySetAsSeries(xhkSMHighBuffer, true); + ArraySetAsSeries(deltaStateBuffer, true); + ArraySetAsSeries(chikouSpanBuffer, true); + ArraySetAsSeries(xhkRawOpenBuffer, true); + ArraySetAsSeries(xhkRawHighBuffer, true); + ArraySetAsSeries(xhkSMCloseBuffer, true); + ArraySetAsSeries(vwapVolumeBuffer, true); + ArraySetAsSeries(senkouSpanABuffer, true); + ArraySetAsSeries(senkouSpanBBuffer, true); + ArraySetAsSeries(peaksGoldenBuffer, true); + ArraySetAsSeries(valesGoldenBuffer, true); + ArraySetAsSeries(xhkRawCloseBuffer, true); + ArraySetAsSeries(atrUpperRawBuffer, true); + ArraySetAsSeries(atrLowerRawBuffer, true); + ArraySetAsSeries(donLowUpperBuffer, true); + ArraySetAsSeries(donLowLowerBuffer, true); + ArraySetAsSeries(resistancesBuffer, true); + ArraySetAsSeries(vwapMidStateBuffer, true); + ArraySetAsSeries(donOpenUpperBuffer, true); + ArraySetAsSeries(donOpenLowerBuffer, true); + ArraySetAsSeries(donHighUpperBuffer, true); + ArraySetAsSeries(donHighLowerBuffer, true); + ArraySetAsSeries(x3maMidStateBuffer, true); + ArraySetAsSeries(bullishVolumeBuffer, true); + ArraySetAsSeries(bearishVolumeBuffer, true); + ArraySetAsSeries(fractalsUpperBuffer, true); + ArraySetAsSeries(fractalsLowerBuffer, true); + ArraySetAsSeries(vwapFastStateBuffer, true); + ArraySetAsSeries(vwapSlowStateBuffer, true); + ArraySetAsSeries(donCloseUpperBuffer, true); + ArraySetAsSeries(donCloseLowerBuffer, true); + ArraySetAsSeries(x3maFastStateBuffer, true); + ArraySetAsSeries(x3maSlowStateBuffer, true); + ArraySetAsSeries(bullishVolumeMaBuffer, true); + ArraySetAsSeries(bearishVolumeMaBuffer, true); + + // + cheMin = 0; + cheMax = 0; + vwapMin = 0; + vwapMax = 0; + x3maMin = 0; + x3maMax = 0; + senkouMax = 0; + senkouMin = 0; + tenKijMax = 0; + tenKijMin = 0; + // + // Slopes ... + + rsiSlope = 0; + strSlope = 0; + atrUpperSlope = 0; + atrLowerSlope = 0; + vwapFastSlope = 0; + vwapMidSlope = 0; + vwapSlowSlope = 0; + + // + // Conditions ... + + // + isRsiSlopeBullish = false; + isStrSlopeBullish = false; + isAtrUpperSlopeBullish = false; + isAtrLowerSlopeBullish = false; + isVwapFastSlopeBullish = false; + isVwapMidSlopeBullish = false; + isVwapSlowSlopeBullish = false; + + // + isRsiSlopeBearish = false; + isStrSlopeBearish = false; + isAtrUpperSlopeBearish = false; + isAtrLowerSlopeBearish = false; + isVwapFastSlopeBearish = false; + isVwapMidSlopeBearish = false; + isVwapSlowSlopeBearish = false; + + // + // RSI ... + + // + isRsiOverBought = false; + isRsiCrossedOverOverBought = false; + isRsiCrossedUnderOverBought = false; + + // + isRsiOverSold = false; + isRsiCrossedUnderOverSold = false; + isRsiCrossedOverOverSold = false; + + // + // ATR ... + + // + isClosedOverAtrUpper = false; + isClosedOverAtrLower = false; + isClosedUnderAtrUpper = false; + isClosedUnderAtrLower = false; + + // + // DON ... + + // + // SAR ... + + // + isSarBullish = false; + isSarBearish = false; + isSarSwitchedToBullish = false; + isSarSwitchedToBearish = false; + + // + // PV ... + + // + isNewPeak = false; + isNewPeakOverLast = false; + isNewPeakUnderLast = false; + + // + isNewVale = false; + isNewValeOverLast = false; + isNewValeUnderLast = false; + + // + // STR ... + + // + isStrBullish = false; + isStrBearish = false; + isStrSwitchedToBullish = false; + isStrSwitchedToBearish = false; + + // + // VWAP ... + isVWapMidBullish = false; + isVWapMidBearish = false; + isVWapMidNeutural = false; + isVWapSlowBullish = false; + isVWapSlowBearish = false; + isVWapFastBullish = false; + isVWapFastBearish = false; + isVWapFastOverMid = false; + isVWapMidOverSlow = false; + isVWapFastNeutural = false; + isVWapSlowNeutural = false; + isVWapFastUnderMid = false; + isVWapMidUnderSlow = false; + isVWapBullishState = false; + isVWapBearishState = false; + isVWapNeuturalState = false; + isVWapBullishOrdered = false; + isVWapBearishOrdered = false; + isVWapSwitchedToBullishState = false; + isVWapSwitchedToBearishState = false; + isVWapSwitchedToNeuturalState = false; + isVWapSwitchedToBullishOrdered = false; + isVWapSwitchedToBearishOrdered = false; + + // + // X3MA ... + isX3MaMidBullish = false; + isX3MaMidBearish = false; + isX3MaFastBullish = false; + isX3MaFastBearish = false; + isX3MaMidNeutural = false; + isX3MaSlowBullish = false; + isX3MaSlowBearish = false; + isX3MaFastOverMid = false; + isX3MaMidOverSlow = false; + isX3MaFastNeutural = false; + isX3MaSlowNeutural = false; + isX3MaFastUnderMid = false; + isX3MaMidUnderSlow = false; + isX3MaBullishState = false; + isX3MaBearishState = false; + isX3MaNeuturalState = false; + isX3MaBullishOrdered = false; + isX3MaBearishOrdered = false; + isX3MaSwitchedToBullishState = false; + isX3MaSwitchedToBearishState = false; + isX3MaSwitchedToNeuturalState = false; + isX3MaSwitchedToBullishOrdered = false; + isX3MaSwitchedToBearishOrdered = false; + + // + // CHE ... + + // + isCheBullish = false; + isCheBearish = false; + isChe1Bullish = false; + isChe1Bearish = false; + isChe2Bullish = false; + isChe2Bearish = false; + isClosedOverCheMin = false; + isClosedOverCheMax = false; + isClosedUnderCheMin = false; + isClosedUnderCheMax = false; + isCheSwitchedToBullish = false; + isCheSwitchedToBearish = false; + isChe1SwitchedToBullish = false; + isChe1SwitchedToBearish = false; + isChe2SwitchedToBullish = false; + isChe2SwitchedToBearish = false; + + // + // XHK ... + isSMHKBullish = false; + isRawHKBullish = false; + isSMHKBearish = false; + isRawHKBearish = false; + isClosedOverSMHK = false; + isClosedUnderSMHK = false; + isClosedOverRawHK = false; + isClosedUnderRawHK = false; + isRawHKClosedOverSMHK = false; + isSMHKSwitchedToBearish = false; + isRawHKSwitchedToBearish = false; + isRawHKClosedUnderSMHK = false; + isSMHKSwitchedToBullish = false; + isRawHKSwitchedToBullish = false; + + // + // XICH ... + isSenkouSpanAOverB = false; + isSenkouSpanAUnderB = false; + isTenkanSenOverKijunSen = false; + isTenkanSenUnderKijunSen = false; + isSenkouSpanACrossedOverB = false; + isSenkouSpanACrossedUnderB = false; + isTenkanSenCrossedOverKijunSen = false; + isTenkanSenCrossedUnderKijunSen = false; + + // + // XDELTA ... + + // + isDeltaBullish = false; + isDeltaBearish = false; + isDeltaSwitchedToBullish = false; + isDeltaSwitchedToBearish = false; + + // + isDeltaOverMa = false; + isDeltaUnderMa = false; + isDeltaCrossedOverMa = false; + isDeltaCrossedUnderMa = false; + + // + // XVOLUME ... + + // + isBullishVolumeOverMa = false; + isBullishVolumeCrossedOverMa = false; + + // + isBullishVolumeUnderMa = false; + isBullishVolumeCrossedUnderMa = false; + + // + isBullishVolumeIncreased = false; + isBullishVolumeSwitchedToIncreased = false; + + // + isBullishVolumeDecreased = false; + isBullishVolumeSwitchedToDecreased = false; + + // + isBearishVolumeOverMa = false; + isBearishVolumeCrossedOverMa = false; + + // + isBearishVolumeUnderMa = false; + isBearishVolumeCrossedUnderMa = false; + + // + isBearishVolumeIncreased = false; + isBearishVolumeSwitchedToIncreased = false; + + // + isBearishVolumeDecreased = false; + isBearishVolumeSwitchedToDecreased = false; + + // + isVolumeSwitchedToBullish = false; + isVolumeSwitchedToBearish = false; + + // + isBullishVolumeMaOverBearishVolumeMa = false; + isBullishVolumeMaUnderBearishVolumeMa = false; + + // + // Complex Conditions ... + + // + isSarIncreased = false; + isSarDecreased = false; + isX3MaFatsOverMid = false; + isSarEqualsToPeak = false; + isSarEqualsToVale = false; + isStrEqualsToPeak = false; + isStrEqualsToVale = false; + isX3MaFatsUnderMid = false; + isX3MaFatsOverSlow = false; + isAtrUpperOverPeak = false; + isPeakOverAtrUpper = false; + isStrUpperOverPeak = false; + isStrLowerOverVale = false; + isClosedOverCheMin = false; + isClosedOverCheMax = false; + isX3MaFatsUnderSlow = false; + isAtrLowerUnderVale = false; + isClosedOverX3MaMin = false; + isClosedOverX3MaMax = false; + isValeUnderAtrLower = false; + isStrUpperUnderPeak = false; + isStrLowerUnderVale = false; + isClosedUnderCheMin = false; + isClosedUnderCheMax = false; + isClosedOverVWapMin = false; + isClosedOverVWapMax = false; + isClosedUnderX3MaMin = false; + isClosedUnderX3MaMax = false; + isStrCrossedOverVale = false; + isSarCrossedOverVale = false; + isClosedUnderVWapMin = false; + isClosedUnderVWapMax = false; + isX3MaFatsOverMidPrev = false; + isSarCrossedUnderPeak = false; + isStrCrossedUnderPeak = false; + isNewPeakOverAtrUpper = false; + isX3MaFatsUnderMidPrev = false; + isX3MaFatsOverSlowPrev = false; + isAtrUpperEqualsToPeak = false; + isAtrLowerEqualsToVale = false; + isStrUpperOverAtrUpper = false; + isStrLowerOverAtrLower = false; + isNewValeUnderAtrLower = false; + isAtrUpperCrossedUpPeak = false; + isAtrLowerCrossedUpVale = false; + isStrUpperUnderAtrUpper = false; + isStrLowerUnderAtrLower = false; + isX3MaFatsUnderSlowPrev = false; + isX3MaFastCrossedOverMid = false; + isVWapFastCrossedOverMid = false; + isX3MaFastCrossedUnderMid = false; + isX3MaFastCrossedOverSlow = false; + isAtrUpperCrossedDownPeak = false; + isAtrLowerCrossedDownVale = false; + isStrLowerOverDonLowLower = false; + isVWapFastCrossedUnderMid = false; + isStrUpperCrossedOverPeak = false; + isStrLowerCrossedOverVale = false; + isDonLowLowerEqualsToVale = false; + isVWapFastCrossedOverSlow = false; + isX3MaFastCrossedUnderSlow = false; + isStrUpperOverDonHighUpper = false; + isStrLowerUnderDonLowLower = false; + isVWapFastCrossedUnderSlow = false; + isStrUpperCrossedUnderPeak = false; + isStrLowerCrossedUnderVale = false; + isDonHighUpperEqualsToPeak = false; + isStrUpperUnderDonHighUpper = false; + isStrUpperCrossedOverAtrUpper = false; + isStrLowerCrossedOverAtrLower = false; + isStrUpperCrossedUnderAtrUpper = false; + isStrLowerCrossedUnderAtrLower = false; + isStrLowerCrossedOverDonLowLower = false; + isStrUpperCrossedOverDonHighUpper = false; + isStrLowerCrossedUnderDonLowLower = false; + isStrUpperCrossedUnderDonHighUpper = false; + + // + ZeroMemory(this); + } + + /** + * Generate Conditions Scores ... + * + * @param bullishScore: Double, Directional Scores Reference ... + * @param bearishScore: Double, Directional Scores Reference ... + */ + void GenerateScore( + double &bullishScore, + double &bearishScore // + ) + { + // + bullishScore = 0; + bearishScore = 0; + + // + double score = 1; + double minScore = 0.5; + double highScore = 1.5; + + // + // SLOPES ... + + // + if (isRsiSlopeBullish) + { + bullishScore += minScore; + } + if (isStrSlopeBullish) + { + bullishScore += minScore; + } + if (isAtrUpperSlopeBullish) + { + bullishScore += minScore; + } + if (isAtrLowerSlopeBullish) + { + bullishScore += minScore; + } + if (isVwapFastSlopeBullish) + { + bullishScore += minScore; + } + if (isVwapMidSlopeBullish) + { + bullishScore += minScore; + } + if (isVwapSlowSlopeBullish) + { + bullishScore += minScore; + } + + // + if (isRsiSlopeBearish) + { + bearishScore += minScore; + } + if (isStrSlopeBearish) + { + bearishScore += minScore; + } + if (isAtrUpperSlopeBearish) + { + bearishScore += minScore; + } + if (isAtrLowerSlopeBearish) + { + bearishScore += minScore; + } + if (isVwapFastSlopeBearish) + { + bearishScore += minScore; + } + if (isVwapMidSlopeBearish) + { + bearishScore += minScore; + } + if (isVwapSlowSlopeBearish) + { + bearishScore += minScore; + } + + // + // COMPLEX ... + + // + if (isRsiOverSold) + { + bullishScore += score; + } + if (isRsiCrossedUnderOverSold) + { + bullishScore += highScore; + } + + // + if (isRsiOverBought) + { + bearishScore += score; + } + if (isRsiCrossedOverOverBought) + { + bearishScore += highScore; + } + + // + // XSAR ... + + // + if (isSarBullish) + { + bullishScore += minScore; + } + if (isSarSwitchedToBullish) + { + bullishScore += score; + } + + // + if (isSarBearish) + { + bearishScore += minScore; + } + if (isSarSwitchedToBearish) + { + bearishScore += score; + } + + // + // XSTR ... + + // + if (isStrBullish) + { + bullishScore += minScore; + } + if (isStrSwitchedToBullish) + { + bullishScore += score; + } + + // + if (isStrBearish) + { + bearishScore += minScore; + } + if (isStrSwitchedToBearish) + { + bearishScore += score; + } + + // + // XCHE ... + + // + if (isCheBullish) + { + bullishScore += score; + } + if (isCheSwitchedToBullish) + { + bullishScore += highScore; + } + if (isChe1Bullish && + !isCheBullish && + !isCheSwitchedToBullish) + { + bullishScore += minScore; + } + if (isChe1SwitchedToBullish && + !isCheBullish && + !isCheSwitchedToBullish) + { + bullishScore += minScore; + } + + // + if (isCheBearish) + { + bearishScore += score; + } + if (isCheSwitchedToBearish) + { + bearishScore += highScore; + } + if (isChe1Bearish && + !isCheBearish && + !isCheSwitchedToBearish) + { + bearishScore += minScore; + } + if (isChe1SwitchedToBearish && + !isCheBearish && + !isCheSwitchedToBearish) + { + bearishScore += minScore; + } + + // + // XVWAP ... + + // + if (isVWapBullishState) + { + bullishScore += score; + } + if (isVWapBullishOrdered) + { + bullishScore += score; + } + if (isVWapSwitchedToBullishState) + { + bullishScore += highScore; + } + if (isVWapSwitchedToBullishOrdered) + { + bullishScore += highScore; + } + if (!isVWapBullishState && + !isVWapSwitchedToBullishState) + { + // + if (isVWapFastBullish) + { + bullishScore += minScore; + } + if (isVWapSlowBullish) + { + bullishScore += minScore; + } + } + if (!isVWapBullishOrdered && + !isVWapSwitchedToBullishOrdered) + { + // + if (isVWapFastOverMid) + { + bullishScore += minScore; + } + if (isVWapMidOverSlow) + { + bullishScore += minScore; + } + } + + // + if (isVWapBearishState) + { + bearishScore += score; + } + if (isVWapBearishOrdered) + { + bearishScore += score; + } + if (isVWapSwitchedToBearishState) + { + bearishScore += highScore; + } + if (isVWapSwitchedToBearishOrdered) + { + bearishScore += highScore; + } + if (!isVWapBearishState && + !isVWapSwitchedToBearishState) + { + // + if (isVWapFastBearish) + { + bearishScore += minScore; + } + if (isVWapSlowBearish) + { + bearishScore += minScore; + } + } + if (!isVWapBearishOrdered && + !isVWapSwitchedToBearishOrdered) + { + // + if (isVWapFastUnderMid) + { + bearishScore += minScore; + } + if (isVWapMidUnderSlow) + { + bearishScore += minScore; + } + } + + // + // X3MA ... + + // + if (isX3MaBullishState) + { + bullishScore += score; + } + if (isX3MaBullishOrdered) + { + bullishScore += score; + } + if (isX3MaSwitchedToBullishState) + { + bullishScore += highScore; + } + if (isX3MaSwitchedToBullishOrdered) + { + bullishScore += highScore; + } + if (!isX3MaBullishState && + !isX3MaSwitchedToBullishState) + { + // + if (isX3MaFastBullish) + { + bullishScore += minScore; + } + if (isX3MaSlowBullish) + { + bullishScore += minScore; + } + } + if (!isX3MaBullishOrdered && + !isX3MaSwitchedToBullishOrdered) + { + // + if (isX3MaFastOverMid) + { + bullishScore += minScore; + } + if (isX3MaMidOverSlow) + { + bullishScore += minScore; + } + } + + // + if (isX3MaBearishState) + { + bearishScore += score; + } + if (isX3MaBearishOrdered) + { + bearishScore += score; + } + if (isX3MaSwitchedToBearishState) + { + bearishScore += highScore; + } + if (isX3MaSwitchedToBearishOrdered) + { + bearishScore += highScore; + } + if (!isX3MaBearishState && + !isX3MaSwitchedToBearishState) + { + // + if (isX3MaFastBearish) + { + bearishScore += minScore; + } + if (isX3MaSlowBearish) + { + bearishScore += minScore; + } + } + if (!isX3MaBearishOrdered && + !isX3MaSwitchedToBearishOrdered) + { + // + if (isX3MaFastUnderMid) + { + bearishScore += minScore; + } + if (isX3MaMidUnderSlow) + { + bearishScore += minScore; + } + } + + // + // XSMHK ... + + // + if (isSMHKBullish) + { + bullishScore += minScore; + } + if (isRawHKBullish) + { + bullishScore += minScore; + } + if (isClosedOverSMHK) + { + bullishScore += minScore; + } + if (isClosedOverRawHK) + { + bullishScore += minScore; + } + if (isRawHKClosedOverSMHK) + { + bullishScore += minScore; + } + if (isSMHKSwitchedToBullish) + { + bullishScore += highScore; + } + if (isRawHKSwitchedToBullish) + { + bullishScore += highScore; + } + + // + if (isSMHKBearish) + { + bearishScore += minScore; + } + if (isRawHKBearish) + { + bearishScore += minScore; + } + if (isClosedUnderSMHK) + { + bearishScore += minScore; + } + if (isClosedUnderRawHK) + { + bearishScore += minScore; + } + if (isRawHKClosedUnderSMHK) + { + bearishScore += minScore; + } + if (isSMHKSwitchedToBearish) + { + bearishScore += highScore; + } + if (isRawHKSwitchedToBullish) + { + bearishScore += highScore; + } + + // + // XICH ... + if (isSenkouSpanAOverB) + { + bullishScore += minScore; + } + if (isTenkanSenOverKijunSen) + { + bullishScore += minScore; + } + if (isSenkouSpanACrossedOverB) + { + bullishScore += highScore; + } + if (isTenkanSenCrossedOverKijunSen) + { + bullishScore += highScore; + } + if (isSenkouSpanAUnderB) + { + bearishScore += minScore; + } + if (isTenkanSenUnderKijunSen) + { + bearishScore += minScore; + } + if (isSenkouSpanACrossedUnderB) + { + bearishScore += highScore; + } + if (isTenkanSenCrossedUnderKijunSen) + { + bearishScore += highScore; + } + + // + // Complex Conditions ... + + // + if (isSarIncreased) + { + bullishScore += minScore; + } + if (isSarEqualsToVale) + { + bullishScore += minScore; + } + if (isSarCrossedOverVale) + { + bullishScore += score; + } + + // + if (isAtrLowerUnderVale) + { + bullishScore += minScore; + } + if (isValeUnderAtrLower) + { + bullishScore += minScore; + } + if (isNewValeUnderAtrLower) + { + bullishScore += minScore; + } + if (isAtrLowerEqualsToVale) + { + bullishScore += minScore; + } + if (isStrLowerOverAtrLower) + { + bullishScore += minScore; + } + if (isStrUpperOverAtrUpper) + { + bullishScore += minScore; + } + if (isAtrLowerCrossedUpVale) + { + bullishScore += score; + } + if (isAtrUpperCrossedUpPeak) + { + bullishScore += score; + } + if (isStrLowerCrossedOverAtrLower) + { + bullishScore += score; + } + if (isStrUpperCrossedOverAtrUpper) + { + bullishScore += score; + } + + // + if (isStrEqualsToVale) + { + bullishScore += minScore; + } + if (isStrLowerOverVale) + { + bullishScore += minScore; + } + if (isStrLowerUnderVale) + { + bullishScore += minScore; + } + if (isStrCrossedOverVale) + { + bullishScore += score; + } + if (isStrUpperCrossedOverPeak) + { + bullishScore += score; + } + if (isStrLowerCrossedOverVale) + { + bullishScore += score; + } + if (isStrLowerUnderDonLowLower) + { + bullishScore += minScore; + } + if (isStrLowerCrossedOverDonLowLower) + { + bullishScore += score; + } + if (isStrUpperCrossedOverDonHighUpper) + { + bullishScore += score; + } + + // + if (isClosedOverVWapMin) + { + bullishScore += minScore; + } + if (isClosedOverVWapMax) + { + bullishScore += minScore; + } + if (isVWapFastCrossedOverMid) + { + bullishScore += score; + } + if (isVWapFastCrossedOverSlow) + { + bullishScore += score; + } + + // + if (isClosedOverX3MaMin) + { + bullishScore += minScore; + } + if (isClosedOverX3MaMax) + { + bullishScore += minScore; + } + if (isX3MaFastCrossedOverMid) + { + bullishScore += score; + } + if (isX3MaFastCrossedOverSlow) + { + bullishScore += score; + } + + // + if (isClosedOverCheMin) + { + bullishScore += minScore; + } + if (isClosedOverCheMax) + { + bullishScore += minScore; + } + if (isDonLowLowerEqualsToVale) + { + bullishScore += minScore; + } + + // + // XDELTA ... + + // + if (isDeltaOverMa) + { + bullishScore += minScore; + } + if (isDeltaBullish) + { + bullishScore += minScore; + } + if (isDeltaCrossedOverMa) + { + bullishScore += score; + } + if (isDeltaSwitchedToBullish) + { + bullishScore += score; + } + + if (isDeltaBearish) + { + bearishScore += minScore; + } + if (isDeltaUnderMa) + { + bearishScore += minScore; + } + if (isDeltaCrossedUnderMa) + { + bearishScore += score; + } + if (isDeltaSwitchedToBearish) + { + bearishScore += score; + } + + // + // XVOLUME ... + + // + if (isBullishVolumeOverMa) + { + bullishScore += minScore; + } + if (isBearishVolumeUnderMa) + { + bullishScore += minScore; + } + if (isBullishVolumeIncreased) + { + bullishScore += minScore; + } + if (isBearishVolumeDecreased) + { + bullishScore += minScore; + } + if (isBullishVolumeMaOverBearishVolumeMa) + { + bullishScore += minScore; + } + + // + if (isVolumeSwitchedToBullish) + { + bullishScore += score; + } + if (isBullishVolumeCrossedOverMa) + { + bullishScore += score; + } + if (isBearishVolumeCrossedUnderMa) + { + bullishScore += score; + } + if (isBullishVolumeSwitchedToIncreased) + { + bullishScore += score; + } + if (isBearishVolumeSwitchedToDecreased) + { + bullishScore += score; + } + + // + if (isBearishVolumeOverMa) + { + bearishScore += minScore; + } + if (isBullishVolumeUnderMa) + { + bearishScore += minScore; + } + if (isBullishVolumeDecreased) + { + bearishScore += minScore; + } + if (isBearishVolumeIncreased) + { + bearishScore += minScore; + } + if (isBullishVolumeMaUnderBearishVolumeMa) + { + bearishScore += minScore; + } + + // + if (isVolumeSwitchedToBearish) + { + bearishScore += score; + } + if (isBearishVolumeCrossedOverMa) + { + bearishScore += score; + } + if (isBullishVolumeCrossedUnderMa) + { + bearishScore += score; + } + if (isBullishVolumeSwitchedToDecreased) + { + bearishScore += score; + } + if (isBearishVolumeSwitchedToIncreased) + { + bearishScore += score; + } + + // + // + // + + // + if (isSarDecreased) + { + bearishScore += minScore; + } + if (isSarEqualsToPeak) + { + bearishScore += minScore; + } + if (isSarCrossedUnderPeak) + { + bearishScore += score; + } + + // + if (isAtrUpperOverPeak) + { + bearishScore += minScore; + } + if (isPeakOverAtrUpper) + { + bearishScore += minScore; + } + if (isNewPeakOverAtrUpper) + { + bearishScore += minScore; + } + if (isAtrUpperEqualsToPeak) + { + bearishScore += minScore; + } + if (isStrLowerUnderAtrLower) + { + bearishScore += minScore; + } + if (isStrUpperUnderAtrUpper) + { + bearishScore += minScore; + } + if (isAtrLowerCrossedDownVale) + { + bearishScore += score; + } + if (isAtrUpperCrossedDownPeak) + { + bearishScore += score; + } + if (isStrLowerCrossedUnderAtrLower) + { + bearishScore += score; + } + if (isStrUpperCrossedUnderAtrUpper) + { + bearishScore += score; + } + + // + if (isStrEqualsToPeak) + { + bearishScore += minScore; + } + if (isStrUpperOverPeak) + { + bearishScore += minScore; + } + if (isStrUpperUnderPeak) + { + bearishScore += minScore; + } + if (isStrCrossedUnderPeak) + { + bearishScore += score; + } + if (isStrLowerOverDonLowLower) + { + bearishScore += minScore; + } + if (isStrUpperOverDonHighUpper) + { + bearishScore += minScore; + } + if (isStrUpperCrossedUnderPeak) + { + bearishScore += score; + } + if (isStrLowerCrossedUnderVale) + { + bearishScore += score; + } + if (isStrUpperUnderDonHighUpper) + { + bearishScore += minScore; + } + if (isStrLowerCrossedUnderDonLowLower) + { + bearishScore += score; + } + if (isStrUpperCrossedUnderDonHighUpper) + { + bearishScore += score; + } + + // + if (isClosedUnderVWapMin) + { + bearishScore += minScore; + } + if (isClosedUnderVWapMax) + { + bearishScore += minScore; + } + if (isVWapFastCrossedUnderMid) + { + bearishScore += score; + } + if (isVWapFastCrossedUnderSlow) + { + bearishScore += score; + } + + // + if (isClosedUnderX3MaMin) + { + bearishScore += minScore; + } + if (isClosedUnderX3MaMax) + { + bearishScore += minScore; + } + if (isX3MaFastCrossedUnderMid) + { + bearishScore += score; + } + if (isX3MaFastCrossedUnderSlow) + { + bearishScore += score; + } + + // + if (isClosedUnderCheMin) + { + bearishScore += minScore; + } + if (isClosedUnderCheMax) + { + bearishScore += minScore; + } + if (isDonHighUpperEqualsToPeak) + { + bearishScore += minScore; + } + + // + // + // + } + + /** + * Generate Summary String for Represent Conditions State ... + * + * @param onlyCommons: Boolean, Just Generate Only Commons Conditions ... + * @param onlyConditions: Boolean, Just Generate Only Conditions ... + * @param includeScores: Boolean, Attach Scores Representations on Result ... + * @param ignoreFalseConditions: Boolean, Ignore False Conditions on Result ... + * @param separator: String, Separate Lines ... + * + * @return ( string ) + */ + string GenerateSummary( + bool onlyCommons = false, + bool onlyConditions = false, + bool includeScores = true, + bool ignoreFalseConditions = true, + string separator = "\n" // + ) + { + // + string result = NULL; + + // + double bullishScore = 0; + double bearishScore = 0; + GenerateScore( + bullishScore, + bearishScore // + ); + + // + string scoresStr = + // + "Scores: " + separator + + "---------------" + separator + + "Bullish: " + ToString(bullishScore) + separator + + "Bearish: " + ToString(bearishScore) + separator + + "" + // + ; + + // + string commonStr = GenerateSpecifiedCommonSummary( + this, + separator, + includeScores // + ); + + // + string conditionsStr = + // + "-----------------------" + separator + + "SAR ..." + separator + + "-----------------------" + separator + + ToString("isSarBullish", isSarBullish, ignoreFalseConditions, separator) + + ToString("isSarBearish", isSarBearish, ignoreFalseConditions, separator) + + ToString("isSarSwitchedToBullish", isSarSwitchedToBullish, ignoreFalseConditions, separator) + + ToString("isSarSwitchedToBearish", isSarSwitchedToBearish, ignoreFalseConditions, separator) + + // + "-----------------------" + separator + + "STR ..." + separator + + "-----------------------" + separator + + ToString("isStrBullish", isStrBullish, ignoreFalseConditions, separator) + + ToString("isStrBearish", isStrBearish, ignoreFalseConditions, separator) + + ToString("isStrSwitchedToBullish", isStrSwitchedToBullish, ignoreFalseConditions, separator) + + ToString("isStrSwitchedToBearish", isStrSwitchedToBearish, ignoreFalseConditions, separator) + + // + "-----------------------" + separator + + "PV ..." + separator + + "-----------------------" + separator + + ToString("isNewPeak", isNewPeak, ignoreFalseConditions, separator) + + ToString("isNewPeakOverLast", isNewPeakOverLast, ignoreFalseConditions, separator) + + ToString("isNewPeakUnderLast", isNewPeakUnderLast, ignoreFalseConditions, separator) + + ToString("isNewVale", isNewVale, ignoreFalseConditions, separator) + + ToString("isNewValeOverLast", isNewValeOverLast, ignoreFalseConditions, separator) + + ToString("isNewValeUnderLast", isNewValeUnderLast, ignoreFalseConditions, separator) + + // + "-----------------------" + separator + + "> RSI ..." + separator + + "-----------------------" + separator + + ToString("isRsiOverBought", isRsiOverBought, ignoreFalseConditions, separator) + + ToString("isRsiCrossedOverOverBought", isRsiCrossedOverOverBought, ignoreFalseConditions, separator) + + ToString("isRsiCrossedUnderOverBought", isRsiCrossedUnderOverBought, ignoreFalseConditions, separator) + + ToString("isRsiOverSold", isRsiOverSold, ignoreFalseConditions, separator) + + ToString("isRsiCrossedUnderOverSold", isRsiCrossedUnderOverSold, ignoreFalseConditions, separator) + + ToString("isRsiCrossedOverOverSold", isRsiCrossedOverOverSold, ignoreFalseConditions, separator) + + // + "-----------------------" + separator + + "ATR ..." + separator + + "-----------------------" + separator + + ToString("isClosedOverAtrUpper", isClosedOverAtrUpper, ignoreFalseConditions, separator) + + ToString("isClosedOverAtrLower", isClosedOverAtrLower, ignoreFalseConditions, separator) + + ToString("isClosedUnderAtrUpper", isClosedUnderAtrUpper, ignoreFalseConditions, separator) + + ToString("isClosedUnderAtrLower", isClosedUnderAtrLower, ignoreFalseConditions, separator) + + // + "-----------------------" + separator + + "DON ..." + separator + + "-----------------------" + separator + + // + "-----------------------" + separator + + "VWAP ..." + separator + + "-----------------------" + separator + + ToString("isVWapFastBullish", isVWapFastBullish, ignoreFalseConditions, separator) + + ToString("isVWapFastBearish", isVWapFastBearish, ignoreFalseConditions, separator) + + ToString("isVWapFastNeutural", isVWapFastNeutural, ignoreFalseConditions, separator) + + ToString("isVWapMidBullish", isVWapMidBullish, ignoreFalseConditions, separator) + + ToString("isVWapMidBearish", isVWapMidBearish, ignoreFalseConditions, separator) + + ToString("isVWapMidNeutural", isVWapMidNeutural, ignoreFalseConditions, separator) + + ToString("isVWapSlowBullish", isVWapSlowBullish, ignoreFalseConditions, separator) + + ToString("isVWapSlowBearish", isVWapSlowBearish, ignoreFalseConditions, separator) + + ToString("isVWapSlowNeutural", isVWapSlowNeutural, ignoreFalseConditions, separator) + + ToString("isVWapFastOverMid", isVWapFastOverMid, ignoreFalseConditions, separator) + + ToString("isVWapMidOverSlow", isVWapMidOverSlow, ignoreFalseConditions, separator) + + ToString("isVWapFastUnderMid", isVWapFastUnderMid, ignoreFalseConditions, separator) + + ToString("isVWapMidUnderSlow", isVWapMidUnderSlow, ignoreFalseConditions, separator) + + ToString("isVWapBullishState", isVWapBullishState, ignoreFalseConditions, separator) + + ToString("isVWapBearishState", isVWapBearishState, ignoreFalseConditions, separator) + + ToString("isVWapNeuturalState", isVWapNeuturalState, ignoreFalseConditions, separator) + + ToString("isVWapBullishOrdered", isVWapBullishOrdered, ignoreFalseConditions, separator) + + ToString("isVWapBearishOrdered", isVWapBearishOrdered, ignoreFalseConditions, separator) + + ToString("isVWapSwitchedToBullishOrdered", isVWapSwitchedToBullishOrdered, ignoreFalseConditions, separator) + + ToString("isVWapSwitchedToBearishOrdered", isVWapSwitchedToBearishOrdered, ignoreFalseConditions, separator) + + ToString("isVWapSwitchedToBullishState", isVWapSwitchedToBullishState, ignoreFalseConditions, separator) + + ToString("isVWapSwitchedToBearishState", isVWapSwitchedToBearishState, ignoreFalseConditions, separator) + + ToString("isVWapSwitchedToNeuturalState", isVWapSwitchedToNeuturalState, ignoreFalseConditions, separator) + + // + "-----------------------" + separator + + "X3MA ..." + separator + + "-----------------------" + separator + + ToString("isX3MaMidBullish", isX3MaMidBullish, ignoreFalseConditions, separator) + + ToString("isX3MaMidBearish", isX3MaMidBearish, ignoreFalseConditions, separator) + + ToString("isX3MaFastBullish", isX3MaFastBullish, ignoreFalseConditions, separator) + + ToString("isX3MaFastBearish", isX3MaFastBearish, ignoreFalseConditions, separator) + + ToString("isX3MaMidNeutural", isX3MaMidNeutural, ignoreFalseConditions, separator) + + ToString("isX3MaSlowBullish", isX3MaSlowBullish, ignoreFalseConditions, separator) + + ToString("isX3MaSlowBearish", isX3MaSlowBearish, ignoreFalseConditions, separator) + + ToString("isX3MaFastOverMid", isX3MaFastOverMid, ignoreFalseConditions, separator) + + ToString("isX3MaMidOverSlow", isX3MaMidOverSlow, ignoreFalseConditions, separator) + + ToString("isX3MaFastNeutural", isX3MaFastNeutural, ignoreFalseConditions, separator) + + ToString("isX3MaSlowNeutural", isX3MaSlowNeutural, ignoreFalseConditions, separator) + + ToString("isX3MaFastUnderMid", isX3MaFastUnderMid, ignoreFalseConditions, separator) + + ToString("isX3MaMidUnderSlow", isX3MaMidUnderSlow, ignoreFalseConditions, separator) + + ToString("isX3MaBullishState", isX3MaBullishState, ignoreFalseConditions, separator) + + ToString("isX3MaBearishState", isX3MaBearishState, ignoreFalseConditions, separator) + + ToString("isX3MaNeuturalState", isX3MaNeuturalState, ignoreFalseConditions, separator) + + ToString("isX3MaBullishOrdered", isX3MaBullishOrdered, ignoreFalseConditions, separator) + + ToString("isX3MaBearishOrdered", isX3MaBearishOrdered, ignoreFalseConditions, separator) + + ToString("isX3MaSwitchedToBullishState", isX3MaSwitchedToBullishState, ignoreFalseConditions, separator) + + ToString("isX3MaSwitchedToBearishState", isX3MaSwitchedToBearishState, ignoreFalseConditions, separator) + + ToString("isX3MaSwitchedToNeuturalState", isX3MaSwitchedToNeuturalState, ignoreFalseConditions, separator) + + ToString("isX3MaSwitchedToBullishOrdered", isX3MaSwitchedToBullishOrdered, ignoreFalseConditions, separator) + + ToString("isX3MaSwitchedToBearishOrdered", isX3MaSwitchedToBearishOrdered, ignoreFalseConditions, separator) + + // + "-----------------------" + separator + + "CHE ..." + separator + + "-----------------------" + separator + + ToString("isChe1Bullish", isChe1Bullish, ignoreFalseConditions, separator) + + ToString("isChe1Bearish", isChe1Bearish, ignoreFalseConditions, separator) + + ToString("isChe1SwitchedToBullish", isChe1SwitchedToBullish, ignoreFalseConditions, separator) + + ToString("isChe1SwitchedToBearish", isChe1SwitchedToBearish, ignoreFalseConditions, separator) + + ToString("isChe2Bullish", isChe2Bullish, ignoreFalseConditions, separator) + + ToString("isChe2Bearish", isChe2Bearish, ignoreFalseConditions, separator) + + ToString("isChe2SwitchedToBullish", isChe2SwitchedToBullish, ignoreFalseConditions, separator) + + ToString("isChe2SwitchedToBearish", isChe2SwitchedToBearish, ignoreFalseConditions, separator) + + ToString("isCheBullish", isCheBullish, ignoreFalseConditions, separator) + + ToString("isCheBearish", isCheBearish, ignoreFalseConditions, separator) + + ToString("isCheSwitchedToBullish", isCheSwitchedToBullish, ignoreFalseConditions, separator) + + ToString("isCheSwitchedToBearish", isCheSwitchedToBearish, ignoreFalseConditions, separator) + + ToString("isClosedOverCheMin", isClosedOverCheMin, ignoreFalseConditions, separator) + + ToString("isClosedOverCheMax", isClosedOverCheMax, ignoreFalseConditions, separator) + + ToString("isClosedUnderCheMin", isClosedUnderCheMin, ignoreFalseConditions, separator) + + ToString("isClosedUnderCheMax", isClosedUnderCheMax, ignoreFalseConditions, separator) + + // + "-----------------------" + separator + + "HK ..." + separator + + "-----------------------" + separator + + ToString("isSMHKBullish", isSMHKBullish, ignoreFalseConditions, separator) + + ToString("isRawHKBullish", isRawHKBullish, ignoreFalseConditions, separator) + + ToString("isSMHKBearish", isSMHKBearish, ignoreFalseConditions, separator) + + ToString("isRawHKBearish", isRawHKBearish, ignoreFalseConditions, separator) + + ToString("isClosedOverSMHK", isClosedOverSMHK, ignoreFalseConditions, separator) + + ToString("isClosedUnderSMHK", isClosedUnderSMHK, ignoreFalseConditions, separator) + + ToString("isClosedOverRawHK", isClosedOverRawHK, ignoreFalseConditions, separator) + + ToString("isClosedUnderRawHK", isClosedUnderRawHK, ignoreFalseConditions, separator) + + ToString("isRawHKClosedOverSMHK", isRawHKClosedOverSMHK, ignoreFalseConditions, separator) + + ToString("isSMHKSwitchedToBearish", isSMHKSwitchedToBearish, ignoreFalseConditions, separator) + + ToString("isRawHKSwitchedToBearish", isRawHKSwitchedToBearish, ignoreFalseConditions, separator) + + ToString("isRawHKClosedUnderSMHK", isRawHKClosedUnderSMHK, ignoreFalseConditions, separator) + + ToString("isSMHKSwitchedToBullish", isSMHKSwitchedToBullish, ignoreFalseConditions, separator) + + ToString("isRawHKSwitchedToBullish", isRawHKSwitchedToBullish, ignoreFalseConditions, separator) + + // + "-----------------------" + separator + + "XICH ..." + separator + + "-----------------------" + separator + + ToString("isTenkanSenOverKijunSen", isTenkanSenOverKijunSen, ignoreFalseConditions, separator) + + ToString("isTenkanSenUnderKijunSen", isTenkanSenUnderKijunSen, ignoreFalseConditions, separator) + + ToString("isTenkanSenCrossedOverKijunSen", isTenkanSenCrossedOverKijunSen, ignoreFalseConditions, separator) + + ToString("isTenkanSenCrossedUnderKijunSen", isTenkanSenCrossedUnderKijunSen, ignoreFalseConditions, separator) + + ToString("isSenkouSpanAOverB", isSenkouSpanAOverB, ignoreFalseConditions, separator) + + ToString("isSenkouSpanAUnderB", isSenkouSpanAUnderB, ignoreFalseConditions, separator) + + ToString("isSenkouSpanACrossedOverB", isSenkouSpanACrossedOverB, ignoreFalseConditions, separator) + + ToString("isSenkouSpanACrossedUnderB", isSenkouSpanACrossedUnderB, ignoreFalseConditions, separator) + + // + "-----------------------" + separator + + "XDELTA ..." + separator + + "-----------------------" + separator + + ToString("isDeltaBullish", isDeltaBullish, ignoreFalseConditions, separator) + + ToString("isDeltaBearish", isDeltaBearish, ignoreFalseConditions, separator) + + ToString("isDeltaSwitchedToBullish", isDeltaSwitchedToBullish, ignoreFalseConditions, separator) + + ToString("isDeltaSwitchedToBearish", isDeltaSwitchedToBearish, ignoreFalseConditions, separator) + + ToString("isDeltaOverMa", isDeltaOverMa, ignoreFalseConditions, separator) + + ToString("isDeltaUnderMa", isDeltaUnderMa, ignoreFalseConditions, separator) + + ToString("isDeltaCrossedOverMa", isDeltaCrossedOverMa, ignoreFalseConditions, separator) + + ToString("isDeltaCrossedUnderMa", isDeltaCrossedUnderMa, ignoreFalseConditions, separator) + + // + "-----------------------" + separator + + "XVOLUME ..." + separator + + "-----------------------" + separator + + ToString("isBullishVolumeOverMa", isBullishVolumeOverMa, ignoreFalseConditions, separator) + + ToString("isBullishVolumeCrossedOverMa", isBullishVolumeCrossedOverMa, ignoreFalseConditions, separator) + + ToString("isBullishVolumeUnderMa", isBullishVolumeUnderMa, ignoreFalseConditions, separator) + + ToString("isBullishVolumeCrossedUnderMa", isBullishVolumeCrossedUnderMa, ignoreFalseConditions, separator) + + ToString("isBullishVolumeIncreased", isBullishVolumeIncreased, ignoreFalseConditions, separator) + + ToString("isBullishVolumeSwitchedToIncreased", isBullishVolumeSwitchedToIncreased, ignoreFalseConditions, separator) + + ToString("isBullishVolumeDecreased", isBullishVolumeDecreased, ignoreFalseConditions, separator) + + ToString("isBullishVolumeSwitchedToDecreased", isBullishVolumeSwitchedToDecreased, ignoreFalseConditions, separator) + + ToString("isBearishVolumeOverMa", isBearishVolumeOverMa, ignoreFalseConditions, separator) + + ToString("isBearishVolumeCrossedOverMa", isBearishVolumeCrossedOverMa, ignoreFalseConditions, separator) + + ToString("isBearishVolumeUnderMa", isBearishVolumeUnderMa, ignoreFalseConditions, separator) + + ToString("isBearishVolumeCrossedUnderMa", isBearishVolumeCrossedUnderMa, ignoreFalseConditions, separator) + + ToString("isBearishVolumeIncreased", isBearishVolumeIncreased, ignoreFalseConditions, separator) + + ToString("isBearishVolumeSwitchedToIncreased", isBearishVolumeSwitchedToIncreased, ignoreFalseConditions, separator) + + ToString("isBearishVolumeDecreased", isBearishVolumeDecreased, ignoreFalseConditions, separator) + + ToString("isBearishVolumeSwitchedToDecreased", isBearishVolumeSwitchedToDecreased, ignoreFalseConditions, separator) + + ToString("isVolumeSwitchedToBullish", isVolumeSwitchedToBullish, ignoreFalseConditions, separator) + + ToString("isVolumeSwitchedToBearish", isVolumeSwitchedToBearish, ignoreFalseConditions, separator) + + ToString("isBullishVolumeMaOverBearishVolumeMa", isBullishVolumeMaOverBearishVolumeMa, ignoreFalseConditions, separator) + + ToString("isBullishVolumeMaUnderBearishVolumeMa", isBullishVolumeMaUnderBearishVolumeMa, ignoreFalseConditions, separator) + + // + "-----------------------" + separator + + "Slopes ..." + separator + + "-----------------------" + separator + + ToString("isRsiSlopeBullish", isRsiSlopeBullish, ignoreFalseConditions, separator) + + ToString("isStrSlopeBullish", isStrSlopeBullish, ignoreFalseConditions, separator) + + ToString("isAtrUpperSlopeBullish", isAtrUpperSlopeBullish, ignoreFalseConditions, separator) + + ToString("isAtrLowerSlopeBullish", isAtrLowerSlopeBullish, ignoreFalseConditions, separator) + + ToString("isVwapFastSlopeBullish", isVwapFastSlopeBullish, ignoreFalseConditions, separator) + + ToString("isVwapMidSlopeBullish", isVwapMidSlopeBullish, ignoreFalseConditions, separator) + + ToString("isVwapSlowSlopeBullish", isVwapSlowSlopeBullish, ignoreFalseConditions, separator) + + ToString("isRsiSlopeBearish", isRsiSlopeBearish, ignoreFalseConditions, separator) + + ToString("isStrSlopeBearish", isStrSlopeBearish, ignoreFalseConditions, separator) + + ToString("isAtrUpperSlopeBearish", isAtrUpperSlopeBearish, ignoreFalseConditions, separator) + + ToString("isAtrLowerSlopeBearish", isAtrLowerSlopeBearish, ignoreFalseConditions, separator) + + ToString("isVwapFastSlopeBearish", isVwapFastSlopeBearish, ignoreFalseConditions, separator) + + ToString("isVwapMidSlopeBearish", isVwapMidSlopeBearish, ignoreFalseConditions, separator) + + ToString("isVwapSlowSlopeBearish", isVwapSlowSlopeBearish, ignoreFalseConditions, separator) + + // + "-----------------------" + separator + + "Coplex ..." + separator + + "-----------------------" + separator + + ToString("isSarIncreased", isSarIncreased, ignoreFalseConditions, separator) + + ToString("isSarDecreased", isSarDecreased, ignoreFalseConditions, separator) + + ToString("isSarEqualsToPeak", isSarEqualsToPeak, ignoreFalseConditions, separator) + + ToString("isStrEqualsToPeak", isStrEqualsToPeak, ignoreFalseConditions, separator) + + ToString("isStrEqualsToVale", isStrEqualsToVale, ignoreFalseConditions, separator) + + ToString("isPeakOverAtrUpper", isPeakOverAtrUpper, ignoreFalseConditions, separator) + + ToString("isStrUpperOverPeak", isStrUpperOverPeak, ignoreFalseConditions, separator) + + ToString("isStrLowerOverVale", isStrLowerOverVale, ignoreFalseConditions, separator) + + ToString("isAtrUpperOverPeak", isAtrUpperOverPeak, ignoreFalseConditions, separator) + + ToString("isAtrLowerUnderVale", isAtrLowerUnderVale, ignoreFalseConditions, separator) + + ToString("isClosedOverVWapMin", isClosedOverVWapMin, ignoreFalseConditions, separator) + + ToString("isClosedOverVWapMax", isClosedOverVWapMax, ignoreFalseConditions, separator) + + ToString("isStrUpperUnderPeak", isStrUpperUnderPeak, ignoreFalseConditions, separator) + + ToString("isValeUnderAtrLower", isValeUnderAtrLower, ignoreFalseConditions, separator) + + ToString("isStrLowerUnderVale", isStrLowerUnderVale, ignoreFalseConditions, separator) + + ToString("isClosedUnderVWapMin", isClosedUnderVWapMin, ignoreFalseConditions, separator) + + ToString("isClosedUnderVWapMax", isClosedUnderVWapMax, ignoreFalseConditions, separator) + + ToString("isSarCrossedOverVale", isSarCrossedOverVale, ignoreFalseConditions, separator) + + ToString("isStrCrossedOverVale", isStrCrossedOverVale, ignoreFalseConditions, separator) + + ToString("isSarCrossedUnderPeak", isSarCrossedUnderPeak, ignoreFalseConditions, separator) + + ToString("isStrCrossedUnderPeak", isStrCrossedUnderPeak, ignoreFalseConditions, separator) + + ToString("isNewPeakOverAtrUpper", isNewPeakOverAtrUpper, ignoreFalseConditions, separator) + + ToString("isNewValeUnderAtrLower", isNewValeUnderAtrLower, ignoreFalseConditions, separator) + + ToString("isStrUpperOverAtrUpper", isStrUpperOverAtrUpper, ignoreFalseConditions, separator) + + ToString("isStrLowerOverAtrLower", isStrLowerOverAtrLower, ignoreFalseConditions, separator) + + ToString("isAtrUpperEqualsToPeak", isAtrUpperEqualsToPeak, ignoreFalseConditions, separator) + + ToString("isAtrLowerEqualsToVale", isAtrLowerEqualsToVale, ignoreFalseConditions, separator) + + ToString("isAtrUpperCrossedUpPeak", isAtrUpperCrossedUpPeak, ignoreFalseConditions, separator) + + ToString("isAtrLowerCrossedUpVale", isAtrLowerCrossedUpVale, ignoreFalseConditions, separator) + + ToString("isStrUpperUnderAtrUpper", isStrUpperUnderAtrUpper, ignoreFalseConditions, separator) + + ToString("isStrLowerUnderAtrLower", isStrLowerUnderAtrLower, ignoreFalseConditions, separator) + + ToString("isVWapFastCrossedOverMid", isVWapFastCrossedOverMid, ignoreFalseConditions, separator) + + ToString("isAtrUpperCrossedDownPeak", isAtrUpperCrossedDownPeak, ignoreFalseConditions, separator) + + ToString("isAtrLowerCrossedDownVale", isAtrLowerCrossedDownVale, ignoreFalseConditions, separator) + + ToString("isVWapFastCrossedUnderMid", isVWapFastCrossedUnderMid, ignoreFalseConditions, separator) + + ToString("isVWapFastCrossedOverSlow", isVWapFastCrossedOverSlow, ignoreFalseConditions, separator) + + ToString("isStrUpperCrossedOverPeak", isStrUpperCrossedOverPeak, ignoreFalseConditions, separator) + + ToString("isStrLowerOverDonLowLower", isStrLowerOverDonLowLower, ignoreFalseConditions, separator) + + ToString("isStrLowerCrossedOverVale", isStrLowerCrossedOverVale, ignoreFalseConditions, separator) + + ToString("isDonLowLowerEqualsToVale", isDonLowLowerEqualsToVale, ignoreFalseConditions, separator) + + ToString("isVWapFastCrossedUnderSlow", isVWapFastCrossedUnderSlow, ignoreFalseConditions, separator) + + ToString("isStrUpperCrossedUnderPeak", isStrUpperCrossedUnderPeak, ignoreFalseConditions, separator) + + ToString("isStrLowerCrossedUnderVale", isStrLowerCrossedUnderVale, ignoreFalseConditions, separator) + + ToString("isDonHighUpperEqualsToPeak", isDonHighUpperEqualsToPeak, ignoreFalseConditions, separator) + + ToString("isStrUpperOverDonHighUpper", isStrUpperOverDonHighUpper, ignoreFalseConditions, separator) + + ToString("isStrLowerUnderDonLowLower", isStrLowerUnderDonLowLower, ignoreFalseConditions, separator) + + ToString("isStrUpperUnderDonHighUpper", isStrUpperUnderDonHighUpper, ignoreFalseConditions, separator) + + ToString("isStrUpperCrossedOverAtrUpper", isStrUpperCrossedOverAtrUpper, ignoreFalseConditions, separator) + + ToString("isStrLowerCrossedOverAtrLower", isStrLowerCrossedOverAtrLower, ignoreFalseConditions, separator) + + ToString("isStrUpperCrossedUnderAtrUpper", isStrUpperCrossedUnderAtrUpper, ignoreFalseConditions, separator) + + ToString("isStrLowerCrossedUnderAtrLower", isStrLowerCrossedUnderAtrLower, ignoreFalseConditions, separator) + + ToString("isStrLowerCrossedOverDonLowLower", isStrLowerCrossedOverDonLowLower, ignoreFalseConditions, separator) + + ToString("isStrUpperCrossedOverDonHighUpper", isStrUpperCrossedOverDonHighUpper, ignoreFalseConditions, separator) + + ToString("isStrLowerCrossedUnderDonLowLower", isStrLowerCrossedUnderDonLowLower, ignoreFalseConditions, separator) + + ToString("isStrUpperCrossedUnderDonHighUpper", isStrUpperCrossedUnderDonHighUpper, ignoreFalseConditions, separator) + + // + "" + // + ; + + // + result = + // + "[" + GetTag() + "]" + separator + + (onlyConditions + ? "" + : commonStr) + + (!includeScores + ? "" + : scoresStr) + + " " + separator + + (onlyCommons + ? "" + : conditionsStr) + + "" + // + ; + + // + return result; + } + + /** + * Retrieve nique Tag Identifier ... + * + * @return ( string ) + */ + string GetTag() + { + return GetTypeName(this); + } + + // +}; + +// +// Implementation ... +class XCX121Helper : public XCBase +{ + // + public: + // + + // + // Helpers ... + XCX121XCCHelper *xccHelper; + XCX121XPVHelper *xpvHelper; + XCX121XHKHelper *xhkHelper; + XCX121XICHHelper *xichHelper; + XCX121XMASHelper *xmasHelper; + XCX121XATRHelper *xatrHelper; + XCX121XSTRHelper *xstrHelper; + XCX121XCHEHelper *xcheHelper; + XCX121XDONHelper *xdonHelper; + XCX121X3MAHelper *x3maHelper; + XCX121XVWAPHelper *xvwapHelper; + XCX121XDELTAHelper *xdeltaHelper; + XCX121XVOLUMEHelper *xvolumeHelper; + + // + // Constructors ... + XCX121Helper() + { + } + + // + // Deconstructor ... + ~XCX121Helper() + { + // + mInputs.Clean(); + xccInputs.Clean(); + xpvInputs.Clean(); + xhkInputs.Clean(); + xichInputs.Clean(); + xmasInputs.Clean(); + xatrInputs.Clean(); + xdonInputs.Clean(); + xstrInputs.Clean(); + xcheInputs.Clean(); + x3maInputs.Clean(); + xvwapInputs.Clean(); + xdeltaInputs.Clean(); + xvolumeInputs.Clean(); + + // + delete xccHelper; + delete xpvHelper; + delete xhkHelper; + delete xichHelper; + delete xmasHelper; + delete xatrHelper; + delete xstrHelper; + delete xcheHelper; + delete xdonHelper; + delete x3maHelper; + delete xvwapHelper; + delete xdeltaHelper; + delete xvolumeHelper; + + // + ZeroMemory(xccHelper); + ZeroMemory(xpvHelper); + ZeroMemory(xhkHelper); + ZeroMemory(xichHelper); + ZeroMemory(xmasHelper); + ZeroMemory(xatrHelper); + ZeroMemory(xstrHelper); + ZeroMemory(xcheHelper); + ZeroMemory(xdonHelper); + ZeroMemory(x3maHelper); + ZeroMemory(xvwapHelper); + ZeroMemory(xdeltaHelper); + ZeroMemory(xvolumeHelper); + } + + // + string GetSymbol() + { + return mSymbol; + } + + // + ENUM_TIMEFRAMES GetPeriod() + { + return mPeriod; + } + + // + // Tools ... + + /** + * Initialize Indicator Helper ... + * + * @param symbol: String, Symbol ... + * @param period: ENUM_TIMEFRAMES member, Period ... + * @param inputs: X121Inputs instance, Indicator Inputs ... + * + * @return ( bool ) + */ + bool Init( + string symbol, // Trading Symbol + ENUM_TIMEFRAMES period, // Trading Period + X121Inputs &inputs // Inputs + ) + { + // + bool result = false; + + // + result = + IsValid(symbol) && + IsValid(period) && + inputs.IsValid(); + if (!result) + { + return result; + } + + // + mSymbol = symbol; + mPeriod = period; + + // + // Setting Inputs ... + + // + mInputs = inputs; + xccInputs = inputs.xccInputs; + xpvInputs = inputs.xpvInputs; + xhkInputs = inputs.xhkInputs; + xichInputs = inputs.xichInputs; + xmasInputs = inputs.xmasInputs; + xatrInputs = inputs.xatrInputs; + xstrInputs = inputs.xstrInputs; + xcheInputs = inputs.xcheInputs; + xdonInputs = inputs.xdonInputs; + x3maInputs = inputs.x3maInputs; + xvwapInputs = inputs.xvwapInputs; + xdeltaInputs = inputs.xdeltaInputs; + xvolumeInputs = inputs.xvolumeInputs; + + // + // Initial Helpers ... + + // + // XCC ... + xccHelper = new XCX121XCCHelper(); + result = xccHelper.Init( + symbol, + period, + xccInputs // + ); + if (!result) + { + // + ZeroMemory(xccHelper); + ZeroMemory(xpvHelper); + ZeroMemory(xhkHelper); + ZeroMemory(xmasHelper); + ZeroMemory(xatrHelper); + ZeroMemory(xichHelper); + ZeroMemory(xstrHelper); + ZeroMemory(xcheHelper); + ZeroMemory(xdonHelper); + ZeroMemory(x3maHelper); + ZeroMemory(xvwapHelper); + ZeroMemory(xdeltaHelper); + ZeroMemory(xvolumeHelper); + + // + return result; + } + + // + // XPV ... + xpvHelper = new XCX121XPVHelper(); + result = xpvHelper.Init( + symbol, + period, + xpvInputs // + ); + if (!result) + { + // + ZeroMemory(xccHelper); + ZeroMemory(xpvHelper); + ZeroMemory(xhkHelper); + ZeroMemory(xmasHelper); + ZeroMemory(xatrHelper); + ZeroMemory(xichHelper); + ZeroMemory(xstrHelper); + ZeroMemory(xcheHelper); + ZeroMemory(xdonHelper); + ZeroMemory(x3maHelper); + ZeroMemory(xvwapHelper); + ZeroMemory(xdeltaHelper); + ZeroMemory(xvolumeHelper); + + // + return result; + } + + // + // XHK ... + xhkHelper = new XCX121XHKHelper(); + result = xhkHelper.Init( + symbol, + period, + xhkInputs // + ); + if (!result) + { + // + ZeroMemory(xccHelper); + ZeroMemory(xpvHelper); + ZeroMemory(xhkHelper); + ZeroMemory(xmasHelper); + ZeroMemory(xatrHelper); + ZeroMemory(xichHelper); + ZeroMemory(xstrHelper); + ZeroMemory(xcheHelper); + ZeroMemory(xdonHelper); + ZeroMemory(x3maHelper); + ZeroMemory(xvwapHelper); + ZeroMemory(xdeltaHelper); + ZeroMemory(xvolumeHelper); + + // + return result; + } + + // + // XMAS ... + xmasHelper = new XCX121XMASHelper(); + result = xmasHelper.Init( + symbol, + period, + xmasInputs // + ); + if (!result) + { + // + ZeroMemory(xccHelper); + ZeroMemory(xpvHelper); + ZeroMemory(xhkHelper); + ZeroMemory(xmasHelper); + ZeroMemory(xatrHelper); + ZeroMemory(xichHelper); + ZeroMemory(xstrHelper); + ZeroMemory(xcheHelper); + ZeroMemory(xdonHelper); + ZeroMemory(x3maHelper); + ZeroMemory(xvwapHelper); + ZeroMemory(xdeltaHelper); + ZeroMemory(xvolumeHelper); + + // + return result; + } + + // + // XATR ... + xatrHelper = new XCX121XATRHelper(); + result = xatrHelper.Init( + symbol, + period, + xatrInputs // + ); + if (!result) + { + // + ZeroMemory(xccHelper); + ZeroMemory(xpvHelper); + ZeroMemory(xhkHelper); + ZeroMemory(xmasHelper); + ZeroMemory(xatrHelper); + ZeroMemory(xichHelper); + ZeroMemory(xstrHelper); + ZeroMemory(xcheHelper); + ZeroMemory(xdonHelper); + ZeroMemory(x3maHelper); + ZeroMemory(xvwapHelper); + ZeroMemory(xdeltaHelper); + ZeroMemory(xvolumeHelper); + + // + return result; + } + + // + // XICH ... + xichHelper = new XCX121XICHHelper(); + result = xichHelper.Init( + symbol, + period, + xichInputs // + ); + if (!result) + { + // + ZeroMemory(xccHelper); + ZeroMemory(xpvHelper); + ZeroMemory(xhkHelper); + ZeroMemory(xmasHelper); + ZeroMemory(xatrHelper); + ZeroMemory(xichHelper); + ZeroMemory(xstrHelper); + ZeroMemory(xcheHelper); + ZeroMemory(xdonHelper); + ZeroMemory(x3maHelper); + ZeroMemory(xvwapHelper); + ZeroMemory(xdeltaHelper); + ZeroMemory(xvolumeHelper); + + // + return result; + } + + // + // XSTR ... + xstrHelper = new XCX121XSTRHelper(); + result = xstrHelper.Init( + symbol, + period, + xstrInputs // + ); + if (!result) + { + // + ZeroMemory(xccHelper); + ZeroMemory(xpvHelper); + ZeroMemory(xhkHelper); + ZeroMemory(xmasHelper); + ZeroMemory(xatrHelper); + ZeroMemory(xichHelper); + ZeroMemory(xstrHelper); + ZeroMemory(xcheHelper); + ZeroMemory(xdonHelper); + ZeroMemory(x3maHelper); + ZeroMemory(xvwapHelper); + ZeroMemory(xdeltaHelper); + ZeroMemory(xvolumeHelper); + + // + return result; + } + + // + // XCHE ... + xcheHelper = new XCX121XCHEHelper(); + result = xcheHelper.Init( + symbol, + period, + xcheInputs // + ); + if (!result) + { + // + ZeroMemory(xccHelper); + ZeroMemory(xpvHelper); + ZeroMemory(xhkHelper); + ZeroMemory(xmasHelper); + ZeroMemory(xatrHelper); + ZeroMemory(xichHelper); + ZeroMemory(xstrHelper); + ZeroMemory(xcheHelper); + ZeroMemory(xdonHelper); + ZeroMemory(x3maHelper); + ZeroMemory(xvwapHelper); + ZeroMemory(xdeltaHelper); + ZeroMemory(xvolumeHelper); + + // + return result; + } + + // + // XDON ... + xdonHelper = new XCX121XDONHelper(); + result = xdonHelper.Init( + symbol, + period, + xdonInputs // + ); + if (!result) + { + // + ZeroMemory(xccHelper); + ZeroMemory(xpvHelper); + ZeroMemory(xhkHelper); + ZeroMemory(xmasHelper); + ZeroMemory(xatrHelper); + ZeroMemory(xichHelper); + ZeroMemory(xstrHelper); + ZeroMemory(xcheHelper); + ZeroMemory(xdonHelper); + ZeroMemory(x3maHelper); + ZeroMemory(xvwapHelper); + ZeroMemory(xdeltaHelper); + ZeroMemory(xvolumeHelper); + + // + return result; + } + + // + // X3MA ... + x3maHelper = new XCX121X3MAHelper(); + result = x3maHelper.Init( + symbol, + period, + x3maInputs // + ); + if (!result) + { + // + ZeroMemory(xccHelper); + ZeroMemory(xpvHelper); + ZeroMemory(xhkHelper); + ZeroMemory(xmasHelper); + ZeroMemory(xatrHelper); + ZeroMemory(xichHelper); + ZeroMemory(xstrHelper); + ZeroMemory(xcheHelper); + ZeroMemory(xdonHelper); + ZeroMemory(x3maHelper); + ZeroMemory(xvwapHelper); + ZeroMemory(xdeltaHelper); + ZeroMemory(xvolumeHelper); + + // + return result; + } + + // + // XVWAP ... + xvwapHelper = new XCX121XVWAPHelper(); + result = xvwapHelper.Init( + symbol, + period, + xvwapInputs // + ); + if (!result) + { + // + ZeroMemory(xccHelper); + ZeroMemory(xpvHelper); + ZeroMemory(xhkHelper); + ZeroMemory(xmasHelper); + ZeroMemory(xatrHelper); + ZeroMemory(xichHelper); + ZeroMemory(xstrHelper); + ZeroMemory(xcheHelper); + ZeroMemory(xdonHelper); + ZeroMemory(x3maHelper); + ZeroMemory(xvwapHelper); + ZeroMemory(xdeltaHelper); + ZeroMemory(xvolumeHelper); + + // + return result; + } + + // + // XDELTA ... + xdeltaHelper = new XCX121XDELTAHelper(); + result = xdeltaHelper.Init( + symbol, + period, + xdeltaInputs // + ); + if (!result) + { + // + ZeroMemory(xccHelper); + ZeroMemory(xpvHelper); + ZeroMemory(xhkHelper); + ZeroMemory(xmasHelper); + ZeroMemory(xatrHelper); + ZeroMemory(xichHelper); + ZeroMemory(xstrHelper); + ZeroMemory(xcheHelper); + ZeroMemory(xdonHelper); + ZeroMemory(x3maHelper); + ZeroMemory(xvwapHelper); + ZeroMemory(xdeltaHelper); + ZeroMemory(xvolumeHelper); + + // + return result; + } + + // + // XVOLUME ... + xvolumeHelper = new XCX121XVOLUMEHelper(); + result = xvolumeHelper.Init( + symbol, + period, + xvolumeInputs // + ); + if (!result) + { + // + ZeroMemory(xccHelper); + ZeroMemory(xpvHelper); + ZeroMemory(xhkHelper); + ZeroMemory(xmasHelper); + ZeroMemory(xatrHelper); + ZeroMemory(xichHelper); + ZeroMemory(xstrHelper); + ZeroMemory(xcheHelper); + ZeroMemory(xdonHelper); + ZeroMemory(x3maHelper); + ZeroMemory(xvwapHelper); + ZeroMemory(xdeltaHelper); + ZeroMemory(xvolumeHelper); + + // + return result; + } + + // + if (inputs.showRSI) + { + // + mRSIHandler = iRSI( + symbol, + period, + xatrInputs.rsiLength, + xatrInputs.rsiAppliedTo // + ); + + // + result = mRSIHandler != INVALID_HANDLE; + if (!result) + { + // + ZeroMemory(xccHelper); + ZeroMemory(xpvHelper); + ZeroMemory(xhkHelper); + ZeroMemory(xmasHelper); + ZeroMemory(xatrHelper); + ZeroMemory(xichHelper); + ZeroMemory(xstrHelper); + ZeroMemory(xcheHelper); + ZeroMemory(xdonHelper); + ZeroMemory(x3maHelper); + ZeroMemory(xvwapHelper); + ZeroMemory(xdeltaHelper); + ZeroMemory(xvolumeHelper); + + // + return result; + } + } + + // + return result; + } + + // + // Conditions Readers ... + + // + // XPV ... + bool GetPVConditions( + X121XPVConditions &conditions, // + int barIndex = 0, // + int loopback = 5 // + ) + { + // + bool result = false; + + // + result = xpvHelper.GetConditions( + conditions, + barIndex, + loopback // + ); + + // + return result; + } + + // + // XHK ... + bool GetHKConditions( + X121XHKConditions &conditions, // + int barIndex = 0, // + int loopback = 5 // + ) + { + // + bool result = false; + + // + result = xhkHelper.GetConditions( + conditions, + barIndex, + loopback // + ); + + // + return result; + } + + // + // XMAS ... + bool GetMASConditions( + X121XMASConditions &conditions, // + int barIndex = 0, // + int loopback = 5 // + ) + { + // + bool result = false; + + // + result = xmasHelper.GetConditions( + conditions, + barIndex, + loopback // + ); + + // + return result; + } + + // + // XICH ... + bool GetICHConditions( + X121XICHConditions &conditions, // + int barIndex = 0, // + int loopback = 5 // + ) + { + // + bool result = false; + + // + result = xichHelper.GetConditions( + conditions, + barIndex, + loopback // + ); + + // + return result; + } + + // + // XATR ... + bool GetATRConditions( + X121XATRConditions &conditions, // + int barIndex = 0, // + int loopback = 5 // + ) + { + // + bool result = false; + + // + result = xatrHelper.GetConditions( + conditions, + barIndex, + loopback // + ); + + // + return result; + } + + // + // XSTR ... + bool GetSTRConditions( + X121XSTRConditions &conditions, // + int barIndex = 0, // + int loopback = 5 // + ) + { + // + bool result = false; + + // + result = xstrHelper.GetConditions( + conditions, + barIndex, + loopback // + ); + + // + return result; + } + + // + // XCHE ... + bool GetCHEConditions( + X121XCHEConditions &conditions, // + int barIndex = 0, // + int loopback = 5 // + ) + { + // + bool result = false; + + // + result = xcheHelper.GetConditions( + conditions, + barIndex, + loopback // + ); + + // + return result; + } + + // + // XDON ... + bool GetDONConditions( + X121XDONConditions &conditions, // + int barIndex = 0, // + int loopback = 5 // + ) + { + // + bool result = false; + + // + result = xdonHelper.GetConditions( + conditions, + barIndex, + loopback // + ); + + // + return result; + } + + // + // X3MA ... + bool Get3MAConditions( + X121X3MAConditions &conditions, // + int barIndex = 0, // + int loopback = 5 // + ) + { + // + bool result = false; + + // + result = x3maHelper.GetConditions( + conditions, + barIndex, + loopback // + ); + + // + return result; + } + + // + // XVWAP ... + bool GetVWAPConditions( + X121XVWAPConditions &conditions, // + int barIndex = 0, // + int loopback = 5 // + ) + { + // + bool result = false; + + // + result = xvwapHelper.GetConditions( + conditions, + barIndex, + loopback // + ); + + // + return result; + } + + // + // XDELTA ... + bool GetDELTAConditions( + X121XDELTAConditions &conditions, // + int barIndex = 0, // + int loopback = 5 // + ) + { + // + bool result = false; + + // + result = xdeltaHelper.GetConditions( + conditions, + barIndex, + loopback // + ); + + // + return result; + } + + // + // XVOLUME ... + bool GetVOLUMEConditions( + X121XVOLUMEConditions &conditions, // + int barIndex = 0, // + int loopback = 5 // + ) + { + // + bool result = false; + + // + result = xvolumeHelper.GetConditions( + conditions, + barIndex, + loopback // + ); + + // + return result; + } + + // + void Free() + { + // + xpvHelper.Free(); + xhkHelper.Free(); + xichHelper.Free(); + xmasHelper.Free(); + xatrHelper.Free(); + xstrHelper.Free(); + xcheHelper.Free(); + xdonHelper.Free(); + xvwapHelper.Free(); + } + + // + bool GetConditions( + X121Conditions &conditions, // + int barIndex = 0, // + int loopback = 5 // + ) + { + // + bool result = true; + + // + if (loopback < 5) + { + loopback = 5; + } + + // + conditions.Clean(); + + // + conditions.symbol = mSymbol; + conditions.period = mPeriod; + conditions.time = TimeCurrent(); + + // + int zIndex = barIndex; + int cIndex = zIndex + 1; + int pIndex = cIndex + 1; + int ppIndex = pIndex + 1; + + // + XOHCL zBar; + result = zBar.Init( + mSymbol, + mPeriod, + zIndex // + ); + if (!result) + { + return result; + } + + // + XOHCL cBar; + result = cBar.Init( + mSymbol, + mPeriod, + cIndex // + ); + if (!result) + { + return result; + } + + // + XOHCL pBar; + result = pBar.Init( + mSymbol, + mPeriod, + pIndex // + ); + if (!result) + { + return result; + } + + // + // XPV ... + X121XPVConditions xpvConditions; + result = GetPVConditions( + xpvConditions, + barIndex, + loopback // + ); + if (!result) + { + // + xpvConditions.Clean(); + + // + return result; + } + + // + // XHK ... + X121XHKConditions xhkConditions; + result = GetHKConditions( + xhkConditions, + barIndex, + loopback // + ); + if (!result) + { + // + xpvConditions.Clean(); + xhkConditions.Clean(); + + // + return result; + } + + // + // XICH ... + X121XICHConditions xichConditions; + result = GetICHConditions( + xichConditions, + barIndex, + loopback // + ); + if (!result) + { + // + xpvConditions.Clean(); + xhkConditions.Clean(); + xichConditions.Clean(); + + // + return result; + } + + // + // XMAS ... + X121XMASConditions xmasConditions; + result = GetMASConditions( + xmasConditions, + barIndex, + loopback // + ); + if (!result) + { + // + xpvConditions.Clean(); + xhkConditions.Clean(); + xichConditions.Clean(); + xmasConditions.Clean(); + + // + return result; + } + + // + // XATR ... + X121XATRConditions xatrConditions; + result = GetATRConditions( + xatrConditions, + barIndex, + loopback // + ); + if (!result) + { + // + xpvConditions.Clean(); + xhkConditions.Clean(); + xichConditions.Clean(); + xmasConditions.Clean(); + xatrConditions.Clean(); + + // + return result; + } + + // + // XSTR ... + X121XSTRConditions xstrConditions; + result = GetSTRConditions( + xstrConditions, + barIndex, + loopback // + ); + if (!result) + { + // + xpvConditions.Clean(); + xhkConditions.Clean(); + xichConditions.Clean(); + xmasConditions.Clean(); + xatrConditions.Clean(); + xstrConditions.Clean(); + + // + return result; + } + + // + // XCHE ... + X121XCHEConditions xcheConditions; + result = GetCHEConditions( + xcheConditions, + barIndex, + loopback // + ); + if (!result) + { + // + xpvConditions.Clean(); + xhkConditions.Clean(); + xichConditions.Clean(); + xmasConditions.Clean(); + xatrConditions.Clean(); + xstrConditions.Clean(); + xcheConditions.Clean(); + + // + return result; + } + + // + // XDON ... + X121XDONConditions xdonConditions; + result = GetDONConditions( + xdonConditions, + barIndex, + loopback // + ); + if (!result) + { + // + xpvConditions.Clean(); + xhkConditions.Clean(); + xichConditions.Clean(); + xmasConditions.Clean(); + xatrConditions.Clean(); + xstrConditions.Clean(); + xcheConditions.Clean(); + xdonConditions.Clean(); + + // + return result; + } + + // + // X3MA ... + X121X3MAConditions x3maConditions; + result = Get3MAConditions( + x3maConditions, + barIndex, + loopback // + ); + if (!result) + { + // + xpvConditions.Clean(); + xhkConditions.Clean(); + xichConditions.Clean(); + xmasConditions.Clean(); + xatrConditions.Clean(); + xstrConditions.Clean(); + xcheConditions.Clean(); + xdonConditions.Clean(); + x3maConditions.Clean(); + + // + return result; + } + + // + // XVWAP ... + X121XVWAPConditions xvwapConditions; + result = GetVWAPConditions( + xvwapConditions, + barIndex, + loopback // + ); + if (!result) + { + // + xpvConditions.Clean(); + xhkConditions.Clean(); + xichConditions.Clean(); + xmasConditions.Clean(); + xatrConditions.Clean(); + xstrConditions.Clean(); + xcheConditions.Clean(); + xdonConditions.Clean(); + x3maConditions.Clean(); + xvwapConditions.Clean(); + + // + return result; + } + + // + // XDELTA ... + X121XDELTAConditions xdeltaConditions; + result = GetDELTAConditions( + xdeltaConditions, + barIndex, + loopback // + ); + if (!result) + { + // + xpvConditions.Clean(); + xhkConditions.Clean(); + xichConditions.Clean(); + xmasConditions.Clean(); + xatrConditions.Clean(); + xstrConditions.Clean(); + xcheConditions.Clean(); + xdonConditions.Clean(); + x3maConditions.Clean(); + xvwapConditions.Clean(); + xdeltaConditions.Clean(); + + // + return result; + } + + // + // XVOLUME ... + X121XVOLUMEConditions xvolumeConditions; + result = GetVOLUMEConditions( + xvolumeConditions, + barIndex, + loopback // + ); + if (!result) + { + // + xpvConditions.Clean(); + xhkConditions.Clean(); + xichConditions.Clean(); + xmasConditions.Clean(); + xatrConditions.Clean(); + xstrConditions.Clean(); + xcheConditions.Clean(); + xdonConditions.Clean(); + x3maConditions.Clean(); + xvwapConditions.Clean(); + xdeltaConditions.Clean(); + xvolumeConditions.Clean(); + + // + return result; + } + + // + // Fill Volume Buffer ... + for (int i = barIndex; i < barIndex + loopback; i++) + { + // + // Reading Bar Valuem ... + long iVol = iVolume( + mSymbol, + mPeriod, + i // + ); + + // + Add( + iVol, + conditions.volumeBuffer // + ); + } + + // + // Fill X121 Conditions Reference by Using + // Retrieved Conditions ... + + // + int cIDX = 1; + int pIDX = cIDX + 1; + + // + // XPV ... + + // + // Buffers ... + + // + Copy( + xpvConditions.peaksBuffer, + conditions.peaksBuffer // + ); + + // + Copy( + xpvConditions.valesBuffer, + conditions.valesBuffer // + ); + + // + Copy( + xpvConditions.supportsBuffer, + conditions.supportsBuffer // + ); + + // + Copy( + xpvConditions.resistancesBuffer, + conditions.resistancesBuffer // + ); + + // + Copy( + xpvConditions.peaksGoldenBuffer, + conditions.peaksGoldenBuffer // + ); + + // + Copy( + xpvConditions.valesGoldenBuffer, + conditions.valesGoldenBuffer // + ); + + // + Copy( + xpvConditions.sarBuffer, + conditions.sarBuffer // + ); + + // + Copy( + xpvConditions.cHHBuffer, + conditions.cHHBuffer // + ); + + // + Copy( + xpvConditions.cLLBuffer, + conditions.cLLBuffer // + ); + + // + Copy( + xpvConditions.sHHBuffer, + conditions.sHHBuffer // + ); + + // + Copy( + xpvConditions.sLLBuffer, + conditions.sLLBuffer // + ); + + // + Copy( + xpvConditions.mHHBuffer, + conditions.mHHBuffer // + ); + + // + Copy( + xpvConditions.mLLBuffer, + conditions.mLLBuffer // + ); + + // + Copy( + xpvConditions.lHHBuffer, + conditions.lHHBuffer // + ); + + // + Copy( + xpvConditions.lLLBuffer, + conditions.lLLBuffer // + ); + + // + Copy( + xpvConditions.hHHBuffer, + conditions.hHHBuffer // + ); + + // + Copy( + xpvConditions.hLLBuffer, + conditions.hLLBuffer // + ); + + // + Copy( + xpvConditions.fractalsUpperBuffer, + conditions.fractalsUpperBuffer // + ); + + // + Copy( + xpvConditions.fractalsLowerBuffer, + conditions.fractalsLowerBuffer // + ); + + // + // Conditions ... + + // + conditions.isNewPeak = xpvConditions.isNewPeak; + conditions.isNewVale = xpvConditions.isNewVale; + conditions.isSarBullish = xpvConditions.isSarBullish; + conditions.isSarBearish = xpvConditions.isSarBearish; + conditions.isNewPeakOverLast = xpvConditions.isNewPeakOverLast; + conditions.isNewValeOverLast = xpvConditions.isNewValeOverLast; + conditions.isNewPeakUnderLast = xpvConditions.isNewPeakUnderLast; + conditions.isNewValeUnderLast = xpvConditions.isNewValeUnderLast; + conditions.isSarSwitchedToBullish = xpvConditions.isSarSwitchedToBullish; + conditions.isSarSwitchedToBearish = xpvConditions.isSarSwitchedToBearish; + + // + // XHK ... + + // + // Buffers ... + + // + Copy( + xhkConditions.xhkRawOpenBuffer, + conditions.xhkRawOpenBuffer // + ); + + // + Copy( + xhkConditions.xhkRawHighBuffer, + conditions.xhkRawHighBuffer // + ); + + // + Copy( + xhkConditions.xhkRawLowBuffer, + conditions.xhkRawLowBuffer // + ); + + // + Copy( + xhkConditions.xhkRawCloseBuffer, + conditions.xhkRawCloseBuffer // + ); + + // + Copy( + xhkConditions.xhkSMOpenBuffer, + conditions.xhkSMOpenBuffer // + ); + + // + Copy( + xhkConditions.xhkSMHighBuffer, + conditions.xhkSMHighBuffer // + ); + + // + Copy( + xhkConditions.xhkSMLowBuffer, + conditions.xhkSMLowBuffer // + ); + + // + Copy( + xhkConditions.xhkSMCloseBuffer, + conditions.xhkSMCloseBuffer // + ); + + // + // Conditions ... + conditions.isSMHKBullish = xhkConditions.isSMHKBullish; + conditions.isRawHKBullish = xhkConditions.isRawHKBullish; + conditions.isSMHKBearish = xhkConditions.isSMHKBearish; + conditions.isRawHKBearish = xhkConditions.isRawHKBearish; + conditions.isClosedOverSMHK = xhkConditions.isClosedOverSMHK; + conditions.isClosedUnderSMHK = xhkConditions.isClosedUnderSMHK; + conditions.isClosedOverRawHK = xhkConditions.isClosedOverRawHK; + conditions.isClosedUnderRawHK = xhkConditions.isClosedUnderRawHK; + conditions.isRawHKClosedOverSMHK = xhkConditions.isRawHKClosedOverSMHK; + conditions.isSMHKSwitchedToBearish = xhkConditions.isSMHKSwitchedToBearish; + conditions.isRawHKSwitchedToBearish = xhkConditions.isRawHKSwitchedToBearish; + conditions.isRawHKClosedUnderSMHK = xhkConditions.isRawHKClosedUnderSMHK; + conditions.isSMHKSwitchedToBullish = xhkConditions.isSMHKSwitchedToBullish; + conditions.isRawHKSwitchedToBullish = xhkConditions.isRawHKSwitchedToBullish; + + // + // XMAS ... + + // + // Buffers ... + + // + Copy( + xmasConditions.upperBuffer, + conditions.masUpperBuffer // + ); + + // + Copy( + xmasConditions.midBuffer, + conditions.masMidBuffer // + ); + + // + Copy( + xmasConditions.lowerBuffer, + conditions.masLowerBuffer // + ); + + // + // XATR ... + + // + // Buffers ... + + // + Copy( + xatrConditions.atrUpperBuffer, + conditions.atrUpperBuffer // + ); + + // + Copy( + xatrConditions.atrLowerBuffer, + conditions.atrLowerBuffer // + ); + + // + Copy( + xatrConditions.atrUpperRawBuffer, + conditions.atrUpperRawBuffer // + ); + + // + Copy( + xatrConditions.atrLowerRawBuffer, + conditions.atrLowerRawBuffer // + ); + + // + Copy( + xatrConditions.atrBuffer, + conditions.atrBuffer // + ); + + // + Copy( + xatrConditions.rsiBuffer, + conditions.rsiBuffer // + ); + + // + // Conditions ... + + // + conditions.isRsiOverSold = xatrConditions.isRsiOverSold; + conditions.isRsiOverBought = xatrConditions.isRsiOverBought; + conditions.isClosedOverAtrUpper = xatrConditions.isClosedOverAtrUpper; + conditions.isClosedOverAtrLower = xatrConditions.isClosedOverAtrLower; + conditions.isClosedUnderAtrUpper = xatrConditions.isClosedUnderAtrUpper; + conditions.isClosedUnderAtrLower = xatrConditions.isClosedUnderAtrLower; + conditions.isRsiCrossedOverOverSold = xatrConditions.isRsiCrossedOverOverSold; + conditions.isRsiCrossedUnderOverSold = xatrConditions.isRsiCrossedUnderOverSold; + conditions.isRsiCrossedOverOverBought = xatrConditions.isRsiCrossedOverOverBought; + conditions.isRsiCrossedUnderOverBought = xatrConditions.isRsiCrossedUnderOverBought; + + // + // XSTR ... + + // + // Buffers ... + + // + Copy( + xstrConditions.strBuffer, + conditions.strBuffer // + ); + + // + Copy( + xstrConditions.strPriceBuffer, + conditions.strPriceBuffer // + ); + + // + Copy( + xstrConditions.strUpBuffer, + conditions.strUpBuffer // + ); + + // + Copy( + xstrConditions.strDownBuffer, + conditions.strDownBuffer // + ); + + // + Copy( + xstrConditions.strStateBuffer, + conditions.strStateBuffer // + ); + + // + // Conditions ... + + // + conditions.isStrBullish = xstrConditions.isStrBullish; + conditions.isStrBearish = xstrConditions.isStrBearish; + conditions.isStrSwitchedToBullish = xstrConditions.isStrSwitchedToBullish; + conditions.isStrSwitchedToBearish = xstrConditions.isStrSwitchedToBearish; + + // + // XCHE ... + + // + // Buffers ... + + // + Copy( + xcheConditions.le1Buffer, + conditions.le1Buffer // + ); + + // + Copy( + xcheConditions.se1Buffer, + conditions.se1Buffer // + ); + + // + Copy( + xcheConditions.le2Buffer, + conditions.le2Buffer // + ); + + // + Copy( + xcheConditions.se2Buffer, + conditions.se2Buffer // + ); + + // + Copy( + xcheConditions.le1StartBuffer, + conditions.le1StartBuffer // + ); + + // + Copy( + xcheConditions.se1StartBuffer, + conditions.se1StartBuffer // + ); + + // + Copy( + xcheConditions.le2StartBuffer, + conditions.le2StartBuffer // + ); + + // + Copy( + xcheConditions.se2StartBuffer, + conditions.se2StartBuffer // + ); + + // + // Conditions ... + + conditions.isCheBullish = xcheConditions.isCheBullish; + conditions.isCheBearish = xcheConditions.isCheBearish; + conditions.isChe1Bullish = xcheConditions.isChe1Bullish; + conditions.isChe1Bearish = xcheConditions.isChe1Bearish; + conditions.isChe2Bullish = xcheConditions.isChe2Bullish; + conditions.isChe2Bearish = xcheConditions.isChe2Bearish; + conditions.isClosedOverCheMin = xcheConditions.isClosedOverCheMin; + conditions.isClosedOverCheMax = xcheConditions.isClosedOverCheMax; + conditions.isClosedUnderCheMin = xcheConditions.isClosedUnderCheMin; + conditions.isClosedUnderCheMax = xcheConditions.isClosedUnderCheMax; + conditions.isCheSwitchedToBullish = xcheConditions.isCheSwitchedToBullish; + conditions.isCheSwitchedToBearish = xcheConditions.isCheSwitchedToBearish; + conditions.isChe1SwitchedToBullish = xcheConditions.isChe1SwitchedToBullish; + conditions.isChe1SwitchedToBearish = xcheConditions.isChe1SwitchedToBearish; + conditions.isChe2SwitchedToBullish = xcheConditions.isChe2SwitchedToBullish; + conditions.isChe2SwitchedToBearish = xcheConditions.isChe2SwitchedToBearish; + + // + // XDON ... + + // + // Buffers ... + + // + Copy( + xdonConditions.donOpenUpperBuffer, + conditions.donOpenUpperBuffer // + ); + + // + Copy( + xdonConditions.donOpenLowerBuffer, + conditions.donOpenLowerBuffer // + ); + + // + Copy( + xdonConditions.donHighUpperBuffer, + conditions.donHighUpperBuffer // + ); + + // + Copy( + xdonConditions.donHighLowerBuffer, + conditions.donHighLowerBuffer // + ); + + // + Copy( + xdonConditions.donLowUpperBuffer, + conditions.donLowUpperBuffer // + ); + + // + Copy( + xdonConditions.donLowLowerBuffer, + conditions.donLowLowerBuffer // + ); + + // + Copy( + xdonConditions.donCloseUpperBuffer, + conditions.donCloseUpperBuffer // + ); + + // + Copy( + xdonConditions.donCloseLowerBuffer, + conditions.donCloseLowerBuffer // + ); + + // + // Conditions ... + + // + // X3MA ... + + // + // Buffers ... + + // + Copy( + x3maConditions.x3maFastBuffer, + conditions.x3maFastBuffer // + ); + + // + Copy( + x3maConditions.x3maMidBuffer, + conditions.x3maMidBuffer // + ); + + // + Copy( + x3maConditions.x3maSlowBuffer, + conditions.x3maSlowBuffer // + ); + + // + Copy( + x3maConditions.x3maFastStateBuffer, + conditions.x3maFastStateBuffer // + ); + + // + Copy( + x3maConditions.x3maMidStateBuffer, + conditions.x3maMidStateBuffer // + ); + + // + Copy( + x3maConditions.x3maSlowStateBuffer, + conditions.x3maSlowStateBuffer // + ); + + // + // Conditions ... + + // + conditions.isX3MaMidBullish = x3maConditions.isX3MaMidBullish; + conditions.isX3MaMidBearish = x3maConditions.isX3MaMidBearish; + conditions.isX3MaFastBullish = x3maConditions.isX3MaFastBullish; + conditions.isX3MaFastBearish = x3maConditions.isX3MaFastBearish; + conditions.isX3MaMidNeutural = x3maConditions.isX3MaMidNeutural; + conditions.isX3MaSlowBullish = x3maConditions.isX3MaSlowBullish; + conditions.isX3MaSlowBearish = x3maConditions.isX3MaSlowBearish; + conditions.isX3MaFastOverMid = x3maConditions.isX3MaFastOverMid; + conditions.isX3MaMidOverSlow = x3maConditions.isX3MaMidOverSlow; + conditions.isX3MaFastNeutural = x3maConditions.isX3MaFastNeutural; + conditions.isX3MaSlowNeutural = x3maConditions.isX3MaSlowNeutural; + conditions.isX3MaFastUnderMid = x3maConditions.isX3MaFastUnderMid; + conditions.isX3MaMidUnderSlow = x3maConditions.isX3MaMidUnderSlow; + conditions.isX3MaBullishState = x3maConditions.isX3MaBullishState; + conditions.isX3MaBearishState = x3maConditions.isX3MaBearishState; + conditions.isX3MaNeuturalState = x3maConditions.isX3MaNeuturalState; + conditions.isX3MaBullishOrdered = x3maConditions.isX3MaBullishOrdered; + conditions.isX3MaBearishOrdered = x3maConditions.isX3MaBearishOrdered; + conditions.isX3MaSwitchedToBullishState = x3maConditions.isX3MaSwitchedToBullishState; + conditions.isX3MaSwitchedToBearishState = x3maConditions.isX3MaSwitchedToBearishState; + conditions.isX3MaSwitchedToNeuturalState = x3maConditions.isX3MaSwitchedToNeuturalState; + conditions.isX3MaSwitchedToBullishOrdered = x3maConditions.isX3MaSwitchedToBullishOrdered; + conditions.isX3MaSwitchedToBearishOrdered = x3maConditions.isX3MaSwitchedToBearishOrdered; + + // + // XVWAP ... + + // + // Buffers ... + + // + Copy( + xvwapConditions.vwapFastBuffer, + conditions.vwapFastBuffer // + ); + + // + Copy( + xvwapConditions.vwapMidBuffer, + conditions.vwapMidBuffer // + ); + + // + Copy( + xvwapConditions.vwapSlowBuffer, + conditions.vwapSlowBuffer // + ); + + // + Copy( + xvwapConditions.vwapVolumeBuffer, + conditions.vwapVolumeBuffer // + ); + + // + Copy( + xvwapConditions.vwapPriceBuffer, + conditions.vwapPriceBuffer // + ); + + // + Copy( + xvwapConditions.vwapFastStateBuffer, + conditions.vwapFastStateBuffer // + ); + + // + Copy( + xvwapConditions.vwapMidStateBuffer, + conditions.vwapMidStateBuffer // + ); + + // + Copy( + xvwapConditions.vwapSlowStateBuffer, + conditions.vwapSlowStateBuffer // + ); + + // + // Conditions ... + + // + conditions.isVWapMidBullish = xvwapConditions.isVWapMidBullish; + conditions.isVWapMidBearish = xvwapConditions.isVWapMidBearish; + conditions.isVWapFastBullish = xvwapConditions.isVWapFastBullish; + conditions.isVWapFastBearish = xvwapConditions.isVWapFastBearish; + conditions.isVWapMidNeutural = xvwapConditions.isVWapMidNeutural; + conditions.isVWapSlowBullish = xvwapConditions.isVWapSlowBullish; + conditions.isVWapSlowBearish = xvwapConditions.isVWapSlowBearish; + conditions.isVWapFastOverMid = xvwapConditions.isVWapFastOverMid; + conditions.isVWapMidOverSlow = xvwapConditions.isVWapMidOverSlow; + conditions.isVWapFastNeutural = xvwapConditions.isVWapFastNeutural; + conditions.isVWapSlowNeutural = xvwapConditions.isVWapSlowNeutural; + conditions.isVWapFastUnderMid = xvwapConditions.isVWapFastUnderMid; + conditions.isVWapMidUnderSlow = xvwapConditions.isVWapMidUnderSlow; + conditions.isVWapBullishState = xvwapConditions.isVWapBullishState; + conditions.isVWapBearishState = xvwapConditions.isVWapBearishState; + conditions.isVWapNeuturalState = xvwapConditions.isVWapNeuturalState; + conditions.isVWapBullishOrdered = xvwapConditions.isVWapBullishOrdered; + conditions.isVWapBearishOrdered = xvwapConditions.isVWapBearishOrdered; + conditions.isVWapSwitchedToBullishState = xvwapConditions.isVWapSwitchedToBullishState; + conditions.isVWapSwitchedToBearishState = xvwapConditions.isVWapSwitchedToBearishState; + conditions.isVWapSwitchedToNeuturalState = xvwapConditions.isVWapSwitchedToNeuturalState; + conditions.isVWapSwitchedToBullishOrdered = xvwapConditions.isVWapSwitchedToBullishOrdered; + conditions.isVWapSwitchedToBearishOrdered = xvwapConditions.isVWapSwitchedToBearishOrdered; + + // + // XICH ... + + // + // Buffers ... + + // + Copy( + xichConditions.kijunSenBuffer, + conditions.kijunSenBuffer // + ); + + // + Copy( + xichConditions.tenkanSenBuffer, + conditions.tenkanSenBuffer // + ); + + // + Copy( + xichConditions.chikouSpanBuffer, + conditions.chikouSpanBuffer // + ); + + // + Copy( + xichConditions.senkouSpanABuffer, + conditions.senkouSpanABuffer // + ); + + // + Copy( + xichConditions.senkouSpanBBuffer, + conditions.senkouSpanBBuffer // + ); + + // + // Conditions ... + + // + conditions.isTenkanSenOverKijunSen = xichConditions.isTenkanSenOverKijunSen; + conditions.isTenkanSenUnderKijunSen = xichConditions.isTenkanSenUnderKijunSen; + + // + conditions.isTenkanSenCrossedOverKijunSen = xichConditions.isTenkanSenCrossedOverKijunSen; + conditions.isTenkanSenCrossedUnderKijunSen = xichConditions.isTenkanSenCrossedUnderKijunSen; + + // + conditions.isSenkouSpanAOverB = xichConditions.isSenkouSpanAOverB; + conditions.isSenkouSpanAUnderB = xichConditions.isSenkouSpanAUnderB; + + // + conditions.isSenkouSpanACrossedOverB = xichConditions.isSenkouSpanACrossedOverB; + conditions.isSenkouSpanACrossedUnderB = xichConditions.isSenkouSpanACrossedUnderB; + + // + conditions.tenKijMax = MathMax(xichConditions.tenkanSenBuffer[cIDX], xichConditions.kijunSenBuffer[cIDX]); + conditions.tenKijMin = MathMin(xichConditions.tenkanSenBuffer[cIDX], xichConditions.kijunSenBuffer[cIDX]); + conditions.senkouMax = MathMax(xichConditions.senkouSpanABuffer[cIDX], xichConditions.senkouSpanBBuffer[cIDX]); + conditions.senkouMin = MathMin(xichConditions.senkouSpanABuffer[cIDX], xichConditions.senkouSpanBBuffer[cIDX]); + + // + // XDELTA ... + + // + // Buffers ... + + // + Copy( + xdeltaConditions.deltaBuffer, + conditions.deltaBuffer // + ); + + // + Copy( + xdeltaConditions.deltaMaBuffer, + conditions.deltaMaBuffer // + ); + + // + Copy( + xdeltaConditions.deltaStateBuffer, + conditions.deltaStateBuffer // + ); + + // + // Conditions ... + + // + conditions.isDeltaBullish = xdeltaConditions.isDeltaBullish; + conditions.isDeltaBearish = xdeltaConditions.isDeltaBearish; + conditions.isDeltaSwitchedToBullish = xdeltaConditions.isDeltaSwitchedToBullish; + conditions.isDeltaSwitchedToBearish = xdeltaConditions.isDeltaSwitchedToBearish; + + // + conditions.isDeltaOverMa = xdeltaConditions.isDeltaOverMa; + conditions.isDeltaUnderMa = xdeltaConditions.isDeltaUnderMa; + conditions.isDeltaCrossedOverMa = xdeltaConditions.isDeltaCrossedOverMa; + conditions.isDeltaCrossedUnderMa = xdeltaConditions.isDeltaCrossedUnderMa; + + // + // XVOLUME ... + + // + // Buffers ... + + // + Copy( + xvolumeConditions.bullishVolumeBuffer, + conditions.bullishVolumeBuffer // + ); + + // + Copy( + xvolumeConditions.bullishVolumeMaBuffer, + conditions.bullishVolumeMaBuffer // + ); + + // + Copy( + xvolumeConditions.bearishVolumeBuffer, + conditions.bearishVolumeBuffer // + ); + + // + Copy( + xvolumeConditions.bearishVolumeMaBuffer, + conditions.bearishVolumeMaBuffer // + ); + + // + // Conditions ... + + // + conditions.isBullishVolumeOverMa = xvolumeConditions.isBullishVolumeOverMa; + conditions.isBullishVolumeCrossedOverMa = xvolumeConditions.isBullishVolumeCrossedOverMa; + + // + conditions.isBullishVolumeUnderMa = xvolumeConditions.isBullishVolumeUnderMa; + conditions.isBullishVolumeCrossedUnderMa = xvolumeConditions.isBullishVolumeCrossedUnderMa; + + // + conditions.isBullishVolumeIncreased = xvolumeConditions.isBullishVolumeIncreased; + conditions.isBullishVolumeSwitchedToIncreased = xvolumeConditions.isBullishVolumeSwitchedToIncreased; + + // + conditions.isBullishVolumeDecreased = xvolumeConditions.isBullishVolumeDecreased; + conditions.isBullishVolumeSwitchedToDecreased = xvolumeConditions.isBullishVolumeSwitchedToDecreased; + + // + conditions.isBearishVolumeOverMa = xvolumeConditions.isBearishVolumeOverMa; + conditions.isBearishVolumeCrossedOverMa = xvolumeConditions.isBearishVolumeCrossedOverMa; + + // + conditions.isBearishVolumeUnderMa = xvolumeConditions.isBearishVolumeUnderMa; + conditions.isBearishVolumeCrossedUnderMa = xvolumeConditions.isBearishVolumeCrossedUnderMa; + + // + conditions.isBearishVolumeIncreased = xvolumeConditions.isBearishVolumeIncreased; + conditions.isBearishVolumeSwitchedToIncreased = xvolumeConditions.isBearishVolumeSwitchedToIncreased; + + // + conditions.isBearishVolumeDecreased = xvolumeConditions.isBearishVolumeDecreased; + conditions.isBearishVolumeSwitchedToDecreased = xvolumeConditions.isBearishVolumeSwitchedToDecreased; + + // + conditions.isVolumeSwitchedToBullish = xvolumeConditions.isVolumeSwitchedToBullish; + conditions.isVolumeSwitchedToBearish = xvolumeConditions.isVolumeSwitchedToBearish; + + // + conditions.isBullishVolumeMaOverBearishVolumeMa = xvolumeConditions.isBullishVolumeMaOverBearishVolumeMa; + conditions.isBullishVolumeMaUnderBearishVolumeMa = xvolumeConditions.isBullishVolumeMaUnderBearishVolumeMa; + + // + // Slopes ... + + // + double rsiSlope = GetSlope(conditions.rsiBuffer, pIDX, cIDX); + double strSlope = GetSlope(conditions.strBuffer, pIDX, cIDX); + double atrUpperSlope = GetSlope(conditions.atrUpperBuffer, pIDX, cIDX); + double atrLowerSlope = GetSlope(conditions.atrLowerBuffer, pIDX, cIDX); + double vwapFastSlope = GetSlope(conditions.vwapFastBuffer, pIDX, cIDX); + double vwapMidSlope = GetSlope(conditions.vwapMidBuffer, pIDX, cIDX); + double vwapSlowSlope = GetSlope(conditions.vwapSlowBuffer, pIDX, cIDX); + + // + bool isRsiSlopeBullish = rsiSlope > 0; + bool isStrSlopeBullish = strSlope > 0; + bool isAtrUpperSlopeBullish = atrUpperSlope > 0; + bool isAtrLowerSlopeBullish = atrLowerSlope > 0; + bool isVwapFastSlopeBullish = vwapFastSlope > 0; + bool isVwapMidSlopeBullish = vwapMidSlope > 0; + bool isVwapSlowSlopeBullish = vwapSlowSlope > 0; + + // + bool isRsiSlopeBearish = rsiSlope < 0; + bool isStrSlopeBearish = strSlope < 0; + bool isAtrUpperSlopeBearish = atrUpperSlope < 0; + bool isAtrLowerSlopeBearish = atrLowerSlope < 0; + bool isVwapFastSlopeBearish = vwapFastSlope < 0; + bool isVwapMidSlopeBearish = vwapMidSlope < 0; + bool isVwapSlowSlopeBearish = vwapSlowSlope < 0; + + // + conditions.rsiSlope = rsiSlope; + conditions.strSlope = strSlope; + conditions.vwapMidSlope = vwapMidSlope; + conditions.vwapSlowSlope = vwapSlowSlope; + conditions.atrUpperSlope = atrUpperSlope; + conditions.atrLowerSlope = atrLowerSlope; + conditions.vwapFastSlope = vwapFastSlope; + conditions.isRsiSlopeBearish = isRsiSlopeBearish; + conditions.isStrSlopeBearish = isStrSlopeBearish; + conditions.isRsiSlopeBullish = isRsiSlopeBullish; + conditions.isStrSlopeBullish = isStrSlopeBullish; + conditions.isVwapMidSlopeBearish = isVwapMidSlopeBearish; + conditions.isVwapMidSlopeBullish = isVwapMidSlopeBullish; + conditions.isAtrUpperSlopeBearish = isAtrUpperSlopeBearish; + conditions.isAtrLowerSlopeBearish = isAtrLowerSlopeBearish; + conditions.isVwapFastSlopeBearish = isVwapFastSlopeBearish; + conditions.isVwapSlowSlopeBearish = isVwapSlowSlopeBearish; + conditions.isAtrUpperSlopeBullish = isAtrUpperSlopeBullish; + conditions.isAtrLowerSlopeBullish = isAtrLowerSlopeBullish; + conditions.isVwapFastSlopeBullish = isVwapFastSlopeBullish; + conditions.isVwapSlowSlopeBullish = isVwapSlowSlopeBullish; + + // + // Complex Conditions ... + + // + double x3maFast = conditions.x3maFastBuffer[cIDX]; + double x3maMid = conditions.x3maMidBuffer[cIDX]; + double x3maSlow = conditions.x3maSlowBuffer[cIDX]; + + // + double x3mas[3] = { + x3maFast, + x3maMid, + x3maSlow // + }; + + // + double x3maMin = GetMin(x3mas); + double x3maMax = GetMax(x3mas); + + // + bool isX3MaFatsOverMid = conditions.x3maFastBuffer[cIDX] > conditions.x3maMidBuffer[cIDX]; + bool isX3MaFatsOverMidPrev = conditions.x3maFastBuffer[pIDX] > conditions.x3maMidBuffer[pIDX]; + + // + bool isX3MaFatsUnderMid = conditions.x3maFastBuffer[cIDX] < conditions.x3maMidBuffer[cIDX]; + bool isX3MaFatsUnderMidPrev = conditions.x3maFastBuffer[pIDX] < conditions.x3maMidBuffer[pIDX]; + + // + bool isX3MaFatsOverSlow = conditions.x3maFastBuffer[cIDX] > conditions.x3maSlowBuffer[cIDX]; + bool isX3MaFatsOverSlowPrev = conditions.x3maFastBuffer[pIDX] > conditions.x3maSlowBuffer[pIDX]; + + // + bool isX3MaFatsUnderSlow = conditions.x3maFastBuffer[cIDX] < conditions.x3maSlowBuffer[cIDX]; + bool isX3MaFatsUnderSlowPrev = conditions.x3maFastBuffer[pIDX] < conditions.x3maSlowBuffer[pIDX]; + + // + bool isX3MaFastCrossedOverMid = isX3MaFatsOverMid && + !isX3MaFatsOverMidPrev; + bool isX3MaFastCrossedUnderMid = isX3MaFatsUnderMid && + !isX3MaFatsUnderMidPrev; + + // + bool isX3MaFastCrossedOverSlow = isX3MaFatsOverSlow && + !isX3MaFatsOverSlowPrev; + bool isX3MaFastCrossedUnderSlow = isX3MaFatsUnderSlow && + !isX3MaFatsUnderSlowPrev; + + // + bool isClosedOverX3MaMin = cBar.close > x3maMin; + bool isClosedUnderX3MaMin = cBar.close < x3maMin; + + // + bool isClosedOverX3MaMax = cBar.close > x3maMax; + bool isClosedUnderX3MaMax = cBar.close < x3maMax; + + // + // + // + + // + double vwapFast = conditions.vwapFastBuffer[cIDX]; + double vwapMid = conditions.vwapMidBuffer[cIDX]; + double vwapSlow = conditions.vwapSlowBuffer[cIDX]; + + // + double vwaps[3] = { + vwapFast, + vwapMid, + vwapSlow // + }; + + // + double vwapMin = GetMin(vwaps); + double vwapMax = GetMax(vwaps); + + // + bool isVWapFatsOverMid = conditions.vwapFastBuffer[cIDX] > conditions.vwapMidBuffer[cIDX]; + bool isVWapFatsOverMidPrev = conditions.vwapFastBuffer[pIDX] > conditions.vwapMidBuffer[pIDX]; + + // + bool isVWapFatsUnderMid = conditions.vwapFastBuffer[cIDX] < conditions.vwapMidBuffer[cIDX]; + bool isVWapFatsUnderMidPrev = conditions.vwapFastBuffer[pIDX] < conditions.vwapMidBuffer[pIDX]; + + // + bool isVWapFatsOverSlow = conditions.vwapFastBuffer[cIDX] > conditions.vwapSlowBuffer[cIDX]; + bool isVWapFatsOverSlowPrev = conditions.vwapFastBuffer[pIDX] > conditions.vwapSlowBuffer[pIDX]; + + // + bool isVWapFatsUnderSlow = conditions.vwapFastBuffer[cIDX] < conditions.vwapSlowBuffer[cIDX]; + bool isVWapFatsUnderSlowPrev = conditions.vwapFastBuffer[pIDX] < conditions.vwapSlowBuffer[pIDX]; + + // + bool isVWapFastCrossedOverMid = isVWapFatsOverMid && + !isVWapFatsOverMidPrev; + bool isVWapFastCrossedUnderMid = isVWapFatsUnderMid && + !isVWapFatsUnderMidPrev; + + // + bool isVWapFastCrossedOverSlow = isVWapFatsOverSlow && + !isVWapFatsOverSlowPrev; + bool isVWapFastCrossedUnderSlow = isVWapFatsUnderSlow && + !isVWapFatsUnderSlowPrev; + + // + bool isClosedOverVWapMin = cBar.close > vwapMin; + bool isClosedUnderVWapMin = cBar.close < vwapMin; + + // + bool isClosedOverVWapMax = cBar.close > vwapMax; + bool isClosedUnderVWapMax = cBar.close < vwapMax; + + // + bool isSarEqualsToPeak = + conditions.sarBuffer[cIDX] == conditions.peaksBuffer[cIDX]; + bool isSarEqualsToVale = + conditions.sarBuffer[cIDX] == conditions.valesBuffer[cIDX]; + + // + bool isSarIncreased = conditions.sarBuffer[cIDX] > conditions.sarBuffer[pIDX]; + bool isSarDecreased = conditions.sarBuffer[cIDX] < conditions.sarBuffer[pIDX]; + + // + double prevSar = conditions.sarBuffer[pIDX]; + double prevStr = conditions.strBuffer[pIDX]; + double prevCheLE1 = conditions.le1Buffer[pIDX]; + double prevCheLE2 = conditions.le2Buffer[pIDX]; + double prevCheSE1 = conditions.se1Buffer[pIDX]; + double prevCheSE2 = conditions.se2Buffer[pIDX]; + double prevAtrUpper = conditions.atrUpperBuffer[pIDX]; + double prevAtrLower = conditions.atrLowerBuffer[pIDX]; + + // + double ches[]; + if (prevCheLE1 != EMPTY_VALUE) + { + // + Add( + prevCheLE1, + ches // + ); + } + if (prevCheLE2 != EMPTY_VALUE) + { + // + Add( + prevCheLE2, + ches // + ); + } + if (prevCheSE1 != EMPTY_VALUE) + { + // + Add( + prevCheSE1, + ches // + ); + } + if (prevCheSE2 != EMPTY_VALUE) + { + // + Add( + prevCheSE2, + ches // + ); + } + + // + double cheMin = GetMin(ches); + double cheMax = GetMax(ches); + + // + bool isSarCrossedUnderPeak = + conditions.sarBuffer[cIDX] < conditions.peaksBuffer[cIDX] && + !(conditions.sarBuffer[pIDX] < conditions.peaksBuffer[pIDX]); + bool isSarCrossedOverVale = + conditions.sarBuffer[cIDX] > conditions.valesBuffer[cIDX] && + !(conditions.sarBuffer[pIDX] > conditions.valesBuffer[pIDX]); + + // + bool isStrEqualsToPeak = + conditions.strBuffer[cIDX] == conditions.peaksBuffer[cIDX]; + bool isStrEqualsToVale = + conditions.strBuffer[cIDX] == conditions.valesBuffer[cIDX]; + + // + bool isStrCrossedUnderPeak = + conditions.strBuffer[cIDX] < conditions.peaksBuffer[cIDX] && + !(conditions.strBuffer[pIDX] < conditions.peaksBuffer[pIDX]); + bool isStrCrossedOverVale = + conditions.strBuffer[cIDX] > conditions.valesBuffer[cIDX] && + !(conditions.strBuffer[pIDX] > conditions.valesBuffer[pIDX]); + + // + bool isPeakOverAtrUpper = + conditions.peaksBuffer[cIDX] > conditions.atrUpperBuffer[cIDX]; + bool isValeUnderAtrLower = + conditions.valesBuffer[cIDX] > conditions.atrLowerBuffer[cIDX]; + + // + bool isNewPeakOverAtrUpper = + isPeakOverAtrUpper && + conditions.isNewPeak; + bool isNewValeUnderAtrLower = + isValeUnderAtrLower && + conditions.isNewVale; + + // + bool isStrUpperOverPeak = + conditions.strBuffer[cIDX] > conditions.peaksBuffer[cIDX]; + bool isStrUpperOverPeakPrev = + conditions.strBuffer[pIDX] > conditions.peaksBuffer[pIDX]; + + // + bool isStrUpperUnderPeak = + conditions.strBuffer[cIDX] < conditions.peaksBuffer[cIDX]; + bool isStrUpperUnderPeakPrev = + conditions.strBuffer[pIDX] < conditions.peaksBuffer[pIDX]; + + // + bool isStrUpperCrossedOverPeak = isStrUpperOverPeak && + !isStrUpperOverPeakPrev; + bool isStrUpperCrossedUnderPeak = isStrUpperUnderPeak && + !isStrUpperUnderPeakPrev; + + // + bool isStrLowerOverVale = + conditions.strBuffer[cIDX] > conditions.valesBuffer[cIDX]; + bool isStrLowerOverValePrev = + conditions.strBuffer[pIDX] > conditions.valesBuffer[pIDX]; + + // + bool isStrLowerUnderVale = + conditions.strBuffer[cIDX] < conditions.valesBuffer[cIDX]; + bool isStrLowerUnderValePrev = + conditions.strBuffer[pIDX] < conditions.valesBuffer[pIDX]; + + // + bool isStrLowerCrossedOverVale = isStrLowerOverVale && + !isStrLowerOverValePrev; + bool isStrLowerCrossedUnderVale = isStrLowerUnderVale && + !isStrLowerUnderValePrev; + + // + bool isDonHighUpperEqualsToPeak = + conditions.donHighUpperBuffer[cIDX] == conditions.peaksBuffer[cIDX]; + bool isDonLowLowerEqualsToVale = + conditions.donLowLowerBuffer[cIDX] == conditions.valesBuffer[cIDX]; + + // + bool isStrUpperOverAtrUpper = + conditions.strUpBuffer[cIDX] > conditions.atrUpperBuffer[cIDX]; + bool isStrUpperOverAtrUpperPrev = + conditions.strUpBuffer[pIDX] > conditions.atrUpperBuffer[pIDX]; + bool isStrUpperCrossedOverAtrUpper = isStrUpperOverAtrUpper && + !isStrUpperOverAtrUpperPrev; + + // + bool isStrUpperUnderAtrUpper = + conditions.strUpBuffer[cIDX] < conditions.atrUpperBuffer[cIDX]; + bool isStrUpperUnderAtrUpperPrev = + conditions.strUpBuffer[pIDX] < conditions.atrUpperBuffer[pIDX]; + bool isStrUpperCrossedUnderAtrUpper = isStrUpperUnderAtrUpper && + !isStrUpperUnderAtrUpperPrev; + + // + bool isStrLowerOverAtrLower = + conditions.strDownBuffer[cIDX] > conditions.atrLowerBuffer[cIDX]; + bool isStrLowerOverAtrLowerPrev = + conditions.strDownBuffer[pIDX] > conditions.atrLowerBuffer[pIDX]; + bool isStrLowerCrossedOverAtrLower = isStrLowerOverAtrLower && + !isStrLowerOverAtrLowerPrev; + + // + bool isStrLowerUnderAtrLower = + conditions.strDownBuffer[cIDX] < conditions.atrLowerBuffer[cIDX]; + bool isStrLowerUnderAtrLowerPrev = + conditions.strDownBuffer[pIDX] < conditions.atrLowerBuffer[pIDX]; + bool isStrLowerCrossedUnderAtrLower = isStrLowerUnderAtrLower && + !isStrLowerUnderAtrLowerPrev; + + // + bool isStrUpperOverDonHighUpper = + conditions.strUpBuffer[cIDX] > conditions.donHighUpperBuffer[cIDX]; + bool isStrUpperOverDonHighUpperPrev = + conditions.strUpBuffer[pIDX] > conditions.donHighUpperBuffer[pIDX]; + bool isStrUpperCrossedOverDonHighUpper = isStrUpperOverDonHighUpper && + !isStrUpperOverDonHighUpperPrev; + + // + bool isStrUpperUnderDonHighUpper = + conditions.strUpBuffer[cIDX] < conditions.donHighUpperBuffer[cIDX]; + bool isStrUpperUnderDonHighUpperPrev = + conditions.strUpBuffer[pIDX] < conditions.donHighUpperBuffer[pIDX]; + bool isStrUpperCrossedUnderDonHighUpper = isStrUpperUnderDonHighUpper && + !isStrUpperUnderDonHighUpperPrev; + + // + bool isStrLowerOverDonLowLower = + conditions.strDownBuffer[cIDX] > conditions.donLowLowerBuffer[cIDX]; + bool isStrLowerOverDonLowLowerPrev = + conditions.strDownBuffer[pIDX] > conditions.donLowLowerBuffer[pIDX]; + bool isStrLowerCrossedOverDonLowLower = isStrLowerOverDonLowLower && + !isStrLowerOverDonLowLowerPrev; + + // + bool isStrLowerUnderDonLowLower = + conditions.strDownBuffer[cIDX] < conditions.donLowLowerBuffer[cIDX]; + bool isStrLowerUnderDonLowLowerPrev = + conditions.strDownBuffer[pIDX] < conditions.donLowLowerBuffer[pIDX]; + bool isStrLowerCrossedUnderDonLowLower = isStrLowerUnderDonLowLower && + !isStrLowerUnderDonLowLowerPrev; + + // + bool isAtrUpperOverPeak = conditions.atrUpperBuffer[cIDX] > conditions.peaksBuffer[cIDX]; + bool isAtrUpperEqualsToPeak = conditions.atrUpperBuffer[cIDX] == conditions.peaksBuffer[cIDX]; + + // + bool isAtrUpperCrossedUpPeak = conditions.atrUpperBuffer[cIDX] > conditions.peaksBuffer[cIDX] && + !(conditions.atrUpperBuffer[cIDX] > conditions.peaksBuffer[cIDX]); + bool isAtrUpperCrossedDownPeak = conditions.atrUpperBuffer[cIDX] < conditions.peaksBuffer[cIDX] && + !(conditions.atrUpperBuffer[cIDX] < conditions.peaksBuffer[cIDX]); + + // + bool isAtrLowerUnderVale = conditions.atrUpperBuffer[cIDX] < conditions.valesBuffer[cIDX]; + bool isAtrLowerEqualsToVale = conditions.atrUpperBuffer[cIDX] == conditions.valesBuffer[cIDX]; + + // + bool isAtrLowerCrossedUpVale = conditions.atrUpperBuffer[cIDX] > conditions.valesBuffer[cIDX] && + !(conditions.atrUpperBuffer[cIDX] > conditions.valesBuffer[cIDX]); + bool isAtrLowerCrossedDownVale = conditions.atrUpperBuffer[cIDX] < conditions.valesBuffer[cIDX] && + !(conditions.atrUpperBuffer[cIDX] < conditions.valesBuffer[cIDX]); + + // + conditions.cheMin = cheMin; + conditions.cheMax = cheMax; + conditions.x3maMin = x3maMin; + conditions.x3maMax = x3maMax; + conditions.vwapMin = vwapMin; + conditions.vwapMax = vwapMax; + + // + conditions.isSarIncreased = isSarIncreased; + conditions.isSarDecreased = isSarDecreased; + conditions.isSarEqualsToPeak = isSarEqualsToPeak; + conditions.isSarEqualsToVale = isSarEqualsToVale; + conditions.isStrEqualsToPeak = isStrEqualsToPeak; + conditions.isStrEqualsToVale = isStrEqualsToVale; + conditions.isX3MaFatsOverMid = isX3MaFatsOverMid; + conditions.isX3MaFatsUnderMid = isX3MaFatsUnderMid; + conditions.isX3MaFatsOverSlow = isX3MaFatsOverSlow; + conditions.isStrUpperOverPeak = isStrUpperOverPeak; + conditions.isPeakOverAtrUpper = isPeakOverAtrUpper; + conditions.isStrLowerOverVale = isStrLowerOverVale; + conditions.isAtrUpperOverPeak = isAtrUpperOverPeak; + conditions.isClosedOverX3MaMin = isClosedOverX3MaMin; + conditions.isClosedOverX3MaMax = isClosedOverX3MaMax; + conditions.isX3MaFatsUnderSlow = isX3MaFatsUnderSlow; + conditions.isAtrLowerUnderVale = isAtrLowerUnderVale; + conditions.isStrLowerUnderVale = isStrLowerUnderVale; + conditions.isStrUpperUnderPeak = isStrUpperUnderPeak; + conditions.isValeUnderAtrLower = isValeUnderAtrLower; + conditions.isClosedOverVWapMin = isClosedOverVWapMin; + conditions.isClosedOverVWapMax = isClosedOverVWapMax; + conditions.isClosedUnderX3MaMin = isClosedUnderX3MaMin; + conditions.isClosedUnderX3MaMax = isClosedUnderX3MaMax; + conditions.isClosedUnderVWapMin = isClosedUnderVWapMin; + conditions.isClosedUnderVWapMax = isClosedUnderVWapMax; + conditions.isSarCrossedOverVale = isSarCrossedOverVale; + conditions.isStrCrossedOverVale = isStrCrossedOverVale; + conditions.isX3MaFatsOverMidPrev = isX3MaFatsOverMidPrev; + conditions.isSarCrossedUnderPeak = isSarCrossedUnderPeak; + conditions.isStrCrossedUnderPeak = isStrCrossedUnderPeak; + conditions.isNewPeakOverAtrUpper = isNewPeakOverAtrUpper; + conditions.isX3MaFatsUnderMidPrev = isX3MaFatsUnderMidPrev; + conditions.isX3MaFatsOverSlowPrev = isX3MaFatsOverSlowPrev; + conditions.isAtrUpperEqualsToPeak = isAtrUpperEqualsToPeak; + conditions.isAtrLowerEqualsToVale = isAtrLowerEqualsToVale; + conditions.isNewValeUnderAtrLower = isNewValeUnderAtrLower; + conditions.isStrUpperOverAtrUpper = isStrUpperOverAtrUpper; + conditions.isStrLowerOverAtrLower = isStrLowerOverAtrLower; + conditions.isX3MaFatsUnderSlowPrev = isX3MaFatsUnderSlowPrev; + conditions.isStrUpperUnderAtrUpper = isStrUpperUnderAtrUpper; + conditions.isStrLowerUnderAtrLower = isStrLowerUnderAtrLower; + conditions.isAtrUpperCrossedUpPeak = isAtrUpperCrossedUpPeak; + conditions.isAtrLowerCrossedUpVale = isAtrLowerCrossedUpVale; + conditions.isX3MaFastCrossedOverMid = isX3MaFastCrossedOverMid; + conditions.isVWapFastCrossedOverMid = isVWapFastCrossedOverMid; + conditions.isX3MaFastCrossedUnderMid = isX3MaFastCrossedUnderMid; + conditions.isX3MaFastCrossedOverSlow = isX3MaFastCrossedOverSlow; + conditions.isAtrUpperCrossedDownPeak = isAtrUpperCrossedDownPeak; + conditions.isAtrLowerCrossedDownVale = isAtrLowerCrossedDownVale; + conditions.isVWapFastCrossedUnderMid = isVWapFastCrossedUnderMid; + conditions.isDonLowLowerEqualsToVale = isDonLowLowerEqualsToVale; + conditions.isStrUpperCrossedOverPeak = isStrUpperCrossedOverPeak; + conditions.isStrLowerCrossedOverVale = isStrLowerCrossedOverVale; + conditions.isStrLowerOverDonLowLower = isStrLowerOverDonLowLower; + conditions.isVWapFastCrossedOverSlow = isVWapFastCrossedOverSlow; + conditions.isX3MaFastCrossedUnderSlow = isX3MaFastCrossedUnderSlow; + conditions.isVWapFastCrossedUnderSlow = isVWapFastCrossedUnderSlow; + conditions.isStrUpperOverDonHighUpper = isStrUpperOverDonHighUpper; + conditions.isStrLowerUnderDonLowLower = isStrLowerUnderDonLowLower; + conditions.isDonHighUpperEqualsToPeak = isDonHighUpperEqualsToPeak; + conditions.isStrUpperCrossedUnderPeak = isStrUpperCrossedUnderPeak; + conditions.isStrLowerCrossedUnderVale = isStrLowerCrossedUnderVale; + conditions.isStrUpperUnderDonHighUpper = isStrUpperUnderDonHighUpper; + conditions.isStrLowerCrossedOverAtrLower = isStrLowerCrossedOverAtrLower; + conditions.isStrUpperCrossedOverAtrUpper = isStrUpperCrossedOverAtrUpper; + conditions.isStrUpperCrossedUnderAtrUpper = isStrUpperCrossedUnderAtrUpper; + conditions.isStrLowerCrossedUnderAtrLower = isStrLowerCrossedUnderAtrLower; + conditions.isStrLowerCrossedOverDonLowLower = isStrLowerCrossedOverDonLowLower; + conditions.isStrUpperCrossedOverDonHighUpper = isStrUpperCrossedOverDonHighUpper; + conditions.isStrLowerCrossedUnderDonLowLower = isStrLowerCrossedUnderDonLowLower; + conditions.isStrUpperCrossedUnderDonHighUpper = isStrUpperCrossedUnderDonHighUpper; + + // + // + xpvConditions.Clean(); + xhkConditions.Clean(); + xichConditions.Clean(); + xmasConditions.Clean(); + xatrConditions.Clean(); + xstrConditions.Clean(); + xcheConditions.Clean(); + xdonConditions.Clean(); + x3maConditions.Clean(); + xvwapConditions.Clean(); + + // + Free(); + + // + return result; + } + + // + protected: + // + + // + private: + // + + // + string mSymbol; // Trading Symbol + ENUM_TIMEFRAMES mPeriod; // Trading Period + + // + // Inputs ... + X121Inputs mInputs; + X121XCCInputs xccInputs; + X121XPVInputs xpvInputs; + X121XHKInputs xhkInputs; + X121XICHInputs xichInputs; + X121XMASInputs xmasInputs; + X121XATRInputs xatrInputs; + X121XDONInputs xdonInputs; + X121XSTRInputs xstrInputs; + X121XCHEInputs xcheInputs; + X121X3MAInputs x3maInputs; + X121XVWAPInputs xvwapInputs; + X121XDELTAInputs xdeltaInputs; + X121XVOLUMEInputs xvolumeInputs; + + // + int mRSIHandler; +}; + +// \ No newline at end of file diff --git a/Documents/BKP/x121.helper.bkp.mq5 b/Documents/BKP/x121.helper.bkp.mq5 new file mode 100644 index 00000000..1487eca5 --- /dev/null +++ b/Documents/BKP/x121.helper.bkp.mq5 @@ -0,0 +1,393 @@ + + // // + // // XICH ... + // X121XICHConditions xichConditions; + // result = GetICHConditions( + // xichConditions, + // barIndex, + // loopback // + // ); + // if (!result) + // { + // // + // xpvConditions.Clean(); + // xhkConditions.Clean(); + // xichConditions.Clean(); + + // // + // return result; + // } + + // // + // // XDON ... + // X121XDONConditions xdonConditions; + // result = GetDONConditions( + // xdonConditions, + // barIndex, + // loopback // + // ); + // if (!result) + // { + // // + // xpvConditions.Clean(); + // xhkConditions.Clean(); + // xichConditions.Clean(); + // xmasConditions.Clean(); + // xatrConditions.Clean(); + // xstrConditions.Clean(); + // xcheConditions.Clean(); + // xdonConditions.Clean(); + + // // + // return result; + // } + + // // + // // XDELTA ... + // X121XDELTAConditions xdeltaConditions; + // result = GetDELTAConditions( + // xdeltaConditions, + // barIndex, + // loopback // + // ); + // if (!result) + // { + // // + // xpvConditions.Clean(); + // xhkConditions.Clean(); + // xichConditions.Clean(); + // xmasConditions.Clean(); + // xatrConditions.Clean(); + // xstrConditions.Clean(); + // xcheConditions.Clean(); + // xdonConditions.Clean(); + // x3maConditions.Clean(); + // xvwapConditions.Clean(); + // xdeltaConditions.Clean(); + + // // + // return result; + // } + + // // + // // XVOLUME ... + // X121XVOLUMEConditions xvolumeConditions; + // result = GetVOLUMEConditions( + // xvolumeConditions, + // barIndex, + // loopback // + // ); + // if (!result) + // { + // // + // xpvConditions.Clean(); + // xhkConditions.Clean(); + // xichConditions.Clean(); + // xmasConditions.Clean(); + // xatrConditions.Clean(); + // xstrConditions.Clean(); + // xcheConditions.Clean(); + // xdonConditions.Clean(); + // x3maConditions.Clean(); + // xvwapConditions.Clean(); + // xdeltaConditions.Clean(); + // xvolumeConditions.Clean(); + + // // + // return result; + // } + + // + // xichConditions.Clean(); + // xdonConditions.Clean(); + // xdeltaConditions.Clean(); + // xvolumeConditions.Clean(); + + + // // + // // XICH ... + // bool GetICHConditions( + // X121XICHConditions &conditions, // + // int barIndex = 0, // + // int loopback = 5 // + // ) + // { + // // + // bool result = false; + + // // + // result = xichHelper.GetConditions( + // conditions, + // barIndex, + // loopback // + // ); + + // // + // return result; + // } + + // // + // // XDON ... + // bool GetDONConditions( + // X121XDONConditions &conditions, // + // int barIndex = 0, // + // int loopback = 5 // + // ) + // { + // // + // bool result = false; + + // // + // result = xdonHelper.GetConditions( + // conditions, + // barIndex, + // loopback // + // ); + + // // + // return result; + // } + + // // + // // XDELTA ... + // bool GetDELTAConditions( + // X121XDELTAConditions &conditions, // + // int barIndex = 0, // + // int loopback = 5 // + // ) + // { + // // + // bool result = false; + + // // + // result = xdeltaHelper.GetConditions( + // conditions, + // barIndex, + // loopback // + // ); + + // // + // return result; + // } + + // // + // // XVOLUME ... + // bool GetVOLUMEConditions( + // X121XVOLUMEConditions &conditions, // + // int barIndex = 0, // + // int loopback = 5 // + // ) + // { + // // + // bool result = false; + + // // + // result = xvolumeHelper.GetConditions( + // conditions, + // barIndex, + // loopback // + // ); + + // // + // return result; + // } + + + // + // xichInputs = inputs.xichInputs; + // xdonInputs = inputs.xdonInputs; + // xdeltaInputs = inputs.xdeltaInputs; + // xvolumeInputs = inputs.xvolumeInputs; + + + + // // + // // XICH ... + // xichHelper = new XCX121XICHHelper(); + // result = xichHelper.Init( + // symbol, + // period, + // xichInputs // + // ); + // if (!result) + // { + // // + // ZeroMemory(xccHelper); + // ZeroMemory(xpvHelper); + // ZeroMemory(xhkHelper); + // ZeroMemory(xmasHelper); + // ZeroMemory(xatrHelper); + // ZeroMemory(xstrHelper); + // ZeroMemory(xcheHelper); + // ZeroMemory(x3maHelper); + // ZeroMemory(xvwapHelper); + + // // + // // ZeroMemory(xichHelper); + // // ZeroMemory(xdonHelper); + // // ZeroMemory(xdeltaHelper); + // // ZeroMemory(xvolumeHelper); + + // // + // return result; + // } + + // // + // // XDON ... + // xdonHelper = new XCX121XDONHelper(); + // result = xdonHelper.Init( + // symbol, + // period, + // xdonInputs // + // ); + // if (!result) + // { + // // + // ZeroMemory(xccHelper); + // ZeroMemory(xpvHelper); + // ZeroMemory(xhkHelper); + // ZeroMemory(xmasHelper); + // ZeroMemory(xatrHelper); + // ZeroMemory(xstrHelper); + // ZeroMemory(xcheHelper); + // ZeroMemory(x3maHelper); + // ZeroMemory(xvwapHelper); + + // // + // // ZeroMemory(xichHelper); + // // ZeroMemory(xdonHelper); + // // ZeroMemory(xdeltaHelper); + // // ZeroMemory(xvolumeHelper); + + // // + // return result; + // } + + // // + // // XDELTA ... + // xdeltaHelper = new XCX121XDELTAHelper(); + // result = xdeltaHelper.Init( + // symbol, + // period, + // xdeltaInputs // + // ); + // if (!result) + // { + // // + // ZeroMemory(xccHelper); + // ZeroMemory(xpvHelper); + // ZeroMemory(xhkHelper); + // ZeroMemory(xmasHelper); + // ZeroMemory(xatrHelper); + // ZeroMemory(xstrHelper); + // ZeroMemory(xcheHelper); + // ZeroMemory(x3maHelper); + // ZeroMemory(xvwapHelper); + + // // + // // ZeroMemory(xichHelper); + // // ZeroMemory(xdonHelper); + // // ZeroMemory(xdeltaHelper); + // // ZeroMemory(xvolumeHelper); + + // // + // return result; + // } + + // // + // // XVOLUME ... + // xvolumeHelper = new XCX121XVOLUMEHelper(); + // result = xvolumeHelper.Init( + // symbol, + // period, + // xvolumeInputs // + // ); + // if (!result) + // { + // // + // ZeroMemory(xccHelper); + // ZeroMemory(xpvHelper); + // ZeroMemory(xhkHelper); + // ZeroMemory(xmasHelper); + // ZeroMemory(xatrHelper); + // ZeroMemory(xstrHelper); + // ZeroMemory(xcheHelper); + // ZeroMemory(x3maHelper); + // ZeroMemory(xvwapHelper); + + // // + // // ZeroMemory(xichHelper); + // // ZeroMemory(xdonHelper); + // // ZeroMemory(xdeltaHelper); + // // ZeroMemory(xvolumeHelper); + + // // + // return result; + // } + + + // + // ZeroMemory(xichHelper); + // ZeroMemory(xdonHelper); + // ZeroMemory(xdeltaHelper); + // ZeroMemory(xvolumeHelper); + + + // + // XCX121XICHHelper *xichHelper; + // XCX121XDONHelper *xdonHelper; + // XCX121XDELTAHelper *xdeltaHelper; + // XCX121XVOLUMEHelper *xvolumeHelper; + + + // + // int xdonMax = xdonInputs.Max(); + // int xichMax = xichInputs.Max(); + // int xdeltaMax = xdeltaInputs.Max(); + // int xvolumeMax = xvolumeInputs.Max(); + + + // + // result = MathMax(result, xdonMax); + // result = MathMax(result, xichMax); + // result = MathMax(result, xdeltaMax); + // result = MathMax(result, xvolumeMax); + + // && + // xichInputs.IsValid() && + // xdonInputs.IsValid() && + // xdeltaInputs.IsValid() && + // xvolumeInputs.IsValid() + // + + + // + // xichInputs.Default(); + // xdonInputs.Default(); + // xdeltaInputs.Default(); + // xvolumeInputs.Default(); + + + // + // xichInputs.Clean(); + // xdonInputs.Clean(); + // xdeltaInputs.Clean(); + // xvolumeInputs.Clean(); + + // + // xichInputs.Clean(); + // xdonInputs.Clean(); + // xdeltaInputs.Clean(); + // xvolumeInputs.Clean(); + + // + // delete xichHelper; + // delete xdonHelper; + // delete xdeltaHelper; + // delete xvolumeHelper; + + // + // ZeroMemory(xichHelper); + // ZeroMemory(xdonHelper); + // ZeroMemory(xdeltaHelper); + // ZeroMemory(xvolumeHelper); diff --git a/Helpers/x-saherelm.x121.helper.mq5 b/Helpers/x-saherelm.x121.helper.mq5 index 5dbfce6d..2314b3fe 100644 --- a/Helpers/x-saherelm.x121.helper.mq5 +++ b/Helpers/x-saherelm.x121.helper.mq5 @@ -26,16 +26,18 @@ #include "../Helpers/x-saherelm.x121.xatr.helper.mq5" #include "../Helpers/x-saherelm.x121.xcc.helper.mq5" #include "../Helpers/x-saherelm.x121.xche.helper.mq5" -#include "../Helpers/x-saherelm.x121.xdelta.helper.mq5" -#include "../Helpers/x-saherelm.x121.xdon.helper.mq5" #include "../Helpers/x-saherelm.x121.xhk.helper.mq5" -#include "../Helpers/x-saherelm.x121.xich.helper.mq5" #include "../Helpers/x-saherelm.x121.xmas.helper.mq5" #include "../Helpers/x-saherelm.x121.xpv.helper.mq5" #include "../Helpers/x-saherelm.x121.xstr.helper.mq5" -#include "../Helpers/x-saherelm.x121.xvolume.helper.mq5" #include "../Helpers/x-saherelm.x121.xvwap.helper.mq5" +// +// #include "../Helpers/x-saherelm.x121.xdelta.helper.mq5" +// #include "../Helpers/x-saherelm.x121.xdon.helper.mq5" +// #include "../Helpers/x-saherelm.x121.xich.helper.mq5" +// #include "../Helpers/x-saherelm.x121.xvolume.helper.mq5" + // // Inputs ... struct X121Inputs @@ -46,16 +48,18 @@ struct X121Inputs X121XCCInputs xccInputs; X121XPVInputs xpvInputs; X121XHKInputs xhkInputs; - X121XICHInputs xichInputs; X121XMASInputs xmasInputs; X121XATRInputs xatrInputs; X121XSTRInputs xstrInputs; X121XCHEInputs xcheInputs; - X121XDONInputs xdonInputs; X121X3MAInputs x3maInputs; X121XVWAPInputs xvwapInputs; - X121XDELTAInputs xdeltaInputs; - X121XVOLUMEInputs xvolumeInputs; + + // + // X121XICHInputs xichInputs; + // X121XDONInputs xdonInputs; + // X121XDELTAInputs xdeltaInputs; + // X121XVOLUMEInputs xvolumeInputs; // // Constructor ... @@ -76,15 +80,12 @@ struct X121Inputs xccInputs.Clean(); xpvInputs.Clean(); xhkInputs.Clean(); - xichInputs.Clean(); xmasInputs.Clean(); xatrInputs.Clean(); xstrInputs.Clean(); xcheInputs.Clean(); - xdonInputs.Clean(); + x3maInputs.Clean(); xvwapInputs.Clean(); - xdeltaInputs.Clean(); - xvolumeInputs.Clean(); // ZeroMemory(this); @@ -99,16 +100,12 @@ struct X121Inputs xccInputs.Default(); xpvInputs.Default(); xhkInputs.Default(); - xichInputs.Default(); xmasInputs.Default(); xatrInputs.Default(); xstrInputs.Default(); xcheInputs.Default(); - xdonInputs.Default(); x3maInputs.Default(); xvwapInputs.Default(); - xdeltaInputs.Default(); - xvolumeInputs.Default(); } /** @@ -127,17 +124,12 @@ struct X121Inputs xccInputs.IsValid() && xpvInputs.IsValid() && xhkInputs.IsValid() && - xichInputs.IsValid() && xmasInputs.IsValid() && xatrInputs.IsValid() && xstrInputs.IsValid() && xcheInputs.IsValid() && - xdonInputs.IsValid() && - xvwapInputs.IsValid() && - xdeltaInputs.IsValid() && - xvolumeInputs.IsValid() - // - ; + x3maInputs.IsValid() && + xvwapInputs.IsValid(); // return result; @@ -160,11 +152,8 @@ struct X121Inputs int xatrMax = xatrInputs.Max(); int xstrMax = xstrInputs.Max(); int xcheMax = xcheInputs.Max(); - int xdonMax = xdonInputs.Max(); - int xichMax = xichInputs.Max(); + int x3maMax = x3maInputs.Max(); int xvwapMax = xvwapInputs.Max(); - int xdeltaMax = xdeltaInputs.Max(); - int xvolumeMax = xvolumeInputs.Max(); // result = MathMax(xpvMax, xhkMax); @@ -172,11 +161,8 @@ struct X121Inputs result = MathMax(result, xatrMax); result = MathMax(result, xstrMax); result = MathMax(result, xcheMax); - result = MathMax(result, xdonMax); - result = MathMax(result, xichMax); + result = MathMax(result, x3maMax); result = MathMax(result, xvwapMax); - result = MathMax(result, xdeltaMax); - result = MathMax(result, xvolumeMax); // return result; @@ -193,16 +179,22 @@ struct X121Conditions ENUM_TIMEFRAMES period; datetime time; + // + // XCC ... + // // Buffers ... - double maBuffer[]; - double rsiBuffer[]; - double atrBuffer[]; - double strBuffer[]; - double le1Buffer[]; - double se1Buffer[]; - double le2Buffer[]; - double se2Buffer[]; + + // + // Conditions ... + + // + // XPV ... + + // + // Buffers ... + + // double sarBuffer[]; double cHHBuffer[]; double cLLBuffer[]; @@ -214,127 +206,23 @@ struct X121Conditions double lLLBuffer[]; double hHHBuffer[]; double hLLBuffer[]; - double upTBuffer[]; - double adxBuffer[]; - double adxPBuffer[]; - double adxMBuffer[]; - long volumeBuffer[]; double peaksBuffer[]; double valesBuffer[]; - double strUpBuffer[]; - double downTBuffer[]; - double deltaBuffer[]; - double masMidBuffer[]; - double deltaMaBuffer[]; - double strDownBuffer[]; - double vwapMidBuffer[]; - double upTrendBuffer[]; - double x3maMidBuffer[]; - double masUpperBuffer[]; - double masLowerBuffer[]; - double kijunSenBuffer[]; - double le1StartBuffer[]; - double se1StartBuffer[]; - double le2StartBuffer[]; - double se2StartBuffer[]; - double strPriceBuffer[]; - double atrUpperBuffer[]; - double atrLowerBuffer[]; - double strStateBuffer[]; - double vwapFastBuffer[]; - double vwapSlowBuffer[]; - double xhkSMLowBuffer[]; - double x3maFastBuffer[]; - double x3maSlowBuffer[]; double supportsBuffer[]; - double tenkanSenBuffer[]; - double downTrendBuffer[]; - double vwapPriceBuffer[]; - double xhkRawLowBuffer[]; - double xhkSMOpenBuffer[]; - double xhkSMHighBuffer[]; - double deltaStateBuffer[]; - double xhkRawOpenBuffer[]; - double xhkRawHighBuffer[]; - double xhkSMCloseBuffer[]; - double vwapVolumeBuffer[]; - double chikouSpanBuffer[]; - double senkouSpanABuffer[]; - double senkouSpanBBuffer[]; double peaksGoldenBuffer[]; double valesGoldenBuffer[]; - double xhkRawCloseBuffer[]; - double atrUpperRawBuffer[]; - double atrLowerRawBuffer[]; - double donLowUpperBuffer[]; - double donLowLowerBuffer[]; double resistancesBuffer[]; - double vwapMidStateBuffer[]; - double donOpenUpperBuffer[]; - double donOpenLowerBuffer[]; - double donHighUpperBuffer[]; - double donHighLowerBuffer[]; - double x3maMidStateBuffer[]; - double bullishVolumeBuffer[]; - double bearishVolumeBuffer[]; double fractalsUpperBuffer[]; double fractalsLowerBuffer[]; - double vwapFastStateBuffer[]; - double vwapSlowStateBuffer[]; - double donCloseUpperBuffer[]; - double donCloseLowerBuffer[]; - double x3maFastStateBuffer[]; - double x3maSlowStateBuffer[]; - double bullishVolumeMaBuffer[]; - double bearishVolumeMaBuffer[]; - - // - double rsiSlope; - double strSlope; - double atrUpperSlope; - double atrLowerSlope; - double vwapFastSlope; - double vwapMidSlope; - double vwapSlowSlope; // // Conditions ... - // - bool isRsiSlopeBullish; - bool isStrSlopeBullish; - bool isAtrUpperSlopeBullish; - bool isAtrLowerSlopeBullish; - bool isVwapFastSlopeBullish; - bool isVwapMidSlopeBullish; - bool isVwapSlowSlopeBullish; - - // - bool isRsiSlopeBearish; - bool isStrSlopeBearish; - bool isAtrUpperSlopeBearish; - bool isAtrLowerSlopeBearish; - bool isVwapFastSlopeBearish; - bool isVwapMidSlopeBearish; - bool isVwapSlowSlopeBearish; - - // - bool isRsiOverSold; - bool isRsiOverBought; - bool isRsiCrossedOverOverSold; - bool isRsiCrossedUnderOverSold; - bool isRsiCrossedOverOverBought; - bool isRsiCrossedUnderOverBought; - - // - bool isClosedOverAtrUpper; - bool isClosedOverAtrLower; - bool isClosedUnderAtrUpper; - bool isClosedUnderAtrLower; - // bool isSarBullish; bool isSarBearish; + + // bool isSarSwitchedToBullish; bool isSarSwitchedToBearish; @@ -348,258 +236,307 @@ struct X121Conditions bool isNewValeOverLast; bool isNewValeUnderLast; + // + // XHK ... + + // + // Buffers ... + + // + double xhkSMLowBuffer[]; + double xhkRawLowBuffer[]; + double xhkSMOpenBuffer[]; + double xhkSMHighBuffer[]; + double xhkRawOpenBuffer[]; + double xhkRawHighBuffer[]; + double xhkSMCloseBuffer[]; + double xhkRawCloseBuffer[]; + + // + // Conditions ... + + // + bool isSMHKBullish; + bool isRawHKBullish; + bool isSMHKSwitchedToBullish; + bool isRawHKSwitchedToBullish; + + // + bool isSMHKBearish; + bool isRawHKBearish; + bool isSMHKSwitchedToBearish; + bool isRawHKSwitchedToBearish; + + // + bool isClosedOverSMHK; + bool isClosedUnderSMHK; + bool isClosedOverRawHK; + bool isClosedUnderRawHK; + + // + bool isRawHKClosedOverSMHK; + bool isRawHKClosedUnderSMHK; + + // + // XMAS ... + + // + // Buffers ... + + // + double midBuffer[]; + double upperBuffer[]; + double lowerBuffer[]; + + // + // Conditions ... + + // + // XATR ... + + // + // Buffers ... + + // + double rsiBuffer[]; + double atrBuffer[]; + double atrUpperBuffer[]; + double atrLowerBuffer[]; + double atrUpperSMBuffer[]; + double atrLowerSMBuffer[]; + double rsiChangeBuffer[]; + double rsiChangeSMBuffer[]; + double priceChangeBuffer[]; + double priceChangeSMBuffer[]; + + // + // Conditions ... + + // + bool isRsiInRange; + bool isRsiOverSold; + bool isRsiOverBought; + bool isRsiCrossedOverOverSold; + bool isRsiCrossedUnderOverSold; + bool isRsiCrossedOverOverBought; + bool isRsiCrossedUnderOverBought; + + // + bool isRsiSMOverPriceChange; + bool isRsiSMUnderPriceChange; + + // + bool isRsiSMCrossedOverPriceChange; + bool isRsiSMCrossedUnderPriceChange; + + // + bool isPriceChangeSMOverRsi; + bool isPriceChangeSMUnderRsi; + + // + bool isPriceChangeSMCrossedOverRsi; + bool isPriceChangeSMCrossedUnderRsi; + + // + bool isRsiOverRsiSM; + bool isRsiUnderRsiSM; + + // + bool isRsiCrossedOverRsiSM; + bool isRsiCrossedUnderRsiSM; + + // + bool isPriceChangeOverPriceChangeSM; + bool isPriceChangeUnderPriceChangeSM; + + // + bool isPriceChangeCrossedOverPriceChangeSM; + bool isPriceChangeCrossedUnderPriceChangeSM; + + // + // XSTR ... + + // + // Buffers ... + + // + double strBuffer[]; + double strUpBuffer[]; + double strDownBuffer[]; + double strPriceBuffer[]; + double strStateBuffer[]; + + // + // Conditions ... + // bool isStrBullish; bool isStrBearish; + + // bool isStrSwitchedToBullish; bool isStrSwitchedToBearish; + // + // XCHE ... + + // + // Buffers ... + + // + double le1Buffer[]; + double se1Buffer[]; + double le2Buffer[]; + double se2Buffer[]; + double le1StartBuffer[]; + double se1StartBuffer[]; + double le2StartBuffer[]; + double se2StartBuffer[]; + + // + // Conditions ... + // bool isChe1Bullish; bool isChe1Bearish; + + // bool isChe1SwitchedToBullish; bool isChe1SwitchedToBearish; // bool isChe2Bullish; bool isChe2Bearish; + + // bool isChe2SwitchedToBullish; bool isChe2SwitchedToBearish; // bool isCheBullish; bool isCheBearish; + + // bool isCheSwitchedToBullish; bool isCheSwitchedToBearish; // - bool isVWapMidBullish; - bool isVWapMidBearish; - bool isVWapFastBullish; - bool isVWapFastBearish; - bool isVWapMidNeutural; - bool isVWapSlowBullish; - bool isVWapSlowBearish; - bool isVWapFastOverMid; - bool isVWapMidOverSlow; - bool isVWapFastNeutural; - bool isVWapSlowNeutural; - bool isVWapFastUnderMid; - bool isVWapMidUnderSlow; - bool isVWapBullishState; - bool isVWapBearishState; - bool isVWapNeuturalState; - bool isVWapBullishOrdered; - bool isVWapBearishOrdered; - bool isVWapSwitchedToBullishState; - bool isVWapSwitchedToBearishState; - bool isVWapSwitchedToNeuturalState; - bool isVWapSwitchedToBullishOrdered; - bool isVWapSwitchedToBearishOrdered; + // X3MA ... + + // + // Buffers ... + + // + double x3maMidBuffer[]; + double x3maFastBuffer[]; + double x3maSlowBuffer[]; + double x3maMidStateBuffer[]; + double x3maFastStateBuffer[]; + double x3maSlowStateBuffer[]; + + // + // Conditions ... + + // + bool isX3MaFastBullish; + bool isX3MaFastBearish; + bool isX3MaFastNeutural; // bool isX3MaMidBullish; bool isX3MaMidBearish; - bool isX3MaFastBullish; - bool isX3MaFastBearish; bool isX3MaMidNeutural; + + // bool isX3MaSlowBullish; bool isX3MaSlowBearish; + bool isX3MaSlowNeutural; + + // bool isX3MaFastOverMid; bool isX3MaMidOverSlow; - bool isX3MaFastNeutural; - bool isX3MaSlowNeutural; + + // bool isX3MaFastUnderMid; bool isX3MaMidUnderSlow; + + // bool isX3MaBullishState; bool isX3MaBearishState; bool isX3MaNeuturalState; + + // bool isX3MaBullishOrdered; bool isX3MaBearishOrdered; - bool isX3MaSwitchedToBullishState; - bool isX3MaSwitchedToBearishState; - bool isX3MaSwitchedToNeuturalState; + + // bool isX3MaSwitchedToBullishOrdered; bool isX3MaSwitchedToBearishOrdered; // - bool isSMHKBullish; - bool isRawHKBullish; - bool isSMHKBearish; - bool isRawHKBearish; - bool isClosedOverSMHK; - bool isClosedUnderSMHK; - bool isClosedOverRawHK; - bool isClosedUnderRawHK; - bool isRawHKClosedOverSMHK; - bool isRawHKClosedUnderSMHK; - bool isSMHKSwitchedToBullish; - bool isSMHKSwitchedToBearish; - bool isRawHKSwitchedToBearish; - bool isRawHKSwitchedToBullish; + bool isX3MaSwitchedToBullishState; + bool isX3MaSwitchedToBearishState; + bool isX3MaSwitchedToNeuturalState; // - // XICH ... + // XVWAP ... // - bool isSenkouSpanAOverB; - bool isSenkouSpanAUnderB; - bool isTenkanSenOverKijunSen; - bool isTenkanSenUnderKijunSen; - bool isSenkouSpanACrossedOverB; - bool isSenkouSpanACrossedUnderB; - bool isTenkanSenCrossedOverKijunSen; - bool isTenkanSenCrossedUnderKijunSen; + // Buffers ... // - // XDELTA ... + double vwapMidBuffer[]; + double vwapFastBuffer[]; + double vwapSlowBuffer[]; + double vwapPriceBuffer[]; + double vwapVolumeBuffer[]; + double vwapMidStateBuffer[]; + double vwapFastStateBuffer[]; + double vwapSlowStateBuffer[]; // - bool isDeltaBullish; - bool isDeltaBearish; - bool isDeltaSwitchedToBullish; - bool isDeltaSwitchedToBearish; + // Conditions ... // - bool isDeltaOverMa; - bool isDeltaUnderMa; - bool isDeltaCrossedOverMa; - bool isDeltaCrossedUnderMa; + bool isVWapFastBullish; + bool isVWapFastBearish; + bool isVWapFastNeutural; // - // XVOLUME ... - - bool isBullishVolumeOverMa; - bool isBullishVolumeCrossedOverMa; + bool isVWapMidBullish; + bool isVWapMidBearish; + bool isVWapMidNeutural; // - bool isBullishVolumeUnderMa; - bool isBullishVolumeCrossedUnderMa; + bool isVWapSlowBullish; + bool isVWapSlowBearish; + bool isVWapSlowNeutural; // - bool isBullishVolumeIncreased; - bool isBullishVolumeSwitchedToIncreased; + bool isVWapFastOverMid; + bool isVWapMidOverSlow; // - bool isBullishVolumeDecreased; - bool isBullishVolumeSwitchedToDecreased; + bool isVWapFastUnderMid; + bool isVWapMidUnderSlow; // - bool isBearishVolumeOverMa; - bool isBearishVolumeCrossedOverMa; + bool isVWapBullishState; + bool isVWapBearishState; + bool isVWapNeuturalState; // - bool isBearishVolumeUnderMa; - bool isBearishVolumeCrossedUnderMa; + bool isVWapBullishOrdered; + bool isVWapBearishOrdered; // - bool isBearishVolumeIncreased; - bool isBearishVolumeSwitchedToIncreased; + bool isVWapSwitchedToBullishOrdered; + bool isVWapSwitchedToBearishOrdered; // - bool isBearishVolumeDecreased; - bool isBearishVolumeSwitchedToDecreased; - - // - bool isVolumeSwitchedToBullish; - bool isVolumeSwitchedToBearish; - - // - bool isBullishVolumeMaOverBearishVolumeMa; - bool isBullishVolumeMaUnderBearishVolumeMa; - - // - // Complex Conditions ... - - // - double cheMin; - double cheMax; - double x3maMin; - double x3maMax; - double vwapMin; - double vwapMax; - double senkouMax; - double senkouMin; - double tenKijMax; - double tenKijMin; - - // - bool isSarIncreased; - bool isSarDecreased; - bool isX3MaFatsOverMid; - bool isSarEqualsToPeak; - bool isSarEqualsToVale; - bool isStrEqualsToPeak; - bool isStrEqualsToVale; - bool isX3MaFatsUnderMid; - bool isX3MaFatsOverSlow; - bool isAtrUpperOverPeak; - bool isPeakOverAtrUpper; - bool isStrUpperOverPeak; - bool isStrLowerOverVale; - bool isClosedOverCheMin; - bool isClosedOverCheMax; - bool isX3MaFatsUnderSlow; - bool isAtrLowerUnderVale; - bool isClosedOverX3MaMin; - bool isClosedOverX3MaMax; - bool isValeUnderAtrLower; - bool isStrUpperUnderPeak; - bool isStrLowerUnderVale; - bool isClosedUnderCheMin; - bool isClosedUnderCheMax; - bool isClosedOverVWapMin; - bool isClosedOverVWapMax; - bool isClosedUnderX3MaMin; - bool isClosedUnderX3MaMax; - bool isStrCrossedOverVale; - bool isSarCrossedOverVale; - bool isClosedUnderVWapMin; - bool isClosedUnderVWapMax; - bool isX3MaFatsOverMidPrev; - bool isSarCrossedUnderPeak; - bool isStrCrossedUnderPeak; - bool isNewPeakOverAtrUpper; - bool isX3MaFatsUnderMidPrev; - bool isX3MaFatsOverSlowPrev; - bool isAtrUpperEqualsToPeak; - bool isAtrLowerEqualsToVale; - bool isStrUpperOverAtrUpper; - bool isStrLowerOverAtrLower; - bool isNewValeUnderAtrLower; - bool isAtrUpperCrossedUpPeak; - bool isAtrLowerCrossedUpVale; - bool isStrUpperUnderAtrUpper; - bool isStrLowerUnderAtrLower; - bool isX3MaFatsUnderSlowPrev; - bool isX3MaFastCrossedOverMid; - bool isVWapFastCrossedOverMid; - bool isX3MaFastCrossedUnderMid; - bool isX3MaFastCrossedOverSlow; - bool isAtrUpperCrossedDownPeak; - bool isAtrLowerCrossedDownVale; - bool isStrLowerOverDonLowLower; - bool isVWapFastCrossedUnderMid; - bool isStrUpperCrossedOverPeak; - bool isStrLowerCrossedOverVale; - bool isDonLowLowerEqualsToVale; - bool isVWapFastCrossedOverSlow; - bool isX3MaFastCrossedUnderSlow; - bool isStrUpperOverDonHighUpper; - bool isStrLowerUnderDonLowLower; - bool isVWapFastCrossedUnderSlow; - bool isStrUpperCrossedUnderPeak; - bool isStrLowerCrossedUnderVale; - bool isDonHighUpperEqualsToPeak; - bool isStrUpperUnderDonHighUpper; - bool isStrUpperCrossedOverAtrUpper; - bool isStrLowerCrossedOverAtrLower; - bool isStrUpperCrossedUnderAtrUpper; - bool isStrLowerCrossedUnderAtrLower; - bool isStrLowerCrossedOverDonLowLower; - bool isStrUpperCrossedOverDonHighUpper; - bool isStrLowerCrossedUnderDonLowLower; - bool isStrUpperCrossedUnderDonHighUpper; + bool isVWapSwitchedToBullishState; + bool isVWapSwitchedToBearishState; + bool isVWapSwitchedToNeuturalState; // // Constructor ... @@ -622,18 +559,16 @@ struct X121Conditions period = NULL; time = NULL; + // + // XPV ... + // // Buffers ... // - Clean(maBuffer); - Clean(rsiBuffer); - Clean(atrBuffer); - Clean(strBuffer); - Clean(le1Buffer); - Clean(se1Buffer); - Clean(le2Buffer); - Clean(se2Buffer); + // Clean ... + + // Clean(sarBuffer); Clean(cHHBuffer); Clean(cLLBuffer); @@ -645,89 +580,19 @@ struct X121Conditions Clean(lLLBuffer); Clean(hHHBuffer); Clean(hLLBuffer); - Clean(upTBuffer); - Clean(adxBuffer); - Clean(adxPBuffer); - Clean(adxMBuffer); Clean(peaksBuffer); Clean(valesBuffer); - Clean(strUpBuffer); - Clean(downTBuffer); - Clean(deltaBuffer); - Clean(volumeBuffer); - Clean(masMidBuffer); - Clean(strDownBuffer); - Clean(vwapMidBuffer); - Clean(upTrendBuffer); - Clean(x3maMidBuffer); - Clean(deltaMaBuffer); - Clean(masUpperBuffer); - Clean(masLowerBuffer); - Clean(le1StartBuffer); - Clean(se1StartBuffer); - Clean(le2StartBuffer); - Clean(se2StartBuffer); - Clean(strPriceBuffer); - Clean(atrUpperBuffer); - Clean(atrLowerBuffer); - Clean(strStateBuffer); - Clean(vwapFastBuffer); - Clean(vwapSlowBuffer); - Clean(xhkSMLowBuffer); - Clean(x3maFastBuffer); - Clean(x3maSlowBuffer); Clean(supportsBuffer); - Clean(kijunSenBuffer); - Clean(tenkanSenBuffer); - Clean(downTrendBuffer); - Clean(vwapPriceBuffer); - Clean(xhkRawLowBuffer); - Clean(xhkSMOpenBuffer); - Clean(xhkSMHighBuffer); - Clean(chikouSpanBuffer); - Clean(xhkRawOpenBuffer); - Clean(xhkRawHighBuffer); - Clean(xhkSMCloseBuffer); - Clean(vwapVolumeBuffer); - Clean(deltaStateBuffer); - Clean(senkouSpanABuffer); - Clean(senkouSpanBBuffer); Clean(peaksGoldenBuffer); Clean(valesGoldenBuffer); - Clean(xhkRawCloseBuffer); - Clean(atrUpperRawBuffer); - Clean(atrLowerRawBuffer); - Clean(donLowUpperBuffer); - Clean(donLowLowerBuffer); Clean(resistancesBuffer); - Clean(vwapMidStateBuffer); - Clean(donOpenUpperBuffer); - Clean(donOpenLowerBuffer); - Clean(donHighUpperBuffer); - Clean(donHighLowerBuffer); - Clean(x3maMidStateBuffer); - Clean(bullishVolumeBuffer); - Clean(bearishVolumeBuffer); Clean(fractalsUpperBuffer); Clean(fractalsLowerBuffer); - Clean(vwapFastStateBuffer); - Clean(vwapSlowStateBuffer); - Clean(donCloseUpperBuffer); - Clean(donCloseLowerBuffer); - Clean(x3maFastStateBuffer); - Clean(x3maSlowStateBuffer); - Clean(bullishVolumeMaBuffer); - Clean(bearishVolumeMaBuffer); // - ArraySetAsSeries(maBuffer, true); - ArraySetAsSeries(rsiBuffer, true); - ArraySetAsSeries(atrBuffer, true); - ArraySetAsSeries(strBuffer, true); - ArraySetAsSeries(le1Buffer, true); - ArraySetAsSeries(se1Buffer, true); - ArraySetAsSeries(le2Buffer, true); - ArraySetAsSeries(se2Buffer, true); + // Set As Series ... + + // ArraySetAsSeries(sarBuffer, true); ArraySetAsSeries(cHHBuffer, true); ArraySetAsSeries(cLLBuffer, true); @@ -739,172 +604,198 @@ struct X121Conditions ArraySetAsSeries(lLLBuffer, true); ArraySetAsSeries(hHHBuffer, true); ArraySetAsSeries(hLLBuffer, true); - ArraySetAsSeries(upTBuffer, true); - ArraySetAsSeries(adxBuffer, true); - ArraySetAsSeries(adxPBuffer, true); - ArraySetAsSeries(adxMBuffer, true); ArraySetAsSeries(peaksBuffer, true); ArraySetAsSeries(valesBuffer, true); - ArraySetAsSeries(strUpBuffer, true); - ArraySetAsSeries(downTBuffer, true); - ArraySetAsSeries(deltaBuffer, true); - ArraySetAsSeries(volumeBuffer, true); - ArraySetAsSeries(masMidBuffer, true); - ArraySetAsSeries(deltaMaBuffer, true); - ArraySetAsSeries(strDownBuffer, true); - ArraySetAsSeries(vwapMidBuffer, true); - ArraySetAsSeries(upTrendBuffer, true); - ArraySetAsSeries(x3maMidBuffer, true); - ArraySetAsSeries(masUpperBuffer, true); - ArraySetAsSeries(masLowerBuffer, true); - ArraySetAsSeries(le1StartBuffer, true); - ArraySetAsSeries(se1StartBuffer, true); - ArraySetAsSeries(le2StartBuffer, true); - ArraySetAsSeries(se2StartBuffer, true); - ArraySetAsSeries(strPriceBuffer, true); - ArraySetAsSeries(atrUpperBuffer, true); - ArraySetAsSeries(atrLowerBuffer, true); - ArraySetAsSeries(strStateBuffer, true); - ArraySetAsSeries(vwapFastBuffer, true); - ArraySetAsSeries(vwapSlowBuffer, true); - ArraySetAsSeries(xhkSMLowBuffer, true); - ArraySetAsSeries(x3maFastBuffer, true); - ArraySetAsSeries(x3maSlowBuffer, true); ArraySetAsSeries(supportsBuffer, true); - ArraySetAsSeries(kijunSenBuffer, true); - ArraySetAsSeries(tenkanSenBuffer, true); - ArraySetAsSeries(downTrendBuffer, true); - ArraySetAsSeries(vwapPriceBuffer, true); - ArraySetAsSeries(xhkRawLowBuffer, true); - ArraySetAsSeries(xhkSMOpenBuffer, true); - ArraySetAsSeries(xhkSMHighBuffer, true); - ArraySetAsSeries(deltaStateBuffer, true); - ArraySetAsSeries(chikouSpanBuffer, true); - ArraySetAsSeries(xhkRawOpenBuffer, true); - ArraySetAsSeries(xhkRawHighBuffer, true); - ArraySetAsSeries(xhkSMCloseBuffer, true); - ArraySetAsSeries(vwapVolumeBuffer, true); - ArraySetAsSeries(senkouSpanABuffer, true); - ArraySetAsSeries(senkouSpanBBuffer, true); ArraySetAsSeries(peaksGoldenBuffer, true); ArraySetAsSeries(valesGoldenBuffer, true); - ArraySetAsSeries(xhkRawCloseBuffer, true); - ArraySetAsSeries(atrUpperRawBuffer, true); - ArraySetAsSeries(atrLowerRawBuffer, true); - ArraySetAsSeries(donLowUpperBuffer, true); - ArraySetAsSeries(donLowLowerBuffer, true); ArraySetAsSeries(resistancesBuffer, true); - ArraySetAsSeries(vwapMidStateBuffer, true); - ArraySetAsSeries(donOpenUpperBuffer, true); - ArraySetAsSeries(donOpenLowerBuffer, true); - ArraySetAsSeries(donHighUpperBuffer, true); - ArraySetAsSeries(donHighLowerBuffer, true); - ArraySetAsSeries(x3maMidStateBuffer, true); - ArraySetAsSeries(bullishVolumeBuffer, true); - ArraySetAsSeries(bearishVolumeBuffer, true); ArraySetAsSeries(fractalsUpperBuffer, true); ArraySetAsSeries(fractalsLowerBuffer, true); - ArraySetAsSeries(vwapFastStateBuffer, true); - ArraySetAsSeries(vwapSlowStateBuffer, true); - ArraySetAsSeries(donCloseUpperBuffer, true); - ArraySetAsSeries(donCloseLowerBuffer, true); - ArraySetAsSeries(x3maFastStateBuffer, true); - ArraySetAsSeries(x3maSlowStateBuffer, true); - ArraySetAsSeries(bullishVolumeMaBuffer, true); - ArraySetAsSeries(bearishVolumeMaBuffer, true); - - // - cheMin = 0; - cheMax = 0; - vwapMin = 0; - vwapMax = 0; - x3maMin = 0; - x3maMax = 0; - senkouMax = 0; - senkouMin = 0; - tenKijMax = 0; - tenKijMin = 0; - // - // Slopes ... - - rsiSlope = 0; - strSlope = 0; - atrUpperSlope = 0; - atrLowerSlope = 0; - vwapFastSlope = 0; - vwapMidSlope = 0; - vwapSlowSlope = 0; // // Conditions ... // - isRsiSlopeBullish = false; - isStrSlopeBullish = false; - isAtrUpperSlopeBullish = false; - isAtrLowerSlopeBullish = false; - isVwapFastSlopeBullish = false; - isVwapMidSlopeBullish = false; - isVwapSlowSlopeBullish = false; - - // - isRsiSlopeBearish = false; - isStrSlopeBearish = false; - isAtrUpperSlopeBearish = false; - isAtrLowerSlopeBearish = false; - isVwapFastSlopeBearish = false; - isVwapMidSlopeBearish = false; - isVwapSlowSlopeBearish = false; - - // - // RSI ... - - // - isRsiOverBought = false; - isRsiCrossedOverOverBought = false; - isRsiCrossedUnderOverBought = false; - - // - isRsiOverSold = false; - isRsiCrossedUnderOverSold = false; - isRsiCrossedOverOverSold = false; - - // - // ATR ... - - // - isClosedOverAtrUpper = false; - isClosedOverAtrLower = false; - isClosedUnderAtrUpper = false; - isClosedUnderAtrLower = false; - - // - // DON ... - - // - // SAR ... - - // + isNewPeak = false; + isNewVale = false; isSarBullish = false; isSarBearish = false; + isNewPeakOverLast = false; + isNewValeOverLast = false; + isNewPeakUnderLast = false; + isNewValeUnderLast = false; isSarSwitchedToBullish = false; isSarSwitchedToBearish = false; // - // PV ... + // XHK ... // - isNewPeak = false; - isNewPeakOverLast = false; - isNewPeakUnderLast = false; + // Buffers ... // - isNewVale = false; - isNewValeOverLast = false; - isNewValeUnderLast = false; + // Clean ... // - // STR ... + Clean(xhkSMLowBuffer); + Clean(xhkRawLowBuffer); + Clean(xhkSMOpenBuffer); + Clean(xhkSMHighBuffer); + Clean(xhkRawOpenBuffer); + Clean(xhkRawHighBuffer); + Clean(xhkSMCloseBuffer); + Clean(xhkRawCloseBuffer); + + // + // Set As Series ... + + // + ArraySetAsSeries(xhkSMLowBuffer, true); + ArraySetAsSeries(xhkRawLowBuffer, true); + ArraySetAsSeries(xhkSMOpenBuffer, true); + ArraySetAsSeries(xhkSMHighBuffer, true); + ArraySetAsSeries(xhkRawOpenBuffer, true); + ArraySetAsSeries(xhkRawHighBuffer, true); + ArraySetAsSeries(xhkSMCloseBuffer, true); + ArraySetAsSeries(xhkRawCloseBuffer, true); + + // + // Conditions ... + + // + isSMHKBullish = false; + isSMHKBearish = false; + isRawHKBullish = false; + isRawHKBearish = false; + isClosedOverSMHK = false; + isClosedUnderSMHK = false; + isClosedOverRawHK = false; + isClosedUnderRawHK = false; + isRawHKClosedOverSMHK = false; + isRawHKClosedUnderSMHK = false; + isSMHKSwitchedToBearish = false; + isSMHKSwitchedToBullish = false; + isRawHKSwitchedToBullish = false; + isRawHKSwitchedToBearish = false; + + // + // XMAS ... + + // + // Buffers ... + + // + // Clean ... + + // + Clean(midBuffer); + Clean(upperBuffer); + Clean(lowerBuffer); + + // + // Set As Series ... + + // + ArraySetAsSeries(midBuffer, true); + ArraySetAsSeries(upperBuffer, true); + ArraySetAsSeries(lowerBuffer, true); + + // + // Conditions ... + + // + // XATR ... + + // + // Buffers ... + + // + // Clean ... + + // + Clean(rsiBuffer); + Clean(atrBuffer); + Clean(atrUpperBuffer); + Clean(atrLowerBuffer); + Clean(rsiChangeBuffer); + Clean(atrUpperSMBuffer); + Clean(atrLowerSMBuffer); + Clean(rsiChangeSMBuffer); + Clean(priceChangeBuffer); + Clean(priceChangeSMBuffer); + + // + // Set As Series ... + + // + ArraySetAsSeries(rsiBuffer, true); + ArraySetAsSeries(atrBuffer, true); + ArraySetAsSeries(atrUpperBuffer, true); + ArraySetAsSeries(atrLowerBuffer, true); + ArraySetAsSeries(rsiChangeBuffer, true); + ArraySetAsSeries(atrUpperSMBuffer, true); + ArraySetAsSeries(atrLowerSMBuffer, true); + ArraySetAsSeries(rsiChangeSMBuffer, true); + ArraySetAsSeries(priceChangeBuffer, true); + ArraySetAsSeries(priceChangeSMBuffer, true); + + // + // Conditions ... + + // + isRsiInRange = false; + isRsiOverSold = false; + isRsiOverRsiSM = false; + isRsiUnderRsiSM = false; + isRsiOverBought = false; + isRsiCrossedOverRsiSM = false; + isRsiCrossedUnderRsiSM = false; + isPriceChangeSMOverRsi = false; + isRsiSMOverPriceChange = false; + isRsiSMUnderPriceChange = false; + isPriceChangeSMUnderRsi = false; + isRsiCrossedOverOverSold = false; + isRsiCrossedUnderOverSold = false; + isRsiCrossedOverOverBought = false; + isRsiCrossedUnderOverBought = false; + isRsiSMCrossedOverPriceChange = false; + isPriceChangeSMCrossedOverRsi = false; + isRsiSMCrossedUnderPriceChange = false; + isPriceChangeSMCrossedUnderRsi = false; + isPriceChangeOverPriceChangeSM = false; + isPriceChangeUnderPriceChangeSM = false; + isPriceChangeCrossedOverPriceChangeSM = false; + isPriceChangeCrossedUnderPriceChangeSM = false; + + // + // XSTR ... + + // + // Buffers ... + + // + // Clean ... + + // + Clean(strBuffer); + Clean(strUpBuffer); + Clean(strDownBuffer); + Clean(strPriceBuffer); + Clean(strStateBuffer); + + // + // Set As Series ... + + // + ArraySetAsSeries(strBuffer, true); + ArraySetAsSeries(strUpBuffer, true); + ArraySetAsSeries(strDownBuffer, true); + ArraySetAsSeries(strPriceBuffer, true); + ArraySetAsSeries(strStateBuffer, true); + + // + // Conditions ... // isStrBullish = false; @@ -913,33 +804,86 @@ struct X121Conditions isStrSwitchedToBearish = false; // - // VWAP ... - isVWapMidBullish = false; - isVWapMidBearish = false; - isVWapMidNeutural = false; - isVWapSlowBullish = false; - isVWapSlowBearish = false; - isVWapFastBullish = false; - isVWapFastBearish = false; - isVWapFastOverMid = false; - isVWapMidOverSlow = false; - isVWapFastNeutural = false; - isVWapSlowNeutural = false; - isVWapFastUnderMid = false; - isVWapMidUnderSlow = false; - isVWapBullishState = false; - isVWapBearishState = false; - isVWapNeuturalState = false; - isVWapBullishOrdered = false; - isVWapBearishOrdered = false; - isVWapSwitchedToBullishState = false; - isVWapSwitchedToBearishState = false; - isVWapSwitchedToNeuturalState = false; - isVWapSwitchedToBullishOrdered = false; - isVWapSwitchedToBearishOrdered = false; + // XCHE ... + + // + // Buffers ... + + // + // Clean ... + + // + Clean(le1Buffer); + Clean(se1Buffer); + Clean(le2Buffer); + Clean(se2Buffer); + Clean(le1StartBuffer); + Clean(se1StartBuffer); + Clean(le2StartBuffer); + Clean(se2StartBuffer); + + // + // Set As Series ... + + // + ArraySetAsSeries(le1Buffer, true); + ArraySetAsSeries(se1Buffer, true); + ArraySetAsSeries(le2Buffer, true); + ArraySetAsSeries(se2Buffer, true); + ArraySetAsSeries(le1StartBuffer, true); + ArraySetAsSeries(se1StartBuffer, true); + ArraySetAsSeries(le2StartBuffer, true); + ArraySetAsSeries(se2StartBuffer, true); + + // + // Conditions ... + + // + isCheBullish = false; + isCheBearish = false; + isChe1Bullish = false; + isChe1Bearish = false; + isChe2Bullish = false; + isChe2Bearish = false; + isCheSwitchedToBullish = false; + isCheSwitchedToBearish = false; + isChe1SwitchedToBullish = false; + isChe1SwitchedToBearish = false; + isChe2SwitchedToBullish = false; + isChe2SwitchedToBearish = false; // // X3MA ... + + // + // Buffers ... + + // + // Clean ... + + // + Clean(x3maMidBuffer); + Clean(x3maFastBuffer); + Clean(x3maSlowBuffer); + Clean(x3maMidStateBuffer); + Clean(x3maFastStateBuffer); + Clean(x3maSlowStateBuffer); + + // + // Set As Series ... + + // + ArraySetAsSeries(x3maMidBuffer, true); + ArraySetAsSeries(x3maFastBuffer, true); + ArraySetAsSeries(x3maSlowBuffer, true); + ArraySetAsSeries(x3maMidStateBuffer, true); + ArraySetAsSeries(x3maFastStateBuffer, true); + ArraySetAsSeries(x3maSlowStateBuffer, true); + + // + // Conditions ... + + // isX3MaMidBullish = false; isX3MaMidBearish = false; isX3MaFastBullish = false; @@ -965,192 +909,64 @@ struct X121Conditions isX3MaSwitchedToBearishOrdered = false; // - // CHE ... + // XVWAP ... // - isCheBullish = false; - isCheBearish = false; - isChe1Bullish = false; - isChe1Bearish = false; - isChe2Bullish = false; - isChe2Bearish = false; - isClosedOverCheMin = false; - isClosedOverCheMax = false; - isClosedUnderCheMin = false; - isClosedUnderCheMax = false; - isCheSwitchedToBullish = false; - isCheSwitchedToBearish = false; - isChe1SwitchedToBullish = false; - isChe1SwitchedToBearish = false; - isChe2SwitchedToBullish = false; - isChe2SwitchedToBearish = false; + // Buffers ... // - // XHK ... - isSMHKBullish = false; - isRawHKBullish = false; - isSMHKBearish = false; - isRawHKBearish = false; - isClosedOverSMHK = false; - isClosedUnderSMHK = false; - isClosedOverRawHK = false; - isClosedUnderRawHK = false; - isRawHKClosedOverSMHK = false; - isSMHKSwitchedToBearish = false; - isRawHKSwitchedToBearish = false; - isRawHKClosedUnderSMHK = false; - isSMHKSwitchedToBullish = false; - isRawHKSwitchedToBullish = false; + // Clean ... // - // XICH ... - isSenkouSpanAOverB = false; - isSenkouSpanAUnderB = false; - isTenkanSenOverKijunSen = false; - isTenkanSenUnderKijunSen = false; - isSenkouSpanACrossedOverB = false; - isSenkouSpanACrossedUnderB = false; - isTenkanSenCrossedOverKijunSen = false; - isTenkanSenCrossedUnderKijunSen = false; + Clean(vwapMidBuffer); + Clean(vwapFastBuffer); + Clean(vwapSlowBuffer); + Clean(vwapPriceBuffer); + Clean(vwapVolumeBuffer); + Clean(vwapMidStateBuffer); + Clean(vwapFastStateBuffer); + Clean(vwapSlowStateBuffer); // - // XDELTA ... + // Set As Series ... // - isDeltaBullish = false; - isDeltaBearish = false; - isDeltaSwitchedToBullish = false; - isDeltaSwitchedToBearish = false; + ArraySetAsSeries(vwapMidBuffer, true); + ArraySetAsSeries(vwapFastBuffer, true); + ArraySetAsSeries(vwapSlowBuffer, true); + ArraySetAsSeries(vwapPriceBuffer, true); + ArraySetAsSeries(vwapVolumeBuffer, true); + ArraySetAsSeries(vwapMidStateBuffer, true); + ArraySetAsSeries(vwapFastStateBuffer, true); + ArraySetAsSeries(vwapSlowStateBuffer, true); // - isDeltaOverMa = false; - isDeltaUnderMa = false; - isDeltaCrossedOverMa = false; - isDeltaCrossedUnderMa = false; + // Conditions ... // - // XVOLUME ... - - // - isBullishVolumeOverMa = false; - isBullishVolumeCrossedOverMa = false; - - // - isBullishVolumeUnderMa = false; - isBullishVolumeCrossedUnderMa = false; - - // - isBullishVolumeIncreased = false; - isBullishVolumeSwitchedToIncreased = false; - - // - isBullishVolumeDecreased = false; - isBullishVolumeSwitchedToDecreased = false; - - // - isBearishVolumeOverMa = false; - isBearishVolumeCrossedOverMa = false; - - // - isBearishVolumeUnderMa = false; - isBearishVolumeCrossedUnderMa = false; - - // - isBearishVolumeIncreased = false; - isBearishVolumeSwitchedToIncreased = false; - - // - isBearishVolumeDecreased = false; - isBearishVolumeSwitchedToDecreased = false; - - // - isVolumeSwitchedToBullish = false; - isVolumeSwitchedToBearish = false; - - // - isBullishVolumeMaOverBearishVolumeMa = false; - isBullishVolumeMaUnderBearishVolumeMa = false; - - // - // Complex Conditions ... - - // - isSarIncreased = false; - isSarDecreased = false; - isX3MaFatsOverMid = false; - isSarEqualsToPeak = false; - isSarEqualsToVale = false; - isStrEqualsToPeak = false; - isStrEqualsToVale = false; - isX3MaFatsUnderMid = false; - isX3MaFatsOverSlow = false; - isAtrUpperOverPeak = false; - isPeakOverAtrUpper = false; - isStrUpperOverPeak = false; - isStrLowerOverVale = false; - isClosedOverCheMin = false; - isClosedOverCheMax = false; - isX3MaFatsUnderSlow = false; - isAtrLowerUnderVale = false; - isClosedOverX3MaMin = false; - isClosedOverX3MaMax = false; - isValeUnderAtrLower = false; - isStrUpperUnderPeak = false; - isStrLowerUnderVale = false; - isClosedUnderCheMin = false; - isClosedUnderCheMax = false; - isClosedOverVWapMin = false; - isClosedOverVWapMax = false; - isClosedUnderX3MaMin = false; - isClosedUnderX3MaMax = false; - isStrCrossedOverVale = false; - isSarCrossedOverVale = false; - isClosedUnderVWapMin = false; - isClosedUnderVWapMax = false; - isX3MaFatsOverMidPrev = false; - isSarCrossedUnderPeak = false; - isStrCrossedUnderPeak = false; - isNewPeakOverAtrUpper = false; - isX3MaFatsUnderMidPrev = false; - isX3MaFatsOverSlowPrev = false; - isAtrUpperEqualsToPeak = false; - isAtrLowerEqualsToVale = false; - isStrUpperOverAtrUpper = false; - isStrLowerOverAtrLower = false; - isNewValeUnderAtrLower = false; - isAtrUpperCrossedUpPeak = false; - isAtrLowerCrossedUpVale = false; - isStrUpperUnderAtrUpper = false; - isStrLowerUnderAtrLower = false; - isX3MaFatsUnderSlowPrev = false; - isX3MaFastCrossedOverMid = false; - isVWapFastCrossedOverMid = false; - isX3MaFastCrossedUnderMid = false; - isX3MaFastCrossedOverSlow = false; - isAtrUpperCrossedDownPeak = false; - isAtrLowerCrossedDownVale = false; - isStrLowerOverDonLowLower = false; - isVWapFastCrossedUnderMid = false; - isStrUpperCrossedOverPeak = false; - isStrLowerCrossedOverVale = false; - isDonLowLowerEqualsToVale = false; - isVWapFastCrossedOverSlow = false; - isX3MaFastCrossedUnderSlow = false; - isStrUpperOverDonHighUpper = false; - isStrLowerUnderDonLowLower = false; - isVWapFastCrossedUnderSlow = false; - isStrUpperCrossedUnderPeak = false; - isStrLowerCrossedUnderVale = false; - isDonHighUpperEqualsToPeak = false; - isStrUpperUnderDonHighUpper = false; - isStrUpperCrossedOverAtrUpper = false; - isStrLowerCrossedOverAtrLower = false; - isStrUpperCrossedUnderAtrUpper = false; - isStrLowerCrossedUnderAtrLower = false; - isStrLowerCrossedOverDonLowLower = false; - isStrUpperCrossedOverDonHighUpper = false; - isStrLowerCrossedUnderDonLowLower = false; - isStrUpperCrossedUnderDonHighUpper = false; + isVWapMidBullish = false; + isVWapMidBearish = false; + isVWapMidNeutural = false; + isVWapFastBullish = false; + isVWapFastBearish = false; + isVWapSlowBullish = false; + isVWapSlowBearish = false; + isVWapFastOverMid = false; + isVWapMidOverSlow = false; + isVWapFastNeutural = false; + isVWapSlowNeutural = false; + isVWapFastUnderMid = false; + isVWapMidUnderSlow = false; + isVWapBullishState = false; + isVWapBearishState = false; + isVWapNeuturalState = false; + isVWapBullishOrdered = false; + isVWapBearishOrdered = false; + isVWapSwitchedToBullishState = false; + isVWapSwitchedToBearishState = false; + isVWapSwitchedToNeuturalState = false; + isVWapSwitchedToBullishOrdered = false; + isVWapSwitchedToBearishOrdered = false; // ZeroMemory(this); @@ -1177,93 +993,10 @@ struct X121Conditions double highScore = 1.5; // - // SLOPES ... + // XCC ... // - if (isRsiSlopeBullish) - { - bullishScore += minScore; - } - if (isStrSlopeBullish) - { - bullishScore += minScore; - } - if (isAtrUpperSlopeBullish) - { - bullishScore += minScore; - } - if (isAtrLowerSlopeBullish) - { - bullishScore += minScore; - } - if (isVwapFastSlopeBullish) - { - bullishScore += minScore; - } - if (isVwapMidSlopeBullish) - { - bullishScore += minScore; - } - if (isVwapSlowSlopeBullish) - { - bullishScore += minScore; - } - - // - if (isRsiSlopeBearish) - { - bearishScore += minScore; - } - if (isStrSlopeBearish) - { - bearishScore += minScore; - } - if (isAtrUpperSlopeBearish) - { - bearishScore += minScore; - } - if (isAtrLowerSlopeBearish) - { - bearishScore += minScore; - } - if (isVwapFastSlopeBearish) - { - bearishScore += minScore; - } - if (isVwapMidSlopeBearish) - { - bearishScore += minScore; - } - if (isVwapSlowSlopeBearish) - { - bearishScore += minScore; - } - - // - // COMPLEX ... - - // - if (isRsiOverSold) - { - bullishScore += score; - } - if (isRsiCrossedUnderOverSold) - { - bullishScore += highScore; - } - - // - if (isRsiOverBought) - { - bearishScore += score; - } - if (isRsiCrossedOverOverBought) - { - bearishScore += highScore; - } - - // - // XSAR ... + // XPV ... // if (isSarBullish) @@ -1285,6 +1018,171 @@ struct X121Conditions bearishScore += score; } + // + // XHK ... + + // + if (isSMHKBullish) + { + bullishScore += minScore; + } + if (isRawHKBullish) + { + bullishScore += minScore; + } + if (isClosedOverSMHK) + { + bullishScore += minScore; + } + if (isClosedOverRawHK) + { + bullishScore += minScore; + } + if (isRawHKClosedOverSMHK) + { + bullishScore += minScore; + } + if (isSMHKSwitchedToBullish) + { + bullishScore += highScore; + } + if (isRawHKSwitchedToBullish) + { + bullishScore += highScore; + } + + // + if (isSMHKBearish) + { + bearishScore += minScore; + } + if (isRawHKBearish) + { + bearishScore += minScore; + } + if (isClosedUnderSMHK) + { + bearishScore += minScore; + } + if (isClosedUnderRawHK) + { + bearishScore += minScore; + } + if (isRawHKClosedUnderSMHK) + { + bearishScore += minScore; + } + if (isSMHKSwitchedToBearish) + { + bearishScore += highScore; + } + if (isRawHKSwitchedToBullish) + { + bearishScore += highScore; + } + + // + // XMAS ... + + // + // XATR ... + + // + if (isRsiOverSold) + { + bullishScore += minScore; + } + if (isRsiOverRsiSM) + { + bullishScore += minScore; + } + if (isRsiSMOverPriceChange) + { + bullishScore += minScore; + } + if (isPriceChangeSMOverRsi) + { + bullishScore += minScore; + } + if (isPriceChangeOverPriceChangeSM) + { + bullishScore += minScore; + } + + // + if (isRsiCrossedOverRsiSM) + { + bullishScore += score; + } + if (isRsiCrossedOverOverSold) + { + bullishScore += score; + } + if (isRsiCrossedUnderOverBought) + { + bullishScore += score; + } + if (isRsiSMCrossedOverPriceChange) + { + bullishScore += score; + } + if (isPriceChangeSMCrossedOverRsi) + { + bullishScore += score; + } + if (isPriceChangeCrossedOverPriceChangeSM) + { + bullishScore += score; + } + + // + if (isRsiOverBought) + { + bearishScore += minScore; + } + if (isRsiUnderRsiSM) + { + bearishScore += minScore; + } + if (isRsiSMUnderPriceChange) + { + bearishScore += minScore; + } + if (isPriceChangeSMUnderRsi) + { + bearishScore += minScore; + } + if (isPriceChangeUnderPriceChangeSM) + { + bearishScore += minScore; + } + + // + if (isRsiCrossedUnderRsiSM) + { + bearishScore += score; + } + if (isRsiCrossedUnderOverSold) + { + bearishScore += score; + } + if (isRsiCrossedOverOverBought) + { + bearishScore += score; + } + if (isRsiSMCrossedUnderPriceChange) + { + bearishScore += score; + } + if (isPriceChangeSMCrossedUnderRsi) + { + bearishScore += score; + } + if (isPriceChangeCrossedUnderPriceChangeSM) + { + bearishScore += score; + } + // // XSTR ... @@ -1355,97 +1253,6 @@ struct X121Conditions bearishScore += minScore; } - // - // XVWAP ... - - // - if (isVWapBullishState) - { - bullishScore += score; - } - if (isVWapBullishOrdered) - { - bullishScore += score; - } - if (isVWapSwitchedToBullishState) - { - bullishScore += highScore; - } - if (isVWapSwitchedToBullishOrdered) - { - bullishScore += highScore; - } - if (!isVWapBullishState && - !isVWapSwitchedToBullishState) - { - // - if (isVWapFastBullish) - { - bullishScore += minScore; - } - if (isVWapSlowBullish) - { - bullishScore += minScore; - } - } - if (!isVWapBullishOrdered && - !isVWapSwitchedToBullishOrdered) - { - // - if (isVWapFastOverMid) - { - bullishScore += minScore; - } - if (isVWapMidOverSlow) - { - bullishScore += minScore; - } - } - - // - if (isVWapBearishState) - { - bearishScore += score; - } - if (isVWapBearishOrdered) - { - bearishScore += score; - } - if (isVWapSwitchedToBearishState) - { - bearishScore += highScore; - } - if (isVWapSwitchedToBearishOrdered) - { - bearishScore += highScore; - } - if (!isVWapBearishState && - !isVWapSwitchedToBearishState) - { - // - if (isVWapFastBearish) - { - bearishScore += minScore; - } - if (isVWapSlowBearish) - { - bearishScore += minScore; - } - } - if (!isVWapBearishOrdered && - !isVWapSwitchedToBearishOrdered) - { - // - if (isVWapFastUnderMid) - { - bearishScore += minScore; - } - if (isVWapMidUnderSlow) - { - bearishScore += minScore; - } - } - // // X3MA ... @@ -1538,538 +1345,95 @@ struct X121Conditions } // - // XSMHK ... + // XVWAP ... // - if (isSMHKBullish) + if (isVWapBullishState) { - bullishScore += minScore; + bullishScore += score; } - if (isRawHKBullish) + if (isVWapBullishOrdered) { - bullishScore += minScore; + bullishScore += score; } - if (isClosedOverSMHK) - { - bullishScore += minScore; - } - if (isClosedOverRawHK) - { - bullishScore += minScore; - } - if (isRawHKClosedOverSMHK) - { - bullishScore += minScore; - } - if (isSMHKSwitchedToBullish) + if (isVWapSwitchedToBullishState) { bullishScore += highScore; } - if (isRawHKSwitchedToBullish) + if (isVWapSwitchedToBullishOrdered) { bullishScore += highScore; } + if (!isVWapBullishState && + !isVWapSwitchedToBullishState) + { + // + if (isVWapFastBullish) + { + bullishScore += minScore; + } + if (isVWapSlowBullish) + { + bullishScore += minScore; + } + } + if (!isVWapBullishOrdered && + !isVWapSwitchedToBullishOrdered) + { + // + if (isVWapFastOverMid) + { + bullishScore += minScore; + } + if (isVWapMidOverSlow) + { + bullishScore += minScore; + } + } // - if (isSMHKBearish) + if (isVWapBearishState) { - bearishScore += minScore; + bearishScore += score; } - if (isRawHKBearish) + if (isVWapBearishOrdered) { - bearishScore += minScore; + bearishScore += score; } - if (isClosedUnderSMHK) - { - bearishScore += minScore; - } - if (isClosedUnderRawHK) - { - bearishScore += minScore; - } - if (isRawHKClosedUnderSMHK) - { - bearishScore += minScore; - } - if (isSMHKSwitchedToBearish) + if (isVWapSwitchedToBearishState) { bearishScore += highScore; } - if (isRawHKSwitchedToBullish) + if (isVWapSwitchedToBearishOrdered) { bearishScore += highScore; } - - // - // XICH ... - if (isSenkouSpanAOverB) - { - bullishScore += minScore; - } - if (isTenkanSenOverKijunSen) - { - bullishScore += minScore; - } - if (isSenkouSpanACrossedOverB) - { - bullishScore += highScore; - } - if (isTenkanSenCrossedOverKijunSen) - { - bullishScore += highScore; - } - if (isSenkouSpanAUnderB) - { - bearishScore += minScore; - } - if (isTenkanSenUnderKijunSen) - { - bearishScore += minScore; - } - if (isSenkouSpanACrossedUnderB) - { - bearishScore += highScore; - } - if (isTenkanSenCrossedUnderKijunSen) - { - bearishScore += highScore; - } - - // - // Complex Conditions ... - - // - if (isSarIncreased) - { - bullishScore += minScore; - } - if (isSarEqualsToVale) - { - bullishScore += minScore; - } - if (isSarCrossedOverVale) - { - bullishScore += score; - } - - // - if (isAtrLowerUnderVale) - { - bullishScore += minScore; - } - if (isValeUnderAtrLower) - { - bullishScore += minScore; - } - if (isNewValeUnderAtrLower) - { - bullishScore += minScore; - } - if (isAtrLowerEqualsToVale) - { - bullishScore += minScore; - } - if (isStrLowerOverAtrLower) - { - bullishScore += minScore; - } - if (isStrUpperOverAtrUpper) - { - bullishScore += minScore; - } - if (isAtrLowerCrossedUpVale) - { - bullishScore += score; - } - if (isAtrUpperCrossedUpPeak) - { - bullishScore += score; - } - if (isStrLowerCrossedOverAtrLower) - { - bullishScore += score; - } - if (isStrUpperCrossedOverAtrUpper) - { - bullishScore += score; - } - - // - if (isStrEqualsToVale) - { - bullishScore += minScore; - } - if (isStrLowerOverVale) - { - bullishScore += minScore; - } - if (isStrLowerUnderVale) - { - bullishScore += minScore; - } - if (isStrCrossedOverVale) - { - bullishScore += score; - } - if (isStrUpperCrossedOverPeak) - { - bullishScore += score; - } - if (isStrLowerCrossedOverVale) - { - bullishScore += score; - } - if (isStrLowerUnderDonLowLower) - { - bullishScore += minScore; - } - if (isStrLowerCrossedOverDonLowLower) - { - bullishScore += score; - } - if (isStrUpperCrossedOverDonHighUpper) - { - bullishScore += score; - } - - // - if (isClosedOverVWapMin) - { - bullishScore += minScore; - } - if (isClosedOverVWapMax) - { - bullishScore += minScore; - } - if (isVWapFastCrossedOverMid) - { - bullishScore += score; - } - if (isVWapFastCrossedOverSlow) - { - bullishScore += score; - } - - // - if (isClosedOverX3MaMin) - { - bullishScore += minScore; - } - if (isClosedOverX3MaMax) - { - bullishScore += minScore; - } - if (isX3MaFastCrossedOverMid) - { - bullishScore += score; - } - if (isX3MaFastCrossedOverSlow) - { - bullishScore += score; - } - - // - if (isClosedOverCheMin) - { - bullishScore += minScore; - } - if (isClosedOverCheMax) - { - bullishScore += minScore; - } - if (isDonLowLowerEqualsToVale) - { - bullishScore += minScore; - } - - // - // XDELTA ... - - // - if (isDeltaOverMa) - { - bullishScore += minScore; - } - if (isDeltaBullish) - { - bullishScore += minScore; - } - if (isDeltaCrossedOverMa) - { - bullishScore += score; - } - if (isDeltaSwitchedToBullish) - { - bullishScore += score; - } - - if (isDeltaBearish) - { - bearishScore += minScore; - } - if (isDeltaUnderMa) - { - bearishScore += minScore; - } - if (isDeltaCrossedUnderMa) - { - bearishScore += score; - } - if (isDeltaSwitchedToBearish) - { - bearishScore += score; - } - - // - // XVOLUME ... - - // - if (isBullishVolumeOverMa) - { - bullishScore += minScore; - } - if (isBearishVolumeUnderMa) - { - bullishScore += minScore; - } - if (isBullishVolumeIncreased) - { - bullishScore += minScore; - } - if (isBearishVolumeDecreased) - { - bullishScore += minScore; - } - if (isBullishVolumeMaOverBearishVolumeMa) - { - bullishScore += minScore; - } - - // - if (isVolumeSwitchedToBullish) - { - bullishScore += score; - } - if (isBullishVolumeCrossedOverMa) - { - bullishScore += score; - } - if (isBearishVolumeCrossedUnderMa) - { - bullishScore += score; - } - if (isBullishVolumeSwitchedToIncreased) - { - bullishScore += score; - } - if (isBearishVolumeSwitchedToDecreased) - { - bullishScore += score; - } - - // - if (isBearishVolumeOverMa) - { - bearishScore += minScore; - } - if (isBullishVolumeUnderMa) - { - bearishScore += minScore; - } - if (isBullishVolumeDecreased) - { - bearishScore += minScore; - } - if (isBearishVolumeIncreased) - { - bearishScore += minScore; - } - if (isBullishVolumeMaUnderBearishVolumeMa) - { - bearishScore += minScore; - } - - // - if (isVolumeSwitchedToBearish) - { - bearishScore += score; - } - if (isBearishVolumeCrossedOverMa) - { - bearishScore += score; - } - if (isBullishVolumeCrossedUnderMa) - { - bearishScore += score; - } - if (isBullishVolumeSwitchedToDecreased) - { - bearishScore += score; - } - if (isBearishVolumeSwitchedToIncreased) - { - bearishScore += score; - } - - // - // - // - - // - if (isSarDecreased) - { - bearishScore += minScore; - } - if (isSarEqualsToPeak) - { - bearishScore += minScore; - } - if (isSarCrossedUnderPeak) - { - bearishScore += score; - } - - // - if (isAtrUpperOverPeak) - { - bearishScore += minScore; - } - if (isPeakOverAtrUpper) - { - bearishScore += minScore; - } - if (isNewPeakOverAtrUpper) - { - bearishScore += minScore; - } - if (isAtrUpperEqualsToPeak) - { - bearishScore += minScore; - } - if (isStrLowerUnderAtrLower) - { - bearishScore += minScore; - } - if (isStrUpperUnderAtrUpper) - { - bearishScore += minScore; - } - if (isAtrLowerCrossedDownVale) - { - bearishScore += score; - } - if (isAtrUpperCrossedDownPeak) - { - bearishScore += score; - } - if (isStrLowerCrossedUnderAtrLower) - { - bearishScore += score; - } - if (isStrUpperCrossedUnderAtrUpper) - { - bearishScore += score; - } - - // - if (isStrEqualsToPeak) - { - bearishScore += minScore; - } - if (isStrUpperOverPeak) - { - bearishScore += minScore; - } - if (isStrUpperUnderPeak) - { - bearishScore += minScore; - } - if (isStrCrossedUnderPeak) - { - bearishScore += score; - } - if (isStrLowerOverDonLowLower) - { - bearishScore += minScore; - } - if (isStrUpperOverDonHighUpper) - { - bearishScore += minScore; - } - if (isStrUpperCrossedUnderPeak) - { - bearishScore += score; - } - if (isStrLowerCrossedUnderVale) - { - bearishScore += score; - } - if (isStrUpperUnderDonHighUpper) - { - bearishScore += minScore; - } - if (isStrLowerCrossedUnderDonLowLower) - { - bearishScore += score; - } - if (isStrUpperCrossedUnderDonHighUpper) - { - bearishScore += score; - } - - // - if (isClosedUnderVWapMin) - { - bearishScore += minScore; - } - if (isClosedUnderVWapMax) - { - bearishScore += minScore; - } - if (isVWapFastCrossedUnderMid) - { - bearishScore += score; - } - if (isVWapFastCrossedUnderSlow) - { - bearishScore += score; - } - - // - if (isClosedUnderX3MaMin) - { - bearishScore += minScore; - } - if (isClosedUnderX3MaMax) - { - bearishScore += minScore; - } - if (isX3MaFastCrossedUnderMid) - { - bearishScore += score; - } - if (isX3MaFastCrossedUnderSlow) - { - bearishScore += score; - } - - // - if (isClosedUnderCheMin) - { - bearishScore += minScore; - } - if (isClosedUnderCheMax) - { - bearishScore += minScore; - } - if (isDonHighUpperEqualsToPeak) - { - bearishScore += minScore; + if (!isVWapBearishState && + !isVWapSwitchedToBearishState) + { + // + if (isVWapFastBearish) + { + bearishScore += minScore; + } + if (isVWapSlowBearish) + { + bearishScore += minScore; + } + } + if (!isVWapBearishOrdered && + !isVWapSwitchedToBearishOrdered) + { + // + if (isVWapFastUnderMid) + { + bearishScore += minScore; + } + if (isVWapMidUnderSlow) + { + bearishScore += minScore; + } } - - // - // - // } /** @@ -2121,58 +1485,190 @@ struct X121Conditions ); // - string conditionsStr = + // XCC ... + + // + // XPV ... + + // + string pvConditionsStr = // "-----------------------" + separator + - "SAR ..." + separator + + "XPV: " + separator + "-----------------------" + separator + ToString("isSarBullish", isSarBullish, ignoreFalseConditions, separator) + ToString("isSarBearish", isSarBearish, ignoreFalseConditions, separator) + ToString("isSarSwitchedToBullish", isSarSwitchedToBullish, ignoreFalseConditions, separator) + ToString("isSarSwitchedToBearish", isSarSwitchedToBearish, ignoreFalseConditions, separator) + - // - "-----------------------" + separator + - "STR ..." + separator + - "-----------------------" + separator + - ToString("isStrBullish", isStrBullish, ignoreFalseConditions, separator) + - ToString("isStrBearish", isStrBearish, ignoreFalseConditions, separator) + - ToString("isStrSwitchedToBullish", isStrSwitchedToBullish, ignoreFalseConditions, separator) + - ToString("isStrSwitchedToBearish", isStrSwitchedToBearish, ignoreFalseConditions, separator) + - // - "-----------------------" + separator + - "PV ..." + separator + - "-----------------------" + separator + ToString("isNewPeak", isNewPeak, ignoreFalseConditions, separator) + ToString("isNewPeakOverLast", isNewPeakOverLast, ignoreFalseConditions, separator) + ToString("isNewPeakUnderLast", isNewPeakUnderLast, ignoreFalseConditions, separator) + ToString("isNewVale", isNewVale, ignoreFalseConditions, separator) + ToString("isNewValeOverLast", isNewValeOverLast, ignoreFalseConditions, separator) + ToString("isNewValeUnderLast", isNewValeUnderLast, ignoreFalseConditions, separator) + + // + "" + // + ; + + // + // XHK ... + + // + string hkConditionsStr = // "-----------------------" + separator + - "> RSI ..." + separator + + "XHK: " + separator + "-----------------------" + separator + + ToString("isSMHKBullish", isSMHKBullish, ignoreFalseConditions, separator) + + ToString("isRawHKBullish", isRawHKBullish, ignoreFalseConditions, separator) + + ToString("isSMHKSwitchedToBullish", isSMHKSwitchedToBullish, ignoreFalseConditions, separator) + + ToString("isRawHKSwitchedToBullish", isRawHKSwitchedToBullish, ignoreFalseConditions, separator) + + ToString("isSMHKBearish", isSMHKBearish, ignoreFalseConditions, separator) + + ToString("isRawHKBearish", isRawHKBearish, ignoreFalseConditions, separator) + + ToString("isSMHKSwitchedToBearish", isSMHKSwitchedToBearish, ignoreFalseConditions, separator) + + ToString("isRawHKSwitchedToBearish", isRawHKSwitchedToBearish, ignoreFalseConditions, separator) + + ToString("isClosedOverSMHK", isClosedOverSMHK, ignoreFalseConditions, separator) + + ToString("isClosedUnderSMHK", isClosedUnderSMHK, ignoreFalseConditions, separator) + + ToString("isClosedOverRawHK", isClosedOverRawHK, ignoreFalseConditions, separator) + + ToString("isClosedUnderRawHK", isClosedUnderRawHK, ignoreFalseConditions, separator) + + ToString("isRawHKClosedOverSMHK", isRawHKClosedOverSMHK, ignoreFalseConditions, separator) + + ToString("isRawHKClosedUnderSMHK", isRawHKClosedUnderSMHK, ignoreFalseConditions, separator) + + // + "" + // + ; + + // + // XMAS ... + + // + // XATR ... + + // + string atrConditionsStr = + // + "-----------------------" + separator + + "XATR: " + separator + + "-----------------------" + separator + + ToString("isRsiInRange", isRsiInRange, ignoreFalseConditions, separator) + + ToString("isRsiOverSold", isRsiOverSold, ignoreFalseConditions, separator) + ToString("isRsiOverBought", isRsiOverBought, ignoreFalseConditions, separator) + + ToString("isRsiCrossedOverOverSold", isRsiCrossedOverOverSold, ignoreFalseConditions, separator) + + ToString("isRsiCrossedUnderOverSold", isRsiCrossedUnderOverSold, ignoreFalseConditions, separator) + ToString("isRsiCrossedOverOverBought", isRsiCrossedOverOverBought, ignoreFalseConditions, separator) + ToString("isRsiCrossedUnderOverBought", isRsiCrossedUnderOverBought, ignoreFalseConditions, separator) + - ToString("isRsiOverSold", isRsiOverSold, ignoreFalseConditions, separator) + - ToString("isRsiCrossedUnderOverSold", isRsiCrossedUnderOverSold, ignoreFalseConditions, separator) + - ToString("isRsiCrossedOverOverSold", isRsiCrossedOverOverSold, ignoreFalseConditions, separator) + + // + ToString("isRsiSMOverPriceChange", isRsiSMOverPriceChange, ignoreFalseConditions, separator) + + ToString("isRsiSMUnderPriceChange", isRsiSMUnderPriceChange, ignoreFalseConditions, separator) + + ToString("isRsiSMCrossedOverPriceChange", isRsiSMCrossedOverPriceChange, ignoreFalseConditions, separator) + + ToString("isRsiSMCrossedUnderPriceChange", isRsiSMCrossedUnderPriceChange, ignoreFalseConditions, separator) + + ToString("isPriceChangeSMOverRsi", isPriceChangeSMOverRsi, ignoreFalseConditions, separator) + + ToString("isPriceChangeSMUnderRsi", isPriceChangeSMUnderRsi, ignoreFalseConditions, separator) + + ToString("isPriceChangeSMCrossedOverRsi", isPriceChangeSMCrossedOverRsi, ignoreFalseConditions, separator) + + ToString("isPriceChangeSMCrossedUnderRsi", isPriceChangeSMCrossedUnderRsi, ignoreFalseConditions, separator) + + ToString("isRsiOverRsiSM", isRsiOverRsiSM, ignoreFalseConditions, separator) + + ToString("isRsiUnderRsiSM", isRsiUnderRsiSM, ignoreFalseConditions, separator) + + ToString("isRsiCrossedOverRsiSM", isRsiCrossedOverRsiSM, ignoreFalseConditions, separator) + + ToString("isRsiCrossedUnderRsiSM", isRsiCrossedUnderRsiSM, ignoreFalseConditions, separator) + + ToString("isPriceChangeOverPriceChangeSM", isPriceChangeOverPriceChangeSM, ignoreFalseConditions, separator) + + ToString("isPriceChangeUnderPriceChangeSM", isPriceChangeUnderPriceChangeSM, ignoreFalseConditions, separator) + + ToString("isPriceChangeCrossedOverPriceChangeSM", isPriceChangeCrossedOverPriceChangeSM, ignoreFalseConditions, separator) + + ToString("isPriceChangeCrossedUnderPriceChangeSM", isPriceChangeCrossedUnderPriceChangeSM, ignoreFalseConditions, separator) + + // + "" + // + ; + + // + // XSTR ... + + // + string strConditionsStr = // "-----------------------" + separator + - "ATR ..." + separator + + "XSTR: " + separator + "-----------------------" + separator + - ToString("isClosedOverAtrUpper", isClosedOverAtrUpper, ignoreFalseConditions, separator) + - ToString("isClosedOverAtrLower", isClosedOverAtrLower, ignoreFalseConditions, separator) + - ToString("isClosedUnderAtrUpper", isClosedUnderAtrUpper, ignoreFalseConditions, separator) + - ToString("isClosedUnderAtrLower", isClosedUnderAtrLower, ignoreFalseConditions, separator) + + ToString("isStrBullish", isStrBullish, ignoreFalseConditions, separator) + + ToString("isStrBearish", isStrBearish, ignoreFalseConditions, separator) + + ToString("isStrSwitchedToBullish", isStrSwitchedToBullish, ignoreFalseConditions, separator) + + ToString("isStrSwitchedToBearish", isStrSwitchedToBearish, ignoreFalseConditions, separator) + + // + "" + // + ; + + // + // XCHE ... + + // + string cheConditionsStr = // "-----------------------" + separator + - "DON ..." + separator + + "XCHE: " + separator + "-----------------------" + separator + + ToString("isChe1Bullish", isChe1Bullish, ignoreFalseConditions, separator) + + ToString("isChe1Bearish", isChe1Bearish, ignoreFalseConditions, separator) + + ToString("isChe1SwitchedToBullish", isChe1SwitchedToBullish, ignoreFalseConditions, separator) + + ToString("isChe1SwitchedToBearish", isChe1SwitchedToBearish, ignoreFalseConditions, separator) + + ToString("isChe2Bullish", isChe2Bullish, ignoreFalseConditions, separator) + + ToString("isChe2Bearish", isChe2Bearish, ignoreFalseConditions, separator) + + ToString("isChe2SwitchedToBullish", isChe2SwitchedToBullish, ignoreFalseConditions, separator) + + ToString("isChe2SwitchedToBearish", isChe2SwitchedToBearish, ignoreFalseConditions, separator) + + ToString("isCheBullish", isCheBullish, ignoreFalseConditions, separator) + + ToString("isCheBearish", isCheBearish, ignoreFalseConditions, separator) + + ToString("isCheSwitchedToBullish", isCheSwitchedToBullish, ignoreFalseConditions, separator) + + ToString("isCheSwitchedToBearish", isCheSwitchedToBearish, ignoreFalseConditions, separator) + + // + "" + // + ; + + // + // X3MA ... + + // + string x3maonditionsStr = // "-----------------------" + separator + - "VWAP ..." + separator + + "X3MA: " + separator + + "-----------------------" + separator + + ToString("isX3MaFastBullish", isX3MaFastBullish, ignoreFalseConditions, separator) + + ToString("isX3MaFastBearish", isX3MaFastBearish, ignoreFalseConditions, separator) + + ToString("isX3MaFastNeutural", isX3MaFastNeutural, ignoreFalseConditions, separator) + + ToString("isX3MaMidBullish", isX3MaMidBullish, ignoreFalseConditions, separator) + + ToString("isX3MaMidBearish", isX3MaMidBearish, ignoreFalseConditions, separator) + + ToString("isX3MaMidNeutural", isX3MaMidNeutural, ignoreFalseConditions, separator) + + ToString("isX3MaSlowBullish", isX3MaSlowBullish, ignoreFalseConditions, separator) + + ToString("isX3MaSlowBearish", isX3MaSlowBearish, ignoreFalseConditions, separator) + + ToString("isX3MaSlowNeutural", isX3MaSlowNeutural, ignoreFalseConditions, separator) + + ToString("isX3MaFastOverMid", isX3MaFastOverMid, ignoreFalseConditions, separator) + + ToString("isX3MaMidOverSlow", isX3MaMidOverSlow, ignoreFalseConditions, separator) + + ToString("isX3MaFastUnderMid", isX3MaFastUnderMid, ignoreFalseConditions, separator) + + ToString("isX3MaMidUnderSlow", isX3MaMidUnderSlow, ignoreFalseConditions, separator) + + ToString("isX3MaBullishState", isX3MaBullishState, ignoreFalseConditions, separator) + + ToString("isX3MaBearishState", isX3MaBearishState, ignoreFalseConditions, separator) + + ToString("isX3MaNeuturalState", isX3MaNeuturalState, ignoreFalseConditions, separator) + + ToString("isX3MaBullishOrdered", isX3MaBullishOrdered, ignoreFalseConditions, separator) + + ToString("isX3MaBearishOrdered", isX3MaBearishOrdered, ignoreFalseConditions, separator) + + ToString("isX3MaSwitchedToBullishOrdered", isX3MaSwitchedToBullishOrdered, ignoreFalseConditions, separator) + + ToString("isX3MaSwitchedToBearishOrdered", isX3MaSwitchedToBearishOrdered, ignoreFalseConditions, separator) + + ToString("isX3MaSwitchedToBullishState", isX3MaSwitchedToBullishState, ignoreFalseConditions, separator) + + ToString("isX3MaSwitchedToBearishState", isX3MaSwitchedToBearishState, ignoreFalseConditions, separator) + + ToString("isX3MaSwitchedToNeuturalState", isX3MaSwitchedToNeuturalState, ignoreFalseConditions, separator) + + // + "" + // + ; + + // + // XVWAP ... + + // + string vwapConditionsStr = + // + "-----------------------" + separator + + "XVWAP: " + separator + "-----------------------" + separator + ToString("isVWapFastBullish", isVWapFastBullish, ignoreFalseConditions, separator) + ToString("isVWapFastBearish", isVWapFastBearish, ignoreFalseConditions, separator) + @@ -2198,196 +1694,20 @@ struct X121Conditions ToString("isVWapSwitchedToBearishState", isVWapSwitchedToBearishState, ignoreFalseConditions, separator) + ToString("isVWapSwitchedToNeuturalState", isVWapSwitchedToNeuturalState, ignoreFalseConditions, separator) + // - "-----------------------" + separator + - "X3MA ..." + separator + - "-----------------------" + separator + - ToString("isX3MaMidBullish", isX3MaMidBullish, ignoreFalseConditions, separator) + - ToString("isX3MaMidBearish", isX3MaMidBearish, ignoreFalseConditions, separator) + - ToString("isX3MaFastBullish", isX3MaFastBullish, ignoreFalseConditions, separator) + - ToString("isX3MaFastBearish", isX3MaFastBearish, ignoreFalseConditions, separator) + - ToString("isX3MaMidNeutural", isX3MaMidNeutural, ignoreFalseConditions, separator) + - ToString("isX3MaSlowBullish", isX3MaSlowBullish, ignoreFalseConditions, separator) + - ToString("isX3MaSlowBearish", isX3MaSlowBearish, ignoreFalseConditions, separator) + - ToString("isX3MaFastOverMid", isX3MaFastOverMid, ignoreFalseConditions, separator) + - ToString("isX3MaMidOverSlow", isX3MaMidOverSlow, ignoreFalseConditions, separator) + - ToString("isX3MaFastNeutural", isX3MaFastNeutural, ignoreFalseConditions, separator) + - ToString("isX3MaSlowNeutural", isX3MaSlowNeutural, ignoreFalseConditions, separator) + - ToString("isX3MaFastUnderMid", isX3MaFastUnderMid, ignoreFalseConditions, separator) + - ToString("isX3MaMidUnderSlow", isX3MaMidUnderSlow, ignoreFalseConditions, separator) + - ToString("isX3MaBullishState", isX3MaBullishState, ignoreFalseConditions, separator) + - ToString("isX3MaBearishState", isX3MaBearishState, ignoreFalseConditions, separator) + - ToString("isX3MaNeuturalState", isX3MaNeuturalState, ignoreFalseConditions, separator) + - ToString("isX3MaBullishOrdered", isX3MaBullishOrdered, ignoreFalseConditions, separator) + - ToString("isX3MaBearishOrdered", isX3MaBearishOrdered, ignoreFalseConditions, separator) + - ToString("isX3MaSwitchedToBullishState", isX3MaSwitchedToBullishState, ignoreFalseConditions, separator) + - ToString("isX3MaSwitchedToBearishState", isX3MaSwitchedToBearishState, ignoreFalseConditions, separator) + - ToString("isX3MaSwitchedToNeuturalState", isX3MaSwitchedToNeuturalState, ignoreFalseConditions, separator) + - ToString("isX3MaSwitchedToBullishOrdered", isX3MaSwitchedToBullishOrdered, ignoreFalseConditions, separator) + - ToString("isX3MaSwitchedToBearishOrdered", isX3MaSwitchedToBearishOrdered, ignoreFalseConditions, separator) + + "" // - "-----------------------" + separator + - "CHE ..." + separator + - "-----------------------" + separator + - ToString("isChe1Bullish", isChe1Bullish, ignoreFalseConditions, separator) + - ToString("isChe1Bearish", isChe1Bearish, ignoreFalseConditions, separator) + - ToString("isChe1SwitchedToBullish", isChe1SwitchedToBullish, ignoreFalseConditions, separator) + - ToString("isChe1SwitchedToBearish", isChe1SwitchedToBearish, ignoreFalseConditions, separator) + - ToString("isChe2Bullish", isChe2Bullish, ignoreFalseConditions, separator) + - ToString("isChe2Bearish", isChe2Bearish, ignoreFalseConditions, separator) + - ToString("isChe2SwitchedToBullish", isChe2SwitchedToBullish, ignoreFalseConditions, separator) + - ToString("isChe2SwitchedToBearish", isChe2SwitchedToBearish, ignoreFalseConditions, separator) + - ToString("isCheBullish", isCheBullish, ignoreFalseConditions, separator) + - ToString("isCheBearish", isCheBearish, ignoreFalseConditions, separator) + - ToString("isCheSwitchedToBullish", isCheSwitchedToBullish, ignoreFalseConditions, separator) + - ToString("isCheSwitchedToBearish", isCheSwitchedToBearish, ignoreFalseConditions, separator) + - ToString("isClosedOverCheMin", isClosedOverCheMin, ignoreFalseConditions, separator) + - ToString("isClosedOverCheMax", isClosedOverCheMax, ignoreFalseConditions, separator) + - ToString("isClosedUnderCheMin", isClosedUnderCheMin, ignoreFalseConditions, separator) + - ToString("isClosedUnderCheMax", isClosedUnderCheMax, ignoreFalseConditions, separator) + - // - "-----------------------" + separator + - "HK ..." + separator + - "-----------------------" + separator + - ToString("isSMHKBullish", isSMHKBullish, ignoreFalseConditions, separator) + - ToString("isRawHKBullish", isRawHKBullish, ignoreFalseConditions, separator) + - ToString("isSMHKBearish", isSMHKBearish, ignoreFalseConditions, separator) + - ToString("isRawHKBearish", isRawHKBearish, ignoreFalseConditions, separator) + - ToString("isClosedOverSMHK", isClosedOverSMHK, ignoreFalseConditions, separator) + - ToString("isClosedUnderSMHK", isClosedUnderSMHK, ignoreFalseConditions, separator) + - ToString("isClosedOverRawHK", isClosedOverRawHK, ignoreFalseConditions, separator) + - ToString("isClosedUnderRawHK", isClosedUnderRawHK, ignoreFalseConditions, separator) + - ToString("isRawHKClosedOverSMHK", isRawHKClosedOverSMHK, ignoreFalseConditions, separator) + - ToString("isSMHKSwitchedToBearish", isSMHKSwitchedToBearish, ignoreFalseConditions, separator) + - ToString("isRawHKSwitchedToBearish", isRawHKSwitchedToBearish, ignoreFalseConditions, separator) + - ToString("isRawHKClosedUnderSMHK", isRawHKClosedUnderSMHK, ignoreFalseConditions, separator) + - ToString("isSMHKSwitchedToBullish", isSMHKSwitchedToBullish, ignoreFalseConditions, separator) + - ToString("isRawHKSwitchedToBullish", isRawHKSwitchedToBullish, ignoreFalseConditions, separator) + - // - "-----------------------" + separator + - "XICH ..." + separator + - "-----------------------" + separator + - ToString("isTenkanSenOverKijunSen", isTenkanSenOverKijunSen, ignoreFalseConditions, separator) + - ToString("isTenkanSenUnderKijunSen", isTenkanSenUnderKijunSen, ignoreFalseConditions, separator) + - ToString("isTenkanSenCrossedOverKijunSen", isTenkanSenCrossedOverKijunSen, ignoreFalseConditions, separator) + - ToString("isTenkanSenCrossedUnderKijunSen", isTenkanSenCrossedUnderKijunSen, ignoreFalseConditions, separator) + - ToString("isSenkouSpanAOverB", isSenkouSpanAOverB, ignoreFalseConditions, separator) + - ToString("isSenkouSpanAUnderB", isSenkouSpanAUnderB, ignoreFalseConditions, separator) + - ToString("isSenkouSpanACrossedOverB", isSenkouSpanACrossedOverB, ignoreFalseConditions, separator) + - ToString("isSenkouSpanACrossedUnderB", isSenkouSpanACrossedUnderB, ignoreFalseConditions, separator) + - // - "-----------------------" + separator + - "XDELTA ..." + separator + - "-----------------------" + separator + - ToString("isDeltaBullish", isDeltaBullish, ignoreFalseConditions, separator) + - ToString("isDeltaBearish", isDeltaBearish, ignoreFalseConditions, separator) + - ToString("isDeltaSwitchedToBullish", isDeltaSwitchedToBullish, ignoreFalseConditions, separator) + - ToString("isDeltaSwitchedToBearish", isDeltaSwitchedToBearish, ignoreFalseConditions, separator) + - ToString("isDeltaOverMa", isDeltaOverMa, ignoreFalseConditions, separator) + - ToString("isDeltaUnderMa", isDeltaUnderMa, ignoreFalseConditions, separator) + - ToString("isDeltaCrossedOverMa", isDeltaCrossedOverMa, ignoreFalseConditions, separator) + - ToString("isDeltaCrossedUnderMa", isDeltaCrossedUnderMa, ignoreFalseConditions, separator) + - // - "-----------------------" + separator + - "XVOLUME ..." + separator + - "-----------------------" + separator + - ToString("isBullishVolumeOverMa", isBullishVolumeOverMa, ignoreFalseConditions, separator) + - ToString("isBullishVolumeCrossedOverMa", isBullishVolumeCrossedOverMa, ignoreFalseConditions, separator) + - ToString("isBullishVolumeUnderMa", isBullishVolumeUnderMa, ignoreFalseConditions, separator) + - ToString("isBullishVolumeCrossedUnderMa", isBullishVolumeCrossedUnderMa, ignoreFalseConditions, separator) + - ToString("isBullishVolumeIncreased", isBullishVolumeIncreased, ignoreFalseConditions, separator) + - ToString("isBullishVolumeSwitchedToIncreased", isBullishVolumeSwitchedToIncreased, ignoreFalseConditions, separator) + - ToString("isBullishVolumeDecreased", isBullishVolumeDecreased, ignoreFalseConditions, separator) + - ToString("isBullishVolumeSwitchedToDecreased", isBullishVolumeSwitchedToDecreased, ignoreFalseConditions, separator) + - ToString("isBearishVolumeOverMa", isBearishVolumeOverMa, ignoreFalseConditions, separator) + - ToString("isBearishVolumeCrossedOverMa", isBearishVolumeCrossedOverMa, ignoreFalseConditions, separator) + - ToString("isBearishVolumeUnderMa", isBearishVolumeUnderMa, ignoreFalseConditions, separator) + - ToString("isBearishVolumeCrossedUnderMa", isBearishVolumeCrossedUnderMa, ignoreFalseConditions, separator) + - ToString("isBearishVolumeIncreased", isBearishVolumeIncreased, ignoreFalseConditions, separator) + - ToString("isBearishVolumeSwitchedToIncreased", isBearishVolumeSwitchedToIncreased, ignoreFalseConditions, separator) + - ToString("isBearishVolumeDecreased", isBearishVolumeDecreased, ignoreFalseConditions, separator) + - ToString("isBearishVolumeSwitchedToDecreased", isBearishVolumeSwitchedToDecreased, ignoreFalseConditions, separator) + - ToString("isVolumeSwitchedToBullish", isVolumeSwitchedToBullish, ignoreFalseConditions, separator) + - ToString("isVolumeSwitchedToBearish", isVolumeSwitchedToBearish, ignoreFalseConditions, separator) + - ToString("isBullishVolumeMaOverBearishVolumeMa", isBullishVolumeMaOverBearishVolumeMa, ignoreFalseConditions, separator) + - ToString("isBullishVolumeMaUnderBearishVolumeMa", isBullishVolumeMaUnderBearishVolumeMa, ignoreFalseConditions, separator) + - // - "-----------------------" + separator + - "Slopes ..." + separator + - "-----------------------" + separator + - ToString("isRsiSlopeBullish", isRsiSlopeBullish, ignoreFalseConditions, separator) + - ToString("isStrSlopeBullish", isStrSlopeBullish, ignoreFalseConditions, separator) + - ToString("isAtrUpperSlopeBullish", isAtrUpperSlopeBullish, ignoreFalseConditions, separator) + - ToString("isAtrLowerSlopeBullish", isAtrLowerSlopeBullish, ignoreFalseConditions, separator) + - ToString("isVwapFastSlopeBullish", isVwapFastSlopeBullish, ignoreFalseConditions, separator) + - ToString("isVwapMidSlopeBullish", isVwapMidSlopeBullish, ignoreFalseConditions, separator) + - ToString("isVwapSlowSlopeBullish", isVwapSlowSlopeBullish, ignoreFalseConditions, separator) + - ToString("isRsiSlopeBearish", isRsiSlopeBearish, ignoreFalseConditions, separator) + - ToString("isStrSlopeBearish", isStrSlopeBearish, ignoreFalseConditions, separator) + - ToString("isAtrUpperSlopeBearish", isAtrUpperSlopeBearish, ignoreFalseConditions, separator) + - ToString("isAtrLowerSlopeBearish", isAtrLowerSlopeBearish, ignoreFalseConditions, separator) + - ToString("isVwapFastSlopeBearish", isVwapFastSlopeBearish, ignoreFalseConditions, separator) + - ToString("isVwapMidSlopeBearish", isVwapMidSlopeBearish, ignoreFalseConditions, separator) + - ToString("isVwapSlowSlopeBearish", isVwapSlowSlopeBearish, ignoreFalseConditions, separator) + - // - "-----------------------" + separator + - "Coplex ..." + separator + - "-----------------------" + separator + - ToString("isSarIncreased", isSarIncreased, ignoreFalseConditions, separator) + - ToString("isSarDecreased", isSarDecreased, ignoreFalseConditions, separator) + - ToString("isSarEqualsToPeak", isSarEqualsToPeak, ignoreFalseConditions, separator) + - ToString("isStrEqualsToPeak", isStrEqualsToPeak, ignoreFalseConditions, separator) + - ToString("isStrEqualsToVale", isStrEqualsToVale, ignoreFalseConditions, separator) + - ToString("isPeakOverAtrUpper", isPeakOverAtrUpper, ignoreFalseConditions, separator) + - ToString("isStrUpperOverPeak", isStrUpperOverPeak, ignoreFalseConditions, separator) + - ToString("isStrLowerOverVale", isStrLowerOverVale, ignoreFalseConditions, separator) + - ToString("isAtrUpperOverPeak", isAtrUpperOverPeak, ignoreFalseConditions, separator) + - ToString("isAtrLowerUnderVale", isAtrLowerUnderVale, ignoreFalseConditions, separator) + - ToString("isClosedOverVWapMin", isClosedOverVWapMin, ignoreFalseConditions, separator) + - ToString("isClosedOverVWapMax", isClosedOverVWapMax, ignoreFalseConditions, separator) + - ToString("isStrUpperUnderPeak", isStrUpperUnderPeak, ignoreFalseConditions, separator) + - ToString("isValeUnderAtrLower", isValeUnderAtrLower, ignoreFalseConditions, separator) + - ToString("isStrLowerUnderVale", isStrLowerUnderVale, ignoreFalseConditions, separator) + - ToString("isClosedUnderVWapMin", isClosedUnderVWapMin, ignoreFalseConditions, separator) + - ToString("isClosedUnderVWapMax", isClosedUnderVWapMax, ignoreFalseConditions, separator) + - ToString("isSarCrossedOverVale", isSarCrossedOverVale, ignoreFalseConditions, separator) + - ToString("isStrCrossedOverVale", isStrCrossedOverVale, ignoreFalseConditions, separator) + - ToString("isSarCrossedUnderPeak", isSarCrossedUnderPeak, ignoreFalseConditions, separator) + - ToString("isStrCrossedUnderPeak", isStrCrossedUnderPeak, ignoreFalseConditions, separator) + - ToString("isNewPeakOverAtrUpper", isNewPeakOverAtrUpper, ignoreFalseConditions, separator) + - ToString("isNewValeUnderAtrLower", isNewValeUnderAtrLower, ignoreFalseConditions, separator) + - ToString("isStrUpperOverAtrUpper", isStrUpperOverAtrUpper, ignoreFalseConditions, separator) + - ToString("isStrLowerOverAtrLower", isStrLowerOverAtrLower, ignoreFalseConditions, separator) + - ToString("isAtrUpperEqualsToPeak", isAtrUpperEqualsToPeak, ignoreFalseConditions, separator) + - ToString("isAtrLowerEqualsToVale", isAtrLowerEqualsToVale, ignoreFalseConditions, separator) + - ToString("isAtrUpperCrossedUpPeak", isAtrUpperCrossedUpPeak, ignoreFalseConditions, separator) + - ToString("isAtrLowerCrossedUpVale", isAtrLowerCrossedUpVale, ignoreFalseConditions, separator) + - ToString("isStrUpperUnderAtrUpper", isStrUpperUnderAtrUpper, ignoreFalseConditions, separator) + - ToString("isStrLowerUnderAtrLower", isStrLowerUnderAtrLower, ignoreFalseConditions, separator) + - ToString("isVWapFastCrossedOverMid", isVWapFastCrossedOverMid, ignoreFalseConditions, separator) + - ToString("isAtrUpperCrossedDownPeak", isAtrUpperCrossedDownPeak, ignoreFalseConditions, separator) + - ToString("isAtrLowerCrossedDownVale", isAtrLowerCrossedDownVale, ignoreFalseConditions, separator) + - ToString("isVWapFastCrossedUnderMid", isVWapFastCrossedUnderMid, ignoreFalseConditions, separator) + - ToString("isVWapFastCrossedOverSlow", isVWapFastCrossedOverSlow, ignoreFalseConditions, separator) + - ToString("isStrUpperCrossedOverPeak", isStrUpperCrossedOverPeak, ignoreFalseConditions, separator) + - ToString("isStrLowerOverDonLowLower", isStrLowerOverDonLowLower, ignoreFalseConditions, separator) + - ToString("isStrLowerCrossedOverVale", isStrLowerCrossedOverVale, ignoreFalseConditions, separator) + - ToString("isDonLowLowerEqualsToVale", isDonLowLowerEqualsToVale, ignoreFalseConditions, separator) + - ToString("isVWapFastCrossedUnderSlow", isVWapFastCrossedUnderSlow, ignoreFalseConditions, separator) + - ToString("isStrUpperCrossedUnderPeak", isStrUpperCrossedUnderPeak, ignoreFalseConditions, separator) + - ToString("isStrLowerCrossedUnderVale", isStrLowerCrossedUnderVale, ignoreFalseConditions, separator) + - ToString("isDonHighUpperEqualsToPeak", isDonHighUpperEqualsToPeak, ignoreFalseConditions, separator) + - ToString("isStrUpperOverDonHighUpper", isStrUpperOverDonHighUpper, ignoreFalseConditions, separator) + - ToString("isStrLowerUnderDonLowLower", isStrLowerUnderDonLowLower, ignoreFalseConditions, separator) + - ToString("isStrUpperUnderDonHighUpper", isStrUpperUnderDonHighUpper, ignoreFalseConditions, separator) + - ToString("isStrUpperCrossedOverAtrUpper", isStrUpperCrossedOverAtrUpper, ignoreFalseConditions, separator) + - ToString("isStrLowerCrossedOverAtrLower", isStrLowerCrossedOverAtrLower, ignoreFalseConditions, separator) + - ToString("isStrUpperCrossedUnderAtrUpper", isStrUpperCrossedUnderAtrUpper, ignoreFalseConditions, separator) + - ToString("isStrLowerCrossedUnderAtrLower", isStrLowerCrossedUnderAtrLower, ignoreFalseConditions, separator) + - ToString("isStrLowerCrossedOverDonLowLower", isStrLowerCrossedOverDonLowLower, ignoreFalseConditions, separator) + - ToString("isStrUpperCrossedOverDonHighUpper", isStrUpperCrossedOverDonHighUpper, ignoreFalseConditions, separator) + - ToString("isStrLowerCrossedUnderDonLowLower", isStrLowerCrossedUnderDonLowLower, ignoreFalseConditions, separator) + - ToString("isStrUpperCrossedUnderDonHighUpper", isStrUpperCrossedUnderDonHighUpper, ignoreFalseConditions, separator) + + ; + + // + string conditionsStr = // + pvConditionsStr + separator + + hkConditionsStr + separator + + atrConditionsStr + separator + + strConditionsStr + separator + + cheConditionsStr + separator + + x3maonditionsStr + separator + + vwapConditionsStr + separator + "" // ; @@ -2440,16 +1760,12 @@ class XCX121Helper : public XCBase XCX121XCCHelper *xccHelper; XCX121XPVHelper *xpvHelper; XCX121XHKHelper *xhkHelper; - XCX121XICHHelper *xichHelper; XCX121XMASHelper *xmasHelper; XCX121XATRHelper *xatrHelper; XCX121XSTRHelper *xstrHelper; XCX121XCHEHelper *xcheHelper; - XCX121XDONHelper *xdonHelper; XCX121X3MAHelper *x3maHelper; XCX121XVWAPHelper *xvwapHelper; - XCX121XDELTAHelper *xdeltaHelper; - XCX121XVOLUMEHelper *xvolumeHelper; // // Constructors ... @@ -2466,46 +1782,34 @@ class XCX121Helper : public XCBase xccInputs.Clean(); xpvInputs.Clean(); xhkInputs.Clean(); - xichInputs.Clean(); xmasInputs.Clean(); xatrInputs.Clean(); - xdonInputs.Clean(); xstrInputs.Clean(); xcheInputs.Clean(); x3maInputs.Clean(); xvwapInputs.Clean(); - xdeltaInputs.Clean(); - xvolumeInputs.Clean(); // delete xccHelper; delete xpvHelper; delete xhkHelper; - delete xichHelper; delete xmasHelper; delete xatrHelper; delete xstrHelper; delete xcheHelper; - delete xdonHelper; delete x3maHelper; delete xvwapHelper; - delete xdeltaHelper; - delete xvolumeHelper; // ZeroMemory(xccHelper); ZeroMemory(xpvHelper); ZeroMemory(xhkHelper); - ZeroMemory(xichHelper); ZeroMemory(xmasHelper); ZeroMemory(xatrHelper); ZeroMemory(xstrHelper); ZeroMemory(xcheHelper); - ZeroMemory(xdonHelper); ZeroMemory(x3maHelper); ZeroMemory(xvwapHelper); - ZeroMemory(xdeltaHelper); - ZeroMemory(xvolumeHelper); } // @@ -2563,16 +1867,12 @@ class XCX121Helper : public XCBase xccInputs = inputs.xccInputs; xpvInputs = inputs.xpvInputs; xhkInputs = inputs.xhkInputs; - xichInputs = inputs.xichInputs; xmasInputs = inputs.xmasInputs; xatrInputs = inputs.xatrInputs; xstrInputs = inputs.xstrInputs; xcheInputs = inputs.xcheInputs; - xdonInputs = inputs.xdonInputs; x3maInputs = inputs.x3maInputs; xvwapInputs = inputs.xvwapInputs; - xdeltaInputs = inputs.xdeltaInputs; - xvolumeInputs = inputs.xvolumeInputs; // // Initial Helpers ... @@ -2580,69 +1880,35 @@ class XCX121Helper : public XCBase // // XCC ... xccHelper = new XCX121XCCHelper(); - result = xccHelper.Init( - symbol, - period, - xccInputs // - ); - if (!result) - { - // - ZeroMemory(xccHelper); - ZeroMemory(xpvHelper); - ZeroMemory(xhkHelper); - ZeroMemory(xmasHelper); - ZeroMemory(xatrHelper); - ZeroMemory(xichHelper); - ZeroMemory(xstrHelper); - ZeroMemory(xcheHelper); - ZeroMemory(xdonHelper); - ZeroMemory(x3maHelper); - ZeroMemory(xvwapHelper); - ZeroMemory(xdeltaHelper); - ZeroMemory(xvolumeHelper); - - // - return result; - } + result = + result && + xccHelper.Init( + symbol, + period, + xccInputs // + ); // // XPV ... xpvHelper = new XCX121XPVHelper(); - result = xpvHelper.Init( - symbol, - period, - xpvInputs // - ); - if (!result) - { - // - ZeroMemory(xccHelper); - ZeroMemory(xpvHelper); - ZeroMemory(xhkHelper); - ZeroMemory(xmasHelper); - ZeroMemory(xatrHelper); - ZeroMemory(xichHelper); - ZeroMemory(xstrHelper); - ZeroMemory(xcheHelper); - ZeroMemory(xdonHelper); - ZeroMemory(x3maHelper); - ZeroMemory(xvwapHelper); - ZeroMemory(xdeltaHelper); - ZeroMemory(xvolumeHelper); - - // - return result; - } + result = + result && + xpvHelper.Init( + symbol, + period, + xpvInputs // + ); // // XHK ... xhkHelper = new XCX121XHKHelper(); - result = xhkHelper.Init( - symbol, - period, - xhkInputs // - ); + result = + result && + xhkHelper.Init( + symbol, + period, + xhkInputs // + ); if (!result) { // @@ -2651,14 +1917,16 @@ class XCX121Helper : public XCBase ZeroMemory(xhkHelper); ZeroMemory(xmasHelper); ZeroMemory(xatrHelper); - ZeroMemory(xichHelper); ZeroMemory(xstrHelper); ZeroMemory(xcheHelper); - ZeroMemory(xdonHelper); ZeroMemory(x3maHelper); ZeroMemory(xvwapHelper); - ZeroMemory(xdeltaHelper); - ZeroMemory(xvolumeHelper); + + // + // ZeroMemory(xichHelper); + // ZeroMemory(xdonHelper); + // ZeroMemory(xdeltaHelper); + // ZeroMemory(xvolumeHelper); // return result; @@ -2667,326 +1935,119 @@ class XCX121Helper : public XCBase // // XMAS ... xmasHelper = new XCX121XMASHelper(); - result = xmasHelper.Init( - symbol, - period, - xmasInputs // - ); - if (!result) - { - // - ZeroMemory(xccHelper); - ZeroMemory(xpvHelper); - ZeroMemory(xhkHelper); - ZeroMemory(xmasHelper); - ZeroMemory(xatrHelper); - ZeroMemory(xichHelper); - ZeroMemory(xstrHelper); - ZeroMemory(xcheHelper); - ZeroMemory(xdonHelper); - ZeroMemory(x3maHelper); - ZeroMemory(xvwapHelper); - ZeroMemory(xdeltaHelper); - ZeroMemory(xvolumeHelper); - - // - return result; - } + result = + result && + xmasHelper.Init( + symbol, + period, + xmasInputs // + ); // // XATR ... xatrHelper = new XCX121XATRHelper(); - result = xatrHelper.Init( - symbol, - period, - xatrInputs // - ); - if (!result) - { - // - ZeroMemory(xccHelper); - ZeroMemory(xpvHelper); - ZeroMemory(xhkHelper); - ZeroMemory(xmasHelper); - ZeroMemory(xatrHelper); - ZeroMemory(xichHelper); - ZeroMemory(xstrHelper); - ZeroMemory(xcheHelper); - ZeroMemory(xdonHelper); - ZeroMemory(x3maHelper); - ZeroMemory(xvwapHelper); - ZeroMemory(xdeltaHelper); - ZeroMemory(xvolumeHelper); - - // - return result; - } - - // - // XICH ... - xichHelper = new XCX121XICHHelper(); - result = xichHelper.Init( - symbol, - period, - xichInputs // - ); - if (!result) - { - // - ZeroMemory(xccHelper); - ZeroMemory(xpvHelper); - ZeroMemory(xhkHelper); - ZeroMemory(xmasHelper); - ZeroMemory(xatrHelper); - ZeroMemory(xichHelper); - ZeroMemory(xstrHelper); - ZeroMemory(xcheHelper); - ZeroMemory(xdonHelper); - ZeroMemory(x3maHelper); - ZeroMemory(xvwapHelper); - ZeroMemory(xdeltaHelper); - ZeroMemory(xvolumeHelper); - - // - return result; - } + result = + result && + xatrHelper.Init( + symbol, + period, + xatrInputs // + ); // // XSTR ... xstrHelper = new XCX121XSTRHelper(); - result = xstrHelper.Init( - symbol, - period, - xstrInputs // - ); - if (!result) - { - // - ZeroMemory(xccHelper); - ZeroMemory(xpvHelper); - ZeroMemory(xhkHelper); - ZeroMemory(xmasHelper); - ZeroMemory(xatrHelper); - ZeroMemory(xichHelper); - ZeroMemory(xstrHelper); - ZeroMemory(xcheHelper); - ZeroMemory(xdonHelper); - ZeroMemory(x3maHelper); - ZeroMemory(xvwapHelper); - ZeroMemory(xdeltaHelper); - ZeroMemory(xvolumeHelper); - - // - return result; - } + result = + result && + xstrHelper.Init( + symbol, + period, + xstrInputs // + ); // // XCHE ... xcheHelper = new XCX121XCHEHelper(); - result = xcheHelper.Init( - symbol, - period, - xcheInputs // - ); - if (!result) - { - // - ZeroMemory(xccHelper); - ZeroMemory(xpvHelper); - ZeroMemory(xhkHelper); - ZeroMemory(xmasHelper); - ZeroMemory(xatrHelper); - ZeroMemory(xichHelper); - ZeroMemory(xstrHelper); - ZeroMemory(xcheHelper); - ZeroMemory(xdonHelper); - ZeroMemory(x3maHelper); - ZeroMemory(xvwapHelper); - ZeroMemory(xdeltaHelper); - ZeroMemory(xvolumeHelper); - - // - return result; - } - - // - // XDON ... - xdonHelper = new XCX121XDONHelper(); - result = xdonHelper.Init( - symbol, - period, - xdonInputs // - ); - if (!result) - { - // - ZeroMemory(xccHelper); - ZeroMemory(xpvHelper); - ZeroMemory(xhkHelper); - ZeroMemory(xmasHelper); - ZeroMemory(xatrHelper); - ZeroMemory(xichHelper); - ZeroMemory(xstrHelper); - ZeroMemory(xcheHelper); - ZeroMemory(xdonHelper); - ZeroMemory(x3maHelper); - ZeroMemory(xvwapHelper); - ZeroMemory(xdeltaHelper); - ZeroMemory(xvolumeHelper); - - // - return result; - } + result = + result && + xcheHelper.Init( + symbol, + period, + xcheInputs // + ); // // X3MA ... x3maHelper = new XCX121X3MAHelper(); - result = x3maHelper.Init( - symbol, - period, - x3maInputs // - ); - if (!result) - { - // - ZeroMemory(xccHelper); - ZeroMemory(xpvHelper); - ZeroMemory(xhkHelper); - ZeroMemory(xmasHelper); - ZeroMemory(xatrHelper); - ZeroMemory(xichHelper); - ZeroMemory(xstrHelper); - ZeroMemory(xcheHelper); - ZeroMemory(xdonHelper); - ZeroMemory(x3maHelper); - ZeroMemory(xvwapHelper); - ZeroMemory(xdeltaHelper); - ZeroMemory(xvolumeHelper); - - // - return result; - } + result = + result && + x3maHelper.Init( + symbol, + period, + x3maInputs // + ); // // XVWAP ... xvwapHelper = new XCX121XVWAPHelper(); - result = xvwapHelper.Init( - symbol, - period, - xvwapInputs // - ); - if (!result) - { - // - ZeroMemory(xccHelper); - ZeroMemory(xpvHelper); - ZeroMemory(xhkHelper); - ZeroMemory(xmasHelper); - ZeroMemory(xatrHelper); - ZeroMemory(xichHelper); - ZeroMemory(xstrHelper); - ZeroMemory(xcheHelper); - ZeroMemory(xdonHelper); - ZeroMemory(x3maHelper); - ZeroMemory(xvwapHelper); - ZeroMemory(xdeltaHelper); - ZeroMemory(xvolumeHelper); - - // - return result; - } - - // - // XDELTA ... - xdeltaHelper = new XCX121XDELTAHelper(); - result = xdeltaHelper.Init( - symbol, - period, - xdeltaInputs // - ); - if (!result) - { - // - ZeroMemory(xccHelper); - ZeroMemory(xpvHelper); - ZeroMemory(xhkHelper); - ZeroMemory(xmasHelper); - ZeroMemory(xatrHelper); - ZeroMemory(xichHelper); - ZeroMemory(xstrHelper); - ZeroMemory(xcheHelper); - ZeroMemory(xdonHelper); - ZeroMemory(x3maHelper); - ZeroMemory(xvwapHelper); - ZeroMemory(xdeltaHelper); - ZeroMemory(xvolumeHelper); - - // - return result; - } - - // - // XVOLUME ... - xvolumeHelper = new XCX121XVOLUMEHelper(); - result = xvolumeHelper.Init( - symbol, - period, - xvolumeInputs // - ); - if (!result) - { - // - ZeroMemory(xccHelper); - ZeroMemory(xpvHelper); - ZeroMemory(xhkHelper); - ZeroMemory(xmasHelper); - ZeroMemory(xatrHelper); - ZeroMemory(xichHelper); - ZeroMemory(xstrHelper); - ZeroMemory(xcheHelper); - ZeroMemory(xdonHelper); - ZeroMemory(x3maHelper); - ZeroMemory(xvwapHelper); - ZeroMemory(xdeltaHelper); - ZeroMemory(xvolumeHelper); - - // - return result; - } + result = + result && + xvwapHelper.Init( + symbol, + period, + xvwapInputs // + ); // + // Show RSI ... if (inputs.showRSI) { // + ENUM_APPLIED_PRICE rsiAppliedTo = ToAppliedPrice(xatrInputs.rsiPriceType); mRSIHandler = iRSI( symbol, period, xatrInputs.rsiLength, - xatrInputs.rsiAppliedTo // + rsiAppliedTo // ); // - result = mRSIHandler != INVALID_HANDLE; - if (!result) - { - // - ZeroMemory(xccHelper); - ZeroMemory(xpvHelper); - ZeroMemory(xhkHelper); - ZeroMemory(xmasHelper); - ZeroMemory(xatrHelper); - ZeroMemory(xichHelper); - ZeroMemory(xstrHelper); - ZeroMemory(xcheHelper); - ZeroMemory(xdonHelper); - ZeroMemory(x3maHelper); - ZeroMemory(xvwapHelper); - ZeroMemory(xdeltaHelper); - ZeroMemory(xvolumeHelper); + result = + result && + mRSIHandler != INVALID_HANDLE; + } - // - return result; - } + // + // If Result is False, Cleanup Resources ... + if (!result) + { + // + mInputs.Clean(); + + // + xccInputs.Clean(); + xpvInputs.Clean(); + xhkInputs.Clean(); + xmasInputs.Clean(); + xatrInputs.Clean(); + xstrInputs.Clean(); + xcheInputs.Clean(); + x3maInputs.Clean(); + xvwapInputs.Clean(); + + // + ZeroMemory(xccHelper); + ZeroMemory(xpvHelper); + ZeroMemory(xhkHelper); + ZeroMemory(xmasHelper); + ZeroMemory(xatrHelper); + ZeroMemory(xstrHelper); + ZeroMemory(xcheHelper); + ZeroMemory(x3maHelper); + ZeroMemory(xvwapHelper); + + // + return result; } // @@ -3062,28 +2123,6 @@ class XCX121Helper : public XCBase return result; } - // - // XICH ... - bool GetICHConditions( - X121XICHConditions &conditions, // - int barIndex = 0, // - int loopback = 5 // - ) - { - // - bool result = false; - - // - result = xichHelper.GetConditions( - conditions, - barIndex, - loopback // - ); - - // - return result; - } - // // XATR ... bool GetATRConditions( @@ -3150,28 +2189,6 @@ class XCX121Helper : public XCBase return result; } - // - // XDON ... - bool GetDONConditions( - X121XDONConditions &conditions, // - int barIndex = 0, // - int loopback = 5 // - ) - { - // - bool result = false; - - // - result = xdonHelper.GetConditions( - conditions, - barIndex, - loopback // - ); - - // - return result; - } - // // X3MA ... bool Get3MAConditions( @@ -3216,63 +2233,23 @@ class XCX121Helper : public XCBase return result; } - // - // XDELTA ... - bool GetDELTAConditions( - X121XDELTAConditions &conditions, // - int barIndex = 0, // - int loopback = 5 // - ) - { - // - bool result = false; - - // - result = xdeltaHelper.GetConditions( - conditions, - barIndex, - loopback // - ); - - // - return result; - } - - // - // XVOLUME ... - bool GetVOLUMEConditions( - X121XVOLUMEConditions &conditions, // - int barIndex = 0, // - int loopback = 5 // - ) - { - // - bool result = false; - - // - result = xvolumeHelper.GetConditions( - conditions, - barIndex, - loopback // - ); - - // - return result; - } - // void Free() { // xpvHelper.Free(); xhkHelper.Free(); - xichHelper.Free(); xmasHelper.Free(); xatrHelper.Free(); xstrHelper.Free(); xcheHelper.Free(); - xdonHelper.Free(); xvwapHelper.Free(); + + // + // xichHelper.Free(); + // xdonHelper.Free(); + // xdeltaHelper.Free(); + // xvolumeHelper.Free(); } // @@ -3307,327 +2284,136 @@ class XCX121Helper : public XCBase // XOHCL zBar; + XOHCL cBar; + XOHCL pBar; + + // + X121XPVConditions xpvConditions; + X121XHKConditions xhkConditions; + X121XMASConditions xmasConditions; + X121XATRConditions xatrConditions; + X121XSTRConditions xstrConditions; + X121XCHEConditions xcheConditions; + X121X3MAConditions x3maConditions; + X121XVWAPConditions xvwapConditions; + + // result = zBar.Init( mSymbol, mPeriod, zIndex // ); - if (!result) - { - return result; - } + result = + result && + zBar.GetPreviousBar(cBar); + result = + result && + cBar.GetPreviousBar(pBar); // - XOHCL cBar; - result = cBar.Init( - mSymbol, - mPeriod, - cIndex // - ); - if (!result) - { - return result; - } - - // - XOHCL pBar; - result = pBar.Init( - mSymbol, - mPeriod, - pIndex // - ); - if (!result) - { - return result; - } + // Conditions Retriever ... // // XPV ... - X121XPVConditions xpvConditions; - result = GetPVConditions( - xpvConditions, - barIndex, - loopback // - ); - if (!result) - { - // - xpvConditions.Clean(); - - // - return result; - } + result = + result && + GetPVConditions( + xpvConditions, + barIndex, + loopback // + ); // // XHK ... - X121XHKConditions xhkConditions; - result = GetHKConditions( - xhkConditions, - barIndex, - loopback // - ); - if (!result) - { - // - xpvConditions.Clean(); - xhkConditions.Clean(); - - // - return result; - } - - // - // XICH ... - X121XICHConditions xichConditions; - result = GetICHConditions( - xichConditions, - barIndex, - loopback // - ); - if (!result) - { - // - xpvConditions.Clean(); - xhkConditions.Clean(); - xichConditions.Clean(); - - // - return result; - } + result = + result && + GetHKConditions( + xhkConditions, + barIndex, + loopback // + ); // // XMAS ... - X121XMASConditions xmasConditions; - result = GetMASConditions( - xmasConditions, - barIndex, - loopback // - ); - if (!result) - { - // - xpvConditions.Clean(); - xhkConditions.Clean(); - xichConditions.Clean(); - xmasConditions.Clean(); - - // - return result; - } + result = + result && + GetMASConditions( + xmasConditions, + barIndex, + loopback // + ); // // XATR ... - X121XATRConditions xatrConditions; - result = GetATRConditions( - xatrConditions, - barIndex, - loopback // - ); - if (!result) - { - // - xpvConditions.Clean(); - xhkConditions.Clean(); - xichConditions.Clean(); - xmasConditions.Clean(); - xatrConditions.Clean(); - - // - return result; - } + result = + result && + GetATRConditions( + xatrConditions, + barIndex, + loopback // + ); // // XSTR ... - X121XSTRConditions xstrConditions; - result = GetSTRConditions( - xstrConditions, - barIndex, - loopback // - ); - if (!result) - { - // - xpvConditions.Clean(); - xhkConditions.Clean(); - xichConditions.Clean(); - xmasConditions.Clean(); - xatrConditions.Clean(); - xstrConditions.Clean(); - - // - return result; - } + result = + result && + GetSTRConditions( + xstrConditions, + barIndex, + loopback // + ); // // XCHE ... - X121XCHEConditions xcheConditions; - result = GetCHEConditions( - xcheConditions, - barIndex, - loopback // - ); - if (!result) - { - // - xpvConditions.Clean(); - xhkConditions.Clean(); - xichConditions.Clean(); - xmasConditions.Clean(); - xatrConditions.Clean(); - xstrConditions.Clean(); - xcheConditions.Clean(); - - // - return result; - } - - // - // XDON ... - X121XDONConditions xdonConditions; - result = GetDONConditions( - xdonConditions, - barIndex, - loopback // - ); - if (!result) - { - // - xpvConditions.Clean(); - xhkConditions.Clean(); - xichConditions.Clean(); - xmasConditions.Clean(); - xatrConditions.Clean(); - xstrConditions.Clean(); - xcheConditions.Clean(); - xdonConditions.Clean(); - - // - return result; - } + result = + result && + GetCHEConditions( + xcheConditions, + barIndex, + loopback // + ); // // X3MA ... - X121X3MAConditions x3maConditions; - result = Get3MAConditions( - x3maConditions, - barIndex, - loopback // - ); - if (!result) - { - // - xpvConditions.Clean(); - xhkConditions.Clean(); - xichConditions.Clean(); - xmasConditions.Clean(); - xatrConditions.Clean(); - xstrConditions.Clean(); - xcheConditions.Clean(); - xdonConditions.Clean(); - x3maConditions.Clean(); - - // - return result; - } + result = + result && + Get3MAConditions( + x3maConditions, + barIndex, + loopback // + ); // // XVWAP ... - X121XVWAPConditions xvwapConditions; - result = GetVWAPConditions( - xvwapConditions, - barIndex, - loopback // - ); - if (!result) - { - // - xpvConditions.Clean(); - xhkConditions.Clean(); - xichConditions.Clean(); - xmasConditions.Clean(); - xatrConditions.Clean(); - xstrConditions.Clean(); - xcheConditions.Clean(); - xdonConditions.Clean(); - x3maConditions.Clean(); - xvwapConditions.Clean(); - - // - return result; - } - - // - // XDELTA ... - X121XDELTAConditions xdeltaConditions; - result = GetDELTAConditions( - xdeltaConditions, - barIndex, - loopback // - ); - if (!result) - { - // - xpvConditions.Clean(); - xhkConditions.Clean(); - xichConditions.Clean(); - xmasConditions.Clean(); - xatrConditions.Clean(); - xstrConditions.Clean(); - xcheConditions.Clean(); - xdonConditions.Clean(); - x3maConditions.Clean(); - xvwapConditions.Clean(); - xdeltaConditions.Clean(); - - // - return result; - } - - // - // XVOLUME ... - X121XVOLUMEConditions xvolumeConditions; - result = GetVOLUMEConditions( - xvolumeConditions, - barIndex, - loopback // - ); - if (!result) - { - // - xpvConditions.Clean(); - xhkConditions.Clean(); - xichConditions.Clean(); - xmasConditions.Clean(); - xatrConditions.Clean(); - xstrConditions.Clean(); - xcheConditions.Clean(); - xdonConditions.Clean(); - x3maConditions.Clean(); - xvwapConditions.Clean(); - xdeltaConditions.Clean(); - xvolumeConditions.Clean(); - - // - return result; - } - - // - // Fill Volume Buffer ... - for (int i = barIndex; i < barIndex + loopback; i++) - { - // - // Reading Bar Valuem ... - long iVol = iVolume( - mSymbol, - mPeriod, - i // + result = + result && + GetVWAPConditions( + xvwapConditions, + barIndex, + loopback // ); + // + // Check Result ... + if (!result) + { // - Add( - iVol, - conditions.volumeBuffer // - ); + zBar.Clean(); + cBar.Clean(); + pBar.Clean(); + + // + xpvConditions.Clean(); + xhkConditions.Clean(); + xmasConditions.Clean(); + xatrConditions.Clean(); + xstrConditions.Clean(); + xcheConditions.Clean(); + x3maConditions.Clean(); + xvwapConditions.Clean(); + + // + return result; } // @@ -3639,46 +2425,22 @@ class XCX121Helper : public XCBase int pIDX = cIDX + 1; // - // XPV ... + // Conditions ... + + // + // XCC ... // // Buffers ... // - Copy( - xpvConditions.peaksBuffer, - conditions.peaksBuffer // - ); + // Conditions ... // - Copy( - xpvConditions.valesBuffer, - conditions.valesBuffer // - ); + // XPV ... // - Copy( - xpvConditions.supportsBuffer, - conditions.supportsBuffer // - ); - - // - Copy( - xpvConditions.resistancesBuffer, - conditions.resistancesBuffer // - ); - - // - Copy( - xpvConditions.peaksGoldenBuffer, - conditions.peaksGoldenBuffer // - ); - - // - Copy( - xpvConditions.valesGoldenBuffer, - conditions.valesGoldenBuffer // - ); + // Buffers ... // Copy( @@ -3746,6 +2508,42 @@ class XCX121Helper : public XCBase conditions.hLLBuffer // ); + // + Copy( + xpvConditions.peaksBuffer, + conditions.peaksBuffer // + ); + + // + Copy( + xpvConditions.valesBuffer, + conditions.valesBuffer // + ); + + // + Copy( + xpvConditions.supportsBuffer, + conditions.supportsBuffer // + ); + + // + Copy( + xpvConditions.peaksGoldenBuffer, + conditions.peaksGoldenBuffer // + ); + + // + Copy( + xpvConditions.valesGoldenBuffer, + conditions.valesGoldenBuffer // + ); + + // + Copy( + xpvConditions.resistancesBuffer, + conditions.resistancesBuffer // + ); + // Copy( xpvConditions.fractalsUpperBuffer, @@ -3781,14 +2579,8 @@ class XCX121Helper : public XCBase // Copy( - xhkConditions.xhkRawOpenBuffer, - conditions.xhkRawOpenBuffer // - ); - - // - Copy( - xhkConditions.xhkRawHighBuffer, - conditions.xhkRawHighBuffer // + xhkConditions.xhkSMLowBuffer, + conditions.xhkSMLowBuffer // ); // @@ -3797,12 +2589,6 @@ class XCX121Helper : public XCBase conditions.xhkRawLowBuffer // ); - // - Copy( - xhkConditions.xhkRawCloseBuffer, - conditions.xhkRawCloseBuffer // - ); - // Copy( xhkConditions.xhkSMOpenBuffer, @@ -3817,8 +2603,14 @@ class XCX121Helper : public XCBase // Copy( - xhkConditions.xhkSMLowBuffer, - conditions.xhkSMLowBuffer // + xhkConditions.xhkRawOpenBuffer, + conditions.xhkRawOpenBuffer // + ); + + // + Copy( + xhkConditions.xhkRawHighBuffer, + conditions.xhkRawHighBuffer // ); // @@ -3827,22 +2619,30 @@ class XCX121Helper : public XCBase conditions.xhkSMCloseBuffer // ); + // + Copy( + xhkConditions.xhkRawCloseBuffer, + conditions.xhkRawCloseBuffer // + ); + // // Conditions ... + + // conditions.isSMHKBullish = xhkConditions.isSMHKBullish; - conditions.isRawHKBullish = xhkConditions.isRawHKBullish; conditions.isSMHKBearish = xhkConditions.isSMHKBearish; + conditions.isRawHKBullish = xhkConditions.isRawHKBullish; conditions.isRawHKBearish = xhkConditions.isRawHKBearish; conditions.isClosedOverSMHK = xhkConditions.isClosedOverSMHK; conditions.isClosedUnderSMHK = xhkConditions.isClosedUnderSMHK; conditions.isClosedOverRawHK = xhkConditions.isClosedOverRawHK; conditions.isClosedUnderRawHK = xhkConditions.isClosedUnderRawHK; conditions.isRawHKClosedOverSMHK = xhkConditions.isRawHKClosedOverSMHK; - conditions.isSMHKSwitchedToBearish = xhkConditions.isSMHKSwitchedToBearish; - conditions.isRawHKSwitchedToBearish = xhkConditions.isRawHKSwitchedToBearish; conditions.isRawHKClosedUnderSMHK = xhkConditions.isRawHKClosedUnderSMHK; + conditions.isSMHKSwitchedToBearish = xhkConditions.isSMHKSwitchedToBearish; conditions.isSMHKSwitchedToBullish = xhkConditions.isSMHKSwitchedToBullish; conditions.isRawHKSwitchedToBullish = xhkConditions.isRawHKSwitchedToBullish; + conditions.isRawHKSwitchedToBearish = xhkConditions.isRawHKSwitchedToBearish; // // XMAS ... @@ -3852,28 +2652,43 @@ class XCX121Helper : public XCBase // Copy( - xmasConditions.upperBuffer, - conditions.masUpperBuffer // + xmasConditions.midBuffer, + conditions.midBuffer // ); // Copy( - xmasConditions.midBuffer, - conditions.masMidBuffer // + xmasConditions.upperBuffer, + conditions.upperBuffer // ); // Copy( xmasConditions.lowerBuffer, - conditions.masLowerBuffer // + conditions.lowerBuffer // ); + // + // Conditions ... + // // XATR ... // // Buffers ... + // + Copy( + xatrConditions.rsiBuffer, + conditions.rsiBuffer // + ); + + // + Copy( + xatrConditions.atrBuffer, + conditions.atrBuffer // + ); + // Copy( xatrConditions.atrUpperBuffer, @@ -3888,42 +2703,67 @@ class XCX121Helper : public XCBase // Copy( - xatrConditions.atrUpperRawBuffer, - conditions.atrUpperRawBuffer // + xatrConditions.rsiChangeBuffer, + conditions.rsiChangeBuffer // ); // Copy( - xatrConditions.atrLowerRawBuffer, - conditions.atrLowerRawBuffer // + xatrConditions.atrUpperSMBuffer, + conditions.atrUpperSMBuffer // ); // Copy( - xatrConditions.atrBuffer, - conditions.atrBuffer // + xatrConditions.atrLowerSMBuffer, + conditions.atrLowerSMBuffer // ); // Copy( - xatrConditions.rsiBuffer, - conditions.rsiBuffer // + xatrConditions.rsiChangeSMBuffer, + conditions.rsiChangeSMBuffer // + ); + + // + Copy( + xatrConditions.priceChangeBuffer, + conditions.priceChangeBuffer // + ); + + // + Copy( + xatrConditions.priceChangeSMBuffer, + conditions.priceChangeSMBuffer // ); // // Conditions ... // + conditions.isRsiInRange = xatrConditions.isRsiInRange; conditions.isRsiOverSold = xatrConditions.isRsiOverSold; + conditions.isRsiOverRsiSM = xatrConditions.isRsiOverRsiSM; + conditions.isRsiUnderRsiSM = xatrConditions.isRsiUnderRsiSM; conditions.isRsiOverBought = xatrConditions.isRsiOverBought; - conditions.isClosedOverAtrUpper = xatrConditions.isClosedOverAtrUpper; - conditions.isClosedOverAtrLower = xatrConditions.isClosedOverAtrLower; - conditions.isClosedUnderAtrUpper = xatrConditions.isClosedUnderAtrUpper; - conditions.isClosedUnderAtrLower = xatrConditions.isClosedUnderAtrLower; + conditions.isRsiCrossedOverRsiSM = xatrConditions.isRsiCrossedOverRsiSM; + conditions.isRsiCrossedUnderRsiSM = xatrConditions.isRsiCrossedUnderRsiSM; + conditions.isPriceChangeSMOverRsi = xatrConditions.isPriceChangeSMOverRsi; + conditions.isRsiSMOverPriceChange = xatrConditions.isRsiSMOverPriceChange; + conditions.isRsiSMUnderPriceChange = xatrConditions.isRsiSMUnderPriceChange; + conditions.isPriceChangeSMUnderRsi = xatrConditions.isPriceChangeSMUnderRsi; conditions.isRsiCrossedOverOverSold = xatrConditions.isRsiCrossedOverOverSold; conditions.isRsiCrossedUnderOverSold = xatrConditions.isRsiCrossedUnderOverSold; conditions.isRsiCrossedOverOverBought = xatrConditions.isRsiCrossedOverOverBought; conditions.isRsiCrossedUnderOverBought = xatrConditions.isRsiCrossedUnderOverBought; + conditions.isRsiSMCrossedOverPriceChange = xatrConditions.isRsiSMCrossedOverPriceChange; + conditions.isPriceChangeSMCrossedOverRsi = xatrConditions.isPriceChangeSMCrossedOverRsi; + conditions.isRsiSMCrossedUnderPriceChange = xatrConditions.isRsiSMCrossedUnderPriceChange; + conditions.isPriceChangeSMCrossedUnderRsi = xatrConditions.isPriceChangeSMCrossedUnderRsi; + conditions.isPriceChangeOverPriceChangeSM = xatrConditions.isPriceChangeOverPriceChangeSM; + conditions.isPriceChangeUnderPriceChangeSM = xatrConditions.isPriceChangeUnderPriceChangeSM; + conditions.isPriceChangeCrossedOverPriceChangeSM = xatrConditions.isPriceChangeCrossedOverPriceChangeSM; + conditions.isPriceChangeCrossedUnderPriceChangeSM = xatrConditions.isPriceChangeCrossedUnderPriceChangeSM; // // XSTR ... @@ -3937,12 +2777,6 @@ class XCX121Helper : public XCBase conditions.strBuffer // ); - // - Copy( - xstrConditions.strPriceBuffer, - conditions.strPriceBuffer // - ); - // Copy( xstrConditions.strUpBuffer, @@ -3955,6 +2789,12 @@ class XCX121Helper : public XCBase conditions.strDownBuffer // ); + // + Copy( + xstrConditions.strPriceBuffer, + conditions.strPriceBuffer // + ); + // Copy( xstrConditions.strStateBuffer, @@ -4027,16 +2867,13 @@ class XCX121Helper : public XCBase // // Conditions ... + // conditions.isCheBullish = xcheConditions.isCheBullish; conditions.isCheBearish = xcheConditions.isCheBearish; conditions.isChe1Bullish = xcheConditions.isChe1Bullish; conditions.isChe1Bearish = xcheConditions.isChe1Bearish; conditions.isChe2Bullish = xcheConditions.isChe2Bullish; conditions.isChe2Bearish = xcheConditions.isChe2Bearish; - conditions.isClosedOverCheMin = xcheConditions.isClosedOverCheMin; - conditions.isClosedOverCheMax = xcheConditions.isClosedOverCheMax; - conditions.isClosedUnderCheMin = xcheConditions.isClosedUnderCheMin; - conditions.isClosedUnderCheMax = xcheConditions.isClosedUnderCheMax; conditions.isCheSwitchedToBullish = xcheConditions.isCheSwitchedToBullish; conditions.isCheSwitchedToBearish = xcheConditions.isCheSwitchedToBearish; conditions.isChe1SwitchedToBullish = xcheConditions.isChe1SwitchedToBullish; @@ -4044,63 +2881,6 @@ class XCX121Helper : public XCBase conditions.isChe2SwitchedToBullish = xcheConditions.isChe2SwitchedToBullish; conditions.isChe2SwitchedToBearish = xcheConditions.isChe2SwitchedToBearish; - // - // XDON ... - - // - // Buffers ... - - // - Copy( - xdonConditions.donOpenUpperBuffer, - conditions.donOpenUpperBuffer // - ); - - // - Copy( - xdonConditions.donOpenLowerBuffer, - conditions.donOpenLowerBuffer // - ); - - // - Copy( - xdonConditions.donHighUpperBuffer, - conditions.donHighUpperBuffer // - ); - - // - Copy( - xdonConditions.donHighLowerBuffer, - conditions.donHighLowerBuffer // - ); - - // - Copy( - xdonConditions.donLowUpperBuffer, - conditions.donLowUpperBuffer // - ); - - // - Copy( - xdonConditions.donLowLowerBuffer, - conditions.donLowLowerBuffer // - ); - - // - Copy( - xdonConditions.donCloseUpperBuffer, - conditions.donCloseUpperBuffer // - ); - - // - Copy( - xdonConditions.donCloseLowerBuffer, - conditions.donCloseLowerBuffer // - ); - - // - // Conditions ... - // // X3MA ... @@ -4109,14 +2889,14 @@ class XCX121Helper : public XCBase // Copy( - x3maConditions.x3maFastBuffer, - conditions.x3maFastBuffer // + x3maConditions.x3maMidBuffer, + conditions.x3maMidBuffer // ); // Copy( - x3maConditions.x3maMidBuffer, - conditions.x3maMidBuffer // + x3maConditions.x3maFastBuffer, + conditions.x3maFastBuffer // ); // @@ -4127,14 +2907,14 @@ class XCX121Helper : public XCBase // Copy( - x3maConditions.x3maFastStateBuffer, - conditions.x3maFastStateBuffer // + x3maConditions.x3maMidStateBuffer, + conditions.x3maMidStateBuffer // ); // Copy( - x3maConditions.x3maMidStateBuffer, - conditions.x3maMidStateBuffer // + x3maConditions.x3maFastStateBuffer, + conditions.x3maFastStateBuffer // ); // @@ -4179,14 +2959,14 @@ class XCX121Helper : public XCBase // Copy( - xvwapConditions.vwapFastBuffer, - conditions.vwapFastBuffer // + xvwapConditions.vwapMidBuffer, + conditions.vwapMidBuffer // ); // Copy( - xvwapConditions.vwapMidBuffer, - conditions.vwapMidBuffer // + xvwapConditions.vwapFastBuffer, + conditions.vwapFastBuffer // ); // @@ -4195,12 +2975,6 @@ class XCX121Helper : public XCBase conditions.vwapSlowBuffer // ); - // - Copy( - xvwapConditions.vwapVolumeBuffer, - conditions.vwapVolumeBuffer // - ); - // Copy( xvwapConditions.vwapPriceBuffer, @@ -4209,8 +2983,8 @@ class XCX121Helper : public XCBase // Copy( - xvwapConditions.vwapFastStateBuffer, - conditions.vwapFastStateBuffer // + xvwapConditions.vwapVolumeBuffer, + conditions.vwapVolumeBuffer // ); // @@ -4219,6 +2993,12 @@ class XCX121Helper : public XCBase conditions.vwapMidStateBuffer // ); + // + Copy( + xvwapConditions.vwapFastStateBuffer, + conditions.vwapFastStateBuffer // + ); + // Copy( xvwapConditions.vwapSlowStateBuffer, @@ -4231,9 +3011,9 @@ class XCX121Helper : public XCBase // conditions.isVWapMidBullish = xvwapConditions.isVWapMidBullish; conditions.isVWapMidBearish = xvwapConditions.isVWapMidBearish; + conditions.isVWapMidNeutural = xvwapConditions.isVWapMidNeutural; conditions.isVWapFastBullish = xvwapConditions.isVWapFastBullish; conditions.isVWapFastBearish = xvwapConditions.isVWapFastBearish; - conditions.isVWapMidNeutural = xvwapConditions.isVWapMidNeutural; conditions.isVWapSlowBullish = xvwapConditions.isVWapSlowBullish; conditions.isVWapSlowBearish = xvwapConditions.isVWapSlowBearish; conditions.isVWapFastOverMid = xvwapConditions.isVWapFastOverMid; @@ -4254,655 +3034,20 @@ class XCX121Helper : public XCBase conditions.isVWapSwitchedToBearishOrdered = xvwapConditions.isVWapSwitchedToBearishOrdered; // - // XICH ... + // Cleanup Resource ... // - // Buffers ... + zBar.Clean(); + cBar.Clean(); + pBar.Clean(); - // - Copy( - xichConditions.kijunSenBuffer, - conditions.kijunSenBuffer // - ); - - // - Copy( - xichConditions.tenkanSenBuffer, - conditions.tenkanSenBuffer // - ); - - // - Copy( - xichConditions.chikouSpanBuffer, - conditions.chikouSpanBuffer // - ); - - // - Copy( - xichConditions.senkouSpanABuffer, - conditions.senkouSpanABuffer // - ); - - // - Copy( - xichConditions.senkouSpanBBuffer, - conditions.senkouSpanBBuffer // - ); - - // - // Conditions ... - - // - conditions.isTenkanSenOverKijunSen = xichConditions.isTenkanSenOverKijunSen; - conditions.isTenkanSenUnderKijunSen = xichConditions.isTenkanSenUnderKijunSen; - - // - conditions.isTenkanSenCrossedOverKijunSen = xichConditions.isTenkanSenCrossedOverKijunSen; - conditions.isTenkanSenCrossedUnderKijunSen = xichConditions.isTenkanSenCrossedUnderKijunSen; - - // - conditions.isSenkouSpanAOverB = xichConditions.isSenkouSpanAOverB; - conditions.isSenkouSpanAUnderB = xichConditions.isSenkouSpanAUnderB; - - // - conditions.isSenkouSpanACrossedOverB = xichConditions.isSenkouSpanACrossedOverB; - conditions.isSenkouSpanACrossedUnderB = xichConditions.isSenkouSpanACrossedUnderB; - - // - conditions.tenKijMax = MathMax(xichConditions.tenkanSenBuffer[cIDX], xichConditions.kijunSenBuffer[cIDX]); - conditions.tenKijMin = MathMin(xichConditions.tenkanSenBuffer[cIDX], xichConditions.kijunSenBuffer[cIDX]); - conditions.senkouMax = MathMax(xichConditions.senkouSpanABuffer[cIDX], xichConditions.senkouSpanBBuffer[cIDX]); - conditions.senkouMin = MathMin(xichConditions.senkouSpanABuffer[cIDX], xichConditions.senkouSpanBBuffer[cIDX]); - - // - // XDELTA ... - - // - // Buffers ... - - // - Copy( - xdeltaConditions.deltaBuffer, - conditions.deltaBuffer // - ); - - // - Copy( - xdeltaConditions.deltaMaBuffer, - conditions.deltaMaBuffer // - ); - - // - Copy( - xdeltaConditions.deltaStateBuffer, - conditions.deltaStateBuffer // - ); - - // - // Conditions ... - - // - conditions.isDeltaBullish = xdeltaConditions.isDeltaBullish; - conditions.isDeltaBearish = xdeltaConditions.isDeltaBearish; - conditions.isDeltaSwitchedToBullish = xdeltaConditions.isDeltaSwitchedToBullish; - conditions.isDeltaSwitchedToBearish = xdeltaConditions.isDeltaSwitchedToBearish; - - // - conditions.isDeltaOverMa = xdeltaConditions.isDeltaOverMa; - conditions.isDeltaUnderMa = xdeltaConditions.isDeltaUnderMa; - conditions.isDeltaCrossedOverMa = xdeltaConditions.isDeltaCrossedOverMa; - conditions.isDeltaCrossedUnderMa = xdeltaConditions.isDeltaCrossedUnderMa; - - // - // XVOLUME ... - - // - // Buffers ... - - // - Copy( - xvolumeConditions.bullishVolumeBuffer, - conditions.bullishVolumeBuffer // - ); - - // - Copy( - xvolumeConditions.bullishVolumeMaBuffer, - conditions.bullishVolumeMaBuffer // - ); - - // - Copy( - xvolumeConditions.bearishVolumeBuffer, - conditions.bearishVolumeBuffer // - ); - - // - Copy( - xvolumeConditions.bearishVolumeMaBuffer, - conditions.bearishVolumeMaBuffer // - ); - - // - // Conditions ... - - // - conditions.isBullishVolumeOverMa = xvolumeConditions.isBullishVolumeOverMa; - conditions.isBullishVolumeCrossedOverMa = xvolumeConditions.isBullishVolumeCrossedOverMa; - - // - conditions.isBullishVolumeUnderMa = xvolumeConditions.isBullishVolumeUnderMa; - conditions.isBullishVolumeCrossedUnderMa = xvolumeConditions.isBullishVolumeCrossedUnderMa; - - // - conditions.isBullishVolumeIncreased = xvolumeConditions.isBullishVolumeIncreased; - conditions.isBullishVolumeSwitchedToIncreased = xvolumeConditions.isBullishVolumeSwitchedToIncreased; - - // - conditions.isBullishVolumeDecreased = xvolumeConditions.isBullishVolumeDecreased; - conditions.isBullishVolumeSwitchedToDecreased = xvolumeConditions.isBullishVolumeSwitchedToDecreased; - - // - conditions.isBearishVolumeOverMa = xvolumeConditions.isBearishVolumeOverMa; - conditions.isBearishVolumeCrossedOverMa = xvolumeConditions.isBearishVolumeCrossedOverMa; - - // - conditions.isBearishVolumeUnderMa = xvolumeConditions.isBearishVolumeUnderMa; - conditions.isBearishVolumeCrossedUnderMa = xvolumeConditions.isBearishVolumeCrossedUnderMa; - - // - conditions.isBearishVolumeIncreased = xvolumeConditions.isBearishVolumeIncreased; - conditions.isBearishVolumeSwitchedToIncreased = xvolumeConditions.isBearishVolumeSwitchedToIncreased; - - // - conditions.isBearishVolumeDecreased = xvolumeConditions.isBearishVolumeDecreased; - conditions.isBearishVolumeSwitchedToDecreased = xvolumeConditions.isBearishVolumeSwitchedToDecreased; - - // - conditions.isVolumeSwitchedToBullish = xvolumeConditions.isVolumeSwitchedToBullish; - conditions.isVolumeSwitchedToBearish = xvolumeConditions.isVolumeSwitchedToBearish; - - // - conditions.isBullishVolumeMaOverBearishVolumeMa = xvolumeConditions.isBullishVolumeMaOverBearishVolumeMa; - conditions.isBullishVolumeMaUnderBearishVolumeMa = xvolumeConditions.isBullishVolumeMaUnderBearishVolumeMa; - - // - // Slopes ... - - // - double rsiSlope = GetSlope(conditions.rsiBuffer, pIDX, cIDX); - double strSlope = GetSlope(conditions.strBuffer, pIDX, cIDX); - double atrUpperSlope = GetSlope(conditions.atrUpperBuffer, pIDX, cIDX); - double atrLowerSlope = GetSlope(conditions.atrLowerBuffer, pIDX, cIDX); - double vwapFastSlope = GetSlope(conditions.vwapFastBuffer, pIDX, cIDX); - double vwapMidSlope = GetSlope(conditions.vwapMidBuffer, pIDX, cIDX); - double vwapSlowSlope = GetSlope(conditions.vwapSlowBuffer, pIDX, cIDX); - - // - bool isRsiSlopeBullish = rsiSlope > 0; - bool isStrSlopeBullish = strSlope > 0; - bool isAtrUpperSlopeBullish = atrUpperSlope > 0; - bool isAtrLowerSlopeBullish = atrLowerSlope > 0; - bool isVwapFastSlopeBullish = vwapFastSlope > 0; - bool isVwapMidSlopeBullish = vwapMidSlope > 0; - bool isVwapSlowSlopeBullish = vwapSlowSlope > 0; - - // - bool isRsiSlopeBearish = rsiSlope < 0; - bool isStrSlopeBearish = strSlope < 0; - bool isAtrUpperSlopeBearish = atrUpperSlope < 0; - bool isAtrLowerSlopeBearish = atrLowerSlope < 0; - bool isVwapFastSlopeBearish = vwapFastSlope < 0; - bool isVwapMidSlopeBearish = vwapMidSlope < 0; - bool isVwapSlowSlopeBearish = vwapSlowSlope < 0; - - // - conditions.rsiSlope = rsiSlope; - conditions.strSlope = strSlope; - conditions.vwapMidSlope = vwapMidSlope; - conditions.vwapSlowSlope = vwapSlowSlope; - conditions.atrUpperSlope = atrUpperSlope; - conditions.atrLowerSlope = atrLowerSlope; - conditions.vwapFastSlope = vwapFastSlope; - conditions.isRsiSlopeBearish = isRsiSlopeBearish; - conditions.isStrSlopeBearish = isStrSlopeBearish; - conditions.isRsiSlopeBullish = isRsiSlopeBullish; - conditions.isStrSlopeBullish = isStrSlopeBullish; - conditions.isVwapMidSlopeBearish = isVwapMidSlopeBearish; - conditions.isVwapMidSlopeBullish = isVwapMidSlopeBullish; - conditions.isAtrUpperSlopeBearish = isAtrUpperSlopeBearish; - conditions.isAtrLowerSlopeBearish = isAtrLowerSlopeBearish; - conditions.isVwapFastSlopeBearish = isVwapFastSlopeBearish; - conditions.isVwapSlowSlopeBearish = isVwapSlowSlopeBearish; - conditions.isAtrUpperSlopeBullish = isAtrUpperSlopeBullish; - conditions.isAtrLowerSlopeBullish = isAtrLowerSlopeBullish; - conditions.isVwapFastSlopeBullish = isVwapFastSlopeBullish; - conditions.isVwapSlowSlopeBullish = isVwapSlowSlopeBullish; - - // - // Complex Conditions ... - - // - double x3maFast = conditions.x3maFastBuffer[cIDX]; - double x3maMid = conditions.x3maMidBuffer[cIDX]; - double x3maSlow = conditions.x3maSlowBuffer[cIDX]; - - // - double x3mas[3] = { - x3maFast, - x3maMid, - x3maSlow // - }; - - // - double x3maMin = GetMin(x3mas); - double x3maMax = GetMax(x3mas); - - // - bool isX3MaFatsOverMid = conditions.x3maFastBuffer[cIDX] > conditions.x3maMidBuffer[cIDX]; - bool isX3MaFatsOverMidPrev = conditions.x3maFastBuffer[pIDX] > conditions.x3maMidBuffer[pIDX]; - - // - bool isX3MaFatsUnderMid = conditions.x3maFastBuffer[cIDX] < conditions.x3maMidBuffer[cIDX]; - bool isX3MaFatsUnderMidPrev = conditions.x3maFastBuffer[pIDX] < conditions.x3maMidBuffer[pIDX]; - - // - bool isX3MaFatsOverSlow = conditions.x3maFastBuffer[cIDX] > conditions.x3maSlowBuffer[cIDX]; - bool isX3MaFatsOverSlowPrev = conditions.x3maFastBuffer[pIDX] > conditions.x3maSlowBuffer[pIDX]; - - // - bool isX3MaFatsUnderSlow = conditions.x3maFastBuffer[cIDX] < conditions.x3maSlowBuffer[cIDX]; - bool isX3MaFatsUnderSlowPrev = conditions.x3maFastBuffer[pIDX] < conditions.x3maSlowBuffer[pIDX]; - - // - bool isX3MaFastCrossedOverMid = isX3MaFatsOverMid && - !isX3MaFatsOverMidPrev; - bool isX3MaFastCrossedUnderMid = isX3MaFatsUnderMid && - !isX3MaFatsUnderMidPrev; - - // - bool isX3MaFastCrossedOverSlow = isX3MaFatsOverSlow && - !isX3MaFatsOverSlowPrev; - bool isX3MaFastCrossedUnderSlow = isX3MaFatsUnderSlow && - !isX3MaFatsUnderSlowPrev; - - // - bool isClosedOverX3MaMin = cBar.close > x3maMin; - bool isClosedUnderX3MaMin = cBar.close < x3maMin; - - // - bool isClosedOverX3MaMax = cBar.close > x3maMax; - bool isClosedUnderX3MaMax = cBar.close < x3maMax; - - // - // - // - - // - double vwapFast = conditions.vwapFastBuffer[cIDX]; - double vwapMid = conditions.vwapMidBuffer[cIDX]; - double vwapSlow = conditions.vwapSlowBuffer[cIDX]; - - // - double vwaps[3] = { - vwapFast, - vwapMid, - vwapSlow // - }; - - // - double vwapMin = GetMin(vwaps); - double vwapMax = GetMax(vwaps); - - // - bool isVWapFatsOverMid = conditions.vwapFastBuffer[cIDX] > conditions.vwapMidBuffer[cIDX]; - bool isVWapFatsOverMidPrev = conditions.vwapFastBuffer[pIDX] > conditions.vwapMidBuffer[pIDX]; - - // - bool isVWapFatsUnderMid = conditions.vwapFastBuffer[cIDX] < conditions.vwapMidBuffer[cIDX]; - bool isVWapFatsUnderMidPrev = conditions.vwapFastBuffer[pIDX] < conditions.vwapMidBuffer[pIDX]; - - // - bool isVWapFatsOverSlow = conditions.vwapFastBuffer[cIDX] > conditions.vwapSlowBuffer[cIDX]; - bool isVWapFatsOverSlowPrev = conditions.vwapFastBuffer[pIDX] > conditions.vwapSlowBuffer[pIDX]; - - // - bool isVWapFatsUnderSlow = conditions.vwapFastBuffer[cIDX] < conditions.vwapSlowBuffer[cIDX]; - bool isVWapFatsUnderSlowPrev = conditions.vwapFastBuffer[pIDX] < conditions.vwapSlowBuffer[pIDX]; - - // - bool isVWapFastCrossedOverMid = isVWapFatsOverMid && - !isVWapFatsOverMidPrev; - bool isVWapFastCrossedUnderMid = isVWapFatsUnderMid && - !isVWapFatsUnderMidPrev; - - // - bool isVWapFastCrossedOverSlow = isVWapFatsOverSlow && - !isVWapFatsOverSlowPrev; - bool isVWapFastCrossedUnderSlow = isVWapFatsUnderSlow && - !isVWapFatsUnderSlowPrev; - - // - bool isClosedOverVWapMin = cBar.close > vwapMin; - bool isClosedUnderVWapMin = cBar.close < vwapMin; - - // - bool isClosedOverVWapMax = cBar.close > vwapMax; - bool isClosedUnderVWapMax = cBar.close < vwapMax; - - // - bool isSarEqualsToPeak = - conditions.sarBuffer[cIDX] == conditions.peaksBuffer[cIDX]; - bool isSarEqualsToVale = - conditions.sarBuffer[cIDX] == conditions.valesBuffer[cIDX]; - - // - bool isSarIncreased = conditions.sarBuffer[cIDX] > conditions.sarBuffer[pIDX]; - bool isSarDecreased = conditions.sarBuffer[cIDX] < conditions.sarBuffer[pIDX]; - - // - double prevSar = conditions.sarBuffer[pIDX]; - double prevStr = conditions.strBuffer[pIDX]; - double prevCheLE1 = conditions.le1Buffer[pIDX]; - double prevCheLE2 = conditions.le2Buffer[pIDX]; - double prevCheSE1 = conditions.se1Buffer[pIDX]; - double prevCheSE2 = conditions.se2Buffer[pIDX]; - double prevAtrUpper = conditions.atrUpperBuffer[pIDX]; - double prevAtrLower = conditions.atrLowerBuffer[pIDX]; - - // - double ches[]; - if (prevCheLE1 != EMPTY_VALUE) - { - // - Add( - prevCheLE1, - ches // - ); - } - if (prevCheLE2 != EMPTY_VALUE) - { - // - Add( - prevCheLE2, - ches // - ); - } - if (prevCheSE1 != EMPTY_VALUE) - { - // - Add( - prevCheSE1, - ches // - ); - } - if (prevCheSE2 != EMPTY_VALUE) - { - // - Add( - prevCheSE2, - ches // - ); - } - - // - double cheMin = GetMin(ches); - double cheMax = GetMax(ches); - - // - bool isSarCrossedUnderPeak = - conditions.sarBuffer[cIDX] < conditions.peaksBuffer[cIDX] && - !(conditions.sarBuffer[pIDX] < conditions.peaksBuffer[pIDX]); - bool isSarCrossedOverVale = - conditions.sarBuffer[cIDX] > conditions.valesBuffer[cIDX] && - !(conditions.sarBuffer[pIDX] > conditions.valesBuffer[pIDX]); - - // - bool isStrEqualsToPeak = - conditions.strBuffer[cIDX] == conditions.peaksBuffer[cIDX]; - bool isStrEqualsToVale = - conditions.strBuffer[cIDX] == conditions.valesBuffer[cIDX]; - - // - bool isStrCrossedUnderPeak = - conditions.strBuffer[cIDX] < conditions.peaksBuffer[cIDX] && - !(conditions.strBuffer[pIDX] < conditions.peaksBuffer[pIDX]); - bool isStrCrossedOverVale = - conditions.strBuffer[cIDX] > conditions.valesBuffer[cIDX] && - !(conditions.strBuffer[pIDX] > conditions.valesBuffer[pIDX]); - - // - bool isPeakOverAtrUpper = - conditions.peaksBuffer[cIDX] > conditions.atrUpperBuffer[cIDX]; - bool isValeUnderAtrLower = - conditions.valesBuffer[cIDX] > conditions.atrLowerBuffer[cIDX]; - - // - bool isNewPeakOverAtrUpper = - isPeakOverAtrUpper && - conditions.isNewPeak; - bool isNewValeUnderAtrLower = - isValeUnderAtrLower && - conditions.isNewVale; - - // - bool isStrUpperOverPeak = - conditions.strBuffer[cIDX] > conditions.peaksBuffer[cIDX]; - bool isStrUpperOverPeakPrev = - conditions.strBuffer[pIDX] > conditions.peaksBuffer[pIDX]; - - // - bool isStrUpperUnderPeak = - conditions.strBuffer[cIDX] < conditions.peaksBuffer[cIDX]; - bool isStrUpperUnderPeakPrev = - conditions.strBuffer[pIDX] < conditions.peaksBuffer[pIDX]; - - // - bool isStrUpperCrossedOverPeak = isStrUpperOverPeak && - !isStrUpperOverPeakPrev; - bool isStrUpperCrossedUnderPeak = isStrUpperUnderPeak && - !isStrUpperUnderPeakPrev; - - // - bool isStrLowerOverVale = - conditions.strBuffer[cIDX] > conditions.valesBuffer[cIDX]; - bool isStrLowerOverValePrev = - conditions.strBuffer[pIDX] > conditions.valesBuffer[pIDX]; - - // - bool isStrLowerUnderVale = - conditions.strBuffer[cIDX] < conditions.valesBuffer[cIDX]; - bool isStrLowerUnderValePrev = - conditions.strBuffer[pIDX] < conditions.valesBuffer[pIDX]; - - // - bool isStrLowerCrossedOverVale = isStrLowerOverVale && - !isStrLowerOverValePrev; - bool isStrLowerCrossedUnderVale = isStrLowerUnderVale && - !isStrLowerUnderValePrev; - - // - bool isDonHighUpperEqualsToPeak = - conditions.donHighUpperBuffer[cIDX] == conditions.peaksBuffer[cIDX]; - bool isDonLowLowerEqualsToVale = - conditions.donLowLowerBuffer[cIDX] == conditions.valesBuffer[cIDX]; - - // - bool isStrUpperOverAtrUpper = - conditions.strUpBuffer[cIDX] > conditions.atrUpperBuffer[cIDX]; - bool isStrUpperOverAtrUpperPrev = - conditions.strUpBuffer[pIDX] > conditions.atrUpperBuffer[pIDX]; - bool isStrUpperCrossedOverAtrUpper = isStrUpperOverAtrUpper && - !isStrUpperOverAtrUpperPrev; - - // - bool isStrUpperUnderAtrUpper = - conditions.strUpBuffer[cIDX] < conditions.atrUpperBuffer[cIDX]; - bool isStrUpperUnderAtrUpperPrev = - conditions.strUpBuffer[pIDX] < conditions.atrUpperBuffer[pIDX]; - bool isStrUpperCrossedUnderAtrUpper = isStrUpperUnderAtrUpper && - !isStrUpperUnderAtrUpperPrev; - - // - bool isStrLowerOverAtrLower = - conditions.strDownBuffer[cIDX] > conditions.atrLowerBuffer[cIDX]; - bool isStrLowerOverAtrLowerPrev = - conditions.strDownBuffer[pIDX] > conditions.atrLowerBuffer[pIDX]; - bool isStrLowerCrossedOverAtrLower = isStrLowerOverAtrLower && - !isStrLowerOverAtrLowerPrev; - - // - bool isStrLowerUnderAtrLower = - conditions.strDownBuffer[cIDX] < conditions.atrLowerBuffer[cIDX]; - bool isStrLowerUnderAtrLowerPrev = - conditions.strDownBuffer[pIDX] < conditions.atrLowerBuffer[pIDX]; - bool isStrLowerCrossedUnderAtrLower = isStrLowerUnderAtrLower && - !isStrLowerUnderAtrLowerPrev; - - // - bool isStrUpperOverDonHighUpper = - conditions.strUpBuffer[cIDX] > conditions.donHighUpperBuffer[cIDX]; - bool isStrUpperOverDonHighUpperPrev = - conditions.strUpBuffer[pIDX] > conditions.donHighUpperBuffer[pIDX]; - bool isStrUpperCrossedOverDonHighUpper = isStrUpperOverDonHighUpper && - !isStrUpperOverDonHighUpperPrev; - - // - bool isStrUpperUnderDonHighUpper = - conditions.strUpBuffer[cIDX] < conditions.donHighUpperBuffer[cIDX]; - bool isStrUpperUnderDonHighUpperPrev = - conditions.strUpBuffer[pIDX] < conditions.donHighUpperBuffer[pIDX]; - bool isStrUpperCrossedUnderDonHighUpper = isStrUpperUnderDonHighUpper && - !isStrUpperUnderDonHighUpperPrev; - - // - bool isStrLowerOverDonLowLower = - conditions.strDownBuffer[cIDX] > conditions.donLowLowerBuffer[cIDX]; - bool isStrLowerOverDonLowLowerPrev = - conditions.strDownBuffer[pIDX] > conditions.donLowLowerBuffer[pIDX]; - bool isStrLowerCrossedOverDonLowLower = isStrLowerOverDonLowLower && - !isStrLowerOverDonLowLowerPrev; - - // - bool isStrLowerUnderDonLowLower = - conditions.strDownBuffer[cIDX] < conditions.donLowLowerBuffer[cIDX]; - bool isStrLowerUnderDonLowLowerPrev = - conditions.strDownBuffer[pIDX] < conditions.donLowLowerBuffer[pIDX]; - bool isStrLowerCrossedUnderDonLowLower = isStrLowerUnderDonLowLower && - !isStrLowerUnderDonLowLowerPrev; - - // - bool isAtrUpperOverPeak = conditions.atrUpperBuffer[cIDX] > conditions.peaksBuffer[cIDX]; - bool isAtrUpperEqualsToPeak = conditions.atrUpperBuffer[cIDX] == conditions.peaksBuffer[cIDX]; - - // - bool isAtrUpperCrossedUpPeak = conditions.atrUpperBuffer[cIDX] > conditions.peaksBuffer[cIDX] && - !(conditions.atrUpperBuffer[cIDX] > conditions.peaksBuffer[cIDX]); - bool isAtrUpperCrossedDownPeak = conditions.atrUpperBuffer[cIDX] < conditions.peaksBuffer[cIDX] && - !(conditions.atrUpperBuffer[cIDX] < conditions.peaksBuffer[cIDX]); - - // - bool isAtrLowerUnderVale = conditions.atrUpperBuffer[cIDX] < conditions.valesBuffer[cIDX]; - bool isAtrLowerEqualsToVale = conditions.atrUpperBuffer[cIDX] == conditions.valesBuffer[cIDX]; - - // - bool isAtrLowerCrossedUpVale = conditions.atrUpperBuffer[cIDX] > conditions.valesBuffer[cIDX] && - !(conditions.atrUpperBuffer[cIDX] > conditions.valesBuffer[cIDX]); - bool isAtrLowerCrossedDownVale = conditions.atrUpperBuffer[cIDX] < conditions.valesBuffer[cIDX] && - !(conditions.atrUpperBuffer[cIDX] < conditions.valesBuffer[cIDX]); - - // - conditions.cheMin = cheMin; - conditions.cheMax = cheMax; - conditions.x3maMin = x3maMin; - conditions.x3maMax = x3maMax; - conditions.vwapMin = vwapMin; - conditions.vwapMax = vwapMax; - - // - conditions.isSarIncreased = isSarIncreased; - conditions.isSarDecreased = isSarDecreased; - conditions.isSarEqualsToPeak = isSarEqualsToPeak; - conditions.isSarEqualsToVale = isSarEqualsToVale; - conditions.isStrEqualsToPeak = isStrEqualsToPeak; - conditions.isStrEqualsToVale = isStrEqualsToVale; - conditions.isX3MaFatsOverMid = isX3MaFatsOverMid; - conditions.isX3MaFatsUnderMid = isX3MaFatsUnderMid; - conditions.isX3MaFatsOverSlow = isX3MaFatsOverSlow; - conditions.isStrUpperOverPeak = isStrUpperOverPeak; - conditions.isPeakOverAtrUpper = isPeakOverAtrUpper; - conditions.isStrLowerOverVale = isStrLowerOverVale; - conditions.isAtrUpperOverPeak = isAtrUpperOverPeak; - conditions.isClosedOverX3MaMin = isClosedOverX3MaMin; - conditions.isClosedOverX3MaMax = isClosedOverX3MaMax; - conditions.isX3MaFatsUnderSlow = isX3MaFatsUnderSlow; - conditions.isAtrLowerUnderVale = isAtrLowerUnderVale; - conditions.isStrLowerUnderVale = isStrLowerUnderVale; - conditions.isStrUpperUnderPeak = isStrUpperUnderPeak; - conditions.isValeUnderAtrLower = isValeUnderAtrLower; - conditions.isClosedOverVWapMin = isClosedOverVWapMin; - conditions.isClosedOverVWapMax = isClosedOverVWapMax; - conditions.isClosedUnderX3MaMin = isClosedUnderX3MaMin; - conditions.isClosedUnderX3MaMax = isClosedUnderX3MaMax; - conditions.isClosedUnderVWapMin = isClosedUnderVWapMin; - conditions.isClosedUnderVWapMax = isClosedUnderVWapMax; - conditions.isSarCrossedOverVale = isSarCrossedOverVale; - conditions.isStrCrossedOverVale = isStrCrossedOverVale; - conditions.isX3MaFatsOverMidPrev = isX3MaFatsOverMidPrev; - conditions.isSarCrossedUnderPeak = isSarCrossedUnderPeak; - conditions.isStrCrossedUnderPeak = isStrCrossedUnderPeak; - conditions.isNewPeakOverAtrUpper = isNewPeakOverAtrUpper; - conditions.isX3MaFatsUnderMidPrev = isX3MaFatsUnderMidPrev; - conditions.isX3MaFatsOverSlowPrev = isX3MaFatsOverSlowPrev; - conditions.isAtrUpperEqualsToPeak = isAtrUpperEqualsToPeak; - conditions.isAtrLowerEqualsToVale = isAtrLowerEqualsToVale; - conditions.isNewValeUnderAtrLower = isNewValeUnderAtrLower; - conditions.isStrUpperOverAtrUpper = isStrUpperOverAtrUpper; - conditions.isStrLowerOverAtrLower = isStrLowerOverAtrLower; - conditions.isX3MaFatsUnderSlowPrev = isX3MaFatsUnderSlowPrev; - conditions.isStrUpperUnderAtrUpper = isStrUpperUnderAtrUpper; - conditions.isStrLowerUnderAtrLower = isStrLowerUnderAtrLower; - conditions.isAtrUpperCrossedUpPeak = isAtrUpperCrossedUpPeak; - conditions.isAtrLowerCrossedUpVale = isAtrLowerCrossedUpVale; - conditions.isX3MaFastCrossedOverMid = isX3MaFastCrossedOverMid; - conditions.isVWapFastCrossedOverMid = isVWapFastCrossedOverMid; - conditions.isX3MaFastCrossedUnderMid = isX3MaFastCrossedUnderMid; - conditions.isX3MaFastCrossedOverSlow = isX3MaFastCrossedOverSlow; - conditions.isAtrUpperCrossedDownPeak = isAtrUpperCrossedDownPeak; - conditions.isAtrLowerCrossedDownVale = isAtrLowerCrossedDownVale; - conditions.isVWapFastCrossedUnderMid = isVWapFastCrossedUnderMid; - conditions.isDonLowLowerEqualsToVale = isDonLowLowerEqualsToVale; - conditions.isStrUpperCrossedOverPeak = isStrUpperCrossedOverPeak; - conditions.isStrLowerCrossedOverVale = isStrLowerCrossedOverVale; - conditions.isStrLowerOverDonLowLower = isStrLowerOverDonLowLower; - conditions.isVWapFastCrossedOverSlow = isVWapFastCrossedOverSlow; - conditions.isX3MaFastCrossedUnderSlow = isX3MaFastCrossedUnderSlow; - conditions.isVWapFastCrossedUnderSlow = isVWapFastCrossedUnderSlow; - conditions.isStrUpperOverDonHighUpper = isStrUpperOverDonHighUpper; - conditions.isStrLowerUnderDonLowLower = isStrLowerUnderDonLowLower; - conditions.isDonHighUpperEqualsToPeak = isDonHighUpperEqualsToPeak; - conditions.isStrUpperCrossedUnderPeak = isStrUpperCrossedUnderPeak; - conditions.isStrLowerCrossedUnderVale = isStrLowerCrossedUnderVale; - conditions.isStrUpperUnderDonHighUpper = isStrUpperUnderDonHighUpper; - conditions.isStrLowerCrossedOverAtrLower = isStrLowerCrossedOverAtrLower; - conditions.isStrUpperCrossedOverAtrUpper = isStrUpperCrossedOverAtrUpper; - conditions.isStrUpperCrossedUnderAtrUpper = isStrUpperCrossedUnderAtrUpper; - conditions.isStrLowerCrossedUnderAtrLower = isStrLowerCrossedUnderAtrLower; - conditions.isStrLowerCrossedOverDonLowLower = isStrLowerCrossedOverDonLowLower; - conditions.isStrUpperCrossedOverDonHighUpper = isStrUpperCrossedOverDonHighUpper; - conditions.isStrLowerCrossedUnderDonLowLower = isStrLowerCrossedUnderDonLowLower; - conditions.isStrUpperCrossedUnderDonHighUpper = isStrUpperCrossedUnderDonHighUpper; - - // // xpvConditions.Clean(); xhkConditions.Clean(); - xichConditions.Clean(); xmasConditions.Clean(); xatrConditions.Clean(); xstrConditions.Clean(); xcheConditions.Clean(); - xdonConditions.Clean(); x3maConditions.Clean(); xvwapConditions.Clean(); @@ -4931,16 +3076,18 @@ class XCX121Helper : public XCBase X121XCCInputs xccInputs; X121XPVInputs xpvInputs; X121XHKInputs xhkInputs; - X121XICHInputs xichInputs; X121XMASInputs xmasInputs; X121XATRInputs xatrInputs; - X121XDONInputs xdonInputs; X121XSTRInputs xstrInputs; X121XCHEInputs xcheInputs; X121X3MAInputs x3maInputs; X121XVWAPInputs xvwapInputs; - X121XDELTAInputs xdeltaInputs; - X121XVOLUMEInputs xvolumeInputs; + + // + // X121XICHInputs xichInputs; + // X121XDONInputs xdonInputs; + // X121XDELTAInputs xdeltaInputs; + // X121XVOLUMEInputs xvolumeInputs; // int mRSIHandler; diff --git a/Helpers/x-saherelm.x121.x3ma.helper.mq5 b/Helpers/x-saherelm.x121.x3ma.helper.mq5 index 8337273c..c636affe 100644 --- a/Helpers/x-saherelm.x121.x3ma.helper.mq5 +++ b/Helpers/x-saherelm.x121.x3ma.helper.mq5 @@ -316,7 +316,100 @@ struct X121X3MAConditions bearishScore = 0; // - // TODO: Implement if Required ... + double score = 1; + double minScore = 0.5; + double highScore = 1.5; + + // + // X3MA ... + + // + if (isX3MaBullishState) + { + bullishScore += score; + } + if (isX3MaBullishOrdered) + { + bullishScore += score; + } + if (isX3MaSwitchedToBullishState) + { + bullishScore += highScore; + } + if (isX3MaSwitchedToBullishOrdered) + { + bullishScore += highScore; + } + if (!isX3MaBullishState && + !isX3MaSwitchedToBullishState) + { + // + if (isX3MaFastBullish) + { + bullishScore += minScore; + } + if (isX3MaSlowBullish) + { + bullishScore += minScore; + } + } + if (!isX3MaBullishOrdered && + !isX3MaSwitchedToBullishOrdered) + { + // + if (isX3MaFastOverMid) + { + bullishScore += minScore; + } + if (isX3MaMidOverSlow) + { + bullishScore += minScore; + } + } + + // + if (isX3MaBearishState) + { + bearishScore += score; + } + if (isX3MaBearishOrdered) + { + bearishScore += score; + } + if (isX3MaSwitchedToBearishState) + { + bearishScore += highScore; + } + if (isX3MaSwitchedToBearishOrdered) + { + bearishScore += highScore; + } + if (!isX3MaBearishState && + !isX3MaSwitchedToBearishState) + { + // + if (isX3MaFastBearish) + { + bearishScore += minScore; + } + if (isX3MaSlowBearish) + { + bearishScore += minScore; + } + } + if (!isX3MaBearishOrdered && + !isX3MaSwitchedToBearishOrdered) + { + // + if (isX3MaFastUnderMid) + { + bearishScore += minScore; + } + if (isX3MaMidUnderSlow) + { + bearishScore += minScore; + } + } } /** @@ -370,6 +463,9 @@ struct X121X3MAConditions // string conditionsStr = // + "-----------------------" + separator + + "X3MA: " + separator + + "-----------------------" + separator + ToString("isX3MaFastBullish", isX3MaFastBullish, ignoreFalseConditions, separator) + ToString("isX3MaFastBearish", isX3MaFastBearish, ignoreFalseConditions, separator) + ToString("isX3MaFastNeutural", isX3MaFastNeutural, ignoreFalseConditions, separator) + diff --git a/Helpers/x-saherelm.x121.xatr.helper.mq5 b/Helpers/x-saherelm.x121.xatr.helper.mq5 index 6efd25ee..4a4f2514 100644 --- a/Helpers/x-saherelm.x121.xatr.helper.mq5 +++ b/Helpers/x-saherelm.x121.xatr.helper.mq5 @@ -34,12 +34,14 @@ enum ENUM_X121_XATR_BUFFERS // X121_ATR_UPPER_LINE = 0, X121_ATR_LOWER_LINE = 1, - X121_PRICE_CHANGE_LINE = 2, - X121_PRICE_CHANGE_MA_LINE = 3, - X121_ATR_LINE = 4, - X121_ATR_UPPER_RAW_LINE = 5, - X121_ATR_LOWER_RAW_LINE = 6, - X121_RSI_LINE = 7, + X121_ATR_SM_UPPER_LINE = 2, + X121_ATR_SM_LOWER_LINE = 3, + X121_PRICE_CHANGE_LINE = 4, + X121_PRICE_CHANGE_SM_LINE = 5, + X121_RSI_CHANGE_LINE = 6, + X121_RSI_CHANGE_SM_LINE = 7, + X121_ATR_LINE = 8, + X121_RSI_LINE = 9, }; // @@ -50,26 +52,41 @@ struct X121XATRInputs // Props ... // - // RSI ... - int rsiLength; // Length - double rsiOverSoldLevel; // Over Sold Level - double rsiOverBoughtLevel; // Over Bought Level - ENUM_APPLIED_PRICE rsiAppliedTo; // Applied To + // RSI Detection ... + int rsiLength; // Length + ENUM_X_PRICE rsiPriceType; // Applied To + ENUM_X_MA_METHOD rsiSmoothingMethod; // Smoothing Method; // // ATR Detection ... - int atrLength; // Length - double atrMultiplier; // Multiplier - ENUM_APPLIED_PRICE atrUpperAppliedTo; // Upper Zone Applied To - ENUM_APPLIED_PRICE atrLowerAppliedTo; // Lower Zone Applied To - ENUM_X_MA_METHOD atrSmoothingMode; // Smoothing Method + int atrLength; // Length + double atrMultiplier; // Multiplier + ENUM_X_PRICE atrUpperPriceType; // Upper Zone Applied To + ENUM_X_PRICE atrLowerPriceType; // Lower Zone Applied To + ENUM_X_MA_METHOD atrSmoothingMethod; // Smoothing Method // + // Price Change ... + int priceChangeSmoothingLength; // Length + ENUM_X_PRICE priceChangeType; // Price Type + ENUM_X_MA_METHOD priceChangeSmoothingMethod; // Moving Average Moethod + + // + // Presentation ... int startCalculationForLastBars; // Calculate Last n Bars + bool showAtrUpper; // Show Upper Zone + bool showAtrLower; // Show Lower Zone + bool showSmoothedAtrUpper; // Show Smoothed Upper Zone + bool showSmoothedAtrLower; // Show Smoothed Lower Zone + bool showRSIChange; // Show RSI Change + bool showSmoothedRSIChange; // ShowSmoothed RSI Change + bool showPriceChange; // Show Price Change + bool showSmoothedPriceChange; // ShowSmoothed Price Change // - bool showATRUpper; // Show Upper Zone - bool showATRLower; // Show Lower Zone + // Custom Props ... + int rsiOverSoldLevel; // RSI Over Sold Level ... + int rsiOverBoughtLevel; // RSI Over Bought Level ... // // Constructor(s) ... @@ -87,26 +104,36 @@ struct X121XATRInputs void Clean() { // - // RSI ... - rsiLength = 0; - rsiOverSoldLevel = 0; - rsiOverBoughtLevel = 0; - rsiAppliedTo = PRICE_CLOSE; + // RSI Detection ... + rsiLength = 0; // Length + rsiPriceType = X_PRICE_NONE; // Applied To + rsiSmoothingMethod = X_MA_MODE_NONE; // Smoothing Method; // - // ATR ... - atrLength = 0; // Length - atrMultiplier = 0; // Multiplier - atrUpperAppliedTo = PRICE_HIGH; // Upper Zone Applied To - atrLowerAppliedTo = PRICE_LOW; // Lower Zone Applied To - atrSmoothingMode = X_MA_MODE_NONE; // Smoothing Method + // ATR Detection ... + atrLength = 0; // Length + atrMultiplier = 0; // Multiplier + atrUpperPriceType = X_PRICE_NONE; // Upper Zone Applied To + atrLowerPriceType = X_PRICE_NONE; // Lower Zone Applied To + atrSmoothingMethod = X_MA_MODE_NONE; // Smoothing Method // - startCalculationForLastBars = 0; + // Price Change ... + priceChangeSmoothingLength = 0; // Length + priceChangeType = X_PRICE_NONE; // Price Type + priceChangeSmoothingMethod = X_MA_MODE_NONE; // Moving Average Moethod // - showATRUpper = false; // Show Upper Zone - showATRLower = false; // Show Lower Zone + // Presentation ... + startCalculationForLastBars = 0; // Calculate Last n Bars + showAtrUpper = false; // Show Upper Zone + showAtrLower = false; // Show Lower Zone + showSmoothedAtrUpper = false; // Show Smoothed Upper Zone + showSmoothedAtrLower = false; // Show Smoothed Lower Zone + showRSIChange = false; // Show RSI Change + showSmoothedRSIChange = false; // ShowSmoothed RSI Change + showPriceChange = false; // Show Price Change + showSmoothedPriceChange = false; // ShowSmoothed Price Change // ZeroMemory(this); @@ -117,24 +144,36 @@ struct X121XATRInputs void Default() { // - // RSI ... - rsiLength = 14; - rsiOverSoldLevel = 30; - rsiOverBoughtLevel = 70; - rsiAppliedTo = PRICE_CLOSE; + // RSI Detection ... + rsiLength = 14; // Length + rsiPriceType = X_PRICE_CLOSE; // Applied To + rsiSmoothingMethod = X_MA_MODE_SMA; // Smoothing Method; // - // ATR ... - atrLength = 14; // Length - atrMultiplier = 1; // Multiplier - atrUpperAppliedTo = PRICE_HIGH; // Upper Zone Applied To - atrLowerAppliedTo = PRICE_LOW; // Lower Zone Applied To - atrSmoothingMode = X_MA_MODE_EMA; // Smoothing Method + // ATR Detection ... + atrLength = 14; // Length + atrMultiplier = 1; // Multiplier + atrUpperPriceType = X_PRICE_HIGH; // Upper Zone Applied To + atrLowerPriceType = X_PRICE_LOW; // Lower Zone Applied To + atrSmoothingMethod = X_MA_MODE_SMA; // Smoothing Method // - startCalculationForLastBars = 1500; - showATRUpper = true; // Show Upper Zone - showATRLower = true; // Show Lower Zone + // Price Change ... + priceChangeSmoothingLength = 14; // Length + priceChangeType = X_PRICE_CLOSE; // Price Type + priceChangeSmoothingMethod = X_MA_MODE_SMA; // Moving Average Moethod + + // + // Presentation ... + startCalculationForLastBars = 1000; // Calculate Last n Bars + showAtrUpper = true; // Show Upper Zone + showAtrLower = true; // Show Lower Zone + showSmoothedAtrUpper = true; // Show Smoothed Upper Zone + showSmoothedAtrLower = true; // Show Smoothed Lower Zone + showRSIChange = true; // Show RSI Change + showSmoothedRSIChange = true; // ShowSmoothed RSI Change + showPriceChange = true; // Show Price Change + showSmoothedPriceChange = true; // ShowSmoothed Price Change } // @@ -147,13 +186,26 @@ struct X121XATRInputs // result = // - atrLength > 0 && + // RSI ... rsiLength > 0 && + // + // ATR ... + atrLength > 0 && atrMultiplier > 0 && + // + // RSI Levels ... rsiOverSoldLevel > 0 && + rsiOverSoldLevel < 100 && rsiOverBoughtLevel > 0 && - startCalculationForLastBars > 0 && - rsiOverSoldLevel < rsiOverBoughtLevel + rsiOverBoughtLevel < 100 && + rsiOverSoldLevel < rsiOverBoughtLevel && + // + priceChangeSmoothingLength > 0 && + // + IsValid(rsiPriceType) && + IsValid(priceChangeType) && + IsValid(atrUpperPriceType) && + IsValid(atrLowerPriceType) // ; @@ -169,7 +221,8 @@ struct X121XATRInputs int result = 0; // - result = MathMax(atrLength, rsiLength); + result = MathMax(rsiLength, atrLength); + result = MathMax(result, priceChangeSmoothingLength); // return result; @@ -188,39 +241,64 @@ struct X121XATRConditions // // Buffers ... - double atrUpperBuffer[]; - double atrLowerBuffer[]; - double atrUpperRawBuffer[]; - double atrLowerRawBuffer[]; double rsiBuffer[]; double atrBuffer[]; + double atrUpperBuffer[]; + double atrLowerBuffer[]; + double atrUpperSMBuffer[]; + double atrLowerSMBuffer[]; + double rsiChangeBuffer[]; + double rsiChangeSMBuffer[]; + double priceChangeBuffer[]; + double priceChangeSMBuffer[]; // // Conditions ... // // RSI ... - - // + bool isRsiInRange; + bool isRsiOverSold; bool isRsiOverBought; + bool isRsiCrossedOverOverSold; + bool isRsiCrossedUnderOverSold; bool isRsiCrossedOverOverBought; bool isRsiCrossedUnderOverBought; // - bool isRsiOverSold; - bool isRsiCrossedUnderOverSold; - bool isRsiCrossedOverOverSold; + // Other ... // - // ATR ... + bool isRsiSMOverPriceChange; + bool isRsiSMUnderPriceChange; // - bool isClosedOverAtrUpper; - bool isClosedOverAtrLower; + bool isRsiSMCrossedOverPriceChange; + bool isRsiSMCrossedUnderPriceChange; // - bool isClosedUnderAtrUpper; - bool isClosedUnderAtrLower; + bool isPriceChangeSMOverRsi; + bool isPriceChangeSMUnderRsi; + + // + bool isPriceChangeSMCrossedOverRsi; + bool isPriceChangeSMCrossedUnderRsi; + + // + bool isRsiOverRsiSM; + bool isRsiUnderRsiSM; + + // + bool isRsiCrossedOverRsiSM; + bool isRsiCrossedUnderRsiSM; + + // + bool isPriceChangeOverPriceChangeSM; + bool isPriceChangeUnderPriceChangeSM; + + // + bool isPriceChangeCrossedOverPriceChangeSM; + bool isPriceChangeCrossedUnderPriceChangeSM; // // bool isCloseLower @@ -254,43 +332,72 @@ struct X121XATRConditions Clean(atrBuffer); Clean(atrUpperBuffer); Clean(atrLowerBuffer); - Clean(atrUpperRawBuffer); - Clean(atrLowerRawBuffer); + Clean(atrUpperSMBuffer); + Clean(atrLowerSMBuffer); + Clean(rsiChangeBuffer); + Clean(rsiChangeSMBuffer); + Clean(priceChangeBuffer); + Clean(priceChangeSMBuffer); // ArraySetAsSeries(rsiBuffer, true); ArraySetAsSeries(atrBuffer, true); ArraySetAsSeries(atrUpperBuffer, true); ArraySetAsSeries(atrLowerBuffer, true); - ArraySetAsSeries(atrUpperRawBuffer, true); - ArraySetAsSeries(atrLowerRawBuffer, true); + ArraySetAsSeries(atrUpperSMBuffer, true); + ArraySetAsSeries(atrLowerSMBuffer, true); + ArraySetAsSeries(rsiChangeBuffer, true); + ArraySetAsSeries(rsiChangeSMBuffer, true); + ArraySetAsSeries(priceChangeBuffer, true); + ArraySetAsSeries(priceChangeSMBuffer, true); // // Conditions ... // // RSI ... - - // + isRsiInRange = false; + isRsiOverSold = false; isRsiOverBought = false; + isRsiCrossedOverOverSold = false; + isRsiCrossedUnderOverSold = false; isRsiCrossedOverOverBought = false; isRsiCrossedUnderOverBought = false; // - isRsiOverSold = false; - isRsiCrossedUnderOverSold = false; - isRsiCrossedOverOverSold = false; + // Other ... // - // ATR ... + isRsiSMOverPriceChange = false; + isRsiSMUnderPriceChange = false; // - isClosedOverAtrUpper = false; - isClosedOverAtrLower = false; + isRsiSMCrossedOverPriceChange = false; + isRsiSMCrossedUnderPriceChange = false; // - isClosedUnderAtrUpper = false; - isClosedUnderAtrLower = false; + isPriceChangeSMOverRsi = false; + isPriceChangeSMUnderRsi = false; + + // + isPriceChangeSMCrossedOverRsi = false; + isPriceChangeSMCrossedUnderRsi = false; + + // + isRsiOverRsiSM = false; + isRsiUnderRsiSM = false; + + // + isRsiCrossedOverRsiSM = false; + isRsiCrossedUnderRsiSM = false; + + // + isPriceChangeOverPriceChangeSM = false; + isPriceChangeUnderPriceChangeSM = false; + + // + isPriceChangeCrossedOverPriceChangeSM = false; + isPriceChangeCrossedUnderPriceChangeSM = false; // ZeroMemory(this); @@ -312,7 +419,105 @@ struct X121XATRConditions bearishScore = 0; // - // TODO: Implement if Required ... + double score = 1; + double minScore = 0.5; + double highScore = 1.5; + + // + if (isRsiOverSold) + { + bullishScore += minScore; + } + if (isRsiOverRsiSM) + { + bullishScore += minScore; + } + if (isRsiSMOverPriceChange) + { + bullishScore += minScore; + } + if (isPriceChangeSMOverRsi) + { + bullishScore += minScore; + } + if (isPriceChangeOverPriceChangeSM) + { + bullishScore += minScore; + } + + // + if (isRsiCrossedOverRsiSM) + { + bullishScore += score; + } + if (isRsiCrossedOverOverSold) + { + bullishScore += score; + } + if (isRsiCrossedUnderOverBought) + { + bullishScore += score; + } + if (isRsiSMCrossedOverPriceChange) + { + bullishScore += score; + } + if (isPriceChangeSMCrossedOverRsi) + { + bullishScore += score; + } + if (isPriceChangeCrossedOverPriceChangeSM) + { + bullishScore += score; + } + + // + if (isRsiOverBought) + { + bearishScore += minScore; + } + if (isRsiUnderRsiSM) + { + bearishScore += minScore; + } + if (isRsiSMUnderPriceChange) + { + bearishScore += minScore; + } + if (isPriceChangeSMUnderRsi) + { + bearishScore += minScore; + } + if (isPriceChangeUnderPriceChangeSM) + { + bearishScore += minScore; + } + + // + if (isRsiCrossedUnderRsiSM) + { + bearishScore += score; + } + if (isRsiCrossedUnderOverSold) + { + bearishScore += score; + } + if (isRsiCrossedOverOverBought) + { + bearishScore += score; + } + if (isRsiSMCrossedUnderPriceChange) + { + bearishScore += score; + } + if (isPriceChangeSMCrossedUnderRsi) + { + bearishScore += score; + } + if (isPriceChangeCrossedUnderPriceChangeSM) + { + bearishScore += score; + } } /** @@ -366,19 +571,33 @@ struct X121XATRConditions // string conditionsStr = // - // RSI ... + "-----------------------" + separator + + "XATR: " + separator + + "-----------------------" + separator + + ToString("isRsiInRange", isRsiInRange, ignoreFalseConditions, separator) + + ToString("isRsiOverSold", isRsiOverSold, ignoreFalseConditions, separator) + ToString("isRsiOverBought", isRsiOverBought, ignoreFalseConditions, separator) + + ToString("isRsiCrossedOverOverSold", isRsiCrossedOverOverSold, ignoreFalseConditions, separator) + + ToString("isRsiCrossedUnderOverSold", isRsiCrossedUnderOverSold, ignoreFalseConditions, separator) + ToString("isRsiCrossedOverOverBought", isRsiCrossedOverOverBought, ignoreFalseConditions, separator) + ToString("isRsiCrossedUnderOverBought", isRsiCrossedUnderOverBought, ignoreFalseConditions, separator) + - ToString("isRsiOverSold", isRsiOverSold, ignoreFalseConditions, separator) + - ToString("isRsiCrossedUnderOverSold", isRsiCrossedUnderOverSold, ignoreFalseConditions, separator) + - ToString("isRsiCrossedOverOverSold", isRsiCrossedOverOverSold, ignoreFalseConditions, separator) + // - // ATR ... - ToString("isClosedOverAtrUpper", isClosedOverAtrUpper, ignoreFalseConditions, separator) + - ToString("isClosedOverAtrLower", isClosedOverAtrLower, ignoreFalseConditions, separator) + - ToString("isClosedUnderAtrUpper", isClosedUnderAtrUpper, ignoreFalseConditions, separator) + - ToString("isClosedUnderAtrLower", isClosedUnderAtrLower, ignoreFalseConditions, separator) + + ToString("isRsiSMOverPriceChange", isRsiSMOverPriceChange, ignoreFalseConditions, separator) + + ToString("isRsiSMUnderPriceChange", isRsiSMUnderPriceChange, ignoreFalseConditions, separator) + + ToString("isRsiSMCrossedOverPriceChange", isRsiSMCrossedOverPriceChange, ignoreFalseConditions, separator) + + ToString("isRsiSMCrossedUnderPriceChange", isRsiSMCrossedUnderPriceChange, ignoreFalseConditions, separator) + + ToString("isPriceChangeSMOverRsi", isPriceChangeSMOverRsi, ignoreFalseConditions, separator) + + ToString("isPriceChangeSMUnderRsi", isPriceChangeSMUnderRsi, ignoreFalseConditions, separator) + + ToString("isPriceChangeSMCrossedOverRsi", isPriceChangeSMCrossedOverRsi, ignoreFalseConditions, separator) + + ToString("isPriceChangeSMCrossedUnderRsi", isPriceChangeSMCrossedUnderRsi, ignoreFalseConditions, separator) + + ToString("isRsiOverRsiSM", isRsiOverRsiSM, ignoreFalseConditions, separator) + + ToString("isRsiUnderRsiSM", isRsiUnderRsiSM, ignoreFalseConditions, separator) + + ToString("isRsiCrossedOverRsiSM", isRsiCrossedOverRsiSM, ignoreFalseConditions, separator) + + ToString("isRsiCrossedUnderRsiSM", isRsiCrossedUnderRsiSM, ignoreFalseConditions, separator) + + ToString("isPriceChangeOverPriceChangeSM", isPriceChangeOverPriceChangeSM, ignoreFalseConditions, separator) + + ToString("isPriceChangeUnderPriceChangeSM", isPriceChangeUnderPriceChangeSM, ignoreFalseConditions, separator) + + ToString("isPriceChangeCrossedOverPriceChangeSM", isPriceChangeCrossedOverPriceChangeSM, ignoreFalseConditions, separator) + + ToString("isPriceChangeCrossedUnderPriceChangeSM", isPriceChangeCrossedUnderPriceChangeSM, ignoreFalseConditions, separator) + // "" // @@ -442,11 +661,15 @@ class XCX121XATRHelper : public XCBaseHelper { // Clean(rsiBuffer); + Clean(atrBuffer); Clean(atrUpperBuffer); Clean(atrLowerBuffer); - Clean(atrBuffer); - Clean(atrUpperRawBuffer); - Clean(atrLowerRawBuffer); + Clean(atrUpperSMBuffer); + Clean(atrLowerSMBuffer); + Clean(rsiChangeBuffer); + Clean(rsiChangeSMBuffer); + Clean(priceChangeBuffer); + Clean(priceChangeSMBuffer); // mInputs.Clean(); @@ -476,11 +699,15 @@ class XCX121XATRHelper : public XCBaseHelper // ArraySetAsSeries(rsiBuffer, true); + ArraySetAsSeries(atrBuffer, true); ArraySetAsSeries(atrUpperBuffer, true); ArraySetAsSeries(atrLowerBuffer, true); - ArraySetAsSeries(atrBuffer, true); - ArraySetAsSeries(atrUpperRawBuffer, true); - ArraySetAsSeries(atrLowerRawBuffer, true); + ArraySetAsSeries(atrUpperSMBuffer, true); + ArraySetAsSeries(atrLowerSMBuffer, true); + ArraySetAsSeries(rsiChangeBuffer, true); + ArraySetAsSeries(rsiChangeSMBuffer, true); + ArraySetAsSeries(priceChangeBuffer, true); + ArraySetAsSeries(priceChangeSMBuffer, true); // mInputs = inputs; @@ -498,22 +725,35 @@ class XCX121XATRHelper : public XCBaseHelper // // RSI Detection ... "", - mInputs.rsiLength, - mInputs.rsiAppliedTo, + mInputs.rsiLength, // Length + mInputs.rsiPriceType, // Applied To + mInputs.rsiSmoothingMethod, // Smoothing Method; // // ATR Detection ... "", - mInputs.atrLength, - mInputs.atrMultiplier, - mInputs.atrUpperAppliedTo, - mInputs.atrLowerAppliedTo, - mInputs.atrSmoothingMode, + mInputs.atrLength, // Length + mInputs.atrMultiplier, // Multiplier + mInputs.atrUpperPriceType, // Upper Zone Applied To + mInputs.atrLowerPriceType, // Lower Zone Applied To + mInputs.atrSmoothingMethod, // Smoothing Method + // + // Price Change ... + "", + mInputs.priceChangeSmoothingLength, // Length + mInputs.priceChangeType, // Price Type + mInputs.priceChangeSmoothingMethod, // Moving Average Moethod // // Presentation ... "", - mInputs.startCalculationForLastBars, - mInputs.showATRUpper, - mInputs.showATRLower + mInputs.startCalculationForLastBars, // Calculate Last n Bars + mInputs.showAtrUpper, // Show Upper Zone + mInputs.showAtrLower, // Show Lower Zone + mInputs.showSmoothedAtrUpper, // Show Smoothed Upper Zone + mInputs.showSmoothedAtrLower, // Show Smoothed Lower Zone + mInputs.showRSIChange, // Show RSI Change + mInputs.showSmoothedRSIChange, // ShowSmoothed RSI Change + mInputs.showPriceChange, // Show Price Change + mInputs.showSmoothedPriceChange // ShowSmoothed Price Change // ); result = mHandler != INVALID_HANDLE; @@ -705,55 +945,6 @@ class XCX121XATRHelper : public XCBaseHelper ); } - // - double GetATRUpperRaw( - int barIndex // Bar Index - ) - { - // - if (barIndex < 0) - { - barIndex = 0; - } - - // - Calculate(); - - // - int count = ArraySize(atrUpperRawBuffer); - if (barIndex >= count) - { - barIndex = count - 1; - } - - // - return atrUpperRawBuffer[barIndex]; - } - - // - int CopyATRUpperRaw( - int start, // Start - int count, // Number of Items for read - double &buffer[], // Dest Buffer - bool forceClean = true // Force To Clean buffer - ) - { - // - // Update Calculations ... - Calculate(); - - // - // Copy Items ... - return Copy( - start, - count, - atrUpperRawBuffer, - buffer, - forceClean - // - ); - } - // double GetATRLower( int barIndex // Bar Index @@ -804,7 +995,7 @@ class XCX121XATRHelper : public XCBaseHelper } // - double GetATRLowerRaw( + double GetSMATRUpper( int barIndex // Bar Index ) { @@ -818,18 +1009,18 @@ class XCX121XATRHelper : public XCBaseHelper Calculate(); // - int count = ArraySize(atrLowerRawBuffer); + int count = ArraySize(atrUpperSMBuffer); if (barIndex >= count) { barIndex = count - 1; } // - return atrLowerRawBuffer[barIndex]; + return atrUpperSMBuffer[barIndex]; } // - int CopyATRLowerRaw( + int CopySMATRUpper( int start, // Start int count, // Number of Items for read double &buffer[], // Dest Buffer @@ -845,7 +1036,258 @@ class XCX121XATRHelper : public XCBaseHelper return Copy( start, count, - atrLowerRawBuffer, + atrUpperSMBuffer, + buffer, + forceClean + // + ); + } + + // + double GetSMATRLower( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(atrLowerSMBuffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + return atrLowerSMBuffer[barIndex]; + } + + // + int CopySMATRLower( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + atrLowerSMBuffer, + buffer, + forceClean + // + ); + } + + // + // PRICE Change ... + + // + double GetPriceChange( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(priceChangeBuffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + return priceChangeBuffer[barIndex]; + } + + // + int CopyPriceChange( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + priceChangeBuffer, + buffer, + forceClean + // + ); + } + + // + double GetSMPriceChange( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(priceChangeSMBuffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + return priceChangeSMBuffer[barIndex]; + } + + // + int CopySMPriceChange( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + priceChangeSMBuffer, + buffer, + forceClean + // + ); + } + + // + // RSI Change ... + + // + double GetRsiChange( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(rsiChangeBuffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + return rsiChangeBuffer[barIndex]; + } + + // + int CopyRsiChange( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + rsiChangeBuffer, + buffer, + forceClean + // + ); + } + + // + double GetSMRsiChange( + int barIndex // Bar Index + ) + { + // + if (barIndex < 0) + { + barIndex = 0; + } + + // + Calculate(); + + // + int count = ArraySize(rsiChangeSMBuffer); + if (barIndex >= count) + { + barIndex = count - 1; + } + + // + return rsiChangeSMBuffer[barIndex]; + } + + // + int CopySMRsiChange( + int start, // Start + int count, // Number of Items for read + double &buffer[], // Dest Buffer + bool forceClean = true // Force To Clean buffer + ) + { + // + // Update Calculations ... + Calculate(); + + // + // Copy Items ... + return Copy( + start, + count, + rsiChangeSMBuffer, buffer, forceClean // @@ -948,13 +1390,6 @@ class XCX121XATRHelper : public XCBaseHelper conditions.atrUpperBuffer // ); - // - CopyATRUpperRaw( - zIndex, - loopback, - conditions.atrUpperRawBuffer // - ); - // CopyATRLower( zIndex, @@ -963,64 +1398,191 @@ class XCX121XATRHelper : public XCBaseHelper ); // - CopyATRLowerRaw( + CopySMATRUpper( zIndex, loopback, - conditions.atrLowerRawBuffer // + conditions.atrUpperSMBuffer // + ); + + // + CopySMATRLower( + zIndex, + loopback, + conditions.atrLowerSMBuffer // + ); + + // + CopyPriceChange( + zIndex, + loopback, + conditions.priceChangeBuffer // + ); + + // + CopySMPriceChange( + zIndex, + loopback, + conditions.priceChangeSMBuffer // + ); + + // + CopyRsiChange( + zIndex, + loopback, + conditions.rsiChangeBuffer // + ); + + // + CopySMRsiChange( + zIndex, + loopback, + conditions.rsiChangeSMBuffer // ); // // Conditions ... // - int cIDX = 1; + int zIDX = 0; + int cIDX = zIDX + 1; int pIDX = cIDX + 1; + int pPIDX = pIDX + 1; + + // + double cRSI = conditions.rsiBuffer[cIDX]; + double pRSI = conditions.rsiBuffer[pIDX]; + double pPRSI = conditions.rsiBuffer[pPIDX]; // // RSI ... // - bool isRsiOverBought = conditions.rsiBuffer[cIDX] > mInputs.rsiOverBoughtLevel; - bool isRsiOverBoughtPrev = conditions.rsiBuffer[pIDX] > mInputs.rsiOverBoughtLevel; + bool isRsiInRange = + cRSI > mInputs.rsiOverSoldLevel && + cRSI < mInputs.rsiOverBoughtLevel; + bool isRsiInRangeP = + pRSI > mInputs.rsiOverSoldLevel && + pRSI < mInputs.rsiOverBoughtLevel; // + bool isRsiOverSold = + cRSI < mInputs.rsiOverSoldLevel; + bool isRsiOverSoldP = + pRSI < mInputs.rsiOverSoldLevel; + bool isRsiCrossedOverOverSold = isRsiOverSold && + !isRsiOverSoldP; + bool isRsiCrossedUnderOverSold = isRsiOverSoldP && + !isRsiOverSold; + + // + bool isRsiOverBought = + cRSI > mInputs.rsiOverBoughtLevel; + bool isRsiOverBoughtP = + pRSI > mInputs.rsiOverBoughtLevel; bool isRsiCrossedOverOverBought = isRsiOverBought && - !isRsiOverBoughtPrev; - bool isRsiCrossedUnderOverBought = !isRsiOverBought && - isRsiOverBoughtPrev; + !isRsiOverBoughtP; + bool isRsiCrossedUnderOverBought = isRsiOverBoughtP && + !isRsiOverBought; // - bool isRsiOverSold = conditions.rsiBuffer[cIDX] < mInputs.rsiOverSoldLevel; - bool isRsiOverSoldPrev = conditions.rsiBuffer[pIDX] < mInputs.rsiOverSoldLevel; + // Other ... // - bool isRsiCrossedUnderOverSold = isRsiOverSold && - !isRsiOverSoldPrev; - bool isRsiCrossedOverOverSold = !isRsiOverSold && - isRsiOverSoldPrev; + double rsiChange = conditions.rsiChangeBuffer[cIDX]; + double rsiChangeP = conditions.rsiChangeBuffer[pIDX]; // - // ATR ... + double rsiChangeSM = conditions.rsiChangeSMBuffer[cIDX]; + double rsiChangeSMP = conditions.rsiChangeSMBuffer[pIDX]; // - bool isClosedOverAtrUpper = cBar.close > conditions.atrUpperBuffer[cIDX]; - bool isClosedOverAtrLower = cBar.close > conditions.atrLowerBuffer[cIDX]; + double priceChange = conditions.priceChangeBuffer[cIDX]; + double priceChangeP = conditions.priceChangeBuffer[pIDX]; // - bool isClosedUnderAtrUpper = cBar.close < conditions.atrUpperBuffer[cIDX]; - bool isClosedUnderAtrLower = cBar.close < conditions.atrLowerBuffer[cIDX]; + double priceChangeSM = conditions.priceChangeSMBuffer[cIDX]; + double priceChangeSMP = conditions.priceChangeSMBuffer[pIDX]; // + // + // + + // + bool isRsiSMOverPriceChange = rsiChangeSM > priceChangeSM; + bool isRsiSMOverPriceChangeP = rsiChangeSMP > priceChangeSMP; + bool isRsiSMCrossedOverPriceChange = isRsiSMOverPriceChange && + !isRsiSMOverPriceChangeP; + + // + bool isRsiSMUnderPriceChange = rsiChangeSM < priceChangeSM; + bool isRsiSMUnderPriceChangeP = rsiChangeSMP < priceChangeSMP; + bool isRsiSMCrossedUnderPriceChange = isRsiSMUnderPriceChange && + !isRsiSMUnderPriceChangeP; + + // + bool isPriceChangeSMOverRsi = priceChangeSM > rsiChangeSM; + bool isPriceChangeSMOverRsiP = priceChangeSMP > rsiChangeSMP; + bool isPriceChangeSMCrossedOverRsi = isPriceChangeSMOverRsi && + !isPriceChangeSMOverRsiP; + + // + bool isPriceChangeSMUnderRsi = priceChangeSM < rsiChangeSM; + bool isPriceChangeSMUnderRsiP = priceChangeSMP < rsiChangeSMP; + bool isPriceChangeSMCrossedUnderRsi = isPriceChangeSMUnderRsi && + !isPriceChangeSMUnderRsiP; + + // + bool isRsiOverRsiSM = rsiChange > rsiChangeSM; + bool isRsiOverRsiSMP = rsiChangeP > rsiChangeSMP; + bool isRsiCrossedOverRsiSM = isRsiOverRsiSM && + !isRsiOverRsiSMP; + + // + bool isRsiUnderRsiSM = rsiChange < rsiChangeSM; + bool isRsiUnderRsiSMP = rsiChangeP < rsiChangeSMP; + bool isRsiCrossedUnderRsiSM = isRsiUnderRsiSM && + !isRsiUnderRsiSMP; + + // + bool isPriceChangeOverPriceChangeSM = priceChange > priceChangeSM; + bool isPriceChangeOverPriceChangeSMP = priceChangeP > priceChangeSMP; + bool isPriceChangeCrossedOverPriceChangeSM = isPriceChangeOverPriceChangeSM && + !isPriceChangeOverPriceChangeSMP; + + // + bool isPriceChangeUnderPriceChangeSM = priceChange < priceChangeSM; + bool isPriceChangeUnderPriceChangeSMP = priceChangeP < priceChangeSMP; + bool isPriceChangeCrossedUnderPriceChangeSM = isPriceChangeUnderPriceChangeSM && + !isPriceChangeUnderPriceChangeSMP; + + // + // + // + + // + conditions.isRsiInRange = isRsiInRange; conditions.isRsiOverSold = isRsiOverSold; + conditions.isRsiOverRsiSM = isRsiOverRsiSM; conditions.isRsiOverBought = isRsiOverBought; - conditions.isClosedOverAtrUpper = isClosedOverAtrUpper; - conditions.isClosedOverAtrLower = isClosedOverAtrLower; - conditions.isClosedUnderAtrUpper = isClosedUnderAtrUpper; - conditions.isClosedUnderAtrLower = isClosedUnderAtrLower; + conditions.isRsiUnderRsiSM = isRsiUnderRsiSM; + conditions.isRsiCrossedOverRsiSM = isRsiCrossedOverRsiSM; + conditions.isRsiCrossedUnderRsiSM = isRsiCrossedUnderRsiSM; + conditions.isPriceChangeSMOverRsi = isPriceChangeSMOverRsi; + conditions.isRsiSMOverPriceChange = isRsiSMOverPriceChange; + conditions.isPriceChangeSMUnderRsi = isPriceChangeSMUnderRsi; + conditions.isRsiSMUnderPriceChange = isRsiSMUnderPriceChange; conditions.isRsiCrossedOverOverSold = isRsiCrossedOverOverSold; conditions.isRsiCrossedUnderOverSold = isRsiCrossedUnderOverSold; conditions.isRsiCrossedOverOverBought = isRsiCrossedOverOverBought; conditions.isRsiCrossedUnderOverBought = isRsiCrossedUnderOverBought; + conditions.isPriceChangeSMCrossedOverRsi = isPriceChangeSMCrossedOverRsi; + conditions.isRsiSMCrossedOverPriceChange = isRsiSMCrossedOverPriceChange; + conditions.isRsiSMCrossedUnderPriceChange = isRsiSMCrossedUnderPriceChange; + conditions.isPriceChangeSMCrossedUnderRsi = isPriceChangeSMCrossedUnderRsi; + conditions.isPriceChangeOverPriceChangeSM = isPriceChangeOverPriceChangeSM; + conditions.isPriceChangeUnderPriceChangeSM = isPriceChangeUnderPriceChangeSM; + conditions.isPriceChangeCrossedOverPriceChangeSM = isPriceChangeCrossedOverPriceChangeSM; + conditions.isPriceChangeCrossedUnderPriceChangeSM = isPriceChangeCrossedUnderPriceChangeSM; // Cleanup(); @@ -1047,11 +1609,15 @@ class XCX121XATRHelper : public XCBaseHelper // // Buffers ... double rsiBuffer[]; + double atrBuffer[]; double atrUpperBuffer[]; double atrLowerBuffer[]; - double atrBuffer[]; - double atrUpperRawBuffer[]; - double atrLowerRawBuffer[]; + double atrUpperSMBuffer[]; + double atrLowerSMBuffer[]; + double rsiChangeBuffer[]; + double rsiChangeSMBuffer[]; + double priceChangeBuffer[]; + double priceChangeSMBuffer[]; // void Calculate( @@ -1074,56 +1640,100 @@ class XCX121XATRHelper : public XCBaseHelper // // ATR ... - - // - CopyBuffer( - mHandler, - X121_ATR_UPPER_LINE, - 0, - maxRequiredBars, - atrUpperBuffer - // - ); - - // - CopyBuffer( - mHandler, - X121_ATR_LOWER_LINE, - 0, - maxRequiredBars, - atrLowerBuffer - // - ); - - // CopyBuffer( mHandler, X121_ATR_LINE, 0, maxRequiredBars, - atrBuffer - // + atrBuffer // + ); + + // + // ATR Band ... + + // + // Upper ... + CopyBuffer( + mHandler, + X121_ATR_UPPER_LINE, + 0, + maxRequiredBars, + atrUpperBuffer // + ); + + // + // Lower ... + CopyBuffer( + mHandler, + X121_ATR_LOWER_LINE, + 0, + maxRequiredBars, + atrLowerBuffer // + ); + + // + // SM Upper ... + CopyBuffer( + mHandler, + X121_ATR_SM_UPPER_LINE, + 0, + maxRequiredBars, + atrUpperSMBuffer // + ); + + // + // Lower ... + CopyBuffer( + mHandler, + X121_ATR_SM_LOWER_LINE, + 0, + maxRequiredBars, + atrLowerSMBuffer // + ); + + // + // PRICE Change ... + + // + CopyBuffer( + mHandler, + X121_PRICE_CHANGE_LINE, + 0, + maxRequiredBars, + priceChangeBuffer // ); // CopyBuffer( mHandler, - X121_ATR_UPPER_RAW_LINE, + X121_PRICE_CHANGE_SM_LINE, 0, maxRequiredBars, - atrUpperRawBuffer - // + priceChangeSMBuffer // + ); + + // + // RSI Change ... + + // + CopyBuffer( + mHandler, + X121_RSI_CHANGE_LINE, + 0, + maxRequiredBars, + rsiChangeBuffer // ); // CopyBuffer( mHandler, - X121_ATR_LOWER_RAW_LINE, + X121_RSI_CHANGE_SM_LINE, 0, maxRequiredBars, - atrLowerRawBuffer - // + rsiChangeSMBuffer // ); + + // } // @@ -1137,6 +1747,12 @@ class XCX121XATRHelper : public XCBaseHelper maxAllowed // ); + // + CleanupArray( + atrBuffer, + maxAllowed // + ); + // CleanupArray( atrUpperBuffer, @@ -1151,19 +1767,37 @@ class XCX121XATRHelper : public XCBaseHelper // CleanupArray( - atrBuffer, + atrUpperSMBuffer, maxAllowed // ); // CleanupArray( - atrUpperRawBuffer, + atrLowerSMBuffer, maxAllowed // ); // CleanupArray( - atrLowerRawBuffer, + rsiChangeBuffer, + maxAllowed // + ); + + // + CleanupArray( + rsiChangeSMBuffer, + maxAllowed // + ); + + // + CleanupArray( + priceChangeBuffer, + maxAllowed // + ); + + // + CleanupArray( + priceChangeSMBuffer, maxAllowed // ); diff --git a/Helpers/x-saherelm.x121.xche.helper.mq5 b/Helpers/x-saherelm.x121.xche.helper.mq5 index 7f7cecd5..dda21f09 100644 --- a/Helpers/x-saherelm.x121.xche.helper.mq5 +++ b/Helpers/x-saherelm.x121.xche.helper.mq5 @@ -202,14 +202,6 @@ struct X121XCHEConditions bool isCheSwitchedToBullish; bool isCheSwitchedToBearish; - // - bool isClosedOverCheMin; - bool isClosedOverCheMax; - - // - bool isClosedUnderCheMin; - bool isClosedUnderCheMax; - // // Constructor ... X121XCHEConditions() @@ -281,14 +273,6 @@ struct X121XCHEConditions isCheSwitchedToBullish = false; isCheSwitchedToBearish = false; - // - isClosedOverCheMin = false; - isClosedOverCheMax = false; - - // - isClosedUnderCheMin = false; - isClosedUnderCheMax = false; - // ZeroMemory(this); } @@ -309,7 +293,56 @@ struct X121XCHEConditions bearishScore = 0; // - // TODO: Implement if Required ... + double score = 1; + double minScore = 0.5; + double highScore = 1.5; + + // + // XCHE ... + + // + if (isCheBullish) + { + bullishScore += score; + } + if (isCheSwitchedToBullish) + { + bullishScore += highScore; + } + if (isChe1Bullish && + !isCheBullish && + !isCheSwitchedToBullish) + { + bullishScore += minScore; + } + if (isChe1SwitchedToBullish && + !isCheBullish && + !isCheSwitchedToBullish) + { + bullishScore += minScore; + } + + // + if (isCheBearish) + { + bearishScore += score; + } + if (isCheSwitchedToBearish) + { + bearishScore += highScore; + } + if (isChe1Bearish && + !isCheBearish && + !isCheSwitchedToBearish) + { + bearishScore += minScore; + } + if (isChe1SwitchedToBearish && + !isCheBearish && + !isCheSwitchedToBearish) + { + bearishScore += minScore; + } } /** @@ -363,6 +396,9 @@ struct X121XCHEConditions // string conditionsStr = // + "-----------------------" + separator + + "XCHE: " + separator + + "-----------------------" + separator + ToString("isChe1Bullish", isChe1Bullish, ignoreFalseConditions, separator) + ToString("isChe1Bearish", isChe1Bearish, ignoreFalseConditions, separator) + ToString("isChe1SwitchedToBullish", isChe1SwitchedToBullish, ignoreFalseConditions, separator) + @@ -375,10 +411,6 @@ struct X121XCHEConditions ToString("isCheBearish", isCheBearish, ignoreFalseConditions, separator) + ToString("isCheSwitchedToBullish", isCheSwitchedToBullish, ignoreFalseConditions, separator) + ToString("isCheSwitchedToBearish", isCheSwitchedToBearish, ignoreFalseConditions, separator) + - ToString("isClosedOverCheMin", isClosedOverCheMin, ignoreFalseConditions, separator) + - ToString("isClosedOverCheMax", isClosedOverCheMax, ignoreFalseConditions, separator) + - ToString("isClosedUnderCheMin", isClosedUnderCheMin, ignoreFalseConditions, separator) + - ToString("isClosedUnderCheMax", isClosedUnderCheMax, ignoreFalseConditions, separator) + // "" // @@ -979,42 +1011,6 @@ class XCX121XCHEHelper : public XCBaseHelper int pIndex = cIndex + 1; int ppIndex = pIndex + 1; - // - XOHCL zBar; - result = zBar.Init( - mSymbol, - mPeriod, - zIndex // - ); - if (!result) - { - return result; - } - - // - XOHCL cBar; - result = cBar.Init( - mSymbol, - mPeriod, - cIndex // - ); - if (!result) - { - return result; - } - - // - XOHCL pBar; - result = pBar.Init( - mSymbol, - mPeriod, - pIndex // - ); - if (!result) - { - return result; - } - // // Buffers ... @@ -1178,12 +1174,6 @@ class XCX121XCHEHelper : public XCBaseHelper double cheMin = GetMin(ches); double cheMax = GetMax(ches); - // - bool isClosedOverCheMin = cBar.close > cheMin; - bool isClosedOverCheMax = cBar.close > cheMax; - bool isClosedUnderCheMin = cBar.close < cheMin; - bool isClosedUnderCheMax = cBar.close < cheMax; - // conditions.isChe1Bullish = isChe1Bullish; conditions.isChe1Bearish = isChe1Bearish; @@ -1197,19 +1187,10 @@ class XCX121XCHEHelper : public XCBaseHelper conditions.isCheBearish = isCheBearish; conditions.isCheSwitchedToBullish = isCheSwitchedToBullish; conditions.isCheSwitchedToBearish = isCheSwitchedToBearish; - conditions.isClosedOverCheMin = isClosedOverCheMin; - conditions.isClosedOverCheMax = isClosedOverCheMax; - conditions.isClosedUnderCheMin = isClosedUnderCheMin; - conditions.isClosedUnderCheMax = isClosedUnderCheMax; // Cleanup(); - // - zBar.Clean(); - cBar.Clean(); - pBar.Clean(); - // return result; } diff --git a/Helpers/x-saherelm.x121.xdelta.helper.mq5 b/Helpers/x-saherelm.x121.xdelta.helper.mq5 index 051e5008..57ca9991 100644 --- a/Helpers/x-saherelm.x121.xdelta.helper.mq5 +++ b/Helpers/x-saherelm.x121.xdelta.helper.mq5 @@ -245,7 +245,44 @@ struct X121XDELTAConditions bearishScore = 0; // - // TODO: Implement if Required ... + double score = 1; + double minScore = 0.5; + double highScore = 1.5; + + // + if (isDeltaOverMa) + { + bullishScore += minScore; + } + if (isDeltaBullish) + { + bullishScore += minScore; + } + if (isDeltaCrossedOverMa) + { + bullishScore += score; + } + if (isDeltaSwitchedToBullish) + { + bullishScore += score; + } + + if (isDeltaBearish) + { + bearishScore += minScore; + } + if (isDeltaUnderMa) + { + bearishScore += minScore; + } + if (isDeltaCrossedUnderMa) + { + bearishScore += score; + } + if (isDeltaSwitchedToBearish) + { + bearishScore += score; + } } /** @@ -299,6 +336,17 @@ struct X121XDELTAConditions // string conditionsStr = // + "-----------------------" + separator + + "XDELTA: " + separator + + "-----------------------" + separator + + ToString("isDeltaBullish", isDeltaBullish, ignoreFalseConditions, separator) + + ToString("isDeltaBearish", isDeltaBearish, ignoreFalseConditions, separator) + + ToString("isDeltaSwitchedToBullish", isDeltaSwitchedToBullish, ignoreFalseConditions, separator) + + ToString("isDeltaSwitchedToBearish", isDeltaSwitchedToBearish, ignoreFalseConditions, separator) + + ToString("isDeltaOverMa", isDeltaOverMa, ignoreFalseConditions, separator) + + ToString("isDeltaUnderMa", isDeltaUnderMa, ignoreFalseConditions, separator) + + ToString("isDeltaCrossedOverMa", isDeltaCrossedOverMa, ignoreFalseConditions, separator) + + ToString("isDeltaCrossedUnderMa", isDeltaCrossedUnderMa, ignoreFalseConditions, separator) + // "" // @@ -607,6 +655,12 @@ class XCX121XDELTAHelper : public XCBaseHelper ); } + // + void Free() override + { + Cleanup(10); + } + // bool GetConditions( X121XDELTAConditions &conditions, // @@ -637,42 +691,6 @@ class XCX121XDELTAHelper : public XCBaseHelper int pIndex = cIndex + 1; int ppIndex = pIndex + 1; - // - XOHCL zBar; - result = zBar.Init( - mSymbol, - mPeriod, - zIndex // - ); - if (!result) - { - return result; - } - - // - XOHCL cBar; - result = cBar.Init( - mSymbol, - mPeriod, - cIndex // - ); - if (!result) - { - return result; - } - - // - XOHCL pBar; - result = pBar.Init( - mSymbol, - mPeriod, - pIndex // - ); - if (!result) - { - return result; - } - // // Buffers ... @@ -744,11 +762,6 @@ class XCX121XDELTAHelper : public XCBaseHelper // Cleanup(); - // - zBar.Clean(); - cBar.Clean(); - pBar.Clean(); - // return result; } diff --git a/Helpers/x-saherelm.x121.xdon.helper.mq5 b/Helpers/x-saherelm.x121.xdon.helper.mq5 index c731e1f4..1c7f0af9 100644 --- a/Helpers/x-saherelm.x121.xdon.helper.mq5 +++ b/Helpers/x-saherelm.x121.xdon.helper.mq5 @@ -934,42 +934,6 @@ class XCX121XDONHelper : public XCBaseHelper int pIndex = cIndex + 1; int ppIndex = pIndex + 1; - // - XOHCL zBar; - result = zBar.Init( - mSymbol, - mPeriod, - zIndex // - ); - if (!result) - { - return result; - } - - // - XOHCL cBar; - result = cBar.Init( - mSymbol, - mPeriod, - cIndex // - ); - if (!result) - { - return result; - } - - // - XOHCL pBar; - result = pBar.Init( - mSymbol, - mPeriod, - pIndex // - ); - if (!result) - { - return result; - } - // // Buffers ... @@ -1039,11 +1003,6 @@ class XCX121XDONHelper : public XCBaseHelper // Cleanup(); - // - zBar.Clean(); - cBar.Clean(); - pBar.Clean(); - // return result; } diff --git a/Helpers/x-saherelm.x121.xhk.helper.mq5 b/Helpers/x-saherelm.x121.xhk.helper.mq5 index 03cdf424..e2309f1a 100644 --- a/Helpers/x-saherelm.x121.xhk.helper.mq5 +++ b/Helpers/x-saherelm.x121.xhk.helper.mq5 @@ -106,7 +106,7 @@ struct X121XHKInputs // result = // - true + xhkSmoothingLength > 0 // ; @@ -268,7 +268,69 @@ struct X121XHKConditions bearishScore = 0; // - // TODO: Implement if Required ... + double score = 1; + double minScore = 0.5; + double highScore = 1.5; + + // + if (isSMHKBullish) + { + bullishScore += minScore; + } + if (isRawHKBullish) + { + bullishScore += minScore; + } + if (isClosedOverSMHK) + { + bullishScore += minScore; + } + if (isClosedOverRawHK) + { + bullishScore += minScore; + } + if (isRawHKClosedOverSMHK) + { + bullishScore += minScore; + } + if (isSMHKSwitchedToBullish) + { + bullishScore += highScore; + } + if (isRawHKSwitchedToBullish) + { + bullishScore += highScore; + } + + // + if (isSMHKBearish) + { + bearishScore += minScore; + } + if (isRawHKBearish) + { + bearishScore += minScore; + } + if (isClosedUnderSMHK) + { + bearishScore += minScore; + } + if (isClosedUnderRawHK) + { + bearishScore += minScore; + } + if (isRawHKClosedUnderSMHK) + { + bearishScore += minScore; + } + if (isSMHKSwitchedToBearish) + { + bearishScore += highScore; + } + if (isRawHKSwitchedToBullish) + { + bearishScore += highScore; + } } /** @@ -322,6 +384,9 @@ struct X121XHKConditions // string conditionsStr = // + "-----------------------" + separator + + "XHK: " + separator + + "-----------------------" + separator + ToString("isSMHKBullish", isSMHKBullish, ignoreFalseConditions, separator) + ToString("isRawHKBullish", isRawHKBullish, ignoreFalseConditions, separator) + ToString("isSMHKSwitchedToBullish", isSMHKSwitchedToBullish, ignoreFalseConditions, separator) + diff --git a/Helpers/x-saherelm.x121.xich.helper.mq5 b/Helpers/x-saherelm.x121.xich.helper.mq5 index 870493a1..4594ddc9 100644 --- a/Helpers/x-saherelm.x121.xich.helper.mq5 +++ b/Helpers/x-saherelm.x121.xich.helper.mq5 @@ -287,7 +287,45 @@ struct X121XICHConditions bearishScore = 0; // - // TODO: Implement if Required ... + double score = 1; + double minScore = 0.5; + double highScore = 1.5; + + // + if (isSenkouSpanAOverB) + { + bullishScore += minScore; + } + if (isTenkanSenOverKijunSen) + { + bullishScore += minScore; + } + if (isSenkouSpanACrossedOverB) + { + bullishScore += highScore; + } + if (isTenkanSenCrossedOverKijunSen) + { + bullishScore += highScore; + } + + // + if (isSenkouSpanAUnderB) + { + bearishScore += minScore; + } + if (isTenkanSenUnderKijunSen) + { + bearishScore += minScore; + } + if (isSenkouSpanACrossedUnderB) + { + bearishScore += highScore; + } + if (isTenkanSenCrossedUnderKijunSen) + { + bearishScore += highScore; + } } /** @@ -341,6 +379,9 @@ struct X121XICHConditions // string conditionsStr = // + "-----------------------" + separator + + "XICH: " + separator + + "-----------------------" + separator + ToString("isTenkanSenOverKijunSen", isTenkanSenOverKijunSen, ignoreFalseConditions, separator) + ToString("isTenkanSenUnderKijunSen", isTenkanSenUnderKijunSen, ignoreFalseConditions, separator) + ToString("isTenkanSenCrossedOverKijunSen", isTenkanSenCrossedOverKijunSen, ignoreFalseConditions, separator) + diff --git a/Helpers/x-saherelm.x121.xmas.helper.mq5 b/Helpers/x-saherelm.x121.xmas.helper.mq5 index 3893423d..8a6196dc 100644 --- a/Helpers/x-saherelm.x121.xmas.helper.mq5 +++ b/Helpers/x-saherelm.x121.xmas.helper.mq5 @@ -583,6 +583,12 @@ class XCX121XMASHelper : public XCBaseHelper ); } + // + void Free() override + { + Cleanup(10); + } + // bool GetConditions( X121XMASConditions &conditions, // diff --git a/Helpers/x-saherelm.x121.xpv.helper.mq5 b/Helpers/x-saherelm.x121.xpv.helper.mq5 index 2d9f42b7..badc1dbd 100644 --- a/Helpers/x-saherelm.x121.xpv.helper.mq5 +++ b/Helpers/x-saherelm.x121.xpv.helper.mq5 @@ -204,7 +204,7 @@ struct X121XPVInputs // Boundary Detection ... hhMode = MODE_HIGH; llMode = MODE_LOW; - goldenZoneLevel = X_FIBO_LEVEL_382; + goldenZoneLevel = X_FIBO_LEVEL_236; // sarStep = 0.02; @@ -441,7 +441,29 @@ struct X121XPVConditions bearishScore = 0; // - // TODO: Implement if Required ... + double score = 1; + double minScore = 0.5; + double highScore = 1.5; + + // + if (isSarBullish) + { + bullishScore += minScore; + } + if (isSarSwitchedToBullish) + { + bullishScore += score; + } + + // + if (isSarBearish) + { + bearishScore += minScore; + } + if (isSarSwitchedToBearish) + { + bearishScore += score; + } } /** @@ -495,6 +517,9 @@ struct X121XPVConditions // string conditionsStr = // + "-----------------------" + separator + + "XPV: " + separator + + "-----------------------" + separator + ToString("isSarBullish", isSarBullish, ignoreFalseConditions, separator) + ToString("isSarBearish", isSarBearish, ignoreFalseConditions, separator) + ToString("isSarSwitchedToBullish", isSarSwitchedToBullish, ignoreFalseConditions, separator) + diff --git a/Helpers/x-saherelm.x121.xstr.helper.mq5 b/Helpers/x-saherelm.x121.xstr.helper.mq5 index acfdaa14..7dffd38d 100644 --- a/Helpers/x-saherelm.x121.xstr.helper.mq5 +++ b/Helpers/x-saherelm.x121.xstr.helper.mq5 @@ -238,7 +238,29 @@ struct X121XSTRConditions bearishScore = 0; // - // TODO: Implement if Required ... + double score = 1; + double minScore = 0.5; + double highScore = 1.5; + + // + if (isStrBullish) + { + bullishScore += minScore; + } + if (isStrSwitchedToBullish) + { + bullishScore += score; + } + + // + if (isStrBearish) + { + bearishScore += minScore; + } + if (isStrSwitchedToBearish) + { + bearishScore += score; + } } /** @@ -292,6 +314,9 @@ struct X121XSTRConditions // string conditionsStr = // + "-----------------------" + separator + + "XSTR: " + separator + + "-----------------------" + separator + ToString("isStrBullish", isStrBullish, ignoreFalseConditions, separator) + ToString("isStrBearish", isStrBearish, ignoreFalseConditions, separator) + ToString("isStrSwitchedToBullish", isStrSwitchedToBullish, ignoreFalseConditions, separator) + @@ -952,14 +977,14 @@ class XCX121XSTRHelper : public XCBaseHelper conditions.isStrBearish = isStrBearish; conditions.isStrSwitchedToBullish = isStrSwitchedToBullish; conditions.isStrSwitchedToBearish = isStrSwitchedToBearish; - + // Cleanup(); // zBar.Clean(); cBar.Clean(); - pBar.Clean(); + pBar.Clean(); // return result; diff --git a/Helpers/x-saherelm.x121.xtrend.helper.mq5 b/Helpers/x-saherelm.x121.xtrend.helper.mq5 index 1f5a7aa0..cec8cdec 100644 --- a/Helpers/x-saherelm.x121.xtrend.helper.mq5 +++ b/Helpers/x-saherelm.x121.xtrend.helper.mq5 @@ -275,7 +275,29 @@ struct X121XTRENDConditions bearishScore = 0; // - // TODO: Implement if Required ... + double score = 1; + double minScore = 0.5; + double highScore = 1.5; + + // + if (isTrendBullish) + { + bullishScore += minScore; + } + if (isTrendSwitchedToBullish) + { + bullishScore += score; + } + + // + if (isTrendBearish) + { + bearishScore += minScore; + } + if (isTrendSwitchedToBearish) + { + bearishScore += score; + } } /** @@ -329,6 +351,9 @@ struct X121XTRENDConditions // string conditionsStr = // + "-----------------------" + separator + + "XTREND: " + separator + + "-----------------------" + separator + ToString("isTrendBullish", isTrendBullish, ignoreFalseConditions, separator) + ToString("isTrendBearish", isTrendBearish, ignoreFalseConditions, separator) + ToString("isTrendSwitchedToBullish", isTrendSwitchedToBullish, ignoreFalseConditions, separator) + diff --git a/Helpers/x-saherelm.x121.xvolume.helper.mq5 b/Helpers/x-saherelm.x121.xvolume.helper.mq5 index 9aeafd39..b2130469 100644 --- a/Helpers/x-saherelm.x121.xvolume.helper.mq5 +++ b/Helpers/x-saherelm.x121.xvolume.helper.mq5 @@ -303,7 +303,97 @@ struct X121XVOLUMEConditions bearishScore = 0; // - // TODO: Implement if Required ... + double score = 1; + double minScore = 0.5; + double highScore = 1.5; + + // + if (isBullishVolumeOverMa) + { + bullishScore += minScore; + } + if (isBearishVolumeUnderMa) + { + bullishScore += minScore; + } + if (isBullishVolumeIncreased) + { + bullishScore += minScore; + } + if (isBearishVolumeDecreased) + { + bullishScore += minScore; + } + if (isBullishVolumeMaOverBearishVolumeMa) + { + bullishScore += minScore; + } + + // + if (isVolumeSwitchedToBullish) + { + bullishScore += score; + } + if (isBullishVolumeCrossedOverMa) + { + bullishScore += score; + } + if (isBearishVolumeCrossedUnderMa) + { + bullishScore += score; + } + if (isBullishVolumeSwitchedToIncreased) + { + bullishScore += score; + } + if (isBearishVolumeSwitchedToDecreased) + { + bullishScore += score; + } + + // + if (isBearishVolumeOverMa) + { + bearishScore += minScore; + } + if (isBullishVolumeUnderMa) + { + bearishScore += minScore; + } + if (isBullishVolumeDecreased) + { + bearishScore += minScore; + } + if (isBearishVolumeIncreased) + { + bearishScore += minScore; + } + if (isBullishVolumeMaUnderBearishVolumeMa) + { + bearishScore += minScore; + } + + // + if (isVolumeSwitchedToBearish) + { + bearishScore += score; + } + if (isBearishVolumeCrossedOverMa) + { + bearishScore += score; + } + if (isBullishVolumeCrossedUnderMa) + { + bearishScore += score; + } + if (isBullishVolumeSwitchedToDecreased) + { + bearishScore += score; + } + if (isBearishVolumeSwitchedToIncreased) + { + bearishScore += score; + } } /** @@ -357,6 +447,29 @@ struct X121XVOLUMEConditions // string conditionsStr = // + "-----------------------" + separator + + "XVOLUME: " + separator + + "-----------------------" + separator + + ToString("isBullishVolumeOverMa", isBullishVolumeOverMa, ignoreFalseConditions, separator) + + ToString("isBullishVolumeCrossedOverMa", isBullishVolumeCrossedOverMa, ignoreFalseConditions, separator) + + ToString("isBullishVolumeUnderMa", isBullishVolumeUnderMa, ignoreFalseConditions, separator) + + ToString("isBullishVolumeCrossedUnderMa", isBullishVolumeCrossedUnderMa, ignoreFalseConditions, separator) + + ToString("isBullishVolumeIncreased", isBullishVolumeIncreased, ignoreFalseConditions, separator) + + ToString("isBullishVolumeSwitchedToIncreased", isBullishVolumeSwitchedToIncreased, ignoreFalseConditions, separator) + + ToString("isBullishVolumeDecreased", isBullishVolumeDecreased, ignoreFalseConditions, separator) + + ToString("isBullishVolumeSwitchedToDecreased", isBullishVolumeSwitchedToDecreased, ignoreFalseConditions, separator) + + ToString("isBearishVolumeOverMa", isBearishVolumeOverMa, ignoreFalseConditions, separator) + + ToString("isBearishVolumeCrossedOverMa", isBearishVolumeCrossedOverMa, ignoreFalseConditions, separator) + + ToString("isBearishVolumeUnderMa", isBearishVolumeUnderMa, ignoreFalseConditions, separator) + + ToString("isBearishVolumeCrossedUnderMa", isBearishVolumeCrossedUnderMa, ignoreFalseConditions, separator) + + ToString("isBearishVolumeIncreased", isBearishVolumeIncreased, ignoreFalseConditions, separator) + + ToString("isBearishVolumeSwitchedToIncreased", isBearishVolumeSwitchedToIncreased, ignoreFalseConditions, separator) + + ToString("isBearishVolumeDecreased", isBearishVolumeDecreased, ignoreFalseConditions, separator) + + ToString("isBearishVolumeSwitchedToDecreased", isBearishVolumeSwitchedToDecreased, ignoreFalseConditions, separator) + + ToString("isVolumeSwitchedToBullish", isVolumeSwitchedToBullish, ignoreFalseConditions, separator) + + ToString("isVolumeSwitchedToBearish", isVolumeSwitchedToBearish, ignoreFalseConditions, separator) + + ToString("isBullishVolumeMaOverBearishVolumeMa", isBullishVolumeMaOverBearishVolumeMa, ignoreFalseConditions, separator) + + ToString("isBullishVolumeMaUnderBearishVolumeMa", isBullishVolumeMaUnderBearishVolumeMa, ignoreFalseConditions, separator) + // "" // diff --git a/Helpers/x-saherelm.x121.xvwap.helper.mq5 b/Helpers/x-saherelm.x121.xvwap.helper.mq5 index 99f3a1bc..e987e5d4 100644 --- a/Helpers/x-saherelm.x121.xvwap.helper.mq5 +++ b/Helpers/x-saherelm.x121.xvwap.helper.mq5 @@ -329,9 +329,98 @@ struct X121XVWAPConditions // bullishScore = 0; bearishScore = 0; + // + double score = 1; + double minScore = 0.5; + double highScore = 1.5; // - // TODO: Implement if Required ... + if (isVWapBullishState) + { + bullishScore += score; + } + if (isVWapBullishOrdered) + { + bullishScore += score; + } + if (isVWapSwitchedToBullishState) + { + bullishScore += highScore; + } + if (isVWapSwitchedToBullishOrdered) + { + bullishScore += highScore; + } + if (!isVWapBullishState && + !isVWapSwitchedToBullishState) + { + // + if (isVWapFastBullish) + { + bullishScore += minScore; + } + if (isVWapSlowBullish) + { + bullishScore += minScore; + } + } + if (!isVWapBullishOrdered && + !isVWapSwitchedToBullishOrdered) + { + // + if (isVWapFastOverMid) + { + bullishScore += minScore; + } + if (isVWapMidOverSlow) + { + bullishScore += minScore; + } + } + + // + if (isVWapBearishState) + { + bearishScore += score; + } + if (isVWapBearishOrdered) + { + bearishScore += score; + } + if (isVWapSwitchedToBearishState) + { + bearishScore += highScore; + } + if (isVWapSwitchedToBearishOrdered) + { + bearishScore += highScore; + } + if (!isVWapBearishState && + !isVWapSwitchedToBearishState) + { + // + if (isVWapFastBearish) + { + bearishScore += minScore; + } + if (isVWapSlowBearish) + { + bearishScore += minScore; + } + } + if (!isVWapBearishOrdered && + !isVWapSwitchedToBearishOrdered) + { + // + if (isVWapFastUnderMid) + { + bearishScore += minScore; + } + if (isVWapMidUnderSlow) + { + bearishScore += minScore; + } + } } /** @@ -385,6 +474,9 @@ struct X121XVWAPConditions // string conditionsStr = // + "-----------------------" + separator + + "XVWAP: " + separator + + "-----------------------" + separator + ToString("isVWapFastBullish", isVWapFastBullish, ignoreFalseConditions, separator) + ToString("isVWapFastBearish", isVWapFastBearish, ignoreFalseConditions, separator) + ToString("isVWapFastNeutural", isVWapFastNeutural, ignoreFalseConditions, separator) + diff --git a/Indicators/x-saherelm.x121.xpv.mq5 b/Indicators/x-saherelm.x121.xpv.mq5 index 463a093e..0a5c6ef0 100644 --- a/Indicators/x-saherelm.x121.xpv.mq5 +++ b/Indicators/x-saherelm.x121.xpv.mq5 @@ -1213,7 +1213,7 @@ void CalculatePeaksAndVales(int barIndex) /** * Calculate Support nad Resistances ... - * + * * @param bar_index: int, Specified Bar Index ... * @param prevCalculated: int, Provides Previous Calculated Bars ... * @param ratesTotal: int, Provides All Availabled Bars ... @@ -1247,8 +1247,8 @@ void CalculateSupportAndResistance( ? iLow : supportsBuffer[bar_index + 1]; double iResistance = iUpperFractalsPrev != EMPTY_VALUE - ? iHigh - : resistancesBuffer[bar_index + 1]; + ? iHigh + : resistancesBuffer[bar_index + 1]; // supportsBuffer[bar_index] = iSupport; diff --git a/X121SMCEA/Classes/x-121.smc.market.cycle.helper.class.mq5 b/X121SMCEA/Classes/x-121.smc.market.cycle.helper.class.mq5 index 48cd31fd..40a6b767 100644 --- a/X121SMCEA/Classes/x-121.smc.market.cycle.helper.class.mq5 +++ b/X121SMCEA/Classes/x-121.smc.market.cycle.helper.class.mq5 @@ -959,262 +959,6 @@ class XC121SMCCycleHelper : public XCBase return result; } - // - bool DetectNearestTenKijCross( - XOHCL &bar, - ENUM_X_DIRECTION &dir, - int barIndex = 0, - int maxAllowedBars = 20 // - ) - { - // - bool result = false; - - // - bar.Clean(); - dir = X_DIRECTION_NONE; - barIndex = NormalizeInt(barIndex, 0); - maxAllowedBars = NormalizeInt(maxAllowedBars, 20); - - // - // Looping Through LoopBack Period ... - // for Detecting Result ... - for (int i = barIndex; i < barIndex + maxAllowedBars; i++) - { - // - XOHCL iBar; - result = iBar.Init( - GetSymbol(), - GetPeriod(), - i // - ); - if (!result) - { - // - iBar.Clean(); - break; - } - - // - double iTSen = mX121Helper.xichHelper.GetTenkanSen(i); - double iTSenP = mX121Helper.xichHelper.GetTenkanSen(i + 1); - - // - double iKSen = mX121Helper.xichHelper.GetKijunSen(i); - double iKSenP = mX121Helper.xichHelper.GetKijunSen(i + 1); - - // - bool isTSenOverKSen = iTSen > iKSen; - bool isTSenOverKSenP = iTSenP > iKSenP; - - // - bool isTSenUnderKSen = iTSen < iKSen; - bool isTSenUnderKSenP = iTSenP < iKSenP; - - // - - // - bool isTSenCrossedOverKSen = isTSenOverKSen && - !isTSenOverKSenP; - - // - bool isTSenCrossedUnderKSen = isTSenUnderKSen && - !isTSenUnderKSenP; - - // - result = isTSenCrossedOverKSen || - isTSenCrossedUnderKSen; - if (result) - { - // - bar = iBar; - - // - dir = isTSenCrossedOverKSen - ? X_DIRECTION_BULLISH - : X_DIRECTION_BEARISH; - - // - iBar.Clean(); - break; - } - - // - iBar.Clean(); - } - - // - return result; - } - - // - bool DetectNearestVolumeSwitched( - XOHCL &bar, - ENUM_X_DIRECTION &dir, - int barIndex = 0, - int maxAllowedBars = 20 // - ) - { - // - bool result = false; - - // - bar.Clean(); - dir = X_DIRECTION_NONE; - barIndex = NormalizeInt(barIndex, 0); - maxAllowedBars = NormalizeInt(maxAllowedBars, 20); - - // - // Looping Through LoopBack Period ... - // for Detecting Result ... - for (int i = barIndex; i < barIndex + maxAllowedBars; i++) - { - // - XOHCL iBar; - result = iBar.Init( - GetSymbol(), - GetPeriod(), - i // - ); - if (!result) - { - // - iBar.Clean(); - break; - } - - // - double iBullVMa = mX121Helper.xvolumeHelper.GetBullishVolumeMa(i); - double iBullVMaP = mX121Helper.xvolumeHelper.GetBullishVolumeMa(i + 1); - - // - double iBearVMa = mX121Helper.xvolumeHelper.GetBearishVolumeMa(i); - double iBearVMaP = mX121Helper.xvolumeHelper.GetBearishVolumeMa(i + 1); - - // - bool isBullVMaOverBearVMa = iBullVMa > iBearVMa; - bool isBullVMaOverBearVMaP = iBullVMaP > iBearVMaP; - bool isCrossOver = isBullVMaOverBearVMa && - !isBullVMaOverBearVMaP; - - // - bool isBullVMaUnderBearVMa = iBullVMa < iBearVMa; - bool isBullVMaUnderBearVMaP = iBullVMaP < iBearVMaP; - bool isCrossUnder = isBullVMaUnderBearVMa && - !isBullVMaUnderBearVMaP; - - // - result = isCrossOver || - isCrossUnder; - if (result) - { - // - bar = iBar; - - // - dir = isCrossOver - ? X_DIRECTION_BULLISH - : X_DIRECTION_BEARISH; - - // - iBar.Clean(); - break; - } - - // - iBar.Clean(); - } - - // - return result; - } - - // - bool DetectNearestDeltaSwitched( - XOHCL &bar, - ENUM_X_DIRECTION &dir, - int barIndex = 0, - int maxAllowedBars = 20 // - ) - { - // - bool result = false; - - // - bar.Clean(); - dir = X_DIRECTION_NONE; - barIndex = NormalizeInt(barIndex, 0); - maxAllowedBars = NormalizeInt(maxAllowedBars, 20); - - // - // Looping Through LoopBack Period ... - // for Detecting Result ... - for (int i = barIndex; i < barIndex + maxAllowedBars; i++) - { - // - XOHCL iBar; - result = iBar.Init( - GetSymbol(), - GetPeriod(), - i // - ); - if (!result) - { - // - iBar.Clean(); - break; - } - - // - double iDelta = mX121Helper.xdeltaHelper.GetDelta(i); - double iDeltaP = mX121Helper.xdeltaHelper.GetDelta(i + 1); - - // - double iDeltaMa = mX121Helper.xdeltaHelper.GetDeltaMa(i); - double iDeltaMaP = mX121Helper.xdeltaHelper.GetDeltaMa(i + 1); - - // - bool isDeltaOverMa = iDelta > iDeltaMa; - bool isDeltaOverMaP = iDeltaP > iDeltaMaP; - - // - bool isDeltaUnderMa = iDelta < iDeltaMa; - bool isDeltaUnderMaP = iDeltaP < iDeltaMaP; - - // - bool isCrossOver = isDeltaOverMa && - !isDeltaOverMaP; - - // - bool isCrossUnder = isDeltaUnderMa && - !isDeltaUnderMaP; - - // - result = isCrossOver || - isCrossUnder; - if (result) - { - // - bar = iBar; - - // - dir = isCrossOver - ? X_DIRECTION_BULLISH - : X_DIRECTION_BEARISH; - - // - iBar.Clean(); - break; - } - - // - iBar.Clean(); - } - - // - return result; - } - // bool DetectNearestStrSwitched( XOHCL &bar, @@ -2049,84 +1793,7 @@ struct X121SMCStrategyConditionParser { // // Props ... - - // - // XMA ... - - // - bool isX3MaFastUnderValesGoldenZone; - bool isX3MaMidUnderValesGoldenZone; - bool isX3MaSlowUnderValesGoldenZone; - - // - bool isX3MaFastCrossedUnderValesGoldenZone; - bool isX3MaMidCrossedUnderValesGoldenZone; - bool isX3MaSlowCrossedUnderValesGoldenZone; - - // - bool isX3MaFastOverPeaksGoldenZone; - bool isX3MaMidOverPeaksGoldenZone; - bool isX3MaSlowOverPeaksGoldenZone; - - // - bool isX3MaFastCrossedOverPeaksGoldenZone; - bool isX3MaMidCrossedOverPeaksGoldenZone; - bool isX3MaSlowCrossedOverPeaksGoldenZone; - - // - // XVWAP ... - - // - bool isVWapFastUnderValesGoldenZone; - bool isVWapMidUnderValesGoldenZone; - bool isVWapSlowUnderValesGoldenZone; - - // - bool isVWapFastCrossedUnderValesGoldenZone; - bool isVWapMidCrossedUnderValesGoldenZone; - bool isVWapSlowCrossedUnderValesGoldenZone; - - // - bool isVWapFastOverPeaksGoldenZone; - bool isVWapMidOverPeaksGoldenZone; - bool isVWapSlowOverPeaksGoldenZone; - - // - bool isVWapFastCrossedOverPeaksGoldenZone; - bool isVWapMidCrossedOverPeaksGoldenZone; - bool isVWapSlowCrossedOverPeaksGoldenZone; - - // - // XHK ... - - // - bool isSMHKUnderValesGoldenZone; - bool isRawHKUnderValesGoldenZone; - - // - bool isSMHKCrossedUnderValesGoldenZone; - bool isRawHKCrossedUnderValesGoldenZone; - - // - bool isSMHKOverPeaksGoldenZone; - bool isRawHKOverPeaksGoldenZone; - - // - bool isSMHKCrossedOverPeaksGoldenZone; - bool isRawHKCrossedOverPeaksGoldenZone; - - // - // XSTR ... - - // - bool isStrUnderValesGoldenZone; - bool isStrCrossedUnderValesGoldenZone; - - // - bool isStrOverPeaksGoldenZone; - bool isStrCrossedOverPeaksGoldenZone; - - // + string VERSION; // // Constructor ... @@ -2141,79 +1808,10 @@ struct X121SMCStrategyConditionParser // void Clean() { - // - isX3MaFastUnderValesGoldenZone = false; - isX3MaFastCrossedUnderValesGoldenZone = false; - - // - isX3MaMidUnderValesGoldenZone = false; - isX3MaMidCrossedUnderValesGoldenZone = false; - - // - isX3MaSlowUnderValesGoldenZone = false; - isX3MaSlowCrossedUnderValesGoldenZone = false; - - // - isX3MaFastOverPeaksGoldenZone = false; - isX3MaFastCrossedOverPeaksGoldenZone = false; - - // - isX3MaMidOverPeaksGoldenZone = false; - isX3MaMidCrossedOverPeaksGoldenZone = false; - - // - isX3MaSlowOverPeaksGoldenZone = false; - isX3MaSlowCrossedOverPeaksGoldenZone = false; - - // - isVWapFastUnderValesGoldenZone = false; - isVWapFastCrossedUnderValesGoldenZone = false; - - // - isVWapMidUnderValesGoldenZone = false; - isVWapMidCrossedUnderValesGoldenZone = false; - - // - isVWapSlowUnderValesGoldenZone = false; - isVWapSlowCrossedUnderValesGoldenZone = false; - - // - isVWapFastOverPeaksGoldenZone = false; - isVWapFastCrossedOverPeaksGoldenZone = false; - - // - isVWapMidOverPeaksGoldenZone = false; - isVWapMidCrossedOverPeaksGoldenZone = false; - - // - isVWapSlowOverPeaksGoldenZone = false; - isVWapSlowCrossedOverPeaksGoldenZone = false; - - // - isSMHKUnderValesGoldenZone = false; - isSMHKCrossedUnderValesGoldenZone = false; - - // - isRawHKUnderValesGoldenZone = false; - isRawHKCrossedUnderValesGoldenZone = false; - - // - isSMHKOverPeaksGoldenZone = false; - isSMHKCrossedOverPeaksGoldenZone = false; - - // - isRawHKOverPeaksGoldenZone = false; - isRawHKCrossedOverPeaksGoldenZone = false; - - // - isStrUnderValesGoldenZone = false; - isStrCrossedUnderValesGoldenZone = false; - - // - isStrOverPeaksGoldenZone = false; - isStrCrossedOverPeaksGoldenZone = false; - - // + // + VERSION = NULL; + + // ZeroMemory(this); } @@ -2233,2394 +1831,11 @@ struct X121SMCStrategyConditionParser // // Reading Required Materials ... - - // - // - - // - double peak = conditions.peaksBuffer[cIDX]; - double vale = conditions.valesBuffer[cIDX]; - - // - double peakP = conditions.peaksBuffer[pIDX]; - double valeP = conditions.valesBuffer[pIDX]; - - // - // - - // - double str = conditions.strBuffer[cIDX]; - double strP = conditions.strBuffer[pIDX]; - - // - // - - // - double smhkO = conditions.xhkSMOpenBuffer[cIDX]; - double smhkC = conditions.xhkSMCloseBuffer[cIDX]; - - // - double smhkMax = MathMax(smhkO, smhkC); - double smhkMin = MathMin(smhkO, smhkC); - - // - double smhkOP = conditions.xhkSMOpenBuffer[pIDX]; - double smhkCP = conditions.xhkSMCloseBuffer[pIDX]; - - // - double smhkMaxP = MathMax(smhkOP, smhkCP); - double smhkMinP = MathMin(smhkOP, smhkCP); - - // - double rawhkO = conditions.xhkRawOpenBuffer[cIDX]; - double rawhkH = conditions.xhkRawHighBuffer[cIDX]; - double rawhkC = conditions.xhkRawCloseBuffer[cIDX]; - double rawhkL = conditions.xhkRawLowBuffer[cIDX]; - - // - double rawhkOP = conditions.xhkRawOpenBuffer[pIDX]; - double rawhkHP = conditions.xhkRawHighBuffer[pIDX]; - double rawhkCP = conditions.xhkRawCloseBuffer[pIDX]; - double rawhkLP = conditions.xhkRawLowBuffer[pIDX]; - - // - // - - // - double support = conditions.supportsBuffer[cIDX]; - double resistance = conditions.resistancesBuffer[cIDX]; - - // - double supportP = conditions.supportsBuffer[pIDX]; - double resistanceP = conditions.resistancesBuffer[pIDX]; - - // - double peakGolden = conditions.peaksGoldenBuffer[cIDX]; - double valeGolden = conditions.valesGoldenBuffer[cIDX]; - - // - double peakGoldenP = conditions.peaksGoldenBuffer[pIDX]; - double valeGoldenP = conditions.valesGoldenBuffer[pIDX]; - - // - // - - // - double x3maFast = conditions.x3maFastBuffer[cIDX]; - double x3maMid = conditions.x3maMidBuffer[cIDX]; - double x3maSlow = conditions.x3maSlowBuffer[cIDX]; - - // - double x3maFastP = conditions.x3maFastBuffer[pIDX]; - double x3maMidP = conditions.x3maMidBuffer[pIDX]; - double x3maSlowP = conditions.x3maSlowBuffer[pIDX]; - - // - double vwapFast = conditions.vwapFastBuffer[cIDX]; - double vwapMid = conditions.vwapMidBuffer[cIDX]; - double vwapSlow = conditions.vwapSlowBuffer[cIDX]; - - // - double vwapFastP = conditions.vwapFastBuffer[pIDX]; - double vwapMidP = conditions.vwapMidBuffer[pIDX]; - double vwapSlowP = conditions.vwapSlowBuffer[pIDX]; - - // - // X3MA ... - - // - isX3MaFastUnderValesGoldenZone = - x3maFast >= vale && - x3maFast <= valeGolden; - - // - bool isX3MaFastUnderValesGoldenZoneP = - x3maFastP >= valeP && - x3maFastP <= valeGoldenP; - - // - isX3MaFastCrossedUnderValesGoldenZone = - isX3MaFastUnderValesGoldenZone && - !isX3MaFastUnderValesGoldenZoneP; - - // - // - - // - isX3MaMidUnderValesGoldenZone = - x3maMid >= vale && - x3maMid <= valeGolden; - - // - bool isX3MaMidUnderValesGoldenZoneP = - x3maMidP >= valeP && - x3maMidP <= valeGoldenP; - - // - isX3MaMidCrossedUnderValesGoldenZone = - isX3MaMidUnderValesGoldenZone && - !isX3MaMidUnderValesGoldenZoneP; - - // - // - - // - isX3MaSlowUnderValesGoldenZone = - x3maSlow >= vale && - x3maSlow <= valeGolden; - - // - bool isX3MaSlowUnderValesGoldenZoneP = - x3maSlowP >= valeP && - x3maSlowP <= valeGoldenP; - - // - isX3MaSlowCrossedUnderValesGoldenZone = - isX3MaSlowUnderValesGoldenZone && - !isX3MaSlowUnderValesGoldenZoneP; - - // - // - - // - isX3MaFastOverPeaksGoldenZone = - x3maFast <= peak && - x3maFast >= peakGolden; - - // - bool isX3MaFastOverPeaksGoldenZoneP = - x3maFastP <= peakP && - x3maFastP >= peakGoldenP; - - // - isX3MaFastCrossedOverPeaksGoldenZone = - isX3MaFastOverPeaksGoldenZone && - !isX3MaFastOverPeaksGoldenZoneP; - - // - // - - // - isX3MaMidOverPeaksGoldenZone = - x3maMid <= peak && - x3maMid >= peakGolden; - - // - bool isX3MaMidOverPeaksGoldenZoneP = - x3maMidP <= peakP && - x3maMidP >= peakGoldenP; - - // - isX3MaMidCrossedOverPeaksGoldenZone = - isX3MaMidOverPeaksGoldenZone && - !isX3MaMidOverPeaksGoldenZoneP; - - // - // - - // - isX3MaSlowOverPeaksGoldenZone = - x3maSlow <= peak && - x3maSlow >= peakGolden; - - // - bool isX3MaSlowOverPeaksGoldenZoneP = - x3maSlowP <= peakP && - x3maSlowP >= peakGoldenP; - - // - isX3MaSlowCrossedOverPeaksGoldenZone = - isX3MaSlowOverPeaksGoldenZone && - !isX3MaSlowOverPeaksGoldenZoneP; - - // - // XVWAP ... - - // - // - - // - isVWapFastUnderValesGoldenZone = - vwapFast >= vale && - vwapFast <= valeGolden; - - // - bool isVWapFastUnderValesGoldenZoneP = - vwapFastP >= valeP && - vwapFastP <= valeGoldenP; - - // - isVWapFastCrossedUnderValesGoldenZone = - isVWapFastUnderValesGoldenZone && - !isVWapFastUnderValesGoldenZoneP; - - // - // - - // - isVWapMidUnderValesGoldenZone = - vwapMid >= vale && - vwapMid <= valeGolden; - - // - bool isVWapMidUnderValesGoldenZoneP = - vwapMidP >= valeP && - vwapMidP <= valeGoldenP; - - // - isVWapMidCrossedUnderValesGoldenZone = - isVWapMidUnderValesGoldenZone && - !isVWapMidUnderValesGoldenZoneP; - - // - // - - // - isVWapSlowUnderValesGoldenZone = - vwapSlow >= vale && - vwapSlow <= valeGolden; - - // - bool isVWapSlowUnderValesGoldenZoneP = - vwapSlowP >= valeP && - vwapSlowP <= valeGoldenP; - - // - isVWapSlowCrossedUnderValesGoldenZone = - isVWapSlowUnderValesGoldenZone && - !isVWapSlowUnderValesGoldenZoneP; - - // - // - - // - isVWapFastOverPeaksGoldenZone = - vwapFast <= peak && - vwapFast >= peakGolden; - - // - bool isVWapFastOverPeaksGoldenZoneP = - vwapFastP <= peakP && - vwapFastP >= peakGoldenP; - - // - isVWapFastCrossedOverPeaksGoldenZone = - isVWapFastOverPeaksGoldenZone && - !isVWapFastOverPeaksGoldenZoneP; - - // - // - - // - isVWapMidOverPeaksGoldenZone = - vwapMid <= peak && - vwapMid >= peakGolden; - - // - bool isVWapMidOverPeaksGoldenZoneP = - vwapMidP <= peakP && - vwapMidP >= peakGoldenP; - - // - isVWapMidCrossedOverPeaksGoldenZone = - isVWapMidOverPeaksGoldenZone && - !isVWapMidOverPeaksGoldenZoneP; - - // - // - - // - isVWapSlowOverPeaksGoldenZone = - vwapSlow <= peak && - vwapSlow >= peakGolden; - - // - bool isVWapSlowOverPeaksGoldenZoneP = - vwapSlowP <= peakP && - vwapSlowP >= peakGoldenP; - - // - isVWapSlowCrossedOverPeaksGoldenZone = - isVWapSlowOverPeaksGoldenZone && - !isVWapSlowOverPeaksGoldenZoneP; - - // - // XHK ... - - // - // - - // - isSMHKUnderValesGoldenZone = - smhkMax >= vale && - smhkMax <= valeGolden; - - // - bool isSMHKUnderValesGoldenZoneP = - smhkMaxP >= valeP && - smhkMaxP <= valeGoldenP; - - // - isSMHKCrossedUnderValesGoldenZone = - isSMHKUnderValesGoldenZone && - !isSMHKUnderValesGoldenZoneP; - - // - // - - // - isRawHKUnderValesGoldenZone = - rawhkH >= vale && - rawhkH <= valeGolden; - - // - bool isRawHKUnderValesGoldenZoneP = - rawhkHP >= valeP && - rawhkHP <= valeGoldenP; - - // - isRawHKCrossedUnderValesGoldenZone = - isRawHKUnderValesGoldenZone && - !isRawHKUnderValesGoldenZoneP; - - // - // - - // - isSMHKOverPeaksGoldenZone = - smhkMin <= peak && - smhkMin >= peakGolden; - - // - bool isSMHKOverPeaksGoldenZoneP = - smhkMinP <= peakP && - smhkMinP >= peakGoldenP; - - // - isSMHKCrossedOverPeaksGoldenZone = - isSMHKOverPeaksGoldenZone && - !isSMHKOverPeaksGoldenZoneP; - - // - // - - // - isRawHKOverPeaksGoldenZone = - rawhkL <= peak && - rawhkL >= peakGolden; - - // - bool isRawHKOverPeaksGoldenZoneP = - rawhkLP <= peakP && - rawhkLP >= peakGoldenP; - - // - isRawHKCrossedOverPeaksGoldenZone = - isRawHKOverPeaksGoldenZone && - !isRawHKOverPeaksGoldenZoneP; - - // - // XSTR ... - - // - // - - // - isStrUnderValesGoldenZone = - str >= vale && - str <= valeGolden; - - // - bool isStrUnderValesGoldenZoneP = - strP >= valeP && - strP <= valeGoldenP; - - // - isStrCrossedUnderValesGoldenZone = - isStrUnderValesGoldenZone && - !isStrUnderValesGoldenZoneP; - - // - // - - // - isStrOverPeaksGoldenZone = - str <= peak && - str >= peakGolden; - - // - bool isStrOverPeaksGoldenZoneP = - strP <= peakP && - strP >= peakGoldenP; - - // - isStrCrossedOverPeaksGoldenZone = - isStrOverPeaksGoldenZone && - !isStrOverPeaksGoldenZoneP; } // - // Rejected Boxes ... - bool HasRejectedBoxConditions( - ENUM_X_CYCLES cycle, - XSignalBox &box, - ENUM_X_DIRECTION &dir, - XSignalBox &waitingBoxes[], - X121SMCStrategySignalProviderData &provider, - int barIndex = 0 // - ) - { - // - bool result = false; - - // - box.Clean(); - dir = X_DIRECTION_NONE; - - // - // Checking Waiting Baoxes Exists ... - result = HasChild(waitingBoxes); - if (!result) - { - return result; - } - - // - // Fil Selected Data ... - XPOIState cState; - X121Conditions cXConditions; - XPOIStateEvents cStateEvents; - XC121SMCCycleHelper *cHelper; - X121SMCCycleConditions cConditions; - result = provider.SelectCycle( - cycle, - cState, - cStateEvents, - cXConditions, - cHelper, - cConditions // - ); - if (!result) - { - // - cState.Clean(); - ZeroMemory(cHelper); - cConditions.Clean(); - cXConditions.Clean(); - cStateEvents.Clean(); - - // - return result; - } - Parse(cXConditions); - - // - // Normalize Args ... - - // - if (barIndex < 0) - { - barIndex = 0; - } - - // - int idx = -1; - int count = 0; - bool has = false; - - // - int zIDX = barIndex; - int cIDX = zIDX + 1; - int pIDX = cIDX + 1; - int ppIDX = pIDX + 1; - - // - bool isBullish = false; - bool isBearish = false; - - // - XOHCL zBar; - XOHCL cBar; - XOHCL pBar; - - // - // Initial Bars ... - result = zBar.Init( - cState.symbol, - cState.period, - barIndex // - ); - result = - result && - zBar.GetPreviousBar(cBar); - result = - result && - cBar.GetPreviousBar(pBar); - if (!result) - { - // - zBar.Clean(); - cBar.Clean(); - pBar.Clean(); - cState.Clean(); - ZeroMemory(cHelper); - cConditions.Clean(); - cXConditions.Clean(); - - // - return result; - } - - // - // Checking Bar Based on Positions State ... - ENUM_X_DIRECTION iBarPosDir; - bool isBarValidForDir = cHelper - .mBarAnalyser - .IsValidForPosition( - cBar, - iBarPosDir // - ); - bool isBarValidForBullish = - isBarValidForDir && - IsBullish(iBarPosDir); - bool isBarValidForBearish = - isBarValidForDir && - IsBearish(iBarPosDir); - - // - // Extract Selected Boxes ... - XBoxZone selectedBox; - XSignalBox iSignalBox; - count = ArraySize(waitingBoxes); - has = IsValidSize(count); - if (has) - { - // - for (int i = 0; i < count; i++) - { - // - XSignalBox iBox = waitingBoxes[i]; - - // - bool isBullish = iBox.ob.IsBullish(); - - // - bool isOBBullishRejected = - // - cBar.low < iBox.ob.upper && - cBar.GetDown() > iBox.ob.upper - // - ; - - // - bool isOBBearishRejected = - // - cBar.high > iBox.ob.lower && - cBar.GetUp() < iBox.ob.lower - // - ; - - // - has = - isBullish - ? isOBBullishRejected - : isOBBearishRejected; - - // - // Force Using OB ... - if (has) - { - // - iSignalBox = iBox; - if (!selectedBox.IsValid()) - { - selectedBox = iBox.ob; - } - iBox.Clean(); - break; - } - - // - iBox.Clean(); - } - } - result = - iSignalBox.IsValid() && - selectedBox.IsValid(); - if (!result) - { - // - zBar.Clean(); - cBar.Clean(); - pBar.Clean(); - cState.Clean(); - iSignalBox.Clean(); - selectedBox.Clean(); - ZeroMemory(cHelper); - cConditions.Clean(); - cXConditions.Clean(); - - // - return result; - } - - // - bool hasSignalBox = iSignalBox.IsValid(); - bool isSignalBoxBullish = IsBullish(iSignalBox.ob.dir); - - // - // Checking Other Conditions ... - bool isVWapSlowPassed = - isSignalBoxBullish - ? cXConditions.isVWapSlowBullish - : cXConditions.isVWapSlowBearish; - - // - // Bullish Conditions ... - isBullish = - // - // Base Condition ... - ( - // - hasSignalBox && - isVWapSlowPassed && - isSignalBoxBullish && - isBarValidForBullish - // - ) - // - ; - - // - // Bearish Conditions ... - isBearish = - // - // Base Condition ... - ( - // - hasSignalBox && - isVWapSlowPassed && - !isSignalBoxBullish && - isBarValidForBearish - // - ) - // - ; - - // - // Filling Requirements ... - result = - isBullish || - isBearish; - if (result) - { - // - dir = - isBullish - ? X_DIRECTION_BULLISH - : X_DIRECTION_BEARISH; - - // - box = iSignalBox; - box.UpdateTo(TimeCurrent()); - } - - // - // Check All Conditions ... - result = - box.IsValid() && - HasDirection(dir) && - (isBullish || - isBearish); - - // - // Cleanup Resources ... - zBar.Clean(); - cBar.Clean(); - pBar.Clean(); - cState.Clean(); - iSignalBox.Clean(); - selectedBox.Clean(); - ZeroMemory(cHelper); - cConditions.Clean(); - cStateEvents.Clean(); - cXConditions.Clean(); - - // - return result; - } - - // - // Activated Boxes ... - bool HasActivatedBoxConditions( - ENUM_X_CYCLES cycle, - XSignalBox &box, - ENUM_X_DIRECTION &dir, - XSignalBox &waitingBoxes[], - X121SMCStrategySignalProviderData &provider, - int barIndex = 0 // - ) - { - // - bool result = false; - - // - box.Clean(); - dir = X_DIRECTION_NONE; - - // - // Checking Waiting Baoxes Exists ... - result = HasChild(waitingBoxes); - if (!result) - { - return result; - } - - // - // Fil Selected Data ... - XPOIState cState; - X121Conditions cXConditions; - XPOIStateEvents cStateEvents; - XC121SMCCycleHelper *cHelper; - X121SMCCycleConditions cConditions; - result = provider.SelectCycle( - cycle, - cState, - cStateEvents, - cXConditions, - cHelper, - cConditions // - ); - if (!result) - { - // - cState.Clean(); - ZeroMemory(cHelper); - cConditions.Clean(); - cXConditions.Clean(); - cStateEvents.Clean(); - - // - return result; - } - Parse(cXConditions); - - // - // Normalize Args ... - - // - if (barIndex < 0) - { - barIndex = 0; - } - - // - int idx = -1; - int count = 0; - bool has = false; - - // - int zIDX = barIndex; - int cIDX = zIDX + 1; - int pIDX = cIDX + 1; - int ppIDX = pIDX + 1; - - // - bool isBullish = false; - bool isBearish = false; - - // - XOHCL zBar; - XOHCL cBar; - XOHCL pBar; - - // - // Initial Bars ... - result = zBar.Init( - cState.symbol, - cState.period, - barIndex // - ); - result = - result && - zBar.GetPreviousBar(cBar); - result = - result && - cBar.GetPreviousBar(pBar); - if (!result) - { - // - zBar.Clean(); - cBar.Clean(); - pBar.Clean(); - cState.Clean(); - ZeroMemory(cHelper); - cConditions.Clean(); - cXConditions.Clean(); - - // - return result; - } - - // - // Checking Bar Based on Positions State ... - ENUM_X_DIRECTION iBarPosDir; - bool isBarValidForDir = cHelper - .mBarAnalyser - .IsValidForPosition( - cBar, - iBarPosDir // - ); - bool isBarValidForBullish = - isBarValidForDir && - IsBullish(iBarPosDir); - bool isBarValidForBearish = - isBarValidForDir && - IsBearish(iBarPosDir); - - // - // Extract Selected Boxes ... - XBoxZone selectedBox; - XSignalBox iSignalBox; - count = ArraySize(waitingBoxes); - has = IsValidSize(count); - if (has) - { - // - for (int i = 0; i < count; i++) - { - // - XSignalBox iBox = waitingBoxes[i]; - - // - bool isBullish = iBox.ob.IsBullish(); - - // - has = cBar.low < iBox.sharp.upper && - cBar.low > iBox.sharp.lower && - cBar.high > iBox.sharp.lower && - cBar.high < iBox.sharp.upper; - - // - // Force Using OB ... - if (has) - { - // - iSignalBox = iBox; - if (!selectedBox.IsValid()) - { - selectedBox = iBox.ob; - } - iBox.Clean(); - break; - } - - // - iBox.Clean(); - } - } - result = - iSignalBox.IsValid() && - selectedBox.IsValid(); - if (!result) - { - // - zBar.Clean(); - cBar.Clean(); - pBar.Clean(); - cState.Clean(); - iSignalBox.Clean(); - selectedBox.Clean(); - ZeroMemory(cHelper); - cConditions.Clean(); - cXConditions.Clean(); - - // - return result; - } - - // - bool hasSignalBox = iSignalBox.IsValid(); - bool isSignalBoxBullish = IsBullish(iSignalBox.ob.dir); - - // - // Checking Other Conditions ... - - // - // XVWAP ... - - // - bool isVWapSlopeBullish = - cXConditions.isVwapFastSlopeBullish && - cXConditions.isVwapMidSlopeBullish && - cXConditions.isVwapSlowSlopeBullish; - - // - bool isVWapSlopeBearish = - cXConditions.isVwapFastSlopeBearish && - cXConditions.isVwapMidSlopeBearish && - cXConditions.isVwapSlowSlopeBearish; - - // - bool isVWapBullishCondition = - (cXConditions.isVWapBullishOrdered && - cXConditions.isVWapSwitchedToBullishState) || - (cXConditions.isVWapBullishState && - cXConditions.isVWapSwitchedToBullishOrdered); - - // - bool isVWapBearishCondition = - (cXConditions.isVWapBearishOrdered && - cXConditions.isVWapSwitchedToBearishState) || - (cXConditions.isVWapBearishState && - cXConditions.isVWapSwitchedToBearishOrdered); - - // - // Bullish Conditions ... - isBullish = - // - // Base Condition ... - ( - // - hasSignalBox && - isSignalBoxBullish && - isVWapSlopeBullish && - isBarValidForBullish && - isVWapBullishCondition - // - ) - // - ; - - // - // Bearish Conditions ... - isBearish = - // - // Base Condition ... - ( - // - hasSignalBox && - isVWapSlopeBearish && - !isSignalBoxBullish && - isBarValidForBearish && - isVWapBearishCondition - // - ) - // - ; - - // - // Filling Requirements ... - result = - isBullish || - isBearish; - if (result) - { - // - dir = - isBullish - ? X_DIRECTION_BULLISH - : X_DIRECTION_BEARISH; - - // - box = iSignalBox; - box.UpdateTo(TimeCurrent()); - - // - // Provide TP/SL ... - - // - box.sl = isBullish - ? cXConditions.vwapMin - : cXConditions.vwapMax; - - // - box.tp = isBullish - ? box.sharp.upper - : box.sharp.lower; - } - - // - // Check All Conditions ... - result = - box.IsValid() && - HasDirection(dir) && - (isBullish || - isBearish); - - // - // Cleanup Resources ... - zBar.Clean(); - cBar.Clean(); - pBar.Clean(); - cState.Clean(); - iSignalBox.Clean(); - selectedBox.Clean(); - ZeroMemory(cHelper); - cConditions.Clean(); - cStateEvents.Clean(); - cXConditions.Clean(); - - // - return result; - } - - // - // Breaked Boxes ... - bool HasBreakedBoxConditions( - ENUM_X_CYCLES cycle, - XSignalBox &box, - ENUM_X_DIRECTION &dir, - XSignalBox &breakedBoxes[], - X121SMCStrategySignalProviderData &provider, - int barIndex = 0 // - ) - { - // - bool result = false; - - // - box.Clean(); - dir = X_DIRECTION_NONE; - - // - // Checking Waiting Baoxes Exists ... - result = HasChild(breakedBoxes); - if (!result) - { - return result; - } - - // - // Fil Selected Data ... - XPOIState cState; - X121Conditions cXConditions; - XPOIStateEvents cStateEvents; - XC121SMCCycleHelper *cHelper; - X121SMCCycleConditions cConditions; - result = provider.SelectCycle( - cycle, - cState, - cStateEvents, - cXConditions, - cHelper, - cConditions // - ); - if (!result) - { - // - cState.Clean(); - ZeroMemory(cHelper); - cConditions.Clean(); - cXConditions.Clean(); - cStateEvents.Clean(); - - // - return result; - } - Parse(cXConditions); - - // - // Normalize Args ... - - // - if (barIndex < 0) - { - barIndex = 0; - } - - // - int idx = -1; - int count = 0; - bool has = false; - - // - int zIDX = barIndex; - int cIDX = zIDX + 1; - int pIDX = cIDX + 1; - int ppIDX = pIDX + 1; - - // - bool isBullish = false; - bool isBearish = false; - - // - XOHCL zBar; - XOHCL cBar; - XOHCL pBar; - - // - // Initial Bars ... - result = zBar.Init( - cState.symbol, - cState.period, - barIndex // - ); - result = - result && - zBar.GetPreviousBar(cBar); - result = - result && - cBar.GetPreviousBar(pBar); - if (!result) - { - // - zBar.Clean(); - cBar.Clean(); - pBar.Clean(); - cState.Clean(); - ZeroMemory(cHelper); - cConditions.Clean(); - cXConditions.Clean(); - - // - return result; - } - - // - // Checking Bar Based on Positions State ... - ENUM_X_DIRECTION iBarPosDir; - bool isBarValidForDir = cHelper - .mBarAnalyser - .IsValidForPosition( - cBar, - iBarPosDir // - ); - bool isBarValidForBullish = - isBarValidForDir && - IsBullish(iBarPosDir); - bool isBarValidForBearish = - isBarValidForDir && - IsBearish(iBarPosDir); - - // - // Extract Selected Boxes ... - XBoxZone selectedBox; - XSignalBox iSignalBox; - count = ArraySize(breakedBoxes); - has = IsValidSize(count); - if (has) - { - // - for (int i = 0; i < count; i++) - { - // - XSignalBox iBox = breakedBoxes[i]; - - // - bool isBullish = iBox.ob.IsBullish(); - - // - has = cBar.low < iBox.sharp.upper && - cBar.low > iBox.sharp.lower && - cBar.high > iBox.sharp.lower && - cBar.high < iBox.sharp.upper; - - // - // Force Using OB ... - if (has) - { - // - iSignalBox = iBox; - if (!selectedBox.IsValid()) - { - selectedBox = iBox.ob; - } - iBox.Clean(); - break; - } - - // - iBox.Clean(); - } - } - result = - iSignalBox.IsValid() && - selectedBox.IsValid(); - if (!result) - { - // - zBar.Clean(); - cBar.Clean(); - pBar.Clean(); - cState.Clean(); - iSignalBox.Clean(); - selectedBox.Clean(); - ZeroMemory(cHelper); - cConditions.Clean(); - cXConditions.Clean(); - - // - return result; - } - - // - bool hasSignalBox = iSignalBox.IsValid(); - bool isSignalBoxBullish = IsBullish(iSignalBox.ob.dir); - - // - // Checking Other Conditions ... - - // - // XVWAP ... - - // - bool isVWapSlopeBullish = - cXConditions.isVwapFastSlopeBullish && - cXConditions.isVwapMidSlopeBullish && - cXConditions.isVwapSlowSlopeBullish; - - // - bool isVWapSlopeBearish = - cXConditions.isVwapFastSlopeBearish && - cXConditions.isVwapMidSlopeBearish && - cXConditions.isVwapSlowSlopeBearish; - - // - bool isVWapBullishCondition = - (cXConditions.isVWapBullishOrdered && - cXConditions.isVWapSwitchedToBullishState) || - (cXConditions.isVWapBullishState && - cXConditions.isVWapSwitchedToBullishOrdered); - - // - bool isVWapBearishCondition = - (cXConditions.isVWapBearishOrdered && - cXConditions.isVWapSwitchedToBearishState) || - (cXConditions.isVWapBearishState && - cXConditions.isVWapSwitchedToBearishOrdered); - - // - // Bullish Conditions ... - isBullish = - // - // Base Condition ... - ( - // - hasSignalBox && - isSignalBoxBullish && - isVWapSlopeBullish && - isBarValidForBullish && - isVWapBullishCondition - // - ) - // - ; - - // - // Bearish Conditions ... - isBearish = - // - // Base Condition ... - ( - // - hasSignalBox && - isVWapSlopeBearish && - !isSignalBoxBullish && - isBarValidForBearish && - isVWapBearishCondition - // - ) - // - ; - - // - // Filling Requirements ... - result = - isBullish || - isBearish; - if (result) - { - // - dir = - isBullish - ? X_DIRECTION_BULLISH - : X_DIRECTION_BEARISH; - - // - box = iSignalBox; - box.UpdateTo(TimeCurrent()); - - // - // Provide TP/SL ... - - // - box.sl = isBullish - ? cXConditions.vwapMin - : cXConditions.vwapMax; - - // - box.tp = isBullish - ? box.sharp.upper - : box.sharp.lower; - } - - // - // Check All Conditions ... - result = - box.IsValid() && - HasDirection(dir) && - (isBullish || - isBearish); - - // - // Cleanup Resources ... - zBar.Clean(); - cBar.Clean(); - pBar.Clean(); - cState.Clean(); - iSignalBox.Clean(); - selectedBox.Clean(); - ZeroMemory(cHelper); - cConditions.Clean(); - cStateEvents.Clean(); - cXConditions.Clean(); - - // - return result; - } - - // - // XFVGMA ... - bool HasXFVGMAConditions( - ENUM_X_CYCLES cycle, - XSignalBox &box, - ENUM_X_DIRECTION &dir, - XSignalBox &waitingBoxes[], - X121SMCStrategySignalProviderData &provider, - int barIndex = 0 // - ) - { - // - bool result = false; - - // - box.Clean(); - dir = X_DIRECTION_NONE; - - // - result = HasChild(waitingBoxes); - if (!result) - { - return result; - } - - // - // Fil Selected Data ... - XPOIState cState; - X121Conditions cXConditions; - XPOIStateEvents cStateEvents; - XC121SMCCycleHelper *cHelper; - X121SMCCycleConditions cConditions; - result = provider.SelectCycle( - cycle, - cState, - cStateEvents, - cXConditions, - cHelper, - cConditions // - ); - if (!result) - { - // - cState.Clean(); - ZeroMemory(cHelper); - cConditions.Clean(); - cXConditions.Clean(); - cStateEvents.Clean(); - - // - return result; - } - Parse(cXConditions); - - // - // Normalize Args ... - - // - if (barIndex < 0) - { - barIndex = 0; - } - - // - int idx = -1; - int count = 0; - bool has = false; - - // - int zIDX = barIndex; - int cIDX = zIDX + 1; - int pIDX = cIDX + 1; - int ppIDX = pIDX + 1; - - // - bool isBullish = false; - bool isBearish = false; - - // - XOHCL zBar; - XOHCL cBar; - XOHCL pBar; - - // - // Initial Bars ... - result = zBar.Init( - cState.symbol, - cState.period, - barIndex // - ); - result = - result && - zBar.GetPreviousBar(cBar); - result = - result && - cBar.GetPreviousBar(pBar); - if (!result) - { - // - zBar.Clean(); - cBar.Clean(); - pBar.Clean(); - cState.Clean(); - ZeroMemory(cHelper); - cConditions.Clean(); - cXConditions.Clean(); - - // - return result; - } - - // - // Select Waiting Box ... - XBoxZone selectedBox; - XSignalBox selectedSignalBox; - count = ArraySize(waitingBoxes); - for (int i = 0; i < count; i++) - { - // - XSignalBox iSBox = waitingBoxes[i]; - bool isBullish = iSBox.ob.IsBullish(); - - // - bool isInsidePassed = - isBullish - ? cBar.low < iSBox.ob.upper && - cBar.low > iSBox.ob.lower - : cBar.high > iSBox.ob.lower && - cBar.high < iSBox.ob.upper; - - // - bool isTypePassed = iSBox.sharp.type == "XSHPOBX"; - - // - has = isTypePassed && - isInsidePassed; - if (has) - { - // - selectedBox = iSBox.ob; - selectedSignalBox = iSBox; - break; - } - } - result = selectedBox.IsValid() && - selectedSignalBox.IsValid(); - if (!result) - { - // - zBar.Clean(); - cBar.Clean(); - pBar.Clean(); - cState.Clean(); - ZeroMemory(cHelper); - cConditions.Clean(); - selectedBox.Clean(); - cXConditions.Clean(); - selectedSignalBox.Clean(); - - // - return result; - } - - // - bool isSignalBoxBullish = selectedBox.IsBullish(); - - // - // Checking Other Conditions ... - - // - // Checking Bar Based on Positions State ... - ENUM_X_DIRECTION iBarPosDir; - bool isBarValidForDir = cHelper - .mBarAnalyser - .IsValidForPosition( - cBar, - iBarPosDir // - ); - bool isBarValidForBullish = - isBarValidForDir && - IsBullish(iBarPosDir); - bool isBarValidForBearish = - isBarValidForDir && - IsBearish(iBarPosDir); - - // - // Bullish Conditions ... - isBullish = - // - // Base Condition ... - ( - // - isSignalBoxBullish && - isBarValidForBullish - // - ) - // - ; - - // - // Bearish Conditions ... - isBearish = - // - // Base Condition ... - ( - // - !isSignalBoxBullish && - isBarValidForBearish - // - ) - // - ; - - // - // Filling Requirements ... - result = - isBullish || - isBearish; - if (result) - { - // - dir = - isBullish - ? X_DIRECTION_BULLISH - : X_DIRECTION_BEARISH; - - // - box = selectedSignalBox; - box.ob.to = TimeCurrent(); - } - - // - // Check All Conditions ... - result = - box.IsValid() && - HasDirection(dir) && - (isBullish || - isBearish); - - // - // Cleanup Resources ... - zBar.Clean(); - cBar.Clean(); - pBar.Clean(); - cState.Clean(); - selectedBox.Clean(); - ZeroMemory(cHelper); - cConditions.Clean(); - cStateEvents.Clean(); - cXConditions.Clean(); - selectedSignalBox.Clean(); - - // - return result; - } - - // - // XWPVZ ... - bool HasXWPVZConditions( - ENUM_X_CYCLES cycle, - ENUM_X_CYCLES vCycle, - XSignalBox &box, - ENUM_X_DIRECTION &dir, - X121SMCStrategySignalProviderData &provider, - int barIndex = 0 // - ) - { - // - bool result = false; - - // - box.Clean(); - dir = X_DIRECTION_NONE; - - // - // Fil Selected Data ... - XPOIState cState; - X121Conditions cXConditions; - XPOIStateEvents cStateEvents; - XC121SMCCycleHelper *cHelper; - X121SMCCycleConditions cConditions; - result = provider.SelectCycle( - cycle, - cState, - cStateEvents, - cXConditions, - cHelper, - cConditions // - ); - if (!result) - { - // - cState.Clean(); - ZeroMemory(cHelper); - cConditions.Clean(); - cXConditions.Clean(); - cStateEvents.Clean(); - - // - return result; - } - Parse(cXConditions); - - // - // Fil Selected Data ... - XPOIState vState; - X121Conditions vXConditions; - XPOIStateEvents vStateEvents; - XC121SMCCycleHelper *vHelper; - X121SMCCycleConditions vConditions; - result = provider.SelectCycle( - vCycle, - vState, - vStateEvents, - vXConditions, - vHelper, - vConditions // - ); - if (!result) - { - // - cState.Clean(); - ZeroMemory(cHelper); - cConditions.Clean(); - cXConditions.Clean(); - cStateEvents.Clean(); - - // - vState.Clean(); - ZeroMemory(vHelper); - cConditions.Clean(); - vXConditions.Clean(); - vStateEvents.Clean(); - - // - return result; - } - Parse(vXConditions); - - // - // Normalize Args ... - - // - if (barIndex < 0) - { - barIndex = 0; - } - - // - int idx = -1; - int count = 0; - bool has = false; - - // - int zIDX = barIndex; - int cIDX = zIDX + 1; - int pIDX = cIDX + 1; - int ppIDX = pIDX + 1; - - // - bool isBullish = false; - bool isBearish = false; - - // - XOHCL zBar; - XOHCL cBar; - XOHCL pBar; - XOHCL pPBar; - - // - // Initial Bars ... - result = zBar.Init( - cState.symbol, - cState.period, - barIndex // - ); - result = - result && - zBar.GetPreviousBar(cBar); - result = - result && - cBar.GetPreviousBar(pBar); - result = - result && - pBar.GetPreviousBar(pPBar); - if (!result) - { - // - zBar.Clean(); - cBar.Clean(); - pBar.Clean(); - cState.Clean(); - ZeroMemory(cHelper); - cConditions.Clean(); - cXConditions.Clean(); - - // - return result; - } - - // - XCPOIDrawer *drawer = provider.visionCycleHelper.mPOIDrawer; - - // - // Checking Other Conditions ... - - // - // Checking Bar Based on Positions State ... - ENUM_X_DIRECTION iBarPosDir; - bool isBarValidForDir = cHelper - .mBarAnalyser - .IsValidForPosition( - cBar, - iBarPosDir // - ); - bool isBarValidForBullish = - isBarValidForDir && - IsBullish(iBarPosDir); - bool isBarValidForBearish = - isBarValidForDir && - IsBearish(iBarPosDir); - - // - // Senkou Span A/B Rejections ... - - // - bool forceType = false; - bool forcePressure = true; - - // - bool isBullishRejectSenkouAB = cBar.IsRejected( - cXConditions.senkouMax, - X_DIRECTION_BULLISH, - forceType, // Force Type ... - forcePressure // Force Pressure ... - ); - - // - bool isBearishRejectSenkouAB = cBar.IsRejected( - cXConditions.senkouMin, - X_DIRECTION_BEARISH, - forceType, // Force Type ... - forcePressure // Force Pressure ... - ); - - // - // TenkanSen/KijunSen Rejections ... - - // - bool isBullishRejectTenKij = cBar.IsRejected( - cXConditions.tenKijMax, - X_DIRECTION_BULLISH, - forceType, // Force Type ... - forcePressure // Force Pressure ... - ); - - // - bool isBearishRejectTenKij = cBar.IsRejected( - cXConditions.tenKijMin, - X_DIRECTION_BEARISH, - forceType, // Force Type ... - forcePressure // Force Pressure ... - ); - - // - // X3MaFast Rejections ... - - // - bool isBullishRejectedFastMa = cBar.IsRejected( - cXConditions.x3maFastBuffer[cIDX], - X_DIRECTION_BULLISH, - forceType, // Force Type ... - forcePressure // Force Pressure ... - ); - - // - bool isBearishRejectedFastMa = cBar.IsRejected( - cXConditions.x3maFastBuffer[cIDX], - X_DIRECTION_BEARISH, - forceType, // Force Type ... - forcePressure // Force Pressure ... - ); - - // - bool isValidBullishRejectedFastMa = - isBullishRejectedFastMa && - cBar.low > cXConditions.senkouMax; - - // - bool isValidBearishRejectedFastMa = - isBearishRejectedFastMa && - cBar.high < cXConditions.senkouMin; - - // - // Bigger Cycle Verification ... - - // - double vBullishScore = 0; - double vBearishScore = 0; - vXConditions.GenerateScore( - vBullishScore, - vBearishScore // - ); - - // - bool isVBUllishPassed = - cBar.low > vXConditions.senkouMax && - vBullishScore > (vBearishScore * 1.5); - - // - bool isVBearishPassed = - cBar.high < vXConditions.senkouMin && - vBearishScore > (vBullishScore * 1.5); - - // - // ichimokou ... - - // - // Bullish Conditions ... - isBullish = - // - isVBUllishPassed && - isBullishRejectSenkouAB - // - ; - - // - // Bearish Conditions ... - isBearish = - // - isVBearishPassed && - isBearishRejectSenkouAB - // - ; - - // - result = isBullish || - isBearish; - if (result) - { - // - dir = - isBullish - ? X_DIRECTION_BULLISH - : X_DIRECTION_BEARISH; - } - - // - // Detecting a Zone and Validate it ... - - // - XBoxZone tmpBoxes[]; - - // - XBoxZone obBox; - XBoxZone fvgBox; - XBoxZone supResBox; - bool hasOB = false; - bool hasFVG = false; - bool hasSupRes = false; - - // - // Select Support and Resistance ... - if (result) - { - // - if (!hasSupRes) - { - // - cState.OrderBlocksAsBox(tmpBoxes); - cState.FairValueGapsAsBox(tmpBoxes); - cState.SupplyDemandsAsBox(tmpBoxes); - cState.SupportResistancesAsBox(tmpBoxes); - - // - has = HasChild(tmpBoxes); - if (has) - { - // - while (HasChild(tmpBoxes)) - { - // - idx = GetOldest(tmpBoxes); - has = IsValidIndex(idx); - if (!has) - { - break; - } - - // - XBoxZone iBox = tmpBoxes[idx]; - ArrayRemove( - tmpBoxes, - idx, - 1 // - ); - iBox.to = TimeCurrent(); - - // - // Try to Validate Support and Resistance ... - int retests = CountBoxRetest( - iBox, - dir, - cBar.period // - ); - bool isTyped = - isBullish - ? iBox.IsBullish() - : iBox.IsBearish(); - bool isRetested = retests >= 1; - bool isPlaced = - isBullish - ? ( - // - (cBar.low < iBox.upper && - cBar.low > iBox.lower) - // - ) - : ( - // - (cBar.high < iBox.upper && - cBar.high > iBox.lower) - // - ); - - // - has = - isTyped && - isPlaced && - isRetested; - if (has) - { - // - supResBox = iBox; - iBox.Clean(); - break; - } - - // - iBox.Clean(); - } - } - - // - hasSupRes = supResBox.IsValid(); - Clean(tmpBoxes); - } - } - - // - Clean(tmpBoxes); - - // - // Bullish Conditions ... - isBullish = - // - isBullish && - hasSupRes - // - ; - - // - // Bearish Conditions ... - isBearish = - // - isBearish && - hasSupRes - // - ; - - // - // Filling Requirements ... - result = - isBullish || - isBearish; - if (result) - { - // - bool drawBoxes = true; - if (drawBoxes) - { - // - if (hasSupRes) - { - // - supResBox.to = TimeCurrent(); - - // - XCBoxObject *iObj; - has = drawer.DrawBox( - supResBox, - iObj // - ); - - // - if (has) - { - iObj.BoxWidth(2); - iObj.BoxStyle(STYLE_DOT); - } - } - } - - // - Print("Signal ..."); - result = false; - isBearish = false; - isBullish = false; - } - - // - // Check All Conditions ... - result = - box.IsValid() && - HasDirection(dir) && - (isBullish || - isBearish); - - // - // Cleanup Resources ... - zBar.Clean(); - cBar.Clean(); - pBar.Clean(); - pPBar.Clean(); - cState.Clean(); - vState.Clean(); - cConditions.Clean(); - cConditions.Clean(); - ZeroMemory(cHelper); - ZeroMemory(vHelper); - cStateEvents.Clean(); - cXConditions.Clean(); - vXConditions.Clean(); - vStateEvents.Clean(); - - // - return result; - } - - // - bool HasXICHConditions( - ENUM_X_CYCLES cycle, - XBoxZone &box, - ENUM_X_DIRECTION &dir, - X121SMCStrategySignalProviderData &provider, - int barIndex = 0 // - ) - { - // - bool result = false; - - // - box.Clean(); - dir = X_DIRECTION_NONE; - - // - // Fil Selected Data ... - XPOIState cState; - X121Conditions cXConditions; - XPOIStateEvents cStateEvents; - XC121SMCCycleHelper *cHelper; - X121SMCCycleConditions cConditions; - result = provider.SelectCycle( - cycle, - cState, - cStateEvents, - cXConditions, - cHelper, - cConditions // - ); - if (!result) - { - // - cState.Clean(); - ZeroMemory(cHelper); - cConditions.Clean(); - cXConditions.Clean(); - cStateEvents.Clean(); - - // - return result; - } - Parse(cXConditions); - - // - // Normalize Args ... - - // - if (barIndex < 0) - { - barIndex = 0; - } - - // - int idx = -1; - int count = 0; - bool has = false; - - // - int zIDX = barIndex; - int cIDX = zIDX + 1; - int pIDX = cIDX + 1; - int ppIDX = pIDX + 1; - - // - bool isBullish = false; - bool isBearish = false; - - // - XOHCL zBar; - XOHCL cBar; - XOHCL pBar; - XOHCL pPBar; - - // - // Initial Bars ... - result = zBar.Init( - cState.symbol, - cState.period, - barIndex // - ); - result = - result && - zBar.GetPreviousBar(cBar); - result = - result && - cBar.GetPreviousBar(pBar); - result = - result && - pBar.GetPreviousBar(pPBar); - if (!result) - { - // - zBar.Clean(); - cBar.Clean(); - pBar.Clean(); - cState.Clean(); - ZeroMemory(cHelper); - cConditions.Clean(); - cXConditions.Clean(); - - // - return result; - } - - // - // Checking Conditions ... - // - // XDELTA ... - - // - bool isDeltaSwitchedToBullish = - (cXConditions.isDeltaCrossedOverMa && - cXConditions.isDeltaSwitchedToBullish); - bool isDeltaBullish = - (cXConditions.isDeltaOverMa && - cXConditions.isDeltaBullish); - bool isDeltaIsBullish = - isDeltaBullish || - isDeltaSwitchedToBullish; - - // - bool isDeltaSwitchedToBearish = - (cXConditions.isDeltaCrossedUnderMa && - cXConditions.isDeltaSwitchedToBearish); - bool isDeltaBearish = - (cXConditions.isDeltaUnderMa && - cXConditions.isDeltaBearish); - bool isDeltaIsBearish = - isDeltaBearish || - isDeltaSwitchedToBearish; - - // - // XVOLUME ... - - // - bool isVolumeSwitchedToBullish = - (cXConditions.isVolumeSwitchedToBullish && - cXConditions.isBullishVolumeSwitchedToIncreased); - bool isVolumeBullish = - (cXConditions.isBullishVolumeIncreased && - cXConditions.isBullishVolumeMaOverBearishVolumeMa); - bool isVolumeIsBullish = - isVolumeBullish || - isVolumeSwitchedToBullish; - - // - bool isVolumeSwitchedToBearish = - (cXConditions.isVolumeSwitchedToBearish && - cXConditions.isBearishVolumeSwitchedToIncreased); - bool isVolumeBearish = - (cXConditions.isBullishVolumeMaUnderBearishVolumeMa && - cXConditions.isBearishVolumeIncreased); - bool isVolumeIsBearish = - isVolumeBearish || - isVolumeSwitchedToBearish; - - // - // XSTR ... - bool isStrIsBullish = - (cXConditions.isStrBullish || - cXConditions.isStrSwitchedToBullish); - bool isStrIsBearish = - (cXConditions.isStrBearish || - cXConditions.isStrSwitchedToBearish); - - // - // XICH ... - bool isIchIsBullish = - (cXConditions.isTenkanSenOverKijunSen || - cXConditions.isTenkanSenCrossedOverKijunSen); - bool isIchIsBearish = - (cXConditions.isTenkanSenUnderKijunSen || - cXConditions.isTenkanSenCrossedUnderKijunSen); - - // - // Checking TK Zone ... - - // - bool isBullishTKZone = - isIchIsBullish && - cBar.low < cXConditions.tenkanSenBuffer[cIDX] && - cBar.low > cXConditions.kijunSenBuffer[cIDX] && - cBar.low < pBar.low && - zBar.open > cBar.low; - - // - bool isBearishTKZone = - isIchIsBearish && - cBar.high > cXConditions.tenkanSenBuffer[cIDX] && - cBar.high < cXConditions.kijunSenBuffer[cIDX] && - cBar.high > pBar.high && - zBar.open < cBar.high; - - // - // Summarize Conditions ... - - // - isBullish = - // - // false - isStrIsBullish && - isIchIsBullish && - isBullishTKZone && - isDeltaIsBullish && - isVolumeIsBullish - // - // - ; - - // - isBearish = - // - // false - isStrIsBearish && - isIchIsBearish && - isBearishTKZone && - isDeltaIsBearish && - isVolumeIsBearish - // - ; - - // - // Filling Requirements ... - result = - isBullish || - isBearish; - if (result) - { - // - dir = - isBullish - ? X_DIRECTION_BULLISH - : X_DIRECTION_BEARISH; - - // - box.dir = dir; - box.from = pPBar.time; - box.to = TimeCurrent(); - box.symbol = cBar.symbol; - box.period = cBar.period; - - // - double points = GetPoints(box.symbol); - - // - double pivot = isBullish - ? cBar.low - (points * 5) - : cBar.high + (points * 5); - - // - double point = GetEntry( - cBar.symbol, - dir // - ); - - // - box.upper = - isBullish - ? point - : pivot; - - // - box.lower = - isBullish - ? pivot - : point; - - // - bool drawBoxes = true; - if (drawBoxes) - { - // - } - } - - // - // Check All Conditions ... - result = - box.IsValid() && - HasDirection(dir) && - (isBullish || - isBearish); - - // - // Cleanup Resources ... - zBar.Clean(); - cBar.Clean(); - pBar.Clean(); - pPBar.Clean(); - cState.Clean(); - cConditions.Clean(); - cConditions.Clean(); - ZeroMemory(cHelper); - cStateEvents.Clean(); - cXConditions.Clean(); - - // - return result; - } - + // Signalling Conditions Parsers ... + // bool HasXSTRConditions( ENUM_X_CYCLES cycle, @@ -4729,55 +1944,6 @@ struct X121SMCStrategyConditionParser // // Checking Conditions ... - // - // XDELTA ... - - // - bool isDeltaSwitchedToBullish = - (cXConditions.isDeltaCrossedOverMa && - cXConditions.isDeltaSwitchedToBullish); - bool isDeltaBullish = - (cXConditions.isDeltaOverMa && - cXConditions.isDeltaBullish); - bool isDeltaIsBullish = - isDeltaBullish || - isDeltaSwitchedToBullish; - - // - bool isDeltaSwitchedToBearish = - (cXConditions.isDeltaCrossedUnderMa && - cXConditions.isDeltaSwitchedToBearish); - bool isDeltaBearish = - (cXConditions.isDeltaUnderMa && - cXConditions.isDeltaBearish); - bool isDeltaIsBearish = - isDeltaBearish || - isDeltaSwitchedToBearish; - - // - // XVOLUME ... - - // - bool isVolumeSwitchedToBullish = - (cXConditions.isVolumeSwitchedToBullish && - cXConditions.isBullishVolumeSwitchedToIncreased); - bool isVolumeBullish = - (cXConditions.isBullishVolumeIncreased && - cXConditions.isBullishVolumeMaOverBearishVolumeMa); - bool isVolumeIsBullish = - isVolumeBullish || - isVolumeSwitchedToBullish; - - // - bool isVolumeSwitchedToBearish = - (cXConditions.isVolumeSwitchedToBearish && - cXConditions.isBearishVolumeSwitchedToIncreased); - bool isVolumeBearish = - (cXConditions.isBullishVolumeMaUnderBearishVolumeMa && - cXConditions.isBearishVolumeIncreased); - bool isVolumeIsBearish = - isVolumeBearish || - isVolumeSwitchedToBearish; // // XSTR ... @@ -4922,8 +2088,6 @@ struct X121SMCStrategyConditionParser hasStrBox && isStrIsBullish && isFastMaOverStr && - // isDeltaIsBullish && - // isVolumeIsBullish && isFastMaBullishReject // // @@ -4936,8 +2100,6 @@ struct X121SMCStrategyConditionParser hasStrBox && isStrIsBearish && isFastMaUnderStr && - // isDeltaIsBearish && - // isVolumeIsBearish && isFastMaBearishReject // ; diff --git a/X121SMCEA/Signals/x-121.smc.xwz.signal.lib.mq5 b/X121SMCEA/Signals/x-121.smc.xwz.signal.lib.mq5 index 8be35a67..f2d23f27 100644 --- a/X121SMCEA/Signals/x-121.smc.xwz.signal.lib.mq5 +++ b/X121SMCEA/Signals/x-121.smc.xwz.signal.lib.mq5 @@ -1938,14 +1938,7 @@ struct X121SMCStrategyXWZWorkingZone if (useSenario1) { // - isSenario1Happend = cParser.HasRejectedBoxConditions( - X_CYCLE_DECISION, - box, - dir, - waitingBoxes, - provider, - barIndex // - ); + isSenario1Happend = false; // isSenario1Bullish = @@ -1977,14 +1970,7 @@ struct X121SMCStrategyXWZWorkingZone useSenario2) { // - isSenario2Happend = cParser.HasActivatedBoxConditions( - X_CYCLE_DECISION, - box, - dir, - waitingBoxes, - provider, - barIndex // - ); + isSenario2Happend = false; // isSenario2Bullish = @@ -2017,14 +2003,7 @@ struct X121SMCStrategyXWZWorkingZone useSenario3) { // - isSenario3Happend = cParser.HasBreakedBoxConditions( - X_CYCLE_DECISION, - box, - dir, - breakedBoxes, - provider, - barIndex // - ); + isSenario3Happend = false; // isSenario3Bullish = @@ -2058,14 +2037,7 @@ struct X121SMCStrategyXWZWorkingZone useSenario4) { // - isSenario4Happend = cParser.HasXFVGMAConditions( - X_CYCLE_DECISION, - box, - dir, - waitingBoxes, - provider, - barIndex // - ); + isSenario4Happend = false; // isSenario4Bullish = @@ -2100,14 +2072,7 @@ struct X121SMCStrategyXWZWorkingZone useSenario5) { // - isSenario5Happend = cParser.HasXWPVZConditions( - X_CYCLE_DECISION, - X_CYCLE_CONSOLIDATION, - box, - dir, - provider, - barIndex // - ); + isSenario5Happend = false; // isSenario5Bullish = diff --git a/X121SMCEA/Strategy/x-121.smc.strategy.class.mq5 b/X121SMCEA/Strategy/x-121.smc.strategy.class.mq5 index c6a38137..07f52057 100644 --- a/X121SMCEA/Strategy/x-121.smc.strategy.class.mq5 +++ b/X121SMCEA/Strategy/x-121.smc.strategy.class.mq5 @@ -934,6 +934,10 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy mMaxAllowedRequiredPOIs = 0; } + // + X121Inputs x121Inputs; + x121Inputs.Default(); + // // Short ... ENUM_X_PERIOD_METHOD scMethod = X_PERIOD_AUTO; // How to Find Period @@ -954,20 +958,30 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy ENUM_X_PERIOD_METHOD hcMethod = X_PERIOD_AUTO; // How to Find Period ENUM_TIMEFRAMES hcPeriod = NULL; // Time Period - // - // XPV ... - X121Inputs x121Inputs; - - // - x121Inputs.Default(); - // bool showAll = false; + // + x121Inputs.showRSI = showAll || true; + + // + // + // + + // + // XCC ... + + // + // Configurations ... + + // + // Presentations ... + // // XPV ... // + // Configurations ... x121Inputs.xpvInputs.scMethod = scMethod; x121Inputs.xpvInputs.scPeriod = scPeriod; x121Inputs.xpvInputs.mcMethod = mcMethod; @@ -976,127 +990,109 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy x121Inputs.xpvInputs.lcPeriod = lcPeriod; x121Inputs.xpvInputs.hcMethod = hcMethod; x121Inputs.xpvInputs.hcPeriod = hcPeriod; - - // - x121Inputs.xhkInputs.xhkIgnoreSmoothingShadows = true; - - // - x121Inputs.xatrInputs.atrMultiplier = 1.5; - x121Inputs.xatrInputs.atrSmoothingMode = X_MA_MODE_EMA; x121Inputs.xpvInputs.goldenZoneLevel = X_FIBO_LEVEL_236; // - x121Inputs.xvwapInputs.vwapFastLength = 20; - x121Inputs.xvwapInputs.vwapMidLength = 50; - x121Inputs.xvwapInputs.vwapSlowLength = 200; - - // - x121Inputs.x3maInputs.x3maFastMALength = 20; - x121Inputs.x3maInputs.x3maMidMALength = 50; - x121Inputs.x3maInputs.x3maSlowMALength = 200; - - // - x121Inputs.xichInputs.shiftKumo = true; - - // - x121Inputs.showRSI = showAll || true; - - // - // x121Inputs.xcheInputs.cheLength = 14; - // x121Inputs.xcheInputs.cheLoopback = 7; - // x121Inputs.xcheInputs.cheMultiplier1 = 1.5; - // x121Inputs.xcheInputs.cheMultiplier2 = 2; - - // - // x121Inputs.xstrInputs.strLength = 14; - // x121Inputs.xstrInputs.strMultiplier = 1.5; - - // - // x121Inputs.xccInputs.upColor = clrLime; - // x121Inputs.xccInputs.downColor = clrRed; - // x121Inputs.xccInputs.lineColor = CLR_NONE; - // x121Inputs.xccInputs.bearishColor = clrRed; - // x121Inputs.xccInputs.bullishColor = clrLime; - // x121Inputs.xccInputs.volumesColor = clrGreen; - - // - // - // - - // - // XCC ... - x121Inputs.xccInputs.showCandles = showAll || true; - - // - // XPV ... - x121Inputs.xpvInputs.showSar = showAll || false; + // Presentations ... + x121Inputs.xpvInputs.showSar = showAll || true; x121Inputs.xpvInputs.showPeaks = showAll || true; x121Inputs.xpvInputs.showVales = showAll || true; x121Inputs.xpvInputs.showSupports = showAll || false; - x121Inputs.xpvInputs.showResistances = showAll || false; x121Inputs.xpvInputs.showGoldenZones = showAll || true; + x121Inputs.xpvInputs.showResistances = showAll || false; // // XHK ... // - x121Inputs.xhkInputs.drawRawXHKCandles = showAll || false; - x121Inputs.xhkInputs.drawSmoothedXHKCandles = showAll || false; + // Configurations ... + x121Inputs.xhkInputs.xhkIgnoreSmoothingShadows = true; + + // + // Presentations ... + x121Inputs.xhkInputs.drawRawXHKCandles = showAll || true; + x121Inputs.xhkInputs.drawSmoothedXHKCandles = showAll || true; // // XMAS ... // - x121Inputs.xmasInputs.showUpper = showAll || false; - x121Inputs.xmasInputs.showMid = showAll || false; - x121Inputs.xmasInputs.showLower = showAll || false; + // Configurations ... + + // + // Presentations ... + x121Inputs.xmasInputs.showMid = showAll || true; + x121Inputs.xmasInputs.showUpper = showAll || true; + x121Inputs.xmasInputs.showLower = showAll || true; // // XATR ... - x121Inputs.xatrInputs.showATRUpper = showAll || false; - x121Inputs.xatrInputs.showATRLower = showAll || false; + + // + // Configurations ... + + // + // Presentations ... + x121Inputs.xatrInputs.showAtrUpper = showAll || false; + x121Inputs.xatrInputs.showAtrLower = showAll || false; + x121Inputs.xatrInputs.showRSIChange = showAll || false; + x121Inputs.xatrInputs.showPriceChange = showAll || false; + x121Inputs.xatrInputs.showSmoothedAtrUpper = showAll || true; + x121Inputs.xatrInputs.showSmoothedAtrLower = showAll || true; + x121Inputs.xatrInputs.showSmoothedRSIChange = showAll || true; + x121Inputs.xatrInputs.showSmoothedPriceChange = showAll || true; // // XSTR ... + + // + // Configurations ... + + // + // Presentations ... x121Inputs.xstrInputs.showStr = showAll || true; x121Inputs.xstrInputs.showStrUpper = showAll || false; x121Inputs.xstrInputs.showStrLower = showAll || false; // // XCHE ... + + // + // Configurations ... + + // + // Presentations ... x121Inputs.xcheInputs.showLE1 = showAll || false; - x121Inputs.xcheInputs.showLE2 = showAll || false; x121Inputs.xcheInputs.showSE1 = showAll || false; + x121Inputs.xcheInputs.showLE2 = showAll || false; x121Inputs.xcheInputs.showSE2 = showAll || false; - // - // XDON ... - x121Inputs.xdonInputs.showOpen = showAll || false; - x121Inputs.xdonInputs.showClose = showAll || false; - x121Inputs.xdonInputs.showLow = showAll || false; - x121Inputs.xdonInputs.showHigh = showAll || false; - - // - // XVWAP ... - x121Inputs.xvwapInputs.showVWapFast = showAll || false; - x121Inputs.xvwapInputs.showVWapMedium = showAll || false; - x121Inputs.xvwapInputs.showVWapSlow = showAll || false; - // // X3MA ... - x121Inputs.x3maInputs.showX3MaFast = showAll || true; + + // + // Configurations ... + + // + // Presentations ... x121Inputs.x3maInputs.showX3MaMid = showAll || false; + x121Inputs.x3maInputs.showX3MaFast = showAll || false; x121Inputs.x3maInputs.showX3MaSlow = showAll || false; // - // XICH ... - x121Inputs.xichInputs.showTenkanSen = showAll || false; - x121Inputs.xichInputs.showKijunSen = showAll || false; - x121Inputs.xichInputs.showChikouSpan = showAll || false; - x121Inputs.xichInputs.showSenkouSpanA = showAll || false; - x121Inputs.xichInputs.showSenkouSpanB = showAll || false; - x121Inputs.xichInputs.showKumo = showAll || false; + // XVWAP ... + // + // Configurations ... + + // + // Presentations ... + x121Inputs.xvwapInputs.showVWapFast = showAll || false; + x121Inputs.xvwapInputs.showVWapSlow = showAll || false; + x121Inputs.xvwapInputs.showVWapMedium = showAll || false; + + // + // // //