From 419d697eb846f2cde6572dd5469e78d3d9330921 Mon Sep 17 00:00:00 2001 From: Hadi Khazaee Asl Date: Fri, 21 Mar 2025 03:04:33 +0330 Subject: [PATCH] last ... --- Experts/x-saherelm.x-121.smc.ea.mq5 | 50 +++--- .../x-121.smc.market.cycle.helper.class.mq5 | 156 ++++++++++++++++++ .../Signals/x-121.smc.xwz.signal.class.mq5 | 9 +- .../Signals/x-121.smc.xwz.signal.lib.mq5 | 27 ++- 4 files changed, 209 insertions(+), 33 deletions(-) diff --git a/Experts/x-saherelm.x-121.smc.ea.mq5 b/Experts/x-saherelm.x-121.smc.ea.mq5 index e53bb696..8a7caceb 100644 --- a/Experts/x-saherelm.x-121.smc.ea.mq5 +++ b/Experts/x-saherelm.x-121.smc.ea.mq5 @@ -44,43 +44,43 @@ input string eaSymbols = "EURUSDb,GBPUSDb,USDCHFb,USDJPYb"; // Trading Symbols // // Signalling ... input group "Signalling"; -input bool eaAllowLong = true; // Allow Long Signals -input bool eaAllowShort = true; // Allow Short Signals -input int eaMaxAllowedLongs = 5; // Max Allowed Long Signals -input int eaMaxAllowedShorts = 5; // Max Allowed Short Signals -input bool eaUseMaxAllowedSignalsPerSymbol = true; // Use Max Allowed Signal Types Per Symbol -input double eaLastPositionProfitForAcceptNextInPoint = 30; // Last Position Profit In Points for Accept new Signal -input int eaDelaysBetweenTwoSignalsInBar = 12; // Delay between two Signals in Bars -input double eaMaxAllowedSpread = 25; // Max Allowed Spread for Signalling +input bool eaAllowLong = true; // Allow Long Signals +input bool eaAllowShort = true; // Allow Short Signals +input int eaMaxAllowedLongs = 5; // Max Allowed Long Signals +input int eaMaxAllowedShorts = 5; // Max Allowed Short Signals +input bool eaUseMaxAllowedSignalsPerSymbol = true; // Use Max Allowed Signal Types Per Symbol +input double eaLastPositionProfitForAcceptNextInPoint = 0; // Last Position Profit In Points for Accept new Signal +input int eaDelaysBetweenTwoSignalsInBar = 0; // Delay between two Signals in Bars +input double eaMaxAllowedSpread = 0; // Max Allowed Spread for Signalling // // Trade ... input group "Trade"; -input bool eaAllowTrade = true; // Allow Open Trade On Signals -input string eaStartTradeAt = "02:30"; // Enable Trade on Signals on Time -input string eaStopTradeAt = "23:30"; // Enable Trade on Signals on Time -input string eaCloseAllTradesAt = ""; // Enable Close All Trades on Signals on Time +input bool eaAllowTrade = true; // Allow Open Trade On Signals +input string eaStartTradeAt = ""; // Enable Trade on Signals on Time +input string eaStopTradeAt = ""; // Enable Trade on Signals on Time +input string eaCloseAllTradesAt = ""; // Enable Close All Trades on Signals on Time // // Risk Management ... input group "Risk Management"; -input double eaR2R = 6; // Signallers Risk to Reward Ratio -input double eaVolume = 0; // Static Volume -input double eaStaticBalance = 1000; // Static Balance -input double eaBalancePerTrade = 10; // Balance Used in Each Trade -input double eaRiskPercentPerBalance = 0; // Risk Percent Per Balance in Each Trade -input bool eaDynamicRiskManagement = false; // Dynamic Risk Management -input bool eaUseDynamicVolume = false; // Use Dynamic Volume -input double eaDynamicVolumeStep = 0.01; // Increase Volume Step -input double eaDynamicVolumeBalanceFactor = 200; // Balance Factor for Generate Dynamic Volume -input double eaMaxAllowedDrawdownToOpenTrades = 3; // Max Allowed Drawdown for Open Trades -input int eaMaxAllowedSLToPauseSignallingPerSymbol = 2; // Max Allowed SL for Pause Signalling Per Symbol -input int eaPauseSignallingAfterReachesMaxAllowedSLInSecconds = 86400; // Pause Signalling Per Symbol afte Max Allowed SL Reached In Seconds +input double eaR2R = 6; // Signallers Risk to Reward Ratio +input double eaVolume = 0; // Static Volume +input double eaStaticBalance = 1000; // Static Balance +input double eaBalancePerTrade = 5; // Balance Used in Each Trade +input double eaRiskPercentPerBalance = 0; // Risk Percent Per Balance in Each Trade +input bool eaDynamicRiskManagement = false; // Dynamic Risk Management +input bool eaUseDynamicVolume = false; // Use Dynamic Volume +input double eaDynamicVolumeStep = 0.01; // Increase Volume Step +input double eaDynamicVolumeBalanceFactor = 200; // Balance Factor for Generate Dynamic Volume +input double eaMaxAllowedDrawdownToOpenTrades = 3; // Max Allowed Drawdown for Open Trades +input int eaMaxAllowedSLToPauseSignallingPerSymbol = 0; // Max Allowed SL for Pause Signalling Per Symbol +input int eaPauseSignallingAfterReachesMaxAllowedSLInSecconds = 0; // Pause Signalling Per Symbol afte Max Allowed SL Reached In Seconds // // Protection ... input group "Protection"; -input bool eaAllowHedging = true; // Allow Hedge Positions +input bool eaAllowHedging = false; // Allow Hedge Positions input int eaMinOpenTradesFroHedging = 4; // Minimum Open Positions for Hedging input double eaHedgingMinVolumeStep = 0.01; // Minimum Volume Step for Hedging input double eaHedgeingMinRequiredProfitPerVolumeStep = 1.0; // Minimum Required Profit Per Volume Step for Hedging 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 5227ff5a..f695bc80 100644 --- a/X121SMCEA/Classes/x-121.smc.market.cycle.helper.class.mq5 +++ b/X121SMCEA/Classes/x-121.smc.market.cycle.helper.class.mq5 @@ -2981,6 +2981,32 @@ struct X121SMCStrategyConditionParser tmpBoxes // ); Clean(tmp); + + // + // Fair Value Gaps ... + ToBox( + cState.bullishFairValueGaps, + tmp // + ); + Copy( + tmp, + tmpBoxes, + false // Ignore Clean ... + ); + Clean(tmp); + + // + // Support Zones ... + ToBox( + cState.supportZones, + tmp // + ); + Copy( + tmp, + tmpBoxes, + false // Ignore Clean ... + ); + Clean(tmp); } else { @@ -2996,6 +3022,32 @@ struct X121SMCStrategyConditionParser tmpBoxes // ); Clean(tmp); + + // + // Fair Value Gaps ... + ToBox( + cState.bearishFairValueGaps, + tmp // + ); + Copy( + tmp, + tmpBoxes, + false // Ignore Clean ... + ); + Clean(tmp); + + // + // Resistance Zones ... + ToBox( + cState.resistanceZones, + tmp // + ); + Copy( + tmp, + tmpBoxes, + false // Ignore Clean ... + ); + Clean(tmp); } // @@ -3445,6 +3497,32 @@ struct X121SMCStrategyConditionParser tmpBoxes // ); Clean(tmp); + + // + // Fair Value Gaps ... + ToBox( + cState.bullishFairValueGaps, + tmp // + ); + Copy( + tmp, + tmpBoxes, + false // Ignore Clean ... + ); + Clean(tmp); + + // + // Support Zones ... + ToBox( + cState.supportZones, + tmp // + ); + Copy( + tmp, + tmpBoxes, + false // Ignore Clean ... + ); + Clean(tmp); } else { @@ -3460,6 +3538,32 @@ struct X121SMCStrategyConditionParser tmpBoxes // ); Clean(tmp); + + // + // Fair Value Gaps ... + ToBox( + cState.bearishFairValueGaps, + tmp // + ); + Copy( + tmp, + tmpBoxes, + false // Ignore Clean ... + ); + Clean(tmp); + + // + // Resistance Zones ... + ToBox( + cState.resistanceZones, + tmp // + ); + Copy( + tmp, + tmpBoxes, + false // Ignore Clean ... + ); + Clean(tmp); } // @@ -3875,6 +3979,32 @@ struct X121SMCStrategyConditionParser tmpBoxes // ); Clean(tmp); + + // + // Fair Value Gaps ... + ToBox( + cState.bullishFairValueGaps, + tmp // + ); + Copy( + tmp, + tmpBoxes, + false // Ignore Clean ... + ); + Clean(tmp); + + // + // Support Zones ... + ToBox( + cState.supportZones, + tmp // + ); + Copy( + tmp, + tmpBoxes, + false // Ignore Clean ... + ); + Clean(tmp); } else { @@ -3890,6 +4020,32 @@ struct X121SMCStrategyConditionParser tmpBoxes // ); Clean(tmp); + + // + // Fair Value Gaps ... + ToBox( + cState.bearishFairValueGaps, + tmp // + ); + Copy( + tmp, + tmpBoxes, + false // Ignore Clean ... + ); + Clean(tmp); + + // + // Resistance Zones ... + ToBox( + cState.resistanceZones, + tmp // + ); + Copy( + tmp, + tmpBoxes, + false // Ignore Clean ... + ); + Clean(tmp); } // diff --git a/X121SMCEA/Signals/x-121.smc.xwz.signal.class.mq5 b/X121SMCEA/Signals/x-121.smc.xwz.signal.class.mq5 index ad614464..405b2984 100644 --- a/X121SMCEA/Signals/x-121.smc.xwz.signal.class.mq5 +++ b/X121SMCEA/Signals/x-121.smc.xwz.signal.class.mq5 @@ -491,7 +491,7 @@ class XCX121SMCXWZSignalDetector : public XCBase // // Fix rf Reward ... - rfRewar = 2; + rfRewar = 1; } else if (signalProvider == X121SMC_XWZ_PROVIDER_XACTIVATED_BOX) { @@ -512,7 +512,7 @@ class XCX121SMCXWZSignalDetector : public XCBase // // Fix rf Reward ... - rfRewar = 2; + rfRewar = 1; } else if (signalProvider == X121SMC_XWZ_PROVIDER_XBREAKED_BOX) { @@ -533,9 +533,12 @@ class XCX121SMCXWZSignalDetector : public XCBase // // Fix rf Reward ... - rfRewar = 2; + rfRewar = 1; } + // + Print("XWZ ", ToString(signalBoxDir), " Signal Provided: ", EnumToString(signalProvider)); + // // Select Condition SL ... diff --git a/X121SMCEA/Signals/x-121.smc.xwz.signal.lib.mq5 b/X121SMCEA/Signals/x-121.smc.xwz.signal.lib.mq5 index a5a8dbb6..5664bc4d 100644 --- a/X121SMCEA/Signals/x-121.smc.xwz.signal.lib.mq5 +++ b/X121SMCEA/Signals/x-121.smc.xwz.signal.lib.mq5 @@ -609,7 +609,6 @@ struct X121SMCStrategyXWZWorkingZone iOB // ); - // has = iOBBox.IsValid(); if (has) @@ -1161,7 +1160,8 @@ struct X121SMCStrategyXWZWorkingZone bool isSenario2Happend = false; bool isSenario2Bullish = false; bool isSenario2Bearish = false; - if (useSenario2) + if (!isSenario1Happend && + useSenario2) { // isSenario2Happend = cParser.HasSenario2Conditions( @@ -1200,7 +1200,9 @@ struct X121SMCStrategyXWZWorkingZone bool isSenario3Happend = false; bool isSenario3Bullish = false; bool isSenario3Bearish = false; - if (useSenario3) + if (!isSenario1Happend && + !isSenario2Happend && + useSenario3) { // isSenario3Happend = cParser.HasSenario3Conditions( @@ -1239,6 +1241,12 @@ struct X121SMCStrategyXWZWorkingZone bool isSenario4Happend = false; bool isSenario4Bullish = false; bool isSenario4Bearish = false; + if (!isSenario1Happend && + !isSenario2Happend && + !isSenario3Happend && + useSenario4) + { + } // // Senario 5: @@ -1248,6 +1256,13 @@ struct X121SMCStrategyXWZWorkingZone bool isSenario5Happend = false; bool isSenario5Bullish = false; bool isSenario5Bearish = false; + if (!isSenario1Happend && + !isSenario2Happend && + !isSenario3Happend && + !isSenario4Happend && + useSenario5) + { + } // // Summarize All Senario(s) Conditions ... @@ -1258,7 +1273,8 @@ struct X121SMCStrategyXWZWorkingZone isSenario1Bullish || isSenario2Bullish || isSenario3Bullish || - isSenario4Bullish + isSenario4Bullish || + isSenario5Bullish // ; @@ -1268,7 +1284,8 @@ struct X121SMCStrategyXWZWorkingZone isSenario1Bearish || isSenario2Bearish || isSenario3Bearish || - isSenario4Bearish + isSenario4Bearish || + isSenario5Bearish // ;