Tiered Harvester
- Yardımcı programlar
- Sürüm: 1.0
- Etkinleştirmeler: 5
BANK A SHARE OF EVERY WINNER AT 1R, 2R AND BEYOND, THEN LET THE REST RUN WITH A STOP THAT ONLY MOVES FORWARD.
Tiered Harvester is a partial close manager for MetaTrader 5: it scales out of winning trades and takes partial profits in up to three tiers, measured in R multiples of your stop, in points or in ATR. After the tier you pick, the stop goes to a break-even that already pays for spread, commission and negative swap, and the runner can be trailed.
Built for traders who already have entries they trust, manual or from an EA, and who keep watching winners turn back into losers. One promise: the plan you would follow on a calm day is followed on every trade, at the exact level, without hesitation. Mechanism: the distance from the entry is measured in units (1R = the initial stop distance by default); when a unit level is reached, a fixed share of the starting volume is closed at market.
Works with: manual trades and other Expert Advisors or trade copiers on the same terminal (symbol scope and magic filter decide which positions it manages), hedging and netting accounts, every symbol (forex, gold, indices, crypto), and prop-firm style rules: it only ever reduces a position or tightens a stop, it never adds risk and it never opens a trade on your account.
Try it free first: run Tiered Harvester in the Strategy Tester with visual mode on. There it opens small demo positions with a stop and no take profit, so you can watch the tier line, the green tier blocks in the panel and the stop stepping to break-even and then trailing.
Who this is NOT for: traders looking for an entry robot or a grid (it opens nothing on a live chart), and traders who never use a stop loss and do not want to set a fixed R unit in points.
A worked example (default settings)
EURUSD buy 0.30 lots at 1.16489 with a stop at 1.16353, so 1R = 136 points (13.6 pips).
Price reaches 1.16625 (+1R): tier 1 closes 33% of 0.30 = 0.099, rounded down to the 0.01 volume step: 0.09 lots are closed and banked. 0.21 lots stay open.
Right after tier 1 the stop moves from 1.16353 to about 1.16528: entry + 20 points buffer + the spread + the 7 USD per lot commission. From here the rest of the trade cannot lose money unless the market gaps through the stop.
Price reaches 1.16761 (+2R): tier 2 closes the second 33%: the target after tier 2 is 0.102 lots left, so 0.10 lots are closed. 0.11 lots remain as the runner.
From tier 2 the runner's stop trails 1R behind the price and only ever moves forward. It ends at the trail stop or wherever you close it.
These are the real numbers of the first demo trade in the Strategy Tester log (June 2026). On small positions the volume step decides the size: a share below the broker's minimum volume is skipped and logged, it is never rounded up into a bigger close.
In short
- Up to 3 tiers: level and share of the starting volume for each; the shares can add up to 100% (no runner) or less (the rest runs).
- Units: R multiple of the initial stop distance, points from the entry, or ATR multiple read when the position is first seen.
- Break-even after the tier you choose: entry + buffer points + current spread + your commission per lot + any negative swap the position has collected.
- Trailing of the runner after the tier you choose, distance in the same unit, sent only when it gains the smallest move.
- Never widens a stop, never touches the take profit, respects minimum volume, volume step, stops level and freeze level.
- Alert-only mode: announces every tier as it is reached, sends nothing.
- Panel with real trading data: VOLUME HARVESTED bar with a mark for every tier, banked money, positions protected at break-even, and per position lots now and at start, distance in R, the next tier, the stop, the money banked and three TIERS blocks that fill as tiers are taken.
- Not a grid, no martingale, no DLLs, no web requests.
- Tester numbers (June 2026, EURUSD H1, defaults): 42 demo positions, 19 tier 1 closes, 9 tier 2 closes, 568.80 USD banked by tier closes, 19 break-even moves, 37 trail steps, 0 failed sends, 0 journal errors.
START HERE
Attach it to one chart, for example EURUSD H1. One copy manages every symbol of the account unless you limit it. Enter your commission per lot (0 if your broker has none). Make sure your trades carry a stop loss when you use R units, or set the R unit for positions without a stop in points. Turn on Algo Trading and watch the position table: WAITING T1, HARVEST T1, TO BREAK-EVEN, PROTECTED, TRAILING. To watch first, switch to ALERT ONLY with the panel button.
How one trade is harvested
First sight. The harvester records the starting volume and the unit distance of the position (for R: the distance from the entry to the stop at that moment). Moving the stop later does not change the unit, so 2R stays 2R.
Tier due. When the price is the tier level or more in profit (bid for buys, ask for sells), the share for that tier is closed at market: starting volume minus the volume that should remain, rounded down to the volume step, never leaving less than the minimum volume open unless the tier is meant to close everything.
Tiers already taken by hand count. If you close part of the position yourself, the harvester notices that the remaining volume is already at or below a tier's target and marks that tier as done instead of closing more.
Break-even. After the chosen tier the stop is moved to the cost-aware break-even, once, while the stop is still on the loss side of the entry.
Trailing. After the chosen tier the runner's stop follows the price at the trailing distance, always forward, and only when the move is at least the smallest stop move.
Price too close. If the broker's stops or freeze level does not allow the new stop yet, the state shows BE WAIT or FREEZE LEVEL and it tries again on the next pass.
Safety patterns inside
Before any send it checks that Algo Trading is allowed, that the symbol session is open and that the last quote is no older than 5 minutes. Every new stop is checked against the broker's stops and freeze levels, and the existing take profit is sent back unchanged. Right before each close the position is selected again and its symbol, magic, volume and tier count are compared with the plan, so a close is never sent twice for the same tier. A refused send is retried with a growing pause up to 2 minutes, with one alert after a set number of failures. Starting volume, unit, tiers done and money banked of every position are kept in GlobalVariables whose keys contain the chart symbol, the magic filter and the magic number, so two copies never share a key and a terminal restart continues the same plan.
Inputs, every one explained
HARVEST LADDER
InpMode = 1. 0 alert only, 1 harvest (partial closes and stop moves).
InpUnit = R multiple. Tier levels in R multiples of the initial stop distance, in points from the entry, or in ATR multiples.
InpT1Level = 1.0, InpT1Pct = 33. Tier 1 level and the share of the starting volume it closes (0 = tier off).
InpT2Level = 2.0, InpT2Pct = 33. Tier 2.
InpT3Level = 3.0, InpT3Pct = 0. Tier 3 (off by default, so 34% runs). Active levels must rise from tier to tier and the shares together may not pass 100%.
InpNoSLRiskPts = 0. R unit in points for positions without a stop; 0 leaves them alone.
BREAK-EVEN AFTER A TIER
InpBEAfterTier = 1. Move the stop to break-even after this tier, 0 = never.
InpBufferPts = 20. Break-even = entry + this many points.
InpAddSpread = true. Add the current spread.
InpCommPerLot = 7.0. Round-turn commission per lot in account money, 0 = none.
InpSwapAware = true. Add the negative swap of the position.
TRAILING THE RUNNER
InpTrailAfterTier = 2. Trail the stop after this tier, 0 = never.
InpTrailDist = 1.0. Trailing distance in the same unit as the tier levels.
InpMinMovePts = 20. Smallest stop move worth a send, in points.
EXECUTION
InpSlippage = 30. Maximum slippage of a partial close, in points.
InpFailAlertAt = 3. One alert after this many failed attempts.
FILTER - WHICH POSITIONS ARE MANAGED
InpSymbolScope = all symbols or the chart symbol only. InpMagicFilter = any magic, only manual trades (magic 0), or only the magic number InpMagic. InpATRTF = H1 and InpATRPeriod = 14 for the ATR unit.
ALERTS
InpAlertPopup = true. InpAlertPush = false (push to the MetaTrader app on your phone).
PANEL
ShowPanel = true. ShowLines = true: next tier line and break-even line for chart-symbol positions. PanelX = 12, PanelY = 15, PanelFontSize = 9, MaxTableRows = 6, MaxHistoryRows = 4. The MOVE button drags the panel; on a short chart it drops its least important rows first.
STRATEGY TESTER DEMO
InpTesterDemo = true. Strategy Tester only: Monday to Friday 08 to 16 one demo position per 4-hour slot with a stop 1.5 ATR away and no take profit, at most 3 open, margin checked x 1.5, closed after 4 days, stopped after a 20 percent balance loss. This code never runs on a live or demo chart.
The panel
VOLUME HARVESTED: a bar with the lots already closed against the starting lots of the positions in scope, with an amber mark at every tier. HARVEST PLAN: tier closes, money banked, positions in scope, protected and runners, open profit, the ladder (for example 33% @1.0R | 33% @2.0R | rest 34% runs), the break-even recipe, the trail, mode, last action, Algo Trading, failed sends and totals. POSITIONS, FURTHEST IN PROFIT FIRST: symbol, side, lots now and at start, distance in units, next tier, stop, banked money, profit, state and the TIERS blocks. ACTION HISTORY lists every close and stop move with server time. QUICK CONTROLS: ARMED or PAUSED, the mode button and CHECK NOW. The right side of the chart stays clear.
Common questions
Does it open trades by itself? No. On a live or demo chart it only closes parts of positions that are already open and moves their stops forward. Demo positions exist only inside the Strategy Tester.
Why did it close 0.09 and not 0.099 lots? Brokers accept only multiples of the volume step. The harvester always rounds the close down, so it never closes more than you planned.
Does it work with my other EA? Yes. Use the magic filter to choose which positions it manages. If your EA also closes parts or rewrites its own stop every tick, exclude it, or the two will fight.
Can the stop move back? No. Every stop move is checked again with the live position right before the send, and a stop further from the price than the current one is never sent.
What happens after a restart? Starting volume, unit, tiers done and banked money are kept in GlobalVariables, so the plan continues where it was.
What it cannot do
It does not choose entries and it does not set a take profit. A tier closed early can miss the rest of a big move: that is the price of banking part of it. A stop can still be filled with slippage or a gap. It only works while it runs: keep the terminal on, for example on a VPS.
What was and was not tested
Tested in the Strategy Tester on a hedging account, 1 to 30 June 2026, 1-minute OHLC, H1, deposit 10000, leverage 100, four runs, with no journal error and no failed send. EURUSD defaults: 42 demo positions, 19 tier 1 and 9 tier 2 closes, 568.80 USD banked, 19 break-even moves, 37 trail steps. XAUUSD with ATR units, three tiers of 25% at 1, 2 and 3 ATR, break-even after tier 2 with a 100 point buffer and a 1.5 ATR trail after tier 3: 42 demo positions, 27, 21 and 12 tier closes, 22 break-even moves, 187 trail steps. EURUSD in points, 50% at 100 points and 50% at 250 points: 23 and 8 tier closes, 23 break-even moves. EURUSD alert only: 39 demo positions, 32 alerts, nothing sent. On a demo chart the panel ran in alert-only mode beside 4 EURUSD positions and showed one tier ready and three under water.
Not tested at the time of writing: real closes on a live or demo broker, a netting account, retries after a broker refusal, freeze level refusals, chart symbol scope, magic filters, pop-up and push alerts and a terminal restart. These paths exist in the code and are described by design. Please try them on a demo account with your own broker first.
Try it in the Strategy Tester
Choose Tiered Harvester, EURUSD or XAUUSD, H1, any recent month, visual mode, and press Start. Watch the dotted tier line, the partial closes in the history and the stop jumping to the dashed break-even line.
If the harvester banked a trade you would otherwise have given back, or you think it should handle a case differently, an honest review on the product page helps other traders decide and tells me what to improve next.
