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 · MT4 · v1.0 · Free
About Scale Out Slider Panel
Scale Out Slider Panel is a script for MetaTrader 4. It has 8 settings, such as Magic filter, Track width and Track height. MQL source code included.
Files in the download: ScaleOutSliderPanel.ex4, ScaleOutSliderPanel.mq4, ScaleOutSliderPanel.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| Magic filter | 0 | 0 = cycle every open position, else only this magic number |
| Track width | 300 | Slider track width, in pixels |
| Track height | 18 | Slider track height, in pixels |
| X offset | 10 | Panel X offset from the top-left corner, in pixels (panel is fixed to top-left) |
| Y offset | 20 | Panel Y offset from the top-left corner, in pixels |
| Slippage pips | 3 | Slippage tolerance, in pips |
| Max retries | 5 | Attempts per close before giving up |
| Retry wait ms | 500 | Pause between attempts, milliseconds |
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 → Scripts.
- 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 script onto a chart to run it once.
Tags: Volume · Risk & Lot Size · MT4 Expert Advisor · MQL4 Source Code