Loading…

Scale Out Slider Panel

Closing "about a third" of a position by typing a lot size means doing the arithmetic yourself and hoping it survives lot-step rounding. This panel replaces that with a slider: click anywhere along the track and the handle jumps straight there, with the percentage, the exact lot-step-normalised volume that percentage rounds to, the volume left open, and - if the position carries a stop - the dollar risk that remaining volume represents, all shown before anything is sent. Prev/Next cycle through every open position matching InpMagicFilter (0 = every open position on the account). The slider track is a non-selectable rectangle object, which is what lets a plain click on it fall through to the chart itself as a CHARTEVENT_CLICK with pixel coordinates rather than an object click - one click sets the handle to that exact position along the track, no drag gesture required. The panel is intentionally pinned to the chart's top-left corner: chart clicks are reported in that same top-left pixel space, so keeping the panel there is what lets its own offsets be compared against a click's coordinates directly. Execute Close sends the previewed volume. If the leftover remainder after that close would round to less than the symbol's minimum lot - an unfillable partial close - the whole position is closed instead of sending a doomed request, and the panel says so via its result line rather than failing silently. Notes and limitations - The slider only recognises a click that lands within the track's own pixel bounds; a click elsewhere on the chart is ignored rather than snapping the handle to an edge. - Remaining risk is only computable when the position carries a stop loss; without one the preview shows "no stop set" rather than a guessed figure. - The position list is rebuilt after every action and on a timer, so a position closed by another tool while this panel is open is dropped from the cycle automatically rather than left selectable. - This panel only ever closes volume from the currently selected ticket - there is no bulk "scale out everything" action.

Expert advisor · MT5 · v1.0 · Free

About Scale Out Slider Panel

Scale Out Slider Panel is an expert advisor (trading robot) for MetaTrader 5. It has 8 settings, such as Magic filter, Track width and Track height. MQL source code included.

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

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

Settings

SettingDefaultWhat it does
Magic filter00 = cycle every open position, else only this magic number
Track width300Slider track width, in pixels
Track height18Slider track height, in pixels
X offset10Panel X offset from the top-left corner, in pixels (panel is fixed to top-left)
Y offset20Panel Y offset from the top-left corner, in pixels
Slippage pips3Slippage tolerance, in pips
Max retries5Attempts per close before giving up
Retry wait ms500Pause between attempts, milliseconds

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: Volume · Risk & Lot Size · MT5 Expert Advisor · MQL5 Source Code

Expert advisors (EA) for MT4 & MT5 · PolyMaria