Skip to content

Commit 70c0b7d

Browse files
author
EarnForex
authored
1.09
1. Breakeven distance can now be set in currency in addition to points. 2. Equity and margin snapshots can now be made global. 3. Timer can now be made persistent. 4. 'Close all other charts' action. 5. Faster closing of open trades when no filters are selected. 6. Fixed a zero divide issue. 7. Fixed margin level triggering when no trades were open. 8. Fixed a bug with the panel's failure to remember the current tab. 9. Fixed a non-critical error with ArraySort() calls. 10. Added a clarification that the daily % profit/loss conditions are based on the account balance.
1 parent b3c3f53 commit 70c0b7d

File tree

6 files changed

+461
-107
lines changed

6 files changed

+461
-107
lines changed

MQL4/Experts/Account Protector/Account Protector.mq4

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
//+------------------------------------------------------------------+
66
#property copyright "EarnForex.com"
77
#property link "https://www.earnforex.com/metatrader-expert-advisors/Account-Protector/"
8-
#property version "1.08"
9-
string Version = "1.08";
8+
#property version "1.09"
9+
string Version = "1.09";
1010
#property strict
1111

1212
#property description "Protects account balance by applying given actions when set conditions trigger."
@@ -22,6 +22,7 @@ input bool PanelOnTopOfChart = true; // PanelOnTopOfChart: Draw chart as backgro
2222
input bool DoNotDisableConditions = false; // DoNotDisableConditions: Don't disable conditions on trigger?
2323
input bool DoNotDisableActions = false; // DoNotDisableActions: Don't disable actions on trigger?
2424
input bool DoNotDisableEquityTS = false; // DoNotDisableEquityTS: Don't disable equity TS on trigger?
25+
input bool DoNotDisableTimer = false; // DoNotDisableTimer: Don't disable timer on trigger?
2526
input bool AlertOnEquityTS = false; // AlertOnEquityTS: Alert when equity trailing stop triggers?
2627
input bool DisableFloatLossRisePerc = false; // Disable floating loss rises % condition.
2728
input bool DisableFloatLossFallPerc = true; // Disable floating loss falls % condition.
@@ -54,6 +55,8 @@ input bool UseTotalVolume = false; // UseTotalVolume: enable if trading with man
5455
input double AdditionalFunds = 0; // AdditionalFunds: Added to balance, equity, and free margin.
5556
input string Instruments = ""; // Instruments: Default list of trading instruments for order filtering.
5657
input bool CloseMostDistantFirst = false; // CloseMostDistantFirst: Close most distant trades first?
58+
input bool BreakEvenProfitInCurrencyUnits = false; // BreakEvenProfitInCurrencyUnits: currency instead of points.
59+
input bool GlobalSnapshots = false; // GlobalSnapshots: AP instances share equity & margin snapshots.
5760

5861
CAccountProtector ExtDialog;
5962

@@ -71,12 +74,14 @@ int OnInit()
7174
sets.Timer = TimeToString(TimeCurrent() - 7200, TIME_MINUTES);
7275
sets.TimeLeft = "";
7376
sets.intTimeType = 0;
77+
sets.dtTimerLastTriggerTime = 0;
7478
sets.boolTrailingStart = false;
7579
sets.intTrailingStart = 0;
7680
sets.boolTrailingStep = false;
7781
sets.intTrailingStep = 0;
7882
sets.boolBreakEven = false;
7983
sets.intBreakEven = 0;
84+
sets.doubleBreakEven = 0;
8085
sets.boolBreakEvenExtra = false;
8186
sets.intBreakEvenExtra = 0;
8287
sets.boolEquityTrailingStop = false;
@@ -86,6 +91,11 @@ int OnInit()
8691
sets.SnapEquityTime = TimeToString(TimeCurrent(), TIME_DATE | TIME_MINUTES | TIME_SECONDS);
8792
sets.SnapMargin = AccountInfoDouble(ACCOUNT_MARGIN_FREE) + AdditionalFunds;
8893
sets.SnapMarginTime = TimeToString(TimeCurrent(), TIME_DATE | TIME_MINUTES | TIME_SECONDS);
94+
if (GlobalSnapshots)
95+
{
96+
SaveGlobalEquitySnapshots();
97+
SaveGlobalMarginSnapshots();
98+
}
8999
sets.OrderCommentary = "";
90100
sets.intOrderCommentaryCondition = 0;
91101
sets.MagicNumbers = "";
@@ -173,6 +183,7 @@ int OnInit()
173183
sets.DisAuto = false;
174184
sets.EnableAuto = false;
175185
sets.RecaptureSnapshots = false;
186+
sets.CloseAllOtherCharts = false;
176187
sets.SelectedTab = MainTab;
177188

178189
ExtDialog.SilentLogging = true;

0 commit comments

Comments
 (0)