One Click Trade Panel
A one-click panel removes the two slowest parts of discretionary trading: typing a lot size into the order dialog, and clicking through several menus to manage an open position. This one adds nine buttons to the chart - Buy, Sell, Close All, Reverse, Breakeven, and three partial-close percentages - and every action runs the same retry and error handling used across this catalogue's scripts, so a busy trade context is waited out rather than treated as a failure. The risk-based lot sizing is the part worth reading before you attach it. A common shortcut multiplies the stop-loss distance in points by an assumed per-point cost, which is only correct on a USD account trading a USD-quoted pair. On a JPY cross, a metal, an index, or any account currency that is not the pair's quote currency, that assumed cost is wrong, sometimes by a large factor. This panel instead reads MODE_TICKVALUE and MODE_TICKSIZE for the symbol and derives the true money cost of the stop distance from them, which is correct on every instrument the broker quotes correctly - that is what "tick value arithmetic, not Point math" means in the summary. Reverse reads the account's net Buy and Sell volume on the chart symbol before closing anything, because once the closes are sent there is nothing left to read the direction from. Breakeven never moves a stop backward - a candidate level worse than the position's current stop is skipped, not applied, so a second click after a trail has already improved the stop cannot undo that progress. Every partial close is rounded to the broker's lot step and skipped, not silently resized, when the result would be smaller than the minimum lot or would equal the entire remaining position. Notes and limitations - Buy, Sell and the stop-loss placed with them always act on the chart's own symbol. Attach one instance per symbol you want a panel on. - Close All, Reverse, Breakeven and the partial closes only touch positions matching this EA's magic number and the chart's symbol - by design, so the panel cannot accidentally manage another EA's book. - Reverse closes the existing position(s) first and only then opens the opposite side. If the opening leg fails after a successful close, the account is left flat rather than reversed - the log states which happened. - Risk-based sizing depends on the broker reporting the tick value/size correctly for the symbol. If either reads back as zero or unavailable, the panel logs a warning and falls back to InpFixedLots for that click rather than sending a nonsensical size. - The panel is a chart tool, not a strategy - it never opens a position on its own initiative. OnTick does no work; every action originates from a button click in OnChartEvent. - On a netting MQL5 account, Buy, Sell and the entry half of Reverse refuse to open while a foreign-magic position sits on the chart symbol - see the differences section above.
Expert advisor · MT4 · v1.0 · Free
About One Click Trade Panel
One Click Trade Panel is an expert advisor (trading robot) for MetaTrader 4. It moves the stop loss behind price (trailing stop / break-even), can size trades from your balance and risk percent and has a news filter. It has 12 settings, such as Fixed lots, Risk percent and Stop loss pips. MQL source code included.
Files in the download: OneClickTradePanel.ex4, OneClickTradePanel.mq4, OneClickTradePanel.txt.
Trading robots can lose money. Check every setting and test on a demo account before using real funds.
Settings
| Setting | Default | What it does |
|---|---|---|
| Fixed lots | 0.10 | Fixed lot size (used when risk % is 0) |
| Risk percent | 0.0 | Risk % of balance per trade (0 = use fixed lots) |
| Stop loss pips | 20 | Stop loss distance for risk sizing, in pips |
| Magic number | 20260101 | Magic number for orders opened by this panel |
| Slippage pips | 3 | Slippage tolerance, in pips |
| Max retries | 5 | Attempts per trade action before giving up |
| Retry wait ms | 500 | Pause between attempts, milliseconds |
| Breakeven buffer pips | 1 | Buffer added past entry when Breakeven is pressed |
| Button color | clrSteelBlue | Button background colour |
| Text color | clrWhite | Button text colour |
| Panel x | 10 | Panel X offset, pixels from corner |
| Panel y | 20 | Panel Y offset, pixels from corner |
How to install
- Download the ZIP from your PolyMaria library and unzip it.
- In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Experts.
- Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
- Open the .mq4 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
- Drag the expert advisor from the Navigator onto a chart, check the settings, allow Algo/Auto Trading and press OK.
- Test it first on a demo account or in the Strategy Tester.
Tags: Trailing Stop & Break-even · Risk & Lot Size · News Trading · MT4 Expert Advisor · MQL4 Source Code