Trade Panel Assistant MT5

Here is the full description of the Trade Manager v4.0 Expert Advisor:

Trade Manager v4.0 — Expert Advisor Description

Overview

Trade Manager is a MetaTrader 5 Expert Advisor designed as a comprehensive, always-on trading panel. It does not trade autonomously — it is a full-featured trade execution and management interface that sits on your chart and gives you fast, visual control over every aspect of entering and managing positions. It is built around a compact, dark-themed floating panel that you can drag anywhere on the screen, and it supports per-position visual trigger lines drawn directly on the chart.

The EA is symbol-aware: it only displays and manages positions open on the current chart symbol. If you run the EA on GBPJPY, only GBPJPY positions appear in the panel. Gold, indices, or other instruments on separate charts with their own EA instances are completely independent.

Panel Layout

The panel is 452 pixels wide and is divided into clearly separated sections stacked vertically from top to bottom:

  1. Header — branding, symbol name, live bid/ask
  2. Account Bar — balance, equity, open P&L
  3. Order Entry — price, SL, TP inputs + Buy/Sell/pending order buttons
  4. Risk Manager — risk mode toggle, risk % or lot size input, calculated counterpart
  5. Order Preview (conditional) — appears only when an order is being configured
  6. Actions Bar — bulk close buttons
  7. Open Positions — one card per open position on the current symbol

The panel has a drop shadow behind it and a full border. It can be repositioned at any time by clicking and dragging the header area. Its default position on the screen is set by the InpX and InpY inputs.

Header Section

Displays the EA title "Trade Manager" and subtitle "Professional Panel" on the left. On the right it shows:

  • The current chart symbol (e.g. GBPJPY)
  • Live Bid price in red
  • Live Ask price in green

Both prices refresh every second via the one-second timer.

Account Bar

A compact one-line bar displaying three values that update every second:

  • Balance — current account balance in dollars
  • Equity — current account equity in dollars
  • P&L — the difference (equity minus balance), representing total open floating profit or loss. Displayed in green when positive and red when negative, with a +$ or -$ prefix.

Order Entry Section

Input Fields

Three side-by-side edit boxes appear at the top of this section:

  • Price — the desired entry price. For market Buy and Sell orders this value is ignored (the current market price is used). For limit and stop orders it is the limit/stop level. This field auto-updates every second with the current Ask price when not in preview mode so there is always a sensible default.
  • SL (pts) — stop loss distance from entry, measured in points. Defaults to InpDefaultSL . Changes here immediately recalculate the estimated lot size shown in the Risk Manager section.
  • TP (pts) — take profit distance from entry, measured in points. Defaults to InpDefaultTP .

Order Buttons

Market orders (large, full-width row):

  • Buy — large green button. Enters preview mode for an immediate market buy at Ask.
  • Sell — large red button. Enters preview mode for an immediate market sell at Bid.

When in preview mode, the active button highlights to a brighter blue to indicate the pending direction.

Pending orders (four smaller buttons in a row):

  • Buy Limit — buy limit order at the price in the Price field
  • Buy Stop — buy stop order at the price in the Price field
  • Sell Limit — sell limit order at the price in the Price field
  • Sell Stop — sell stop order at the price in the Price field

Keyboard Shortcuts

  • F1 — enters Buy preview mode
  • F2 — enters Sell preview mode
  • Esc — cancels preview mode and removes all chart lines

Risk Manager Section

Mode Toggle

Two buttons in the header row of this section switch between sizing modes:

  • % Risk (green when active) — lot size is automatically calculated to risk a specific percentage of account balance
  • Lots (blue when active) — a fixed lot size is used directly

Clicking either button immediately rebuilds the section in the correct layout for the new mode.

% Risk Mode Layout

  • Risk % (editable) — type a percentage value. Every change immediately recalculates the Lot Size display. Updating the SL field also recalculates this automatically.
  • Lot Size (read-only display) — shows the calculated lot size based on: current SL in points, account balance, tick value, tick size, and the risk percentage. Updates every second via the timer so it stays accurate as equity changes.

Lots Mode Layout

  • Risk % (read-only display) — shows the back-calculated risk percentage that the current lot size and SL represent relative to the account balance. Updates every second.
  • Lot Size (editable) — type the desired lot size directly. On pressing Enter the Risk % display immediately recalculates to show the implied risk for that number of lots.

In both modes, changing the SL field automatically triggers recalculation of whichever field is the derived/read-only one.

Order Preview Mode

When any order button is clicked, the EA enters preview mode. Three chart lines are drawn on the price chart:

  • White solid line — Entry price
  • Green dashed line — Take profit level
  • Red dashed line — Stop loss level

