From 0fa788d12667ff7563807e68b875bb949d90db41 Mon Sep 17 00:00:00 2001 From: Hadi Khazaee Asl Date: Wed, 12 Jun 2024 18:38:23 +0330 Subject: [PATCH] last ... --- Classes/x-saherelm.x121.setup.xea.mq5 | 21 +++++++++ Classes/x-saherelm.xtrade.class.mq5 | 63 ++++++--------------------- Experts/x-saherelm.x121.ea.mq5 | 11 ++--- 3 files changed, 40 insertions(+), 55 deletions(-) diff --git a/Classes/x-saherelm.x121.setup.xea.mq5 b/Classes/x-saherelm.x121.setup.xea.mq5 index c9c85405..90099f82 100644 --- a/Classes/x-saherelm.x121.setup.xea.mq5 +++ b/Classes/x-saherelm.x121.setup.xea.mq5 @@ -729,6 +729,26 @@ public: mReuiredSignalVerifications = value; } + // + int MaxAllowedTrades() + { + return mMaxAllowedTrades; + } + + // + void MaxAllowedTrades(int value) + { + // + if (value < 0) + { + value = 0; + } + + // + mMaxAllowedTrades = value; + mTrader.SetMaxAllowedPositions(value); + } + // bool IsEnable() { @@ -1489,6 +1509,7 @@ private: double mSLPoint; // SL Point bool mIgnoreTP; // Ignore Calculated TP bool mIgnoreSL; // Ignore Calculated SL + int mMaxAllowedTrades; // Max Alloed Positions bool mCloseOnOpposit; // Close all Positions on Opposit int mReuiredSignalVerifications; // Required Verifications for Validate Signals diff --git a/Classes/x-saherelm.xtrade.class.mq5 b/Classes/x-saherelm.xtrade.class.mq5 index b2032b82..8302ee54 100644 --- a/Classes/x-saherelm.xtrade.class.mq5 +++ b/Classes/x-saherelm.xtrade.class.mq5 @@ -605,12 +605,6 @@ public: return mMagicNumber; } - // - int GetManageInterval() - { - return mManageInterval; - } - // double GetMaxAllowedSpread() { @@ -623,6 +617,19 @@ public: return mMaxAllowedPositions; } + // + void SetMaxAllowedPositions(int value) + { + // + if (value < 0) + { + value = 0; + } + + // + mMaxAllowedPositions = value; + } + // double GetMaxAllowedDrawdownFactor() { @@ -1062,46 +1069,6 @@ public: return result; } - // - // Manage ... - // this must be Call on OnTick for Manage - // Positions ... - // NOTE: Call this Before Checking IsNewBar ... - void Manage() - { - // // - // // All required Position Managements Actions implemented here ... - // datetime tmc = TimeCurrent(); - // bool canManage = !IsValid(mLastManageOn) - // ? true - // : mLastManageOn + mManageInterval >= tmc; - // if (!canManage) - // { - // return; - // } - - // // - // mLastManageOn = tmc; - - // - // - [] Partial Close; - // - [] Risk Free; - // - [] Trail Stop; - // - [] SLS; - // - [] TPS; - - // - // - [] Data Collector; - // - [] Profit Management; - - // - // TODO: Implement them ... - - // - // Implement Signal Collector Inside this Class - // and Manipulate Signals when SL/TP/Partial Close/Trail Stop/Profit/Close/ Modify and etc Happens ... - } - // // Execute a Signal ... bool ExecuteSignal( @@ -3673,10 +3640,6 @@ private: int mSlippage; // Slippage ... ulong mMagicNumber; // Magic Number (Unique Identifier) ... - // - datetime mLastManageOn; // Last Manager Check - int mManageInterval; // Manager Check Intervals Seconds - // double mMaxAllowedSpread; // Max Allowed Spred for Opening Trades int mMaxAllowedPositions; // Max Allowed Same Positions diff --git a/Experts/x-saherelm.x121.ea.mq5 b/Experts/x-saherelm.x121.ea.mq5 index 94ff0098..a5213f70 100644 --- a/Experts/x-saherelm.x121.ea.mq5 +++ b/Experts/x-saherelm.x121.ea.mq5 @@ -43,15 +43,16 @@ string x121EASymbols = "EURUSDb"; // Symbols // Signals ... bool x121EAAllowLong = true; // Allow Long Trades bool x121EAAllowShort = true; // Allow Short Trades -int x121EAReuiredSignalVerifications = 3; // Required Verifications for Signals +int x121EAReuiredSignalVerifications = 5; // Required Verifications for Signals // // Risk Management ... -double x121EAVolume = 0.01; // Static Volume -double x121EATPPoint = 30; // TP Point -double x121EASLPoint = 300; // SL Point +double x121EAVolume = 0.01; // Static Volume +double x121EATPPoint = 50; // TP Point +double x121EASLPoint = 500; // SL Point +int x121EAMaxAllowedTrades = 1; // Max Allowed Positions bool x121EAIgnoreSL = false; // Ignore Calculated SL -bool x121EAIgnoreTP = false; // Ignore Calculated TP +bool x121EAIgnoreTP = false; // Ignore Calculated TP bool x121EACloseOnOpposit = false; // Close all Positions on Opposit //