Pending Ladder From Drawn Fibonacci
Scaling into a retracement by hand means reading each level off the drawn fib tool, converting it to a price, working out a sensible lot size per level, and placing each order one at a time - fiddly enough that most traders either skip the deeper levels or place everything at one flat size instead of weighting toward the entries they actually have more conviction in. This script reads the levels straight off the Fibonacci retracement object already on the chart (OBJPROP_LEVELS / OBJPROP_FIRSTLEVEL+i), rather than assuming a fixed 38.2/50/61.8 set - whatever levels are actually drawn are what gets placed, including any custom ratios. The object's own two anchor points (ratio 0.0 and 1.0) are skipped, since they are not retracement entries, and anything outside the 0-1 range (an extension level) is skipped too - this tool places retracement entries only. Direction is read from the object itself: MetaTrader's fib convention puts level 0.0 at PRICE2 and level 1.0 at PRICE1, so PRICE2 above PRICE1 means an up-swing was drawn and the ladder places BUY LIMIT orders; PRICE2 below PRICE1 places SELL LIMIT orders. Lot size grows with retracement depth - InpBaseLots at the shallowest usable level, up to InpBaseLots times (1 + InpSizeSlope) at the deepest - so a deeper, statistically less likely pullback carries more size, matching how a discretionary trader usually scales in. The script always prints the full plan first. Nothing is sent to the server unless InpApply is set to true. Notes and limitations - Uses whatever levels are drawn on the fib object, including the count set by OBJPROP_LEVELS - if only three levels are visible on the object, only three orders are placed. - Levels at ratio 0.0 and 1.0, and any level outside the 0-1 range (extensions), are always skipped - this script places retracement entries only, never extension entries. - A level that falls inside the broker's stop level or freeze level relative to the current market price is skipped and reported, not forced through with a wider price. - Direction (buy-side vs sell-side ladder) is fixed by the object's own anchors for the whole run - it cannot place a mixed ladder from one object. - Re-running the script on the same fib object after it has already placed orders will place a second, duplicate set of pendings; it does not check for orders it placed previously.
Script · MT5 · v1.0 · Free
About Pending Ladder From Drawn Fibonacci
Pending Ladder From Drawn Fibonacci is an expert advisor (trading robot) for MetaTrader 5. It places pending buy/sell stop or limit orders. It has 11 settings, such as Fibo object name, Base lots and Size slope. MQL source code included.
Files in the download: PendingLadderFromFib.ex5, PendingLadderFromFib.mq5, PendingLadderFromFib.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 |
|---|---|---|
| Fibo object name | Name of the drawn Fibonacci retracement object (blank = first OBJ_FIBO found) | |
| Base lots | 0.10 | Lot size at the shallowest usable level (closest to 0.0) |
| Size slope | 1.0 | Extra lots multiplier added at the deepest level (1.0 = deepest level gets 2x InpBaseLots) |
| Stop loss pips | 0.0 | Stop loss distance from each entry, pips (0 = no stop) |
| Take profit pips | 0.0 | Take profit distance from each entry, pips (0 = no target) |
| Expiry hours | 0 | Pending expiry, hours from now (0 = GTC, no expiry) |
| Magic | 0 | Magic number stamped on every order placed |
| Slippage pips | 3 | Slippage tolerance passed to the order |
| Apply | false | Must be true to actually send the orders |
| Max retries | 3 | Attempts per level before giving up |
| Retry wait ms | 400 | Pause between attempts, milliseconds |
How to install
- Download the ZIP from your PolyMaria library and unzip it.
- In MetaTrader 5 open File → Open Data Folder, then go to MQL5 → Experts.
- Copy the .mq5 file(s) there. Put any .mqh files in MQL5 → Include.
- Open the .mq5 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: Fibonacci · Risk & Lot Size · Pending Orders · MT5 Script · MQL5 Source Code