From f726043c5686fb95d632cd8b115b6dae82ac4cd2 Mon Sep 17 00:00:00 2001 From: Hadi Khazaee Asl Date: Wed, 4 Jun 2025 03:51:34 +0330 Subject: [PATCH] last ... --- XCATBEA/Classes/xcatbea.signaller.class.mq5 | 124 +++++++++++++++++++- XCATBEA/Libraries/xcatbea.signaller.lib.mq5 | 2 +- 2 files changed, 123 insertions(+), 3 deletions(-) diff --git a/XCATBEA/Classes/xcatbea.signaller.class.mq5 b/XCATBEA/Classes/xcatbea.signaller.class.mq5 index 551c37c4..4f27493e 100644 --- a/XCATBEA/Classes/xcatbea.signaller.class.mq5 +++ b/XCATBEA/Classes/xcatbea.signaller.class.mq5 @@ -554,6 +554,7 @@ class XCXCATBEASignaller : XCBase helper.Update(barIndex); // + bool has = false; datetime cTime = TimeCurrent(); // @@ -746,7 +747,86 @@ class XCXCATBEASignaller : XCBase if (result) { // - // Filling Conditions of Strategy ... + // Use Signal Zone ... + UseBox(mConditions.pivotZone); + + // + // Prepare Condition ... + + // + // Prepare Signal ... + mConditions.dir = + mConditions + .pivotZone + .dir; + mConditions.symbol = symbol; + mConditions.period = period; + mConditions.provider = provider; + mConditions.reward = riskToRewardRatio; + mConditions.time = mConditions.conditions.bars[0].time; + mConditions.setupTime = mConditions.conditions.bars[0].time; + + // + // Prepare Target ... + double targets[]; + for (int i = 1; i <= riskToRewardRatio; i++) + { + // + Add( + (double)i, + targets // + ); + } + + // + // Calculate SL Additions ... + double iATR = 0; + if (barIndex > 0 && + barIndex < ArraySize(helper.atrBuffer)) + { + iATR = helper.atrBuffer[barIndex]; + } + double slAdditional = slATRMultiplier * iATR; + + // + // Preparing Signal ... + XSignal iSignal; + result = ToSignal( + mConditions.pivotZone, + iSignal, + targets, + slAdditional // + ); + if (result) + { + // + mConditions.sl = iSignal.sl; + mConditions.tp = iSignal.tp; + mConditions.pivot = iSignal.sl; + mConditions.entry = iSignal.entry; + mConditions.point = iSignal.entry; + mConditions.type = ToPositionType(iSignal.type); + + // + // Draw Trigger Block ... + if (allowDraws) + { + // + XCBoxObject *iObj; + has = drawer + .drawer + .DrawBox( + mConditions.pivotZone, + iObj // + ); + if (has) + { + mObjects.Add(iObj); + } + ZeroMemory(iObj); + } + } + iSignal.Clean(); } } @@ -1395,9 +1475,15 @@ class XCXCATBEASignaller : XCBase } // + bool has = false; + datetime cTime = TimeCurrent(); bool isBullish = IsBullish(conditions.dir); bool isBearish = IsBearish(conditions.dir); + // + bool isBasedOnPivotZone = conditions.pivotZone.IsValid(); + bool isBasedOnTriggerBlock = conditions.triggerBlock.IsValid(); + // // Validate Direction of Setuped Conditions ... result = @@ -1408,7 +1494,7 @@ class XCXCATBEASignaller : XCBase // // Do Triggering Senario based on Trigger Block ... if (result && - conditions.triggerBlock.IsValid()) + isBasedOnTriggerBlock) { // // Checking Score ... @@ -1433,6 +1519,32 @@ class XCXCATBEASignaller : XCBase } } + // + // Do Triggering based on Market Conditions PivotZones ... + if (result && + isBasedOnPivotZone) + { + // + // Update Box To ... + conditions.pivotZone.to = cTime; + + // + // Draw Box ... + XCBoxObject *iObj; + has = drawer + .drawer + .DrawBox( + conditions.pivotZone, + iObj // + ); + if (has) + { + mObjects.Add(iObj); + } + + // + } + // // Do Other Validation Senarios ... @@ -1445,6 +1557,14 @@ class XCXCATBEASignaller : XCBase // Check Setup Age or Setup Validations here ... if (!result) { + // + // Validate Trigger Block Based Setups ... + + // + // Validate Pivot Zone Based Setups ... + + // + // Validate Setup Age ... } // diff --git a/XCATBEA/Libraries/xcatbea.signaller.lib.mq5 b/XCATBEA/Libraries/xcatbea.signaller.lib.mq5 index cdf33be0..6792e6b7 100644 --- a/XCATBEA/Libraries/xcatbea.signaller.lib.mq5 +++ b/XCATBEA/Libraries/xcatbea.signaller.lib.mq5 @@ -1379,7 +1379,7 @@ bool DetectSignalZone( // Print("Conditions ..."); - signalZone.Clean(); + // signalZone.Clean(); } //