Trendline v5.0 Strategy
Trendline v5.0 Strategy is the auto-trading version of the Trendline v5.0 indicator for MetaTrader 5. It runs the exact same non-repainting signal engine you already see on the chart - four switchable modes, the Sensitivity and Signal Strength mapping, the Stability, Smart Filter, Follow-Trend and Session gates, the shared cooldown and the multi-timeframe confluence - and then executes those signals for you as real broker orders. With matching inputs, the Strategy trades precisely the entries the indicator prints; nothing extra is invented.
Key benefits
- Trades the signals you already trust - the signal logic is identical to the Trendline v5.0 indicator, so every entry is one you could have seen and verified on the chart first.
- Hands-off execution - the Strategy watches each closed bar, and the moment a valid signal fires it places the order group automatically, on your account, at your broker.
- Position sizing built in - choose a fixed lot or risk a fixed percentage of equity; the Strategy sizes each trade from the ATR stop distance so risk stays consistent across instruments.
- Every target is its own order - each enabled take-profit (TP1/TP2/TP3) is placed as a separate broker ticket sharing one stop, so partial targets close cleanly and the rest of the position keeps running.
- Automatic stop management - once the first target is banked, the remaining legs move to breakeven, taking the initial risk off the table.
- No order stacking - Stability Mode keeps one clean trade on at a time; a new group is only opened once the previous one is closed.
- Selective by design - cooldown, an optional Smart Signal Filter, a session-time window and an optional trend bias all keep the Strategy from over-trading.
How it works
On every completed bar the Strategy replays the Trendline v5.0 engine, classifies the market with the range-based Sentiment Range MA, and looks for a qualified entry in the active mode. When one appears it derives the entry, an ATR-based stop and up to three reward targets, then opens the trade as a min-lot-aware split of separate tickets under a single stop. Stop-to-breakeven and anti-stacking are handled for you. Full rules and every input are in the Manual.
What's included
- MetaTrader 5 auto-trading Strategy file (.ex5)
- The same four signal modes, adjustable Sensitivity and Signal Strength as the indicator
- Fixed-lot or risk-percent position sizing
- ATR stop with up to three R-multiple targets, each as its own broker order
- Stop-to-breakeven, anti-stacking and an optional server-time session filter
- Full manual with the complete input reference and installation steps
Best for
FX majors, gold, index CFDs and large-cap crypto on M15 to H4 - for traders who want the Trendline v5.0 setups executed automatically with a defined stop, structured targets and disciplined risk.
Get started
Browse the ZynAlgo marketplace
Trading involves risk; no strategy predicts the market. Trendline v5.0 Strategy is an automated trading tool, not financial advice, and past performance does not guarantee future results.
Trendline v5.0 Strategy
What the Strategy actually does
Trendline v5.0 Strategy is the auto-trading version of the Trendline v5.0 indicator for MetaTrader 5. It is not a new set of rules bolted onto the indicator - it is the same signal engine, executing on your account. The four signal modes, the Sensitivity and Signal Strength mapping, the range-based Sentiment Range MA that colours the candles, the shared cooldown, the multi-timeframe confluence and every entry filter are identical, bit-for-bit, to the plain indicator. With matching inputs, the Strategy opens trades on exactly the signals you would see printed on the chart.
What the Strategy adds on top of the indicator's on-chart simulation is a real-money execution layer:
- Lot sizing - fixed, or a fixed percentage of equity risked against the stop
- Each enabled take-profit placed as its own broker order (a min-lot-aware split) sharing one stop
- Stop-to-breakeven once the trigger target is reached
- Anti-stacking, so only one trade group is on at a time
Everything else - how a signal is defined, when it is allowed and when it is suppressed - works exactly as described in the Trendline v5.0 indicator manual.
How a signal becomes a trade
On every completed bar, the Strategy replays the Trendline v5.0 engine over recent history and re-derives the current signal, non-repainting (the still-forming bar is excluded). When a valid entry fires on the most recently closed bar, the Strategy:
- Takes the entry as the close of the signal bar.
- Sets the stop ATR(14) x the SL Distance multiple away from entry.
- Derives each enabled target as an R-multiple of that stop distance (TP1/TP2/TP3).
- Sizes the total position - fixed lot or risk percent - from the stop distance.
- Splits that size across the enabled targets, one broker ticket per target, all sharing the single stop.
- Opens the order group, tagged with the Strategy's Magic number.
While the group is live, the Strategy manages it: once the breakeven trigger target is banked, the remaining legs' stops move to the entry price. A new group is only opened after the current one has closed, so signals never stack.
The four signal modes (shared with the indicator)
- Mode 4 (default) - mean-reversion. RSI reversal at the edge of the 50-bar range, only while the Sentiment Range MA is flat.
- Mode 1 - pullback onto a stacked EMA set (touch-and-confirm).
- Mode 2 - the bar three EMAs first stack in trend order.
- Mode 3 - a fast/slow crossover calculated on RSI.
The full definition of each mode, the Sentiment Range MA and the shared filters is in the Trendline v5.0 indicator manual. The Strategy trades them unchanged.
Inputs
Basic Setting
InpMode(defaultMode 4): Active signal engine: Mode 1, 2, 3 or 4. Mode 4 is mean-reversion; Modes 1-3 are trend-following.InpSensitivity(default5): Shifts the internal MA / RSI lengths. Lower is faster and busier, higher is slower and more selective.InpSignalStrength(default0): 0 uses the chart timeframe. Higher values recompute the active mode's signal on a proportionally higher timeframe for stronger confluence.
Risk Management
InpStabilityMode(defaulttrue): Blocks any new entry while a trade group is still open (anti-stacking). On by default.InpSmartSignalFilter(defaultfalse): Forces signals to alternate direction, so a BUY cannot follow a BUY.
Session
InpUseSession(defaultfalse): Enables the server-time trading window. When off, signals are allowed at any hour.InpSession(default"0700-1800"): The allowed window in server time,HHMM-HHMM. Overnight windows (start > end) are supported.
Trend Bias
InpFollowTrend(defaultfalse): When on, permits BUY only above the 200 EMA with RSI(14) over 50, and SELL only below it with RSI under 50. Works against Mode 4's mean-reversion character.
Take Profit / Stop Loss
InpEnableTpSlEntry(defaulttrue): Master switch for stop and target management on placed trades.InpSlAtrMultiplier(default2.8): Stop distance as a multiple of ATR(14) from the entry.InpEnableTp1(defaulttrue): Enable the first target.InpRR1(default1.0): TP1 reward-to-risk multiple (1.0 = one stop distance).InpEnableTp2(defaultfalse): Enable the second target.InpRR2(default2.0): TP2 reward-to-risk multiple.InpEnableTp3(defaultfalse): Enable the third target.InpRR3(default3.0): TP3 reward-to-risk multiple.InpMaxTradeDuration(default200): Bars-in-trade cap used by the on-chart simulation and dashboard stats only; it does not force-close live broker orders.
Each enabled target becomes a separate broker ticket. With two or more targets enabled, a breakeven stop activates on the remaining legs once the trigger target is reached (see below).
Trading (position sizing & execution)
InpLotMode(defaultRisk %): Position-sizing mode: fixed lot, or risk a percentage of equity against the stop.InpFixedLots(default0.01): Total group lot size when using fixed-lot mode (also the fallback if a risk-percent calc cannot be resolved).InpRiskPercent(default1.0): Percent of account equity risked on the stop distance, when using risk-percent mode.InpEnableSLtoBE(defaulttrue): Move the remaining legs' stop to the entry price (breakeven) after the trigger target is banked.InpBETrigger(defaultAfter TP1): Which target triggers the breakeven move: after TP1 or after TP2.InpMagic(default574050): Magic number tagging this Strategy's orders, so it manages only its own trades.InpSlippagePoints(default20): Maximum price deviation allowed on order execution, in points.InpMaxSpreadPoints(default0): Maximum spread that still permits a new entry, in points. 0 disables the check.
License
InpAccessKey(default""): Your ZynAlgo access key. Optional if the installer has already droppedmarket.datinto the terminal's Common\Files.
Visuals & window
InpEnableBbCloud(defaultfalse): Draw the optional Bollinger-band ATR cloud.InpCalculateBars(default2000): History window used for the on-chart replay, dashboard stats and visuals.- Candle / signal / line / dashboard colours. Cosmetic only (
InpColorUptrend,InpColorDowntrend,InpColorSideways,InpColorBullSignal,InpColorBearSignal,InpColorEntryLine,InpColorTpLine,InpColorSlLine, the BB and dashboard colours). They do not affect trading.
Position sizing and the target split
The Strategy first works out the total lots for the group. In risk-percent mode it divides the money at risk (equity x risk percent) by the loss-per-lot implied by the stop distance; in fixed mode it uses the fixed lot directly. That total is then split into one ticket per enabled target, each floored to the broker's lot step and never below the broker minimum. If the total size can only fund fewer legs than there are targets, the nearer targets are funded first; any rounding remainder is added to the furthest-target leg so the group total stays as close as possible to the request without exceeding it. Every leg shares the same ATR stop.
Stop-to-breakeven and anti-stacking
With InpEnableSLtoBE on and at least two targets enabled, the Strategy watches the trigger leg (TP1 or TP2, per InpBETrigger). Once that leg is no longer open - its target has been hit - the remaining legs' stops are moved to the group's entry price, so the trade can no longer give back the initial risk.
Anti-stacking is governed by Stability Mode. While any order tagged with this Strategy's Magic number is open, no new group is opened, even if a fresh signal fires. This keeps one clean trade on the instrument at a time and mirrors the indicator's Stability Mode behaviour.
Installing and running it
- Copy the
ZynAlgoTrendlineV5Strategy.ex5file into theMQL5/Expertsfolder inside your MetaTrader 5 data folder. - Refresh the Navigator panel and drag the Strategy onto the chart and timeframe you want to trade (M15-H4 suits the default settings).
- In the dialog, allow algorithmic trading. This Strategy needs Allow DLL imports enabled for the license check.
- Enter your ZynAlgo access key in
InpAccessKey, or make sure the installer has placedmarket.datin the terminal's Common\Files. - Set your position-sizing mode and risk, choose the signal mode and confirm.
Make sure the terminal's global Algo Trading button is on so the Strategy can place orders.
License
Trendline v5.0 Strategy requires a valid ZynAlgo access key at all times - there is no test build and no Strategy Tester bypass, so a key is required in every context, including the tester. The check runs through the ZynAlgo licensing library (the same compiled DLL used by the indicators), which is why Allow DLL imports must be enabled. The key is read from InpAccessKey first, and otherwise from the market.dat file the installer writes into Common\Files. On the backend the Strategy identifies itself with the slug trendline-v5 and the file type mt5_strategy. If no valid key is found, the Strategy draws an "Access Denied" banner and does not trade.
Partial take-profit - how the TP toggles behave
Each target you enable (TP1, TP2, TP3) opens as its own broker ticket sharing one stop loss, so the position is scaled out in parts - the broker closes each ticket when price reaches that target (no partial-close call is used). Targets sit at Entry +/- R x Ratio, where R is the Entry-to-Stop distance. Defaults are TP1 = 1R, TP2 = 2R, TP3 = 3R, and "Move SL to breakeven" is armed after TP1.
Partial exit ON (two or more targets enabled):
- TP1 + TP2 + TP3 (default) - 3 orders, about 1/3 of the size each; scales out at 1R / 2R / 3R. After TP1 closes, the TP2 and TP3 stops move to breakeven.
- TP1 + TP2 (TP3 off) - 2 orders, about half each; scales out at 1R / 2R. After TP1 closes, the TP2 stop moves to breakeven.
- TP1 + TP3 (TP2 off) - 2 orders, about half each; scales out at 1R / 3R (2R skipped). After TP1 closes, the TP3 stop moves to breakeven.
- TP2 + TP3 (TP1 off) - 2 orders, about half each; scales out at 2R / 3R. The breakeven trigger falls back to the nearest enabled target (TP2); when it closes, the TP3 stop moves to breakeven.
Partial exit OFF (a single target enabled):
- TP1 only - 1 order at full size, closes at 1R. No partial exit; with one leg, breakeven has nothing left to protect.
- TP2 only - 1 order at full size, closes at 2R. No partial exit.
- TP3 only - 1 order at full size, closes at 3R. No partial exit.
- All targets off - no trades are taken. Keep at least one target enabled.
Good to know:
- If your lot size only funds fewer legs than the targets you enabled, only the nearest legs open (the Experts log notes this).
- On a netting account, same-symbol tickets merge into one position that runs to the furthest enabled target, so partial exits are not available there; the chart shows a banner. Use a hedging account for true partial take-profit.
Browse the ZynAlgo marketplace
Trading involves risk. Trendline v5.0 Strategy is an automated trading tool, not financial advice, and past behaviour does not predict future results. Always test on a demo account first.
- Trendline v1Aug 13, 2026





















