Payoff Ratio Keeper
- Utilitários
-
AL MOOSAWI ABDULLAH JAFFER BAQER
To trade successfully we need to go through the proven path that others had gone and reached!
Here are 17 quotes from such successful investors:
1- Limit your size in any position so that fear does not become the prevailing instinct guiding your judgment.
Joe Vidich - Versão: 1.0
- Ativações: 5
EVERY POSITION GETS A TAKE PROFIT AT THE PAYOFF:RISK RATIO YOU CHOSE, EVEN WHEN YOU FORGOT TO SET ONE.
Payoff Ratio Keeper is a risk to payoff manager for MetaTrader 5: an auto take profit tool that sets the TP of manual and EA trades to a fixed R-multiple of the stop loss. Positions without a take profit get one; a take profit that pays less than your minimum ratio is moved further out. Your stop loss is never changed and a take profit is never pulled closer.
Built for traders who decide the stop first and then lose the discipline on the target: a TP forgotten in a fast market, a TP of 40 points behind a stop of 150, a copier that sends trades with no target at all. One promise: every trade in scope carries the ratio you planned. Mechanism: risk = distance from the entry to the stop; target = entry + risk x your ratio + the spread and commission, so the ratio is net of costs.
Before and after, from the Strategy Tester log (June 2026): EURUSD buy with a stop of 150 points and a take profit only 1:0.27 away: the TP was moved from 1.16439 to 1.16643, the 1:2 target.
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 writes take profits, it never adds volume and it never opens a trade on your account.
Try it free first: run Payoff Ratio Keeper in the Strategy Tester with visual mode on. There it opens small demo positions with a stop, most of them with no take profit and every third one with a TP of only 0.5 R, so you can watch the dotted target line, the TP appearing and the RISK|TARGET gauge in the panel turning green.
Who this is NOT for: traders looking for an entry robot or a grid (it opens nothing on a live chart), scalpers who close by hand and want no take profit at all, and traders who never use a stop loss and do not want to give a fixed risk in points.
A worked example (default settings)
EURUSD buy 0.30 lots at 1.16489 with a stop at 1.16353, so the risk is 136 points. No take profit.
After the 10 second grace time the keeper computes the 1:2 target: 1.16489 + 2 x 136 points = 1.16761, plus about 12 points of spread and 7 points for the 7 USD per lot commission on 0.30 lots: the take profit is set at 1.16780. These are the real numbers of the first demo trade in the tester log.
If you or your EA later put a take profit at 1.16550 (1:0.31 after costs), the keeper sees a ratio below the 1:1.5 minimum and moves it back out to 1.16780. A take profit at 1.16900 (more than 1:2) is left exactly where it is.
In short
- Target payoff:risk ratio, for example 1:2, with risk = entry to stop loss.
- Two rules: only add missing take profits, or also lift take profits that offer less than a minimum ratio.
- Costs inside the ratio: current spread and your commission per lot, so 1:2 means 1:2 after costs.
- Grace time after a position opens, so an EA that sets its own TP a moment later is not overruled.
- Optional fixed risk in points for positions without a stop; otherwise they are left alone.
- Never changes the stop loss, never pulls a take profit closer, respects stops level and freeze level.
- Alert-only mode: one alert per position that needs a take profit, nothing sent.
- Panel with real trading data: TARGET COVERAGE bar, book risk against book target in money, and per position the risk in points, the TP now, the R:R now, the target TP and a RISK|TARGET gauge.
- Not a grid, no martingale, no DLLs, no web requests.
- Tester numbers (June 2026, EURUSD H1, defaults): 42 demo positions, 28 take profits set, 15 lifted, 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. Set your target ratio and your commission per lot (0 if your broker has none). Turn on Algo Trading and watch the position table: GRACE, SETTING TP, LIFTING TP, RATIO OK. To watch first, switch to ALERT ONLY with the panel button.
How one trade is handled
Risk. The distance from the entry to the stop loss, read on every pass. A stop already moved into profit means the trade has no risk left: the state shows STOP IN PROFIT and the take profit is left alone.
Target. Entry plus risk times the target ratio plus spread and commission, rounded away from the entry to the tick size.
Missing take profit. After the grace time the target is sent as the take profit, with the stop loss sent back unchanged.
Low ratio. With the lift rule, a take profit that pays less than the minimum ratio after costs is moved out to the target, never closer.
Removed take profit. If you delete a take profit the keeper set, it sets it again; turn InpReapply off to respect your choice.
Price already past the target. The target would be invalid, so nothing is sent and the state shows PRICE PAST TARGET.
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 take profit is checked against the broker's stops and freeze levels. Right before each send the position is selected again and its symbol, magic, stop and take profit are compared with the plan, so a changed position is never overwritten with old numbers. A refused send is retried with a growing pause up to 2 minutes, with one alert after a set number of failures. Which positions it already handled is kept in GlobalVariables whose keys contain the chart symbol, the magic filter and the magic number, so two copies never share a key.
Inputs, every one explained
TARGET TO RISK
InpMode = 1. 0 alert only, 1 keep (set and lift take profits).
InpRule = missing + lift. Only positions without a take profit, or also take profits below the minimum ratio.
InpTargetRR = 2.0. Take profit distance = risk x this.
InpMinRR = 1.5. A take profit offering less than this ratio after costs is lifted (lift rule only). Not above the target ratio.
InpNoSLRiskPts = 0. Risk in points for positions without a stop; 0 leaves them alone.
InpGraceSec = 10. Seconds to wait after a position opens before acting.
InpReapply = true. Set the take profit again if it is removed later.
COSTS IN THE RATIO
InpAddSpread = true. Add the current spread to the target.
InpCommPerLot = 7.0. Round-turn commission per lot in account money, 0 = none.
EXECUTION
InpMinMovePts = 5. Smallest take profit move worth a send, 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.
ALERTS
InpAlertPopup = true. InpAlertPush = false (push to the MetaTrader app on your phone).
PANEL
ShowPanel = true. ShowLines = true: dotted target take profit 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, 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
TARGET COVERAGE: a bar with the share of positions whose take profit pays at least the minimum ratio. KEEPER PLAN: target and minimum ratio, rule, book risk against book target in money with the ratio of the whole book, positions without TP or with a low ratio, open profit, costs, mode, last action, Algo Trading, failed sends and totals. POSITIONS, LOWEST RATIO FIRST: symbol, side, lots, risk, TP now, R:R now, target TP, profit, state and the RISK|TARGET gauge (red block = 1 risk, green or amber = payoff up to 1:4, blue tick = your target). ACTION HISTORY lists every take profit set or lifted 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 writes take profits of positions that are already open. Demo positions exist only inside the Strategy Tester.
Will it fight my EA's take profit? It waits the grace time, never pulls a TP closer, and only lifts a TP below your minimum ratio. If your EA rewrites its TP every tick, exclude it with the magic filter.
Why is the take profit a few points further than exactly 2R? Spread and commission are added so the ratio is net of costs; turn both off for a pure 2R.
Does it move my stop loss? Never. The stop is sent back unchanged with every take profit.
What it cannot do
It does not choose entries and it does not manage stops. A take profit can still be filled with slippage, and a far target is reached less often than a near one: that is the trade-off of a fixed ratio. 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, 28 take profits set, 15 lifted. XAUUSD with target 1:3, minimum 1:2.5 and no commission: 25 demo positions, 17 set, 8 lifted. EURUSD missing-only rule: 28 set, 0 lifted. EURUSD alert only: 41 demo positions, 28 alerts, nothing sent. On a demo chart the panel ran in alert-only mode beside 4 EURUSD positions on a closed market and showed MARKET SHUT with the targets drawn.
Not tested at the time of writing: real sends 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 Payoff Ratio Keeper, EURUSD or XAUUSD, H1, any recent month, visual mode, and press Start. Watch the dotted target line and the take profit appearing on each new demo trade.
If the keeper saved a trade from closing without a target, 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.
