From 69df921dd2a8c78ae8e42ef76a01d6dc3f670945 Mon Sep 17 00:00:00 2001 From: Hadi Khazaee Asl Date: Thu, 28 Aug 2025 01:04:57 +0330 Subject: [PATCH] last works ... --- XOM1EA/Classes/xom1ea.expert.class.mq5 | 13 +++-- XOM1EA/Classes/xom1ea.signaller.class.mq5 | 61 ++++++++++++++++++----- XOM1EA/Libraries/xom1ea.lib.mq5 | 51 ++++++++++++++++++- 3 files changed, 109 insertions(+), 16 deletions(-) diff --git a/XOM1EA/Classes/xom1ea.expert.class.mq5 b/XOM1EA/Classes/xom1ea.expert.class.mq5 index 617ef8d9..8edca790 100644 --- a/XOM1EA/Classes/xom1ea.expert.class.mq5 +++ b/XOM1EA/Classes/xom1ea.expert.class.mq5 @@ -146,14 +146,18 @@ class XCXOM1EAExpert : public XCBase // Here we Apply Symbols,Periods and Configs ... // + // Configure Indicator ... XOM1Inputs iDZoneOMInputs; iDZoneOMInputs.Default(); + iDZoneOMInputs.showFiboZone = false; // + // Configure Signaller ... XOM1SignallerConfig iDZoneSignallerConfig; iDZoneSignallerConfig.processAllTicks = false; // + // Make Instance Signaller Class ... XCXOM1SignallerBase *iDZoneSignaller = NULL; iDZoneSignaller = new XCXOM1SignallerBase( "XDZN", @@ -164,6 +168,7 @@ class XCXOM1EAExpert : public XCBase if (iDZoneSignaller != NULL) { // + // Register Signaller ... Add( iDZoneSignaller, signallers // @@ -208,16 +213,18 @@ class XCXOM1EAExpert : public XCBase // int count = ArraySize(signallers); bool has = IsValidSize(count); - if (!has) { + if (!has) + { return; } // // Loop through Signallers ... - for (int i = 0; i < count; i++) { + for (int i = 0; i < count; i++) + { // // Calling Process Ticks on Signaller ... - signallers[i].ProcessTick(0); + signallers[i].ProcessTick(0); } } diff --git a/XOM1EA/Classes/xom1ea.signaller.class.mq5 b/XOM1EA/Classes/xom1ea.signaller.class.mq5 index e949594a..0296b3e7 100644 --- a/XOM1EA/Classes/xom1ea.signaller.class.mq5 +++ b/XOM1EA/Classes/xom1ea.signaller.class.mq5 @@ -22,6 +22,7 @@ // // Imports ... +#include "../../Classes/x-saherelm.x-poi.drawer.class.mq5" #include "../../Helpers/x-saherelm.xom1.helper.mq5" #include "../Libraries/xom1ea.lib.mq5" @@ -39,7 +40,8 @@ struct XOM1SignallerConfig // // Constructor ... - XOM1SignallerConfig() { + XOM1SignallerConfig() + { Clean(); } @@ -49,7 +51,8 @@ struct XOM1SignallerConfig /** * Cleanup ... */ - void Clean() { + void Clean() + { ZeroMemory(this); } }; @@ -73,6 +76,7 @@ class XCXOM1SignallerBase XOM1Inputs inputs; // Indicator Inputs ... ENUM_TIMEFRAMES period; // Period ... XOM1SignallerConfig config; // Configuration ... + XCPOIDrawer drawer; // POI Drawer ... // // Constructor ... @@ -133,6 +137,9 @@ class XCXOM1SignallerBase // inputs.Clean(); + // + mObjects.Clear(); + // SpecifiedClean(zones); @@ -201,6 +208,11 @@ class XCXOM1SignallerBase return; } + // + // Set Last Works ... + mProcessedTicksCount++; + mLastCheckedBarTime = cBarTime; + // // Initialize iBar ... has = iBar.Init( @@ -239,9 +251,9 @@ class XCXOM1SignallerBase // int zIdx = 0; - int cIdx = zIdx++; - int pIdx = cIdx++; - int p2Idx = pIdx++; + int cIdx = zIdx + 1; + int pIdx = cIdx + 1; + int p2Idx = pIdx + 1; // // Check New Peak or Vale Happens ... @@ -306,7 +318,8 @@ class XCXOM1SignallerBase iPrice, iDir, iReason, - iConditions.bars[pIdx].time // From ... + iConditions.bars[pIdx].time, // From ... + iConditions.bars[cIdx].time // To ); if (has) { @@ -318,11 +331,6 @@ class XCXOM1SignallerBase ); } - // - // Set Last Works ... - mProcessedTicksCount++; - mLastCheckedBarTime = cBarTime; - // // Clean Resources ... iBar.Clean(); @@ -342,6 +350,9 @@ class XCXOM1SignallerBase // // Props ... + // + CArrayObj mObjects; // Drawn Objects ... + // XCXOM1Helper *mHelper; // Indicator Helper ... @@ -375,9 +386,35 @@ class XCXOM1SignallerBase { // // Update Lifetime by Bar Index ... - zones[i].UpdateByBarIndex(barIndex); + // zones[i].UpdateByBarIndex(barIndex); + + // + // COnverts to Box ... + XBoxZone iBox; + has = zones[i].ToBox(iBox); + if (has) + { + // + XCBoxObject *iBoxObj; + has = drawer.DrawBox( + iBox, + iBoxObj, + true // Ignore At ... + ); + if (has) + { + mObjects.Add(iBoxObj); + } + } + + // + iBox.Clean(); } } + + // + // Check XOMZones Validations ... + } }; diff --git a/XOM1EA/Libraries/xom1ea.lib.mq5 b/XOM1EA/Libraries/xom1ea.lib.mq5 index c5877329..217cabfc 100644 --- a/XOM1EA/Libraries/xom1ea.lib.mq5 +++ b/XOM1EA/Libraries/xom1ea.lib.mq5 @@ -23,6 +23,7 @@ // // Imports ... #include "../../Libraries/x-saherelm.common.lib.mq5" +#include "../../Libraries/x-saherelm.x-poi.lib.mq5" // // Definitions ... @@ -170,6 +171,7 @@ struct XOM1Zone * @param _dir: Direction * @param _reason: Creation Reason * @param _from: Detection Time + * @param _to: Lifetime Time * * @return ( bool ) */ @@ -182,7 +184,8 @@ struct XOM1Zone double _price, ENUM_X_DIRECTION _dir, ENUM_XOM1_ZONE_REASON _reason, - datetime _from // + datetime _from, + datetime _to = NULL // ) { // @@ -197,6 +200,11 @@ struct XOM1Zone reason = _reason; signaller = _signaller; + // + if (IsSpecifiedValid(_to)) { + to = _to; + } + // bool result = IsValid(); if (!result) @@ -346,6 +354,47 @@ struct XOM1Zone return result; } + /** + * Converts to Box ... + * + * @param box: Dest + * + * @return ( bool ) + */ + bool ToBox(XBoxZone &box) + { + // + bool result = false; + + // + box.Clean(); + result = IsValid(); + if (!result) + { + return result; + } + + // + box.to = to; + box.dir = dir; + box.from = from; + box.upper = upper; + box.lower = lower; + box.symbol = symbol; + box.period = period; + box.type = signaller; + + // + result = box.IsValid(); + if (!result) + { + box.Clean(); + } + + // + return result; + } + /** * Unique Identifier ... *