Guarda come scaricare robot di trading gratuitamente
Ci trovi su Facebook!
Unisciti alla nostra fan page
Script interessante?
Pubblica il link!
lasciare che altri lo valutino
Ti è piaciuto lo script? Provalo nel Terminale MetaTrader 5
Sistemi Esperti

RiskManagement kit - sistema esperto per MetaTrader 5

Real Author
Pubblicati da::
59848
Visualizzazioni:
180
Pubblicato:
Aggiornato:
Freelance MQL5 Hai bisogno di un robot o indicatore basato su questo codice? Ordinalo su Freelance Vai a Freelance

RiskManagementKit.mq5 is an MQL5 Expert Advisor (EA) for risk control and position management. It is not a signal generator and it does not open trades by strategy logic. The EA is designed to run on any symbol and any timeframe as a protective layer for manual trading or other entry systems.




Program structure (MQL5):

Event handlers: OnInit(), OnTick()
Main class: CRiskManagementKit
Core methods: StartOfDay(), RefreshDayState(), CheckDailyLock(), CalcLotSizeByRisk(), ApplyBreakEven(), RoundVolume()


What the EA does on each tick (OnTick):

Refreshes daily state using TimeCurrent(), TimeToStruct(), StructToTime().
Checks daily equity lock using AccountInfoDouble(ACCOUNT_EQUITY).
If not locked, applies break-even logic to open positions.
Calculates recommended lot size from risk settings.
Shows current status on chart using Comment().


Risk Based Calculation:


Uses AccountInfoDouble(ACCOUNT_BALANCE), SymbolInfoDouble(SYMBOL_TRADE_TICK_VALUE), SymbolInfoDouble(SYMBOL_TRADE_TICK_SIZE), and SymbolInfoDouble(SYMBOL_POINT).
Normalizes volume to broker constraints with SymbolInfoDouble(SYMBOL_VOLUME_MIN), SYMBOL_VOLUME_MAX, SYMBOL_VOLUME_STEP.
Returns normalized lot size from CalcLotSizeByRisk().


Daily Lock system/logic:


Stores day-start equity and monitors intraday equity change in percent.
If equity change <= -InpDailyLossLimitPercent or >= InpDailyProfitTargetPercent, trading state is locked for the day.
State is reset at new day boundary.


Break-even logic:


Scans positions with PositionsTotal(), PositionGetTicket(), PositionSelectByTicket().
Reads position data with PositionGetDouble()/PositionGetInteger()/PositionGetString().
For BUY/SELL positions on current chart symbol, when floating profit in points reaches InpBreakEvenTriggerPoints, modifies SL to break-even +/- InpBreakEvenBufferPoints using CTrade::PositionModify().



External input parameters:

input double InpRiskPercent
input int InpStopLossPoints
input bool InpEnableDailyLock
input double InpDailyLossLimitPercent
input double InpDailyProfitTargetPercent
input bool InpEnableBreakEven
input int InpBreakEvenTriggerPoints
input int InpBreakEvenBufferPoints


Recommended usage:
Attach EA to the symbol you want to manage. It provides risk sizing and protective management only; entry and exit strategy rules are expected to be handled separately.

Note: This EA does not open positions automatically; it is intended for risk control and position management only.



WPR for Overbought and Oversold WPR for Overbought and Oversold

Overbought and oversold indicators aim to determine where the price may experience a reversal.

nCalculate Lot by Percent nCalculate Lot by Percent

Function of lot calculation by risk percentage

Accelerator Oscillator (AC) Accelerator Oscillator (AC)

The Acceleration/Deceleration Indicator (AC) measures acceleration and deceleration of the current driving force.

MACD Signals MACD Signals

Indicator edition for new platform.