주시
1
0
포크
이미 MQLArticles을(를) 포크했습니다
0
원본 프로젝트 nique_372/MQLArticles
MQLArticles/Account/DEFINES.md
2026-11-05 19:07:00 -05:00

← MQLArticles

Account - Defines

Preprocessor defines that change the behavior of the Account module (RM, MoneyStatus, MoneyHistory, OrderUtils): extra logs, optional behaviors, calculations and sizes.

How to use them: define them in your EA before the first #include of the library, the preprocessor evaluates them when the file is included.

#define MQLARTICLES_RM_MULTI_EA_MODE
#include "..\\Account\\RM\\RiskManagement\\Main.mqh"

In the source code a disabled switch appears as //#define NAME. The constants are wrapped in #ifndef NAME, so your value wins.

Extra logs (all disabled by default)

Define File Effect
TSNMQLART_RM_RISKAMANGEMENT_ELOGS RM\RiskManagement\Core\Core.mqh Extra logs of CRiskManagemet
MORE_INFO_LOSS_PROFIT_DEFINE RM\LossProfit\* Extra info logs of the max loss / max profit classes and the manager
MQLART_GLOT_ENABLE_LOGS RM\Bases\LoteSizeCalc.mqh Logs of the lot size calculation
MQLARTICLES_TICKETSINFO_DEBUG MoneyStatus\TicketsTable\Heavy.mqh, Tiny.mqh Extra logs of the tickets tables
OCO_ORDER_MORE_PRINTS OrderUtils\OcoOrder.mqh Extra prints of COcoOrder

Behavior

Define Default File Effect
MQLARTICLES_RM_MULTI_EA_MODE off MoneyStatus\Manager.mqh, RM\RiskManagement\Core\Core.mqh, RM\LossProfit\Bases\Base.mqh, RM\RiskManagement\Imp\PropFirm.mqh Floating profit is calculated only for the positions of the EA's magic number (risk.CalcProfit()), and balance/equity are read with AccountInfoDouble. Use it when several EAs run on the same account. Strict: when it is defined, TSN::g_account_balance, g_account_equity, account_status_curr_profit and the ACCOUNTSTATUS_ONEVERYTICK macro do not exist, so in OnTick the macro must go in the #else branch. Disabled: they exist (faster global calculation)
MQLARTICLES_RM_USE_HASHMAP_TICKESTABLE off MoneyStatus\Manager.mqh Uses TicketsTable\Heavy (hashmap) instead of Tiny (supports only 16 simultaneous positions). Must be defined before including Manager.mqh
CACCOUNT_STATUS_ACTIVE_ON_ORDER_ADD
CACCOUNT_STATUS_ACTIVE_ON_ORDER_UPDATE
CACCOUNT_STATUS_ACTIVE_ON_ORDER_DELETE
CACCOUNT_STATUS_ACTIVE_ON_POSITION_MODIFIED
off MoneyStatus\Manager.mqh Enable the OnOrderAdd, OnOrderUpdate, OnOrderDelete and OnPositionModified events of CAccountStatus. COcoOrder and COrderGestor override OnOrderDelete, so they need ..._ON_ORDER_DELETE
CACCOUNT_STATUS_COUNT_ORDERS_BUY_SELL off MoneyStatus\Manager.mqh In the order events, also count the buy and sell (market) orders
RISK_MANAGEMENT_UPDATE_CHOSEN_BALANCE_DEPOSIT_WITDRAWAL on RM\RiskManagement\Core\Core.mqh Keeps the chosen balance updated on deposits and withdrawals (OnWithdrawalDeposit). Dangerous to disable: the risk could increase strongly. It is wrapped in #ifndef, but being enabled by default there is no define to turn it off from outside (to disable it, comment the #define in Core.mqh)

Calculation

Define Default File Effect
MQLART_LOTSIZE_CALC_ROUND(number, step) TSNMQLART_ROUND_LOTSIZE_F(MathRound, number, step) RM\Bases\LoteSizeCalc.mqh How the calculated lot is rounded to the volume step. Overridable
ACCOUNT_STATUS_MIN_VOL 0.00000001 MoneyStatus\Defines.mqh Tolerance used to detect a full close and to ignore deals with zero profit. Overridable
NOT_MAGIC_NUMBER 0 RM\Bases\Def.mqh Magic number value that means "any magic". Overridable

Sizes and reserves

Define Default File What it sizes
MQLARTICLES_RM_ACCOUNT_MAX_POSITIONS 64 MoneyStatus\TicketsTable\Heavy.mqh Maximum simultaneous positions of the Heavy table. Overridable
MQLARTICLES_RM_ACCOUNT_FREELIST_SIZE 32 MoneyStatus\TicketsTable\Heavy.mqh Free list of the Heavy table. Overridable
LOSSPROFIT_MANAGER_MAX_ITEMS 32 RM\LossProfit\Manager.mqh Fixed arrays of CLossProfitManager (items and type map). TSN_MQLART_RM_LPMAN_TL_MAXS is derived (half of it). Overridable
RISK_MANAGEMENT_BASES_MAX_POS_OPEN 64 RM\RiskManagement\Def.mqh Fixed array of open positions of CRiskManagemet. Overridable
CORDER_GESTOR_RESERVE_ARR 5 OrderUtils\OrdersGestor.mqh Initial reserve of the orders array. Overridable

MoneyStatus\Old\ (previous tickets table) has its own defines (MQLARTICLES_HASH_TABLE_SIZE, ...); it is legacy and not documented here.