Each line has a drag handle on the right edge of the chart — a labelled strip showing the price level and relevant distances or dollar amounts. These handles can be clicked and dragged with the mouse to visually reposition the levels:

  • Dragging the Entry handle moves all three levels together, preserving the SL and TP distances
  • Dragging the SL handle moves only the stop loss
  • Dragging the TP handle moves only the take profit

As the handles are dragged, all information updates live: the SL and TP edit boxes, the lot size calculation, and the preview panel below.

Preview Information Panel

A dedicated panel section appears showing a complete trade summary:

  • Direction pill — BUY or SELL in the trade's colour
  • Symbol
  • [drag handles to adjust] hint
  • ENTRY price
  • TAKE PROFIT price + distance in points
  • STOP LOSS price + distance in points
  • Lots — calculated or fixed lot size
  • Risk $ — dollar amount at risk if the stop loss is hit
  • Reward $ — dollar profit if take profit is hit
  • R:R pill — Risk to Reward ratio, colour-coded: green for ≥ 2:1, orange for ≥ 1:1, red for < 1:1

Sending or Cancelling

  • SEND ORDER — submits the order to the broker with the current entry, SL, TP, and lot size. Clears preview mode and removes all chart lines afterward.
  • Cancel — discards the order, removes chart lines, and returns to normal mode.

When in preview mode the preview section is inserted into the panel between the Risk Manager and the Actions Bar. On exit from preview mode (either via Send or Cancel) it is removed from the panel.

Actions Bar

Three equally-sized buttons for immediate bulk order execution:

  • x Close All — closes every open position in the account immediately, regardless of symbol
  • x Close Buys — closes all open buy positions on the current chart symbol immediately
  • x Close Sells — closes all open sell positions on the current chart symbol immediately

Open Positions Section

Section Header

Shows the label "OPEN POSITIONS" on the left, and the Total P&L for all positions on the current symbol on the right. This figure includes profit, swap, and commission. It is colour-coded green or red and refreshes every second.

Position Cards

One card is rendered per open position on the current chart symbol, up to a maximum of 50 positions. Cards alternate between two shades of dark blue for easy visual separation. Each card has a thin colour bar on its left edge — green for buys, red for sells.

Each card contains three rows:

Row 1 — Position Summary

  • Symbol name
  • Direction pill (BUY or SELL, colour-coded)
  • Volume in lots
  • Floating P&L (right-aligned, green or red, includes swap and commission, refreshes every second)

Row 2 — Price Levels + Action Buttons

Displayed values (left side):

  • Open: — the position's open price
  • SL: — the current stop loss (red text if set, grey dash if no SL)
  • TP: — the current take profit (green text if set, hidden if no TP)

Action buttons (right side, left to right):

Button Colour Action
BEv Cyan / Green Visual Break-Even — toggle a draggable trigger line (see below)
Pv Amber / Green Visual Partial — toggle a draggable partial close trigger line (see below)
P1 Teal Instant partial close at the InpP1Pct percentage (default 50%)
P2 Teal Instant partial close at the InpP2Pct percentage (default 25%)
BE Blue Instant break-even — moves SL to open price ± InpBEOffset points immediately
X Red Full close — closes the entire position immediately

Row 3 — Custom Close

  • Close: label
  • Edit box — enter a number. If ≤ 100 it is treated as a percentage of current volume. If > 100 it is treated as an exact lot size. Defaults to 100.
  • Go button — executes the partial or full close using the entered value

Visual Partial Lines (Pv)

The Pv system lets you set a price level on the chart and have the EA automatically execute a partial close the moment price reaches that level. Each position has its own independent Pv line.

Activating

Clicking Pv on a position card places an amber dashed horizontal line on the chart at a default offset above the current price for a buy (or below for a sell). The default offset is controlled by InpPvOffsetPts . A handle strip appears on the right edge of the chart at the line's price level.

Edit State (before placing)

The handle strip shows:

  • The price level in the strip background label
  • A small edit box for the close amount (default 50). Enter a value ≤ 100 for a percentage of volume, or > 100 for an exact lot count.
  • % / lots descriptor label
  • Place button (green) — locks the line and begins watching
  • x Cancel button (red) — removes the Pv line entirely

While in Edit state the line can be dragged by clicking and holding anywhere on the handle strip and moving the mouse. The line and handle follow the mouse position in real time.

Placed / Watching State

After clicking Place:

  • The line is locked — dragging is disabled until you click Edit
  • The handle strip switches to show a status message:
    • >> auto-fires when price crosses — the line is armed and will execute when price reaches it
    • >> drag line past current price to arm — the line is currently on the wrong side of price (it would trigger instantly). Move the line to the correct side first.
  • Edit button — returns to Edit state, re-enables dragging, shows the amount field and Place button again
  • x Cancel button — removes the Pv line

Trigger Logic

The system uses an armed/disarmed mechanism to prevent instant execution:

  • For a buy position: fires when Bid ≥ line price, but only if price was below the line when it was placed
  • For a sell position: fires when Ask ≤ line price, but only if price was above the line when it was placed

