거래 로봇을 무료로 다운로드 하는 법을 시청해보세요
당사를 Facebook에서 찾아주십시오!
당사 팬 페이지에 가입하십시오
스크립트가 흥미로우신가요?
그렇다면 링크 to it -
하셔서 다른 이들이 평가할 수 있도록 해보세요
스크립트가 마음에 드시나요? MetaTrader 5 터미널에서 시도해보십시오
Experts

RiskManagement kit - MetaTrader 5용 expert

Real Author
게시자:
59848
조회수:
180
게시됨:
업데이트됨:
MQL5 프리랜스 이 코드를 기반으로 한 로봇이나 지표가 필요하신가요? 프리랜스로 주문하세요 프리랜스로 이동

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.