Skip to content

Commit

Permalink
1.091
Browse files Browse the repository at this point in the history
Fixed a compatibility issue with newer builds of MT5.
  • Loading branch information
EarnForex committed Jun 9, 2023
1 parent 70c0b7d commit 12a503e
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 32 deletions.
10 changes: 5 additions & 5 deletions MQL4/Experts/Account Protector/Account Protector.mq4
Original file line number Diff line number Diff line change
@@ -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."
Expand All @@ -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?
Expand Down Expand Up @@ -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));
Expand Down
8 changes: 4 additions & 4 deletions MQL4/Experts/Account Protector/Account Protector.mqh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//+------------------------------------------------------------------+
//| Account Protector.mqh |
//| Copyright © 2017-2022, EarnForex.com |
//| Copyright © 2017-2023, EarnForex.com |
//| https://www.earnforex.com/ |
//+------------------------------------------------------------------+
#include "Defines.mqh"
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
8 changes: 1 addition & 7 deletions MQL4/Experts/Account Protector/Defines.mqh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//+------------------------------------------------------------------+
//| Defines.mqh |
//| Copyright © 2017-2022, EarnForex.com |
//| Copyright © 2017-2023, EarnForex.com |
//| https://www.earnforex.com/ |
//+------------------------------------------------------------------+
#include <Controls\Button.mqh>
Expand All @@ -16,12 +16,6 @@

#define LOG_TIMER_VALUE_WRONG "Timer value is wrong. Time format: HH:MM."

enum Enable
{
No,
Yes
};

enum TABS
{
MainTab,
Expand Down
10 changes: 5 additions & 5 deletions MQL5/Experts/Account Protector/Account Protector.mq5
Original file line number Diff line number Diff line change
@@ -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."
Expand All @@ -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?
Expand Down Expand Up @@ -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));
Expand Down
8 changes: 4 additions & 4 deletions MQL5/Experts/Account Protector/Account Protector.mqh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//+------------------------------------------------------------------+
//| Account Protector.mqh |
//| Copyright © 2017-2022, EarnForex.com |
//| Copyright © 2017-2023, EarnForex.com |
//| https://www.earnforex.com/ |
//+------------------------------------------------------------------+
#include "Defines.mqh"
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
8 changes: 1 addition & 7 deletions MQL5/Experts/Account Protector/Defines.mqh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//+------------------------------------------------------------------+
//| Defines.mqh |
//| Copyright © 2017-2022, EarnForex.com |
//| Copyright © 2017-2023, EarnForex.com |
//| https://www.earnforex.com/ |
//+------------------------------------------------------------------+
#include <Controls\Button.mqh>
Expand All @@ -16,12 +16,6 @@

#define LOG_TIMER_VALUE_WRONG "Timer value is wrong. Time format: HH:MM."

enum Enable
{
No,
Yes
};

enum TABS
{
MainTab,
Expand Down

0 comments on commit 12a503e

Please sign in to comment.