Loading…

Bracket Builder Panel

Planning a trade by typing prices into a dialog gives no feel for the shape of the trade - how far the stop really is, whether the target is worth the risk. This panel puts three ordinary draggable horizontal lines on the chart - Entry, Stop, Target - and reads their live prices every second, working out the direction (buy or sell) from which side of Entry the Stop and Target lines sit on. Drag any line and the panel's numbers update: stop distance and target distance in pips, reward:risk ratio, the lot size that risks the configured percent of equity at that stop distance, and an estimated margin requirement for that size. A bracket with the lines in an inconsistent order (for example the Stop above Entry while the Target is also above Entry) has no valid direction and is flagged INVALID rather than guessed at or silently sent wrong. Sending is direction-aware: if the Entry line sits at the current market price it sends a market order; otherwise it sends the correct pending order type for that side automatically (buy stop above market, buy limit below market, and the mirrored pair for sell), so dragging Entry away from price to plan a level order does not require picking the order type by hand. Notes and limitations The estimated margin uses MODE_MARGINREQUIRED at the current price and leverage; it does not account for existing open exposure on the same symbol, so it can differ from the margin the broker actually reserves if other positions are already open. Only one bracket (one set of three lines) is supported at a time; building a second bracket means dragging the existing lines rather than adding new ones. The panel does not manage the trade after sending - no breakeven, no trailing, and it does not delete the lines once an order is sent, so they remain on the chart as a visual record until Reset or the EA is removed.

Expert advisor · MT5 · v1.0 · Free

About Bracket Builder Panel

Bracket Builder Panel is an expert advisor (trading robot) for MetaTrader 5. It places pending buy/sell stop or limit orders and can size trades from your balance and risk percent. It has 8 settings, such as Corner, X offset and Y offset. MQL source code included.

Files in the download: BracketBuilderPanel.ex5, BracketBuilderPanel.mq5, BracketBuilderPanel.txt.

Trading robots can lose money. Check every setting and test on a demo account before using real funds.

Settings

SettingDefaultWhat it does
Corner0Panel corner: 0=top-left 1=top-right 2=bottom-left 3=bottom-right
X offset12Panel offset from the chosen corner, X pixels
Y offset18Panel offset from the chosen corner, Y pixels
Default stop pips30.0Default distance from entry to the stop line, in pips
Default target pips60.0Default distance from entry to the target line, in pips
Risk percent1.0Percent of account equity risked, used to size the position
Slippage30Slippage in points passed to the trade request
Magic38200Magic number for orders sent from this panel

How to install

  1. Download the ZIP from your PolyMaria library and unzip it.
  2. In MetaTrader 5 open File → Open Data Folder, then go to MQL5 → Experts.
  3. Copy the .mq5 file(s) there. Put any .mqh files in MQL5 → Include.
  4. Open the .mq5 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
  5. Drag the expert advisor from the Navigator onto a chart, check the settings, allow Algo/Auto Trading and press OK.
  6. Test it first on a demo account or in the Strategy Tester.

Download the PDF guide

Tags: Risk & Lot Size · Pending Orders · MT5 Expert Advisor · MQL5 Source Code

Expert advisors (EA) for MT4 & MT5 · PolyMaria