MQLArticles/RM
Repository-Dateien (neuester Commit zuerst)
Dateiname Letzte Commit-Nachricht Letztes Commit-Datum
Nique_372 dac3a3c730
2026-09-06 20:42:03 -05:00
..
LossProfit Correciones por update del HashMapFast y nuevo sistema en tickets 2026-09-03 11:56:36 -05:00
Old new files added 2026-07-28 08:55:53 -05:00
AccountStatus.mqh 2026-09-06 20:42:03 -05:00
LoteSizeCalc.mqh 2026-09-06 20:42:03 -05:00
OcoOrder.mqh 2026-01-31 19:44:40 -05:00
OrdersGestor.mqh 2026-01-31 19:44:40 -05:00
README.md new files added 2026-09-06 11:15:27 -05:00
RiskManagement.mqh Correciones de uso de count (no a que depdne del hashmap) 2. correciones de firmas 2026-09-03 15:35:10 -05:00
RiskManagementBases.mqh 2026-07-28 09:08:36 -05:00
RM_Defines.mqh 2026-05-28 12:01:58 -05:00
RM_Functions.mqh 2026-07-28 09:08:36 -05:00
RM_Hooks.mqh 2026-03-05 12:10:29 -05:00
RM_Test.mq5 1. Debido al bug de CHashMapFast con kdelete sobrepasandose, podia pasar que un Rehash en la talba haga qeu el pos idx de la tabla deje de sincronizarse con el de risk maanger o o tors moduslo qeu lo usen como para marcar lo qeu es suyo lo cual es peligrioso dado que podria apuntar a otras operaciones 2. Nuevo modo con fgreelist en tickets table 2026-09-03 15:24:56 -05:00
TicketsTable.mqh 1. Debido al bug de CHashMapFast con kdelete sobrepasandose, podia pasar que un Rehash en la talba haga qeu el pos idx de la tabla deje de sincronizarse con el de risk maanger o o tors moduslo qeu lo usen como para marcar lo qeu es suyo lo cual es peligrioso dado que podria apuntar a otras operaciones 2. Nuevo modo con fgreelist en tickets table 2026-09-03 15:24:56 -05:00
TinyTicketsTable.mqh 2026-09-06 20:42:03 -05:00

← MQLArticles

RM

Risk management library: position sizing, SL/TP calculation, OCO orders and account-level loss/profit limits.

Main features

  • Lot size and SL/TP calculation based on account risk (CRiskManagemet).
  • Personal and prop-firm risk profiles (CRiskManagemetPersonal, CRiskManagemetPropFirm).
  • Max loss / max profit limits (daily, weekly, monthly, since peak) with automatic position closing — see LossProfit for the full inheritance model.
  • OCO (one-cancels-other) order linking.
  • Per-account order/position tracking (COrderGestor, CTicketsTable).

Basic usage

Risk management

CRiskManagemet rm;
// Note: "rm" requires the lot, type, max profit and max loss to be reset (etc.)
// before calling functions like GetSL, GetLote, etc.

// Check if a limit was hit
if(g_loss_profit_manager.MaxLossIsSuperated())
  {
   risk.CloseAllPositions();
   CanTrade = false;
  }

// Lot size
double entry_price = 1000.0;
double l = risk.GetLote(ORDER_TYPE_BUY, entry_price, 100, 0);

// Stop loss
long sl = risk.GetSL(ORDER_TYPE_BUY, entry_price, 100, 0);

// And more: GetPositionsTotal, SetStopLoss, CloseAllOrders, GetPositions...

OCO order

COcoOrder oco;

void Function()
{
 unsigned long ticket1 = trade.ResultOrder();
 unsigned long ticket2 = trade.ResultOrder();

 oco.AddOrders(ticket1, ticket2);
}

Only the most representative classes are shown here. See LossProfit/README.md for the max loss/profit inheritance structure.