Trade Analyzer Panel
- Utilità
- Minh Vuong Pham
- Versione: 1.10
- Attivazioni: 10
Version: 1.10
Platform: MetaTrader 5
Type: Panel EA (non-trading, analysis only)Group support: https://www.mql5.com/en/channels/vuongphamtrading
Overview
Trade Analyzer Panel is a real-time dashboard EA for MetaTrader 5 that gives you instant visibility into your open positions, account risk exposure, hypothetical P/L scenarios, and target profit planning — all from a single scrollable on-chart panel.
Key Features
| Feature | Description |
|---|---|
| Position Scanner | Lists all open positions with symbol, direction, lot size, open price, and live P/L |
| Account Summary | Displays balance, equity, used/free margin, and margin level in real time |
| Risk Analysis | Calculates max drawdown before stop-out, price range the account can withstand, and estimated stop-out price |
| Price Simulator | Enter any target price to see projected P/L, price difference, and estimated equity across all positions |
| Target Profit | Enter a desired profit amount and the EA calculates the exact price needed to reach that goal |
| Scrollable Panel | Mouse wheel and ▲▼ buttons to scroll when the panel exceeds the chart height |
Installation
-
Copy the file — Place TradeAnalyzerPanel.mq5 into your MT5 data folder:
[MT5 Data Folder]\MQL5\Experts\
You can find the data folder via MT5 menu: File → Open Data Folder.
-
Compile — Open TradeAnalyzerPanel.mq5 in MetaEditor and press F7 (or click Compile). Ensure there are no errors.
-
Attach to chart — In MT5, open the Navigator panel (Ctrl+N), expand Expert Advisors, and drag TradeAnalyzerPanel onto any chart.
-
Enable Algo Trading — Make sure the Algo Trading button on the MT5 toolbar is enabled (green icon).
Note: This EA does not place or modify any trades. It is purely an analysis and display tool.
Panel Sections
1. Account
The top section displays core account metrics updated in real time:
| Field | Description |
|---|---|
| Balance | Current account balance (excluding floating P/L) |
| Equity | Balance + floating profit/loss. Green if ≥ balance, red if below |
| Used Margin | Margin currently locked by open positions |
| Free Margin | Available margin for new positions. Green if > used margin |
| Margin Level | Equity / Margin × 100%. Color-coded: green (>200%), yellow (100–200%), red (<100%) |
2. Open Positions
Displays up to 12 open positions in a table format:
| Column | Description |
|---|---|
| Symbol | Trading instrument (truncated to 10 characters if needed) |
| Type | BUY (green) or SELL (red) |
| Lots | Position volume |
| Open | Entry price |
| P/L | Current profit/loss including swap (green if positive, red if negative) |
Below the table, three summary rows show Total Orders, Total P/L, and Total Lots across all open positions. Rows without positions are left blank.
3. Risk Analysis
Calculates how much adverse price movement your account can absorb before reaching the broker's stop-out level. All calculations are based on positions on the current chart symbol.
| Field | Description |
|---|---|
| Max Drawdown | Maximum loss the account can sustain before stop-out: Equity - (Margin × StopOut% / 100) |
| Price Range Left | How far the price can move against your net position before the account is stopped out |
| Est. Stopout Price | The estimated price at which stop-out would occur, with a direction arrow (▼ for net-long, ▲ for net-short) |
How it works:
- The EA sums buy lots (positive) and sell lots (negative) on the current chart symbol to determine the net exposure.
- It divides the max drawdown by the cost-per-tick of the net position to find how many ticks the account can endure.
- The stop-out price is then projected from the current bid price.
Example: If you have 2.0 lots net-long on XAUUSD, equity of $10,000, and max drawdown of $8,000, the EA calculates: 8000 / (2.0 × tick_value) = number of ticks → converted to price distance. If the current price is 2350.00 and the price range is 400.00, the estimated stop-out price would be 1950.00 ▼.
4. Price Simulator
Lets you enter a hypothetical price to see what your P/L would be if the current chart symbol reached that price.
How to use:
- Type a price into the input field (e.g., 2400.50 ).
- Press Enter or click the CALC button.
- The panel displays:
| Field | Description |
|---|---|
| Simulated P/L | Total projected profit/loss across all positions if the symbol reaches the entered price |
| Price Difference | Distance between the simulated price and current bid, plus the number of affected orders |
| Est. Equity | Projected account equity: Balance + Simulated Total P/L |
Important notes:
- The simulation applies to positions on the current chart symbol only. Positions on other symbols retain their current live P/L in the total calculation.
- The P/L calculation accounts for each position's actual lot size, open price, direction (buy/sell), and swap.
- The simulation updates automatically when the panel refreshes if a price is entered.
5. Target Profit Calculator
Enter a desired profit amount and the EA reverse-calculates the exact price the current chart symbol needs to reach.
How to use:
- Type the desired profit in account currency into the input field (e.g., 200 for +$200, or -100 for -$100).
- Press Enter or click the CALC button.
- The panel displays:
| Field | Description |
|---|---|
| Required Price | The price the current chart symbol must reach for total P/L to equal your target |
| Price Distance | Distance from the current bid to the required price (positive = price must go up, negative = price must go down) |
| Est. Equity | Projected equity at target: Balance + Target Profit |
How it works:
- The EA gathers all positions on the current chart symbol: net lots, weighted open prices, and swap.
- Positions on other symbols keep their current live P/L, which is subtracted from the target to isolate the required P/L from the chart symbol.
- The formula solves for the price that would produce exactly that P/L given the actual lot sizes and open prices.
- Supports negative values — enter -100 to find the price at which you'd lose $100.
Edge cases:
- If positions are fully hedged (net lots ≈ 0), the panel shows "Hedged/No [symbol]" since no single price can change the P/L.
- If the calculated price is negative (not achievable), the panel shows "Not achievable".
Scrolling
The panel supports scrolling when its content extends beyond the visible chart area. The header bar (title and scroll buttons) remains fixed at the top while content scrolls beneath it.
Scroll Methods
| Method | Action |
|---|---|
| Mouse wheel | Hover the mouse over the panel and scroll up/down. Each tick scrolls by the configured step (default 40px) |
| ▲ / ▼ buttons | Click the arrow buttons in the top-right corner of the header. Each click scrolls 3× the step (120px by default) |
Content that scrolls above the header is automatically hidden. The panel background resizes dynamically to fit the visible content area.
Tip: If the panel fits entirely on screen, scrolling has no effect — the EA automatically limits scroll range.
Input Parameters
All parameters can be configured when attaching the EA to a chart or via the EA properties window.
Position & Layout
| Parameter | Default | Description |
|---|---|---|
| InpPanelX | 20 | Panel X position (pixels from left) |
| InpPanelY | 30 | Panel Y position (pixels from top) |
| InpScrollStep | 40 | Pixels per mouse wheel tick |
Colors
| Parameter | Default | Description |
|---|---|---|
| InpPanelBg | C'18,18,24' | Main panel background |
| InpHeaderBg | C'30,30,42' | Header bar background |
| InpAccentColor | C'99,102,241' | Accent color (title, buttons) |
| InpProfitColor | C'34,197,94' | Profit / positive values |
| InpLossColor | C'239,68,68' | Loss / negative values |
| InpTextColor | C'226,232,240' | Primary text |
| InpDimText | C'148,163,184' | Secondary / label text |
| InpInputBg | C'30,34,46' | Input field background |
| InpBorderColor | C'55,65,81' | Borders and separators |
Typography & Performance
| Parameter | Default | Description |
|---|---|---|
| InpFontSize | 9 | Base font size |
| InpFontName | "Consolas" | Font family |
| InpRefreshMs | 500 | Data refresh interval in milliseconds |
Tip: Increase InpRefreshMs to 1000 or higher if you notice performance impact on slower machines.
Frequently Asked Questions
Q: Does this EA place any trades?
A: No. It is strictly a read-only analysis panel. It does not open, close, or modify any positions.
Q: Why does Risk Analysis show nothing?
A: You have no open positions, or no positions on the current chart symbol. The risk calculation requires at least one position on the chart's symbol.
Q: Can I use this alongside other EAs?
A: MT5 allows only one EA per chart. Attach this EA to a separate chart window of the same symbol if you need another EA running simultaneously.
Q: The stop-out price seems inaccurate. Why?
A: The calculation is an approximation. It uses the current tick value and assumes a static market (no spread changes, no swap accrual, no other symbol movements). Real stop-out may differ due to these factors.
Q: Price Simulator and Target Profit only affect the current chart symbol?
A: Yes. They calculate based on positions matching the chart symbol. All other positions keep their real-time P/L in the total.
Q: Target Profit shows "Hedged/No XAUUSD" — what does this mean?
A: Your buy and sell lots on that symbol cancel each other out (net lots ≈ 0). Since the position is fully hedged, no single price movement can reach a specific profit target.
Q: How do I scroll the panel?
A: Use the mouse wheel while hovering over the panel, or click the ▲/▼ buttons in the top-right corner of the header bar.
Q: How do I change the panel position?
A: Modify InpPanelX and InpPanelY in the EA input parameters (right-click EA on chart → Properties → Inputs).
Technical Details
- Refresh mechanism: Uses EventSetMillisecondTimer() for periodic updates independent of tick arrival.
- Max displayed positions: 12 (configurable via MAX_DISPLAY constant in source code).
- Stop-out level: Reads from ACCOUNT_MARGIN_SO_SO . Falls back to 50% if the broker returns 0.
- Scroll system: Tracks base Y positions of all scrollable objects in fixed-size arrays ( MAX_SCROLL_OBJ = 200 ). Header and scroll buttons are excluded from scrolling. Objects scrolled above the header are moved off-screen (-2000px) to hide them. Mouse wheel events require CHART_EVENT_MOUSE_WHEEL enabled (set automatically on init).
- Panel objects: All chart objects use the prefix TAP_ and are fully cleaned up on EA removal.
- Dependencies: Standard MQL5 includes only ( Trade.mqh , PositionInfo.mqh , AccountInfo.mqh ).
Changelog
v1.10
- Added Target Profit Calculator — enter desired profit to find the required price
- Added scrollable panel with mouse wheel and ▲▼ button support
- Fixed empty rows showing "Label" text (replaced with blank space)
- Added InpScrollStep input parameter
- Code refactored for cleaner scroll architecture
v1.00
- Initial release
- Account info display (balance, equity, margin, margin level)
- Open position scanner with live P/L
- Risk analysis: max drawdown, price range, stop-out estimation
- Price simulation with projected P/L and equity
Recommended Companion Indicator
Recommended Companion Toolkits
1. One-Click Trade Panel ⭐ HIGHLY RECOMMENDED
Why you need it: When a signal fires, speed matters. The indicator shows you the entry price and SL/TP levels, but manually typing lot size, SL, and TP into the order window costs precious seconds — especially on M1–M15 where price moves fast.
2. Trailing Stop & Breakeven Manager ⭐ RECOMMENDED
Why you need it: The indicator draws 3 TP levels for a reason — the strategy works best when you scale out gradually. But manually moving SL to breakeven at TP1, then trailing behind swings toward TP2 and TP3, requires constant chart monitoring. This is impractical if you trade multiple pairs or cannot watch the screen non-stop.
3. Trade Journal & Dashboard 📋 NICE TO HAVE
Why you need it: The indicator does not track historical performance — it only shows signals in real time. Without journaling, you have no way to know your actual win rate, average R:R, which signal type performs best, or which sessions/pairs give you the best results.
