From 12a503e166feb1a025108c44f733c21db061f629 Mon Sep 17 00:00:00 2001 From: EarnForex <48102957+EarnForex@users.noreply.github.com> Date: Fri, 9 Jun 2023 12:25:27 +0200 Subject: [PATCH] 1.091 Fixed a compatibility issue with newer builds of MT5. --- MQL4/Experts/Account Protector/Account Protector.mq4 | 10 +++++----- MQL4/Experts/Account Protector/Account Protector.mqh | 8 ++++---- MQL4/Experts/Account Protector/Defines.mqh | 8 +------- MQL5/Experts/Account Protector/Account Protector.mq5 | 10 +++++----- MQL5/Experts/Account Protector/Account Protector.mqh | 8 ++++---- MQL5/Experts/Account Protector/Defines.mqh | 8 +------- 6 files changed, 20 insertions(+), 32 deletions(-) diff --git a/MQL4/Experts/Account Protector/Account Protector.mq4 b/MQL4/Experts/Account Protector/Account Protector.mq4 index 3406604..a83e2ba 100644 --- a/MQL4/Experts/Account Protector/Account Protector.mq4 +++ b/MQL4/Experts/Account Protector/Account Protector.mq4 @@ -1,12 +1,12 @@ //+------------------------------------------------------------------+ //| Account Protector.mq4 | -//| Copyright © 2017-2022, EarnForex.com | +//| Copyright © 2017-2023, EarnForex.com | //| https://www.earnforex.com/ | //+------------------------------------------------------------------+ #property copyright "EarnForex.com" #property link "https://www.earnforex.com/metatrader-expert-advisors/Account-Protector/" -#property version "1.09" -string Version = "1.09"; +#property version "1.091" +string Version = "1.091"; #property strict #property description "Protects account balance by applying given actions when set conditions trigger." @@ -17,7 +17,7 @@ string Version = "1.09"; input int Slippage = 2; // Slippage input string LogFileName = "log.txt"; // Log file name -input Enable EnableEmergencyButton = No; // Enable emergency button +input bool EnableEmergencyButton = false; // Enable emergency button input bool PanelOnTopOfChart = true; // PanelOnTopOfChart: Draw chart as background? input bool DoNotDisableConditions = false; // DoNotDisableConditions: Don't disable conditions on trigger? input bool DoNotDisableActions = false; // DoNotDisableActions: Don't disable actions on trigger? @@ -207,7 +207,7 @@ int OnInit() decimal_places = 2; } ExtDialog.Logging("Account Margin Call Level = " + DoubleToString(AccountInfoDouble(ACCOUNT_MARGIN_SO_CALL), decimal_places) + units + ", Account Margin Stopout Level = " + DoubleToString(AccountInfoDouble(ACCOUNT_MARGIN_SO_SO), decimal_places) + units); - ExtDialog.Logging("Enable Emergency Button = " + EnumToString((Enable)EnableEmergencyButton)); + ExtDialog.Logging("Enable Emergency Button = " + IntegerToString(EnableEmergencyButton)); ExtDialog.Logging("DelayOrderClose = " + IntegerToString(DelayOrderClose)); ExtDialog.Logging("UseTotalVolume = " + IntegerToString(UseTotalVolume)); ExtDialog.Logging("AdditionalBalance = " + DoubleToString(AdditionalFunds, 2)); diff --git a/MQL4/Experts/Account Protector/Account Protector.mqh b/MQL4/Experts/Account Protector/Account Protector.mqh index 5cad980..a989a42 100644 --- a/MQL4/Experts/Account Protector/Account Protector.mqh +++ b/MQL4/Experts/Account Protector/Account Protector.mqh @@ -1,6 +1,6 @@ //+------------------------------------------------------------------+ //| Account Protector.mqh | -//| Copyright © 2017-2022, EarnForex.com | +//| Copyright © 2017-2023, EarnForex.com | //| https://www.earnforex.com/ | //+------------------------------------------------------------------+ #include "Defines.mqh" @@ -624,7 +624,7 @@ bool CAccountProtector::CreateObjects() y += element_height + v_spacing; if (!ButtonCreate(m_BtnNewSnapEquity, first_column_start, y, first_column_start + snap_button_width, y + element_height, "m_BtnNewSnapEquity", "New snapshot of equity")) return false; if (!ButtonCreate(m_BtnNewSnapMargin, first_column_start + snap_button_width + h_spacing, y, panel_farther_end, y + element_height, "m_BtnNewSnapMargin", "New snapshot of free margin")) return false; - if (EnableEmergencyButton == Yes) + if (EnableEmergencyButton) { y += element_height + 3 * v_spacing; if (!ButtonCreate(m_BtnEmergency, first_column_start, y, panel_farther_end, y + (int)(element_height * 2.5), "m_BtnEmergency", "Emergency button")) return false; @@ -988,7 +988,7 @@ void CAccountProtector::MoveAndResize() m_LblSnapMargin.Move(m_LblSnapMargin.Left(), ref_point + 2 * col_height); m_BtnNewSnapEquity.Move(m_BtnNewSnapEquity.Left(), ref_point + 3 * col_height); m_BtnNewSnapMargin.Move(m_BtnNewSnapMargin.Left(), ref_point + 3 * col_height); - if (EnableEmergencyButton == Yes) + if (EnableEmergencyButton) { m_BtnEmergency.Move(m_BtnEmergency.Left(), ref_point + 4 * col_height); ref_point = m_BtnEmergency.Top() + (int)MathRound(30 * m_DPIScale); @@ -4215,7 +4215,7 @@ void CAccountProtector::Logging_Current_Settings() { SilentLogging = true; Logging("Logging Current Parameters:"); - Logging("EnableEmergencyButton = " + EnumToString((Enable)EnableEmergencyButton)); + Logging("EnableEmergencyButton = " + IntegerToString(EnableEmergencyButton)); Logging("sets.CountCommSwaps = " + (string)sets.CountCommSwaps); Logging("sets.UseTimer = " + (string)sets.UseTimer); Logging("sets.Timer = " + sets.Timer); diff --git a/MQL4/Experts/Account Protector/Defines.mqh b/MQL4/Experts/Account Protector/Defines.mqh index 1906a3b..0203078 100644 --- a/MQL4/Experts/Account Protector/Defines.mqh +++ b/MQL4/Experts/Account Protector/Defines.mqh @@ -1,6 +1,6 @@ //+------------------------------------------------------------------+ //| Defines.mqh | -//| Copyright © 2017-2022, EarnForex.com | +//| Copyright © 2017-2023, EarnForex.com | //| https://www.earnforex.com/ | //+------------------------------------------------------------------+ #include @@ -16,12 +16,6 @@ #define LOG_TIMER_VALUE_WRONG "Timer value is wrong. Time format: HH:MM." -enum Enable -{ - No, - Yes -}; - enum TABS { MainTab, diff --git a/MQL5/Experts/Account Protector/Account Protector.mq5 b/MQL5/Experts/Account Protector/Account Protector.mq5 index 6c2f024..f442f72 100644 --- a/MQL5/Experts/Account Protector/Account Protector.mq5 +++ b/MQL5/Experts/Account Protector/Account Protector.mq5 @@ -1,12 +1,12 @@ //+------------------------------------------------------------------+ //| Account Protector.mq5 | -//| Copyright © 2017-2022, EarnForex.com | +//| Copyright © 2017-2023, EarnForex.com | //| https://www.earnforex.com/ | //+------------------------------------------------------------------+ #property copyright "EarnForex.com" #property link "https://www.earnforex.com/metatrader-expert-advisors/Account-Protector/" -#property version "1.09" -string Version = "1.09"; +#property version "1.091" +string Version = "1.091"; #property strict #property description "Protects account balance by applying given actions when set conditions trigger." @@ -17,7 +17,7 @@ string Version = "1.09"; input int Slippage = 2; // Slippage input string LogFileName = "log.txt"; // Log file name -input Enable EnableEmergencyButton = No; // Enable emergency button +input bool EnableEmergencyButton = false; // Enable emergency button input bool PanelOnTopOfChart = true; // PanelOnTopOfChart: Draw chart as background? input bool DoNotDisableConditions = false; // DoNotDisableConditions: Don't disable conditions on trigger? input bool DoNotDisableActions = false; // DoNotDisableActions: Don't disable actions on trigger? @@ -209,7 +209,7 @@ int OnInit() decimal_places = ExtDialog.AccountCurrencyDigits; } ExtDialog.Logging("Account Margin Call Level = " + DoubleToString(AccountInfoDouble(ACCOUNT_MARGIN_SO_CALL), decimal_places) + units + ", Account Margin Stopout Level = " + DoubleToString(AccountInfoDouble(ACCOUNT_MARGIN_SO_SO), decimal_places) + units); - ExtDialog.Logging("Enable Emergency Button = " + EnumToString((Enable)EnableEmergencyButton)); + ExtDialog.Logging("Enable Emergency Button = " + IntegerToString(EnableEmergencyButton)); ExtDialog.Logging("DelayOrderClose = " + IntegerToString(DelayOrderClose)); ExtDialog.Logging("UseTotalVolume = " + IntegerToString(UseTotalVolume)); ExtDialog.Logging("AdditionalBalance = " + DoubleToString(AdditionalFunds, ExtDialog.AccountCurrencyDigits)); diff --git a/MQL5/Experts/Account Protector/Account Protector.mqh b/MQL5/Experts/Account Protector/Account Protector.mqh index 75f96b0..302cc20 100644 --- a/MQL5/Experts/Account Protector/Account Protector.mqh +++ b/MQL5/Experts/Account Protector/Account Protector.mqh @@ -1,6 +1,6 @@ //+------------------------------------------------------------------+ //| Account Protector.mqh | -//| Copyright © 2017-2022, EarnForex.com | +//| Copyright © 2017-2023, EarnForex.com | //| https://www.earnforex.com/ | //+------------------------------------------------------------------+ #include "Defines.mqh" @@ -627,7 +627,7 @@ bool CAccountProtector::CreateObjects() y += element_height + v_spacing; if (!ButtonCreate(m_BtnNewSnapEquity, first_column_start, y, first_column_start + snap_button_width, y + element_height, "m_BtnNewSnapEquity", "New snapshot of equity")) return false; if (!ButtonCreate(m_BtnNewSnapMargin, first_column_start + snap_button_width + h_spacing, y, panel_farther_end, y + element_height, "m_BtnNewSnapMargin", "New snapshot of free margin")) return false; - if (EnableEmergencyButton == Yes) + if (EnableEmergencyButton) { y += element_height + 3 * v_spacing; if (!ButtonCreate(m_BtnEmergency, first_column_start, y, panel_farther_end, y + (int)(element_height * 2.5), "m_BtnEmergency", "Emergency button")) return false; @@ -990,7 +990,7 @@ void CAccountProtector::MoveAndResize() m_LblSnapMargin.Move(m_LblSnapMargin.Left(), ref_point + 2 * col_height); m_BtnNewSnapEquity.Move(m_BtnNewSnapEquity.Left(), ref_point + 3 * col_height); m_BtnNewSnapMargin.Move(m_BtnNewSnapMargin.Left(), ref_point + 3 * col_height); - if (EnableEmergencyButton == Yes) + if (EnableEmergencyButton) { m_BtnEmergency.Move(m_BtnEmergency.Left(), ref_point + 4 * col_height); ref_point = m_BtnEmergency.Top() + (int)MathRound(30 * m_DPIScale); @@ -4294,7 +4294,7 @@ void CAccountProtector::Logging_Current_Settings() { SilentLogging = true; Logging("Logging Current Parameters:"); - Logging("EnableEmergencyButton = " + EnumToString((Enable)EnableEmergencyButton)); + Logging("EnableEmergencyButton = " + IntegerToString(EnableEmergencyButton)); Logging("sets.CountCommSwaps = " + (string)sets.CountCommSwaps); Logging("sets.UseTimer = " + (string)sets.UseTimer); Logging("sets.Timer = " + sets.Timer); diff --git a/MQL5/Experts/Account Protector/Defines.mqh b/MQL5/Experts/Account Protector/Defines.mqh index 6d058bb..0e3096d 100644 --- a/MQL5/Experts/Account Protector/Defines.mqh +++ b/MQL5/Experts/Account Protector/Defines.mqh @@ -1,6 +1,6 @@ //+------------------------------------------------------------------+ //| Defines.mqh | -//| Copyright © 2017-2022, EarnForex.com | +//| Copyright © 2017-2023, EarnForex.com | //| https://www.earnforex.com/ | //+------------------------------------------------------------------+ #include @@ -16,12 +16,6 @@ #define LOG_TIMER_VALUE_WRONG "Timer value is wrong. Time format: HH:MM." -enum Enable -{ - No, - Yes -}; - enum TABS { MainTab,