|
1 | 1 | //+------------------------------------------------------------------+
|
2 | 2 | //| Account Protector.mq4 |
|
3 |
| -//| Copyright © 2017-2024, EarnForex.com | |
| 3 | +//| Copyright © 2017-2025, EarnForex.com | |
4 | 4 | //| https://www.earnforex.com/ |
|
5 | 5 | //+------------------------------------------------------------------+
|
6 | 6 | #property copyright "EarnForex.com"
|
7 | 7 | #property link "https://www.earnforex.com/metatrader-expert-advisors/Account-Protector/"
|
8 |
| -#property version "1.11" |
9 |
| -string Version = "1.11"; |
| 8 | +#property version "1.12" |
| 9 | +string Version = "1.12"; |
10 | 10 | #property strict
|
11 | 11 |
|
12 | 12 | #property description "Protects account balance by applying given actions when set conditions trigger."
|
@@ -38,34 +38,48 @@ input bool DisableFloatProfitRisePoints = false; // Disable floating profit rise
|
38 | 38 | input bool DisableFloatProfitFallPoints = true; // Disable floating profit falls points condition.
|
39 | 39 | input bool DisableCurrentPriceGE = true; // Disable current price greater or equal condition.
|
40 | 40 | input bool DisableCurrentPriceLE = true; // Disable current price less or equal condition.
|
| 41 | +input bool DisableEquityUnitsLE = false; // Disable equity less or equal currency units condition. |
| 42 | +input bool DisableEquityUnitsGE = false; // Disable equity greater or equal currency units condition. |
| 43 | +input bool DisableEquityPercLE = false; // Disable equity less or equal % of snapshot condition. |
| 44 | +input bool DisableEquityPercGE = false; // Disable equity greater or equal % of snapshot condition. |
41 | 45 | input bool DisableEquityMinusSnapshot = true; // Disable (Equity - snapshot) greater or equal condition.
|
42 | 46 | input bool DisableSnapshotMinusEquity = true; // Disable (snapshot - Equity) greater or equal condition.
|
| 47 | +input bool DisableMarginUnitsLE = false; // Disable free margin less or equal currency units condition. |
| 48 | +input bool DisableMarginUnitsGE = false; // Disable free margin greater or equal currency units condition. |
| 49 | +input bool DisableMarginPercLE = false; // Disable free margin less or equal % of snapshot condition. |
| 50 | +input bool DisableMarginPercGE = false; // Disable free margin greater or equal % of snapshot condition. |
43 | 51 | input bool DisableMarginLevelGE = true; // Disable margin level greater or equal condition.
|
44 | 52 | input bool DisableMarginLevelLE = true; // Disable margin level less or equal condition.
|
45 | 53 | input bool DisableSpreadGE = true; // Disable spread greater or equal condition.
|
46 | 54 | input bool DisableSpreadLE = true; // Disable spread less or equal condition.
|
47 | 55 | input bool DisableDailyProfitLossUnitsGE = true; // Disable daily profit/loss greater or equal units condition.
|
48 |
| -input bool DisableDailyProfitLossUnitsLE = true; // Disable daily profit/loss level less or equal units condition. |
| 56 | +input bool DisableDailyProfitLossUnitsLE = true; // Disable daily profit/loss less or equal units condition. |
49 | 57 | input bool DisableDailyProfitLossPointsGE = true; // Disable daily profit/loss greater or equal points condition.
|
50 |
| -input bool DisableDailyProfitLossPointsLE = true; // Disable daily profit/loss level less or equal points condition. |
| 58 | +input bool DisableDailyProfitLossPointsLE = true; // Disable daily profit/loss less or equal points condition. |
51 | 59 | input bool DisableDailyProfitLossPercGE = true; // Disable daily profit/loss greater or equal percentage condition.
|
52 |
| -input bool DisableDailyProfitLossPercLE = true; // Disable daily profit/loss level less or equal percentage condition. |
| 60 | +input bool DisableDailyProfitLossPercLE = true; // Disable daily profit/loss less or equal percentage condition. |
53 | 61 | input bool DisableNumberOfPositionsGE = true; // Disable number of positions greater or equal condition.
|
54 | 62 | input bool DisableNumberOfOrdersGE = true; // Disable number of pending orders greater or equal condition.
|
55 | 63 | input bool DisableNumberOfPositionsLE = true; // Disable number of positions less or equal condition.
|
56 | 64 | input bool DisableNumberOfOrdersLE = true; // Disable number of pending orders less or equal condition.
|
| 65 | +input bool DisableBalanceGE = true; // Disable balance greater or equal condition. |
| 66 | +input bool DisableBalanceLE = true; // Disable balance less or equal condition. |
| 67 | +input bool DisableListenToSignal = true; // Disable signal condition. |
| 68 | +input bool WaitForAllConditions = false; // WaitForAllConditions: Only trigger when all conditions are met. |
57 | 69 | input string ____Trading = "";
|
58 | 70 | input int DelayOrderClose = 0; // DelayOrderClose: Delay in milliseconds.
|
59 | 71 | input bool UseTotalVolume = false; // UseTotalVolume: enable if trading with many small trades and partial position closing.
|
60 | 72 | input ENUM_CLOSE_TRADES CloseFirst = ENUM_CLOSE_TRADES_DEFAULT; // CloseFirst: Close which trades first?
|
61 | 73 | input bool BreakEvenProfitInCurrencyUnits = false; // BreakEvenProfitInCurrencyUnits: currency instead of points.
|
62 | 74 | input bool EquityTrailingStopInPercentage = false; // EquityTrailingStopInPercentage: % instead of $.
|
| 75 | +input bool DisableAutoTradingOnTS = false; // DisableAutoTradingOnTS: Disable autotrading on eq. TS trigger. |
63 | 76 | input string ____Miscellaneous = "";
|
64 | 77 | input bool AlertOnEquityTS = false; // AlertOnEquityTS: Alert when equity trailing stop triggers?
|
65 | 78 | input double AdditionalFunds = 0; // AdditionalFunds: Added to balance, equity, and free margin.
|
66 | 79 | input string Instruments = ""; // Instruments: Default list of trading instruments for order filtering.
|
67 | 80 | input bool GlobalSnapshots = false; // GlobalSnapshots: AP instances share equity & margin snapshots.
|
68 | 81 | input int Slippage = 2; // Slippage
|
| 82 | +input bool CloseOtherChartsOnEmergencyButton = false; // Close other charts on emergency button. |
69 | 83 | input string LogFileName = "ap_log.txt"; // Log file name
|
70 | 84 | input string SettingsFileName = ""; // Settings file: Load custom panel settings from \Files\ folder.
|
71 | 85 | input bool Silent = false; // Silent: No log output to the Experts tab.
|
@@ -169,6 +183,9 @@ int OnInit()
|
169 | 183 | sets.boolNumberOfOrdersGE = false;
|
170 | 184 | sets.boolNumberOfPositionsLE = false;
|
171 | 185 | sets.boolNumberOfOrdersLE = false;
|
| 186 | + sets.boolBalanceGE = false; |
| 187 | + sets.boolBalanceLE = false; |
| 188 | + sets.boolListenToSignal = false; |
172 | 189 | sets.doubleLossPerBalance = 0;
|
173 | 190 | sets.doubleLossQuanUnits = 0;
|
174 | 191 | sets.intLossPoints = 0;
|
@@ -207,6 +224,9 @@ int OnInit()
|
207 | 224 | sets.intNumberOfOrdersGE = 0;
|
208 | 225 | sets.intNumberOfPositionsLE = 0;
|
209 | 226 | sets.intNumberOfOrdersLE = 0;
|
| 227 | + sets.doubleBalanceGE = 0; |
| 228 | + sets.doubleBalanceLE = 0; |
| 229 | + sets.intListenToSignal = 0; |
210 | 230 | sets.ClosePos = true;
|
211 | 231 | sets.doubleClosePercentage = 100;
|
212 | 232 | sets.CloseWhichPositions = All;
|
|
0 commit comments