Skip to content

Commit 12a503e

Browse files
author
EarnForex
authored
1.091
Fixed a compatibility issue with newer builds of MT5.
1 parent 70c0b7d commit 12a503e

File tree

6 files changed

+20
-32
lines changed

6 files changed

+20
-32
lines changed

MQL4/Experts/Account Protector/Account Protector.mq4

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
//+------------------------------------------------------------------+
22
//| Account Protector.mq4 |
3-
//| Copyright © 2017-2022, EarnForex.com |
3+
//| Copyright © 2017-2023, EarnForex.com |
44
//| https://www.earnforex.com/ |
55
//+------------------------------------------------------------------+
66
#property copyright "EarnForex.com"
77
#property link "https://www.earnforex.com/metatrader-expert-advisors/Account-Protector/"
8-
#property version "1.09"
9-
string Version = "1.09";
8+
#property version "1.091"
9+
string Version = "1.091";
1010
#property strict
1111

1212
#property description "Protects account balance by applying given actions when set conditions trigger."
@@ -17,7 +17,7 @@ string Version = "1.09";
1717

1818
input int Slippage = 2; // Slippage
1919
input string LogFileName = "log.txt"; // Log file name
20-
input Enable EnableEmergencyButton = No; // Enable emergency button
20+
input bool EnableEmergencyButton = false; // Enable emergency button
2121
input bool PanelOnTopOfChart = true; // PanelOnTopOfChart: Draw chart as background?
2222
input bool DoNotDisableConditions = false; // DoNotDisableConditions: Don't disable conditions on trigger?
2323
input bool DoNotDisableActions = false; // DoNotDisableActions: Don't disable actions on trigger?
@@ -207,7 +207,7 @@ int OnInit()
207207
decimal_places = 2;
208208
}
209209
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);
210-
ExtDialog.Logging("Enable Emergency Button = " + EnumToString((Enable)EnableEmergencyButton));
210+
ExtDialog.Logging("Enable Emergency Button = " + IntegerToString(EnableEmergencyButton));
211211
ExtDialog.Logging("DelayOrderClose = " + IntegerToString(DelayOrderClose));
212212
ExtDialog.Logging("UseTotalVolume = " + IntegerToString(UseTotalVolume));
213213
ExtDialog.Logging("AdditionalBalance = " + DoubleToString(AdditionalFunds, 2));

