Set&Forget Alfonso Money Management EA (MT5)
INTRODUCTION
This Expert Advisor (EA) is a specialized utility tool designed for MetaTrader 5 to assist traders practicing the Supply and Demand strategy. The EA automates lot size calculations, manages risk strictly according to account balance (factoring in spreads and commissions), and places split orders with multiple targets. It acts as an interactive bridge between your visual analysis (drawing boxes) and order execution.
HOW IT WORKS & SYSTEM SETUP
The EA monitors rectangles drawn on the chart. To activate trading or analysis on a zone, follow these steps:
- Draw a Rectangle: Use the standard MT5 rectangle drawing tool to mark your supply or demand zone.
- Rename the Rectangle:
- For a Demand Zone (Buy): Open the rectangle properties and change the name to buy (or your custom configured name).
- For a Supply Zone (Sell): Open the rectangle properties and change the name to sell (or your custom configured name).
- Execution: Depending on your selected trading mode, the EA will either show execution buttons, place pending orders immediately, or wait for the price to touch the zone.
TRADING MODES
The EA offers three execution methods via the Default_Trading_Method parameter:
- Mode_Manual_Buttons: The EA draws the Entry, Stop Loss, and Take Profit lines visually on the chart and shows interactive buttons (BUY, SELL, CANCEL). No order is placed until you click the buttons.
- Mode_Auto_Instant: As soon as you draw and rename a box to buy or sell, the EA instantly calculates parameters and places pending orders (Limit/Stop) in the market.
- Mode_Auto_OnTouch: The EA does not place pending orders. Instead, it waits until the live price (Ask for Buy, Bid for Sell) touches the boundary of your drawn box. Once touched, it executes market orders instantly.
PARAMETERS EXPLANATION
Here is the complete description of the parameters available in the EA settings:
1. General & Core Settings
- Note: A descriptive text field showing the EA identifier.
- Default_Trading_Method: Choose how the EA behaves upon box detection (Mode_Manual_Buttons, Mode_Auto_Instant, or Mode_Auto_OnTouch).
- BuyBoxName: The exact name the EA looks for to identify Buy/Demand zones. Default is buy (case-sensitive).
- SellBoxName: The exact name the EA looks for to identify Sell/Supply zones. Default is sell (case-sensitive).
- NumberOfPositions: The number of split orders to open. If set to more than 1, the EA divides your total calculated lot size into equal parts, allowing for multi-position target management.
2. Risk & Money Management
- RiskPercent: The maximum percentage of your account balance you are willing to lose on a single setup. Default is 0.5%.
- SL_Factor: A multiplier used to determine the buffer distance for the Stop Loss line. The SL is placed outside the box boundary by a distance equal to Box Height * SL_Factor.
- UseCustomBalance: If set to true, the EA ignores your actual account balance and uses the value defined in CustomBalance for risk calculations. Useful for prop firm evaluation preparation.
- CustomBalance: The virtual account balance utilized for calculations when UseCustomBalance is active.
- SL_Calculation_Mode: Determines how the Stop Loss level is set.
- SL_Auto_Percentage_Based: Automatically places the SL based on the SL_Factor input.
- SL_Manual_Drag_Line: Spawns a horizontal SL line that you can manually drag on the chart to customize your risk distance.
- UseCustomTargetLine: If set to true, the Take Profit targets will spawn as draggable lines on your chart. You can manually adjust them, and the EA will recalculate your potential profit in real-time.
- TP1: The first Take Profit target multiplier represented as a Net Risk-to-Reward ratio (e.g., 2.0 means a target of 1:2 Net Risk/Reward).
- TP2: The second Take Profit target multiplier represented as a Net Risk-to-Reward ratio (used if NumberOfPositions is set to 2 or more).
CRITICAL CONCEPT: TRUE / NET RISK-TO-REWARD RATIO
Please read this carefully regarding Take Profit targets:
Standard trading utilities place Take Profit lines strictly based on price distance (Gross R:R). As a result, when price hits the target, broker spreads and commissions eat into the profit, reducing your real payout below your set R:R factor.
How this EA guarantees Real Profit:
- This EA calculates True Net Risk-to-Reward.
- When you set TP1 = 2.0, the EA calculates the exact gross target distance needed so that after deducting broker spread and entry/exit commissions, your actual Net Balance gain equals exactly 2.0x your risked money.
- Visual Chart Difference: Because transaction fees (spread + commission) are automatically added to the target distance, you may notice the visual R:R displayed on the chart line showing a slightly higher price distance ratio (e.g., 1:2.3 or 1:2.4 instead of 1:2.0). This is completely normal and intentional—it ensures that when the TP line is hit, your account balance receives the full, uncompromised 1:2 Net payout.
3. Commission Customization
The EA uses an iterative algorithm to deduct commissions and spreads from your total risk to ensure your net loss never exceeds the allowed RiskPercent.
- Commission_Mode: Defines how commission is calculated (COMM_PER_LOT, COMM_PER_MILLION, COMM_PERCENT, or COMM_NONE).
- Commission_PerLot: Commission value charged per 1 standard lot.
- Commission_PerMillion: Commission value charged per million units traded.
- Commission_Percent: Commission value represented as a percentage of the contract value.
- Commission_IsOneWay: If set to false, the EA doubles the commission calculation to account for both opening and closing of the trade (Round-turn). If true, it calculates one-way commission.
4. Touch & Advanced Filters
- OnTouch_ShowLinesOnlyOnInside: If true and utilizing OnTouch mode, the visual SL, Entry, and TP lines will only appear on your chart once the price enters the drawn box.
- UseCurrencyExposureCheck: An advanced risk filter. If true, the EA prevents executing a new trade on touch if you already have open positions containing the same currency in the same direction. It protects the account from over-exposure across correlated pairs.
- UseUSDExposureException: If true, the EA bypasses the USD exposure check for the specific assets defined in the exclusion list (allowing you to trade Gold or major Cryptos alongside regular USD pairs).
- USD_Excl_Sym_1 to USD_Excl_Sym_4: Custom assets excluded from the USD exposure check (e.g., Gold: XAUUSD, Silver: XAGUSD, Bitcoin: BTCUSD).
- UseCommodityCorrelationCheck: If true, the EA checks for correlated commodity or crypto pairs before touch execution and prevents taking overlapping trades in the same direction on both.
- Correlated_SymA_1 to Correlated_SymB_3: Setup pairs of highly correlated symbols to monitor (e.g., Pair 1: XAUUSD and XAGUSD).
5. Entry Alerts
- UseEntryAlerts: Master toggle to enable warnings when the price enters a drawn box.
- UsePopupAlert: Triggers a standard popup warning box inside your MetaTrader terminal.
- UsePushAlert: Sends an instant push notification to your registered MetaTrader mobile application on iOS/Android.
- UseEmailAlert: Sends a warning email to your configured MetaTrader email address.
- AlertSoundFile: Playback sound file name when an alert is triggered (must be located in the Terminal's /Sounds directory).
6. Information Panel Position
- InfoX_Distance: Horizontal offset in pixels to adjust the position of the floating Information Panel on the chart.
- InfoY_Distance: Vertical offset in pixels to adjust the position of the floating Information Panel on the chart.
IMPORTANT SYSTEM NOTES
- Anti-Spam Alert Logic: The zone alert mechanism is designed to notify you only once per entry. It flags the zone as triggered, and will only alert you again if the price completely exits the zone and re-enters, preventing annoying sound or popup spam.
- SL & TP Line Dragging: When SL_Calculation_Mode is set to SL_Manual_Drag_Line and UseCustomTargetLine is set to true, you have total physical control over the setup. You can visually click and drag the SL or TP lines on the chart. The EA automatically detects the change, adjusts the lot size, and recalculates risk values on the fly.