Skip to content

Commit 45e7c67

Browse files
author
EarnForex
authored
3.03
1. Added an option to set commission in percentage of the contract's value. 2. Added a possibility to use fractional values for custom leverage and symbol leverage. 3. Added an option to surpass the broker's maximum position with multiple trades (SurpassBrokerMaxPositionSize). 4. Added an option to apply SL/TP to market execution mode trades only after all positions are opened (MarketModeApplySLTPAfterAllTradesExecuted). 5. Added an option to limit maximum total risk per pair or overall. 6. Added support for trade execution when the Position Sizer is attached to a custom symbol in MT5. The actual symbol for trading is set via the TradeSymbol input parameter. 7. Added a warning when broker has tick value set to zero for a Forex trading instrument. 8. Added a hotkey setting (SwitchHideShowLinesHotKey) to hide/show the EA's lines. 9. Added an input parameter (DisableTradingSounds) to disable sounds during trade execution. 10. Added a possibility to use Escape, Tab, Backspace, and Caps Lock keys for panel hotkeys. 11. Added a new hotkey setting (SwitchOrderTypeHotKey) to quickly switch order type. 12. Added quick buttons to modify Entry, Stop-loss, Take-profit, and Stop price values. 13. Added a possibility to add and remove additional take-profits directly on the panel. 14. Added a panel button to quickly populate take-profit volume shares based on three different schemes: equal, descending, ascending. 15. Added the Stop limit line label to show the distance from Entry. 16. Added an option to switch the spread display from points to stop-loss ratio via the ShowSpread input parameter. 17. Added a setting (DisableStopLimit) to disable the Stop limit order type selection when switching via the 'Order type' button. 18. Changed the trading function to check the symbol's execution mode only if the relevant input parameter (IgnoreMarketExecutionMode) is set to false. 19. Changed the 'All symbols' checkbox to apply to 'Max # of trades', 'Max total volume', and 'Max total risk' fields simultaneously. 20. Changed the margin currency display to switch to the currency pair's base currency when conversion to the account currency is impossible. 21. Changed the 'Ignore orders without stop-loss/take-profit' checkbox to two separate checkboxes: 'Ignore orders without stop-loss' and 'Ignore orders without take-profit'. 22. Fixed the algorithm for trading volume distribution between multiple TP trades on trade execution. 23. Fixed a bug that would cause stop-loss to sometimes reset to zero. 24. Fixed a bug that was causing some panel edit values to reset to previous value after changing them. 25. Fixed a bug that resulted in a failing trade execution following a switch from a currency pair with Stop Limit order type to another pair. 26. Fixed a bug that caused the open trade's commentary to be "PS EA" despite empty the empty Order commentary field. 27. Fixed a bug that caused wrong values in volume shares after changing the TakeProfitsNumber input parameter. 28. Fixed a bug that resulted in the take-profit line not disappearing even after setting TP to zero. 29. Fixed the ATR timeframe button to remain in the Current state when the default ATR timeframe is set to Current. 30. Fixed a bug that would sometimes cause SL/TP lines to snap back when dragging them in the ATR mode. 31. Fixed a bug that would deselect SL/TP/Entry lines on chart template change. 32. Fixed a bug with lines re-appearing on platform profile change even if the 'Hide lines' button was pressed. 33. Fixed rounding issues with the risk value in the additional stop-loss label. 34. Fixed a bug with incorrect processing of the situation when Stop-loss is equal to Entry. 35. Fixed the default PositionSize input parameter to make it override the percentage Risk setting. 36. Fixed incorrect volume calculation that could sometimes occur on the Risk tab in MT5. 37. Fixed a bug that caused the 'Do not apply take-profit' checkbox to be ignored. 38. Fixed a minor bug that would sometimes cause line labels to freeze on the chart. 39. Fixed a bug that would sometimes cause the EA initialization to fail in MT5. 40. Improved currency conversion for calculations in MT5. 41. Optimized the EA initialization and deinitialization phases to significantly improve the loading speed when switching the chart symbol. 42. Removed the PanelOnTopOfChart input parameter. Use the 'Chart on foreground' checkbox in the chart's settings instead.
1 parent bb39549 commit 45e7c67

File tree

8 files changed

+4272
-1981
lines changed

8 files changed

+4272
-1981
lines changed

MQL4/Experts/Position Sizer/Defines.mqh