MQL4/Experts/Account Protector/Account Protector.mqh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//+------------------------------------------------------------------+
22
//| Account Protector.mqh |
3-
//| Copyright © 2017-2022, EarnForex.com |
3+
//| Copyright © 2017-2023, EarnForex.com |
44
//| https://www.earnforex.com/ |
55
//+------------------------------------------------------------------+
66
#include "Defines.mqh"
@@ -624,7 +624,7 @@ bool CAccountProtector::CreateObjects()
624624
y += element_height + v_spacing;
625625
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;
626626
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;
627-
if (EnableEmergencyButton == Yes)
627+
if (EnableEmergencyButton)
628628
{
629629
y += element_height + 3 * v_spacing;
630630
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()
988988
m_LblSnapMargin.Move(m_LblSnapMargin.Left(), ref_point + 2 * col_height);
989989
m_BtnNewSnapEquity.Move(m_BtnNewSnapEquity.Left(), ref_point + 3 * col_height);
990990
m_BtnNewSnapMargin.Move(m_BtnNewSnapMargin.Left(), ref_point + 3 * col_height);
991-
if (EnableEmergencyButton == Yes)
991+
if (EnableEmergencyButton)
992992
{
993993
m_BtnEmergency.Move(m_BtnEmergency.Left(), ref_point + 4 * col_height);
994994
ref_point = m_BtnEmergency.Top() + (int)MathRound(30 * m_DPIScale);
@@ -4215,7 +4215,7 @@ void CAccountProtector::Logging_Current_Settings()
42154215
{
42164216
SilentLogging = true;
42174217
Logging("Logging Current Parameters:");
4218-
Logging("EnableEmergencyButton = " + EnumToString((Enable)EnableEmergencyButton));
4218+
Logging("EnableEmergencyButton = " + IntegerToString(EnableEmergencyButton));
42194219
Logging("sets.CountCommSwaps = " + (string)sets.CountCommSwaps);
42204220
Logging("sets.UseTimer = " + (string)sets.UseTimer);
42214221
Logging("sets.Timer = " + sets.Timer);

MQL4/Experts/Account Protector/Defines.mqh

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//+------------------------------------------------------------------+
22
//| Defines.mqh |
3-
//| Copyright © 2017-2022, EarnForex.com |
3+
//| Copyright © 2017-2023, EarnForex.com |
44
//| https://www.earnforex.com/ |
55
//+------------------------------------------------------------------+
66
#include <Controls\Button.mqh>
@@ -16,12 +16,6 @@
1616

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

19-
enum Enable
20-
{
21-
No,
22-
Yes
23-
};
24-
2519
enum TABS
2620
{
2721
MainTab,

MQL5/Experts/Account Protector/Account Protector.mq5

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
//+------------------------------------------------------------------+
22
//| Account Protector.mq5 |
3-
//| Copyright © 2017-2022, EarnForex.com |
3+
//| Copyright © 2017-2023, EarnForex.com |
44
//| https://www.earnforex.com/ |
55
//+------------------------------------------------------------------+
66
#property copyright "EarnForex.com"
77
#property link "https://www.earnforex.com/metatrader-expert-advisors/Account-Protector/"
8-
#property version "1.09"
9-
string Version = "1.09";
8+
#property version "1.091"
9+
string Version = "1.091";
1010
#property strict
1111

1212
#property description "Protects account balance by applying given actions when set conditions trigger."
@@ -17,7 +17,7 @@ string Version = "1.09";
1717

1818
input int Slippage = 2; // Slippage
1919
input string LogFileName = "log.txt"; // Log file name
20-
input Enable EnableEmergencyButton = No; // Enable emergency button
20+
input bool EnableEmergencyButton = false; // Enable emergency button
2121
input bool PanelOnTopOfChart = true; // PanelOnTopOfChart: Draw chart as background?
2222
input bool DoNotDisableConditions = false; // DoNotDisableConditions: Don't disable conditions on trigger?
2323
input bool DoNotDisableActions = false; // DoNotDisableActions: Don't disable actions on trigger?
@@ -209,7 +209,7 @@ int OnInit()
209209
decimal_places = ExtDialog.AccountCurrencyDigits;
210210
}
211211
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);
212-
ExtDialog.Logging("Enable Emergency Button = " + EnumToString((Enable)EnableEmergencyButton));
212+
ExtDialog.Logging("Enable Emergency Button = " + IntegerToString(EnableEmergencyButton));
213213
ExtDialog.Logging("DelayOrderClose = " + IntegerToString(DelayOrderClose));
214214
ExtDialog.Logging("UseTotalVolume = " + IntegerToString(UseTotalVolume));
215215
ExtDialog.Logging("AdditionalBalance = " + DoubleToString(AdditionalFunds, ExtDialog.AccountCurrencyDigits));

MQL5/Experts/Account Protector/Account Protector.mqh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//+------------------------------------------------------------------+
22
//| Account Protector.mqh |
3-
//| Copyright © 2017-2022, EarnForex.com |
3+
//| Copyright © 2017-2023, EarnForex.com |
44
//| https://www.earnforex.com/ |
55
//+------------------------------------------------------------------+
66
#include "Defines.mqh"
@@ -627,7 +627,7 @@ bool CAccountProtector::CreateObjects()
627627
y += element_height + v_spacing;
628628
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;
629629
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;
630-
if (EnableEmergencyButton == Yes)
630+
if (EnableEmergencyButton)
631631
{
632632
y += element_height + 3 * v_spacing;
633633
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()
990990
m_LblSnapMargin.Move(m_LblSnapMargin.Left(), ref_point + 2 * col_height);
991991
m_BtnNewSnapEquity.Move(m_BtnNewSnapEquity.Left(), ref_point + 3 * col_height);
992992
m_BtnNewSnapMargin.Move(m_BtnNewSnapMargin.Left(), ref_point + 3 * col_height);
993-
if (EnableEmergencyButton == Yes)
993+
if (EnableEmergencyButton)
994994
{
995995
m_BtnEmergency.Move(m_BtnEmergency.Left(), ref_point + 4 * col_height);
996996
ref_point = m_BtnEmergency.Top() + (int)MathRound(30 * m_DPIScale);
@@ -4294,7 +4294,7 @@ void CAccountProtector::Logging_Current_Settings()
42944294
{
42954295
SilentLogging = true;
42964296
Logging("Logging Current Parameters:");
4297-
Logging("EnableEmergencyButton = " + EnumToString((Enable)EnableEmergencyButton));
4297+
Logging("EnableEmergencyButton = " + IntegerToString(EnableEmergencyButton));
42984298
Logging("sets.CountCommSwaps = " + (string)sets.CountCommSwaps);
42994299
Logging("sets.UseTimer = " + (string)sets.UseTimer);
43004300
Logging("sets.Timer = " + sets.Timer);

MQL5/Experts/Account Protector/Defines.mqh

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//+------------------------------------------------------------------+
22
//| Defines.mqh |
3-
//| Copyright © 2017-2022, EarnForex.com |
3+
//| Copyright © 2017-2023, EarnForex.com |
44
//| https://www.earnforex.com/ |
55
//+------------------------------------------------------------------+
66
#include <Controls\Button.mqh>
@@ -16,12 +16,6 @@
1616

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

19-
enum Enable
20-
{
21-
No,
22-
Yes
23-
};
24-
2519
enum TABS
2620
{
2721
MainTab,

0 commit comments

Comments
 (0)