When triggered, the EA closes the specified percentage or lot amount of the position using a partial close (or full close if the amount ≥ remaining volume). The line is then automatically removed.

Button Colour States

The Pv button on the position card changes colour to indicate the current state:

  • Dim amber — not active
  • Bright amber — active, in Edit mode (line is on chart, not yet watching)
  • Bright green — placed and armed (actively watching for the price trigger)

Visual Break-Even Lines (BEv)

The BEv system lets you set a price trigger level and have the EA automatically move the stop loss to break-even the moment price reaches that level. Each position has its own independent BEv line.

Activating

Clicking BEv on a position card places a cyan dashed horizontal line on the chart. The default offset from current price is controlled by InpBEvOffsetPts . A cyan handle strip appears on the right edge.

Edit State

The handle strip shows:

  • The trigger price and current position open price in the main label
  • An information label: Drag to trigger level. When crossed: SL -> open (XXXXX.XX) — a reminder that the SL will move to the open price, not to the line's price
  • Place button — locks and arms the line
  • x Cancel button — removes the BEv line

Dragging works the same as Pv — click the handle and drag.

Placed / Watching State

Same two-button layout as Pv (Edit + x Cancel) with the same status messages indicating armed or disarmed state.

What Actually Executes

When the trigger fires the EA does not move the SL to the line's dragged price. It always moves the SL to:

  • Buy position: open price + InpBEOffset points
  • Sell position: open price − InpBEOffset points

The InpBEOffset buffer (default 2 points) ensures the SL clears the spread and avoids an immediate stop-out. A sanity check runs before modifying: if the computed SL would be invalid for current price (e.g. SL ≥ Bid for a buy), the action is skipped and the line is cancelled.

Button Colour States

The BEv button on the position card:

  • Dim cyan — not active
  • Bright cyan — active, Edit mode
  • Bright green — placed and armed, watching for price trigger

Multi-Position Support

Both Pv and BEv support up to 50 simultaneous independent lines (one per position slot, matching the MAX_P limit). Each line tracks its own:

  • Ticket number
  • Trigger price
  • Close amount (Pv only)
  • Armed/disarmed state
  • Placed/edit state
  • Screen Y coordinate for the drag handle

Lines for different positions are completely independent. You can have a Pv line for one position and a BEv line for a different position both active and watching at the same time.

Timeframe Switch Persistence

When you switch timeframes on the same symbol (e.g. from M5 to M30), the EA reinitialises but the chart lines survive:

  • All Pv and BEv chart lines (the horizontal dashed lines) are preserved because the cleanup logic specifically detects timeframe-only changes and skips deletion of chart objects
  • On reinitialisation the EA scans for any surviving TM_chart_vp_* and TM_chart_vbe_* objects, verifies each position still exists, and re-links them into the state arrays
  • Lines are restored to Edit mode — the amount field and Place button reappear so you can review the setting and re-place to resume watching
  • If you switch symbols (not just timeframe), all lines are fully cleaned up

Timer and Live Updates

A one-second timer drives all live display updates without requiring any trading activity:

  • Bid and Ask prices in the header
  • Account balance, equity, and open P&L in the account bar
  • Estimated lot size (in % Risk mode) or implied risk % (in Lots mode)
  • Per-position floating P&L on every card
  • Total P&L in the positions section header
  • Repositioning of all drag handles as the chart scrolls or zooms
  • Checking Pv and BEv trigger conditions for every active line

EA Inputs Reference

Group: RISK

Input Default Purpose
InpUsePercent true Starting risk mode: true = % Risk, false = Lots
InpRiskPct 1.0 Default risk percentage pre-loaded into the Risk % field
InpFixedLots 0.10 Default lot size pre-loaded when switching to Lots mode
InpDefaultSL 50 Default SL distance in points, pre-fills the SL edit box
InpDefaultTP 100 Default TP distance in points, pre-fills the TP edit box

Group: PARTIAL / BE

Input Default Purpose
InpP1Pct 50.0 Volume percentage closed by the P1 button
InpP2Pct 25.0 Volume percentage closed by the P2 button
InpBEOffset 2 Point buffer added/subtracted when moving SL to break-even (both instant BE and BEv trigger)

Group: VISUAL LINES

Input Default Purpose
InpPvOffsetPts 50.0 How far above/below current price the Pv line is placed by default when first activated
InpBEvOffsetPts 25.0 How far above/below current price the BEv line is placed by default when first activated

Group: PANEL

Input Default Purpose
InpX 14 Panel X position in pixels from the left edge of the chart window
InpY 24 Panel Y position in pixels from the top edge of the chart window



    Filtrele:
    Değerlendirme yok
    Değerlendirmeye yanıt