diff --git a/Documents/BKP/1/xcaea.signaller.lib.mq5 b/Documents/BKP/1/xcaea.signaller.lib.mq5 index 1a2f09f9..cd29c16b 100644 --- a/Documents/BKP/1/xcaea.signaller.lib.mq5 +++ b/Documents/BKP/1/xcaea.signaller.lib.mq5 @@ -86,7 +86,7 @@ struct XCAEAStrategyConditions // Constructor ... XCAEAStrategyConditions() { - Clean(); + Default(); } // @@ -125,6 +125,40 @@ struct XCAEAStrategyConditions type = X_POSITION_TYPE_NONE; // + ZeroMemory(this); + } + + /** + * Default ... + */ + void Default() + { + // + sl = 0; + tp = 0; + pivot = 0; + point = 0; + + // + symbol = NULL; + period = NULL; + provider = NULL; + + // + time = NULL; + setupTime = NULL; + triggerTime = NULL; + + // + Clean(targets); + + // + signalBox.Clean(); + conditions.Clean(); + + // + dir = X_DIRECTION_NONE; + type = X_POSITION_TYPE_NONE; } // @@ -319,7 +353,7 @@ struct XCAEAGuard // Constructor ... XCAEAGuard() { - Clean(); + Default(); } // @@ -352,6 +386,29 @@ struct XCAEAGuard ZeroMemory(this); } + /** + * Default ... + */ + void Default() { + // + time = NULL; + action = X_GUARD_ACTION_NONE; + + // + symbol = NULL; + provider = NULL; + + // + ticket = 0; + + // + volumeMultiplier = 0; + + // + sl = 0; + tp = 0; + } + /** * Validate ... * diff --git a/Documents/BKP/xcaea.x-poi.detector.class.mq5 b/Documents/BKP/xcaea.x-poi.detector.class.mq5 index a3d3a6e8..97cb01e5 100644 --- a/Documents/BKP/xcaea.x-poi.detector.class.mq5 +++ b/Documents/BKP/xcaea.x-poi.detector.class.mq5 @@ -108,7 +108,7 @@ struct XCAPivot // Constructor ... XCAPivot() { - Clean(); + Default(); } // @@ -135,6 +135,27 @@ struct XCAPivot ZeroMemory(this); } + /** + * Default ... + */ + void Default() + { + // + value = 0; + to = NULL; + reserve = 0; + from = NULL; + symbol = NULL; + period = NULL; + type = XCA_NONE; + + // + Clean(values); + + // + ZeroMemory(this); + } + /** * Validate ... * @@ -482,7 +503,7 @@ struct XCAPVPivot // Constructor ... XCAPVPivot() { - Clean(); + Default(); } // @@ -500,6 +521,15 @@ struct XCAPVPivot ZeroMemory(this); } + // + void Default() + { + // + value = 0; + Clean(pivots); + dir = X_DIRECTION_NONE; + } + // bool IsValid() { @@ -601,7 +631,7 @@ struct XCAPVTick // XCAPVTick() { - Clean(); + Default(); } // @@ -618,6 +648,16 @@ struct XCAPVTick ZeroMemory(this); } + // + void Default() + { + // + pivot.Clean(); + + // + ZeroMemory(zone); + } + // bool IsValid() { diff --git a/Helpers/x-saherelm.x121.x3ma.helper.mq5 b/Helpers/x-saherelm.x121.x3ma.helper.mq5 index 75225c3b..ac54b463 100644 --- a/Helpers/x-saherelm.x121.x3ma.helper.mq5 +++ b/Helpers/x-saherelm.x121.x3ma.helper.mq5 @@ -86,7 +86,7 @@ struct X121X3MAInputs // Constructor ... X121X3MAInputs() { - Clean(); + Default(); } // @@ -124,6 +124,9 @@ struct X121X3MAInputs showFast = false; showSlow = false; showMedium = false; + + // + ZeroMemory(this); } // @@ -368,6 +371,9 @@ struct X121X3MAConditions // is3MaFinishedFromBullish = false; is3MaFinishedFromBearish = false; + + // + ZeroMemory(this); } /** diff --git a/Libraries/x-saherelm.x-poi.state.lib.mq5 b/Libraries/x-saherelm.x-poi.state.lib.mq5 index 3279865e..e52ea2b5 100644 --- a/Libraries/x-saherelm.x-poi.state.lib.mq5 +++ b/Libraries/x-saherelm.x-poi.state.lib.mq5 @@ -80,6 +80,9 @@ struct XSignalBox ob.Clean(); fvg.Clean(); sharp.Clean(); + + // + ZeroMemory(this); } /** diff --git a/Libraries/x-saherelm.x-trade.lib.mq5 b/Libraries/x-saherelm.x-trade.lib.mq5 index f33e7c88..a1054a05 100644 --- a/Libraries/x-saherelm.x-trade.lib.mq5 +++ b/Libraries/x-saherelm.x-trade.lib.mq5 @@ -347,6 +347,9 @@ struct XRR // Clean(tps); + + // + ZeroMemory(this); } // @@ -1119,6 +1122,7 @@ struct XSignal // // Traget ... double targets[]; // Force Risk Free On Targets ... + bool isTargetApplied; // Target Applied ... int appliedTargetIDX; // Last Applied Target Index ... bool ignoreEAVolume; // Ignore EA Volume ... @@ -1131,7 +1135,7 @@ struct XSignal // Constructor ... XSignal() { - Clean(); + Default(); } // @@ -1683,6 +1687,7 @@ struct XSignal Clean(targets); appliedTargetIDX = -1; ignoreEAVolume = false; + isTargetApplied = false; // trailSL = false; @@ -1702,6 +1707,46 @@ struct XSignal ZeroMemory(this); } + // + // Default Values ... + void Default() { + // + entry = 0; + volume = 0; + pushers = 0; + positionId = 0; + + // + time = NULL; + type = NULL; + mode = NULL; + symbol = NULL; + period = NULL; + comment = NULL; + provider = NULL; + conditions = NULL; + + // + Clean(targets); + appliedTargetIDX = -1; + ignoreEAVolume = false; + isTargetApplied = false; + + // + trailSL = false; + riskFreeOnBreakEven = false; + + // + fullTPLevel = 0; + tpLevelForBreakEven = 0; + partialCloseOnTPLevel = 0; + partialCloseMultiplier = 0; + trailSLStartOnReachTPLevel = 0; + + // + Clean(supports); + } + // // Validate ... bool IsValid() diff --git a/XCAEA/Classes/xcaea.x-poi.detector.class.mq5 b/XCAEA/Classes/xcaea.x-poi.detector.class.mq5 index 26ebfe21..2edbc2ce 100644 --- a/XCAEA/Classes/xcaea.x-poi.detector.class.mq5 +++ b/XCAEA/Classes/xcaea.x-poi.detector.class.mq5 @@ -648,6 +648,9 @@ struct XCATRENDFVG // Clean(fvgs); trend.Clean(); + + // + ZeroMemory(this); } // diff --git a/XCAEA/Classes/xcaea.x-trade.manager.class.mq5 b/XCAEA/Classes/xcaea.x-trade.manager.class.mq5 index cda38977..f8fdfa60 100644 --- a/XCAEA/Classes/xcaea.x-trade.manager.class.mq5 +++ b/XCAEA/Classes/xcaea.x-trade.manager.class.mq5 @@ -558,10 +558,13 @@ class XCXCAEATradeManager : public XCBaseAlert // double jTarget = targets[j]; + // + int appliedTargetIDX = -1; + // // Check Target is Applied Before or Not ... has = - !IsValidIndex(trades[idx].signal.appliedTargetIDX) + !trades[idx].signal.isTargetApplied ? true : trades[idx].signal.appliedTargetIDX < j; if (!has) @@ -612,6 +615,7 @@ class XCXCAEATradeManager : public XCBaseAlert { // trades[idx].signal.appliedTargetIDX = j; + trades[idx].signal.isTargetApplied = true; // string message = prefix + diff --git a/XCAEA/Libraries/xcaea.signaller.lib.mq5 b/XCAEA/Libraries/xcaea.signaller.lib.mq5 index 60e93fe3..0187c4e6 100644 --- a/XCAEA/Libraries/xcaea.signaller.lib.mq5 +++ b/XCAEA/Libraries/xcaea.signaller.lib.mq5 @@ -126,6 +126,7 @@ struct XCAEAStrategyConditions type = X_POSITION_TYPE_NONE; // + ZeroMemory(this); } // @@ -783,6 +784,27 @@ bool DetectXCAEAConditions( double pCCI = conditions.cciBuffer[pIDX]; double p2CCI = conditions.cciBuffer[p2IDX]; + // + // ADX ... + double zADX = conditions.adxBuffer[zIDX]; + double cADX = conditions.adxBuffer[cIDX]; + double pADX = conditions.adxBuffer[pIDX]; + double p2ADX = conditions.adxBuffer[p2IDX]; + + // + // ADX P ... + double zADXP = conditions.adxpBuffer[zIDX]; + double cADXP = conditions.adxpBuffer[cIDX]; + double pADXP = conditions.adxpBuffer[pIDX]; + double p2ADXP = conditions.adxpBuffer[p2IDX]; + + // + // ADX N ... + double zADXN = conditions.adxnBuffer[zIDX]; + double cADXN = conditions.adxnBuffer[cIDX]; + double pADXN = conditions.adxnBuffer[pIDX]; + double p2ADXN = conditions.adxnBuffer[p2IDX]; + // // X3MA ... @@ -914,6 +936,26 @@ bool DetectXCAEAConditions( cCCI < pCCI && !conditions.isCCIOS; + // + bool isADXBullish = + cADX > cADXN; + bool isADXBullishPrev = + pADX > pADXN; + + // + bool isADXSwitchedToBullish = isADXBullish && + !isADXBullishPrev; + + // + bool isADXBearish = + cADX > cADXN; + bool isADXBearishPrev = + pADX > pADXN; + + // + bool isADXSwitchedToBearish = isADXBearish && + !isADXBearishPrev; + // bool isLowOverMax = cBar.low > maxCTrendValue; bool isHighUnderMin = cBar.high < minCTrendValue; @@ -1233,14 +1275,15 @@ bool DetectXCAEAConditions( isPCCIOS && isRSIBullish && isCCIBullish && - hasRCIContainers && + // isADXBullish && + // hasRCIContainers && rciPivot.IsValid() && rciPivot.IsBullish() && - conditions.isUnderMal && - conditions.isValeIsPivot && + // conditions.isUnderMal && + // conditions.isValeIsPivot && (conditions.isRSICrossedOverOS || - conditions.isCCICrossedOverOS) && - conditions.swingLowBuffer[cIDX] < conditions.fiboLevel3Buffer[cIDX] + conditions.isCCICrossedOverOS) // && + // conditions.swingLowBuffer[cIDX] < conditions.fiboLevel3Buffer[cIDX] // ; @@ -1253,14 +1296,15 @@ bool DetectXCAEAConditions( isPCCIOB && isRSIBearish && isCCIBearish && - hasRCIContainers && + // isADXBearish && + // hasRCIContainers && rciPivot.IsValid() && rciPivot.IsBearish() && - conditions.isOverMal && - conditions.isPeakIsPivot && + // conditions.isOverMal && + // conditions.isPeakIsPivot && (conditions.isRSICrossedUnderOB || - conditions.isCCICrossedUnderOB) && - conditions.swingHighBuffer[cIDX] > conditions.fiboLevel1Buffer[cIDX] + conditions.isCCICrossedUnderOB) // && + // conditions.swingHighBuffer[cIDX] > conditions.fiboLevel1Buffer[cIDX] // ; @@ -1269,11 +1313,7 @@ bool DetectXCAEAConditions( isCond2Bearish; if (isCond2) { - // pivotBox = rciPivot; - - // - // Selectiing Pivot Box based on RCI Containers ... } // @@ -1458,7 +1498,8 @@ bool DetectXCAEAConditions( // // Preparing Targets ... - if (isCond1) + if (isCond1 || + isCond2) { // // Add Reward 1 ... @@ -1771,4 +1812,90 @@ bool SelectRejectedBox( return result; } +// +int ExtractValues( + double &values[], + XBoxZone &pivots[], + bool forceClean = true // +) +{ + // + int result = 0; + + // + if (forceClean) + { + Clean(values); + } + + // + int count = ArraySize(pivots); + for (int i = 0; i < count; i++) + { + // + XBoxZone iPivot = pivots[i]; + + // + Add( + iPivot.upper, + values // + ); + + // + Add( + iPivot.lower, + values // + ); + + // + iPivot.Clean(); + } + + // + result = ArraySize(values); + + // + return result; +} + +// +double GetMax(XBoxZone &pivots[]) +{ + // + double values[]; + ExtractValues( + values, + pivots // + ); + + // + double result = GetMax(values); + + // + Clean(values); + + // + return result; +} + +// +double GetMin(XBoxZone &pivots[]) +{ + // + double values[]; + ExtractValues( + values, + pivots // + ); + + // + double result = GetMin(values); + + // + Clean(values); + + // + return result; +} + // \ No newline at end of file diff --git a/XCAEA/Signals/xcaea.signaller.class.mq5 b/XCAEA/Signals/xcaea.signaller.class.mq5 index 42e63d66..77354854 100644 --- a/XCAEA/Signals/xcaea.signaller.class.mq5 +++ b/XCAEA/Signals/xcaea.signaller.class.mq5 @@ -852,8 +852,8 @@ class XCXCAEASignaller : XCBase // // Oscillators Views ... - inputs.showRSI = true; - inputs.showCCI = true; + inputs.showRSI = false; + inputs.showCCI = false; inputs.showMFI = false; inputs.showRVI = false; inputs.showADX = false;