The LakshmiFX Risk Manager is a powerful tool designed to protect your trading account by enforcing strict risk management rules. Built into the LakshmiFX Expert Advisor (EA) for MetaTrader 5 (MT5), it ensures your trading stays within safe boundaries, whether you’re aiming to limit losses or lock in profits. With customizable settings, it adapts to your unique trading style while keeping your capital secure.
This guide explains how the Risk Manager works and dives into its five key input variables. We’ll break down each one with examples to show you how to use them effectively.
What Does the LakshmiFX Risk Manager Do?
Imagine you’re driving a car: you want to enjoy the ride, but you also need brakes and a speed limit to stay safe. The LakshmiFX Risk Manager acts as your trading “brakes” and “speed limit.” It monitors your account’s performance in real-time and takes action when certain thresholds are crossed—closing trades, pausing trading, or even stopping the EA entirely if needed. It’s designed to:
- Prevent catastrophic losses across your entire account.
- Cap daily losses, both overall and for specific trading strategies (identified by magic numbers).
- Secure your profits when you hit a daily target.
- Restart trading automatically at a set time after a loss limit is reached.
Let’s explore the settings that make this possible.

Input Variables Explained
The LakshmiFX Risk Manager uses five input variables you can adjust to match your risk tolerance and trading goals. Here’s what each one does, with examples to bring it to life.
1. inpMaximumLossPercent – Max Loss % (Based on Equity)
- What it does: Sets the maximum percentage of your account equity you’re willing to lose before the EA stops completely, requiring manual intervention to restart.
- Default value: 0.0 (disabled unless you set a value).
- How it works: If your equity drops below this percentage of your starting equity, all trades are closed, and the EA shuts down to protect your account.
- Example:
- Account equity: $10,000.
- inpMaximumLossPercent = 10.0 (10%).
- Maximum allowable loss = $1,000 (10% of $10,000).
- If equity falls to $9,000 (a $1,000 loss), the EA closes all trades and stops. You’ll need to restart it manually after reviewing your strategy.
- When to use it: Ideal for setting an absolute safety net for your entire account, especially if you’re trading with high risk or multiple strategies.
2. inpMaximumDailyRunningLoss – Max Daily Running Loss (Currency)
- What it does: Limits the total loss your account can take in a single day, measured in your account’s currency (e.g., USD).
- Default value: 1000.00 ($1,000).
- How it works: Tracks both closed losses and unrealized (floating) losses daily. If this limit is hit, all trades are closed, and trading pauses until the next day at the restart hour (see inpEaRestartHour).
- Example:
- Account balance: $10,000.
- inpMaximumDailyRunningLoss = 1000.00.
- Day starts, and you lose $600 on closed trades. Open trades show a floating loss of $500.
- Total daily running loss = $600 + $500 = $1,100 > $1,000.
- The EA closes all trades and pauses trading until the next day’s restart hour.
- When to use it: Perfect for controlling daily risk across all your trading activities, ensuring one bad day doesn’t wipe out your account.
3. inpMaximumDailyRunningLossForMagic – Max Daily Running Loss For Magic # (Currency)
- What it does: Caps the daily loss for trades tied to this EA’s specific magic number, also in currency units.
- Default value: 300.00 ($300).
- How it works: Monitors losses for trades with this EA’s magic number only (a unique identifier for this instance of LakshmiFX). If breached, only those trades are closed, and the EA resumes trading immediately.
- Example:
- You run two EAs: LakshmiFX (Magic #123456) and another strategy (Magic #789012).
- inpMaximumDailyRunningLossForMagic = 300.00.
- LakshmiFX trades lose $200 closed + $150 floating = $350 > $300.
- Only LakshmiFX trades (Magic #123456) are closed; the other EA’s trades continue. LakshmiFX restarts trading right away.
- When to use it: Great if you’re running multiple EAs or strategies on the same account and want to limit risk for just this one without affecting others.
4. inpDailyProfitTarget – Daily Profit (DP) Target – (Currency)
- What it does: Defines the profit goal for the day. Once reached, all trades are closed, and trading stops until the next day.
- Default value: 4000.00 ($4,000).
- How it works: Tracks daily profit (closed + floating). When the target is hit, the EA locks in your gains by closing all trades and pausing until the restart hour.
- Example:
- Account balance: $10,000.
- inpDailyProfitTarget = 4000.00.
- You make $3,000 from closed trades, and open trades show $1,500 profit.
- Total profit = $3,000 + $1,500 = $4,500 > $4,000.
- The EA closes all trades, securing your profit, and pauses until the next day.
- When to use it: Use this to take profits off the table and avoid overtrading after a successful day.
5. inpEaRestartHour – EA Restart Hour
- What it does: Sets the hour (in server time, 0-23) when the EA resumes trading the next day after hitting a daily loss or profit limit.
- Default value: 1 (1:00 AM server time).
- How it works: After inpMaximumDailyRunningLoss or inpDailyProfitTarget triggers a pause, the EA waits until this hour the next day to reset and start again.
- Example:
- Server time zone: GMT+2.
- inpEaRestartHour = 1.
- Daily loss limit ($1,000) is hit at 3:00 PM today. All trades close, and trading pauses.
- Trading resumes tomorrow at 1:00 AM GMT+2 (server time).
- When to use it: Adjust this to align with your broker’s daily reset or your preferred trading start time.
How It All Fits Together
The LakshmiFX Risk Manager works like a layered safety system:
- Account-Wide Protection: inpMaximumLossPercent is the ultimate guard, stopping everything if losses get too big.
- Daily Control: inpMaximumDailyRunningLoss and inpDailyProfitTarget manage your day-to-day risk and reward, pausing trading when limits are hit.
- Strategy-Specific Limits: inpMaximumDailyRunningLossForMagic keeps this EA’s trades in check without disrupting others.
- Smart Restart: inpEaRestartHour ensures trading resumes at the right time after a pause.
Real-World Scenario
- Setup: $10,000 account, inpMaximumLossPercent = 10.0, inpMaximumDailyRunningLoss = 1000.00, inpMaximumDailyRunningLossForMagic = 300.00, inpDailyProfitTarget = 4000.00, inpEaRestartHour = 1.
- Day 1:
- LakshmiFX (Magic #123456) loses $350. inpMaximumDailyRunningLossForMagic triggers, closing its trades. Trading resumes immediately for this EA.
- Later, total account loss hits $1,200. inpMaximumDailyRunningLoss triggers, closing all trades and pausing until 1:00 AM tomorrow.
- Day 2:
- Trading restarts at 1:00 AM. Profit reaches $4,500. inpDailyProfitTarget triggers, closing trades and pausing until 1:00 AM the next day.
- Day 3:
- Equity drops to $8,900 (>$1,000 loss). inpMaximumLossPercent triggers, shutting down the EA until you intervene.
Why Use LakshmiFX Risk Manager?
- Peace of Mind: Automated rules protect your account 24/7.
- Flexibility: Customize limits to fit your risk appetite and trading plan.
- Control: Balances aggressive trading with safety, so you can focus on strategy, not babysitting.
Whether you’re a beginner protecting a small account or a pro managing multiple strategies, the LakshmiFX Risk Manager keeps your trading disciplined and secure. Adjust the inputs, test them in MT5’s Strategy Tester, and watch it work for you!