Lines changed: 56 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
//+------------------------------------------------------------------+
22
//| Defines.mqh |
3-
//| Copyright © 2022, EarnForex.com |
3+
//| Copyright © 2023, EarnForex.com |
44
//| https://www.earnforex.com/ |
55
//+------------------------------------------------------------------+
66
#include <Controls\Button.mqh>
77
#include <Controls\Dialog.mqh>
88
#include <Controls\CheckBox.mqh>
99
#include <Controls\Label.mqh>
10+
#include <Arrays\List.mqh>
1011

1112
#define CONTROLS_EDIT_COLOR_ENABLE C'255,255,255'
1213
#define CONTROLS_EDIT_COLOR_DISABLE C'221,221,211'
@@ -54,28 +55,58 @@ enum CANDLE_NUMBER
5455
Previous_Candle = 1 // Previous candle
5556
};
5657

58+
enum VOLUME_SHARE_MODE
59+
{
60+
Equal, // Equal shares
61+
Decreasing, // Decreasing shares
62+
Increasing // Increasing shares
63+
};
64+
65+
enum SHOW_SPREAD
66+
{
67+
No,
68+
Points,
69+
Ratio // Spread / SL ratio
70+
};
71+
72+
enum SYMBOL_CHART_CHANGE_REACTION
73+
{
74+
SYMBOL_CHART_CHANGE_EACH_OWN, // Each symbol - own settings
75+
SYMBOL_CHART_CHANGE_HARD_RESET, // Reset to defaults on symbol change
76+
SYMBOL_CHART_CHANGE_KEEP_PANEL // Keep panel as is
77+
};
78+
79+
enum COMMISSION_TYPE
80+
{
81+
COMMISSION_CURRENCY, // Currency units
82+
COMMISSION_PERCENT, // Percentage
83+
};
84+
5785
struct Settings
5886
{
5987
ENTRY_TYPE EntryType;
6088
double EntryLevel;
6189
double StopLossLevel;
6290
double TakeProfitLevel;
91+
int TakeProfitsNumber;
6392
double Risk;
6493
double MoneyRisk;
6594
double CommissionPerLot;
95+
COMMISSION_TYPE CommissionType;
6696
bool UseMoneyInsteadOfPercentage;
6797
bool RiskFromPositionSize;
6898
double PositionSize; // Used only when RiskFromPositionSize == true.
6999
ACCOUNT_BUTTON AccountButton;
70100
double CustomBalance;
71101
bool DeleteLines;
72102
bool CountPendingOrders;
73-
bool IgnoreOrdersWithoutStopLoss;
103+
bool IgnoreOrdersWithoutSL;
104+
bool IgnoreOrdersWithoutTP;
74105
bool IgnoreOtherSymbols;
75106
bool HideAccSize;
76107
bool ShowLines;
77108
TABS SelectedTab;
78-
int CustomLeverage;
109+
double CustomLeverage;
79110
int MagicNumber;
80111
string Commentary;
81112
bool DisableTradingWhenLinesAreHidden;
@@ -102,6 +133,7 @@ struct Settings
102133
int BreakEvenPoints;
103134
int MaxNumberOfTrades;
104135
bool AllSymbols;
136+
double MaxTotalRisk;
105137
// For ATR:
106138
int ATRPeriod;
107139
double ATRMultiplierSL;
@@ -117,5 +149,26 @@ struct Settings
117149
// Panel states:
118150
bool IsPanelMinimized;
119151
bool TPLockedOnSL;
152+
VOLUME_SHARE_MODE ShareVolumeMode;
153+
bool TemplateChanged;
120154
} sets;
155+
156+
// An object class for a list of panel objects with their names for fields located on a given tab of the panel. There will be one list per tab.
157+
class CStringForList : public CObject
158+
{
159+
public:
160+
string Name;
161+
CWnd* Obj;
162+
bool Hidden; // Used only in the Trading tab to avoid deleting the extra TPs but keep them hidden after removal.
163+
CStringForList() {Hidden = false;}
164+
};
165+
166+
class CPanelList : public CList
167+
{
168+
public:
169+
void DeleteListElementByName(const string name);
170+
void MoveListElementByName(const string name, const int index);
171+
void CreateListElementByName(CObject &obj, const string name);
172+
void SetHiddenByName(const string name, const bool hidden);
173+
};
121174
//+------------------------------------------------------------------+

0 commit comments

Comments
 (0)