Trendline Breaker MT5
- Experts
- Versione: 1.0
Mechanical Trendline Breakout Trading for MetaTrader 5
Trendline Breaker is a fully automated Expert Advisor for MetaTrader 5 built around a simple concept:
Confirmed Swings → Trendline Detection → Breakout → Entry → Safety Line Management → Exit
Instead of relying on manually drawn trendlines, the EA converts trendline trading into objective and repeatable rules.
The system automatically detects confirmed swing highs and lows, evaluates valid trendline structures, waits for a confirmed breakout, and manages the position using a dynamic Safety Line.
How It Works
Trendline Breaker uses two main structures:
ACTION LINE
The Action Line is the trendline that price must break before a trade can be considered.
For a potential BUY setup, the EA searches for a valid descending resistance trendline.
For a potential SELL setup, the EA searches for a valid ascending support trendline.
A breakout is confirmed only after a closed candle crosses the Action Line according to the configured breakout buffer.
SAFETY LINE
The Safety Line represents the opposite market structure and is used to control trade risk.
For BUY positions, the Safety Line is constructed from confirmed swing lows.
For SELL positions, it is constructed from confirmed swing highs.
The initial Stop Loss is placed beyond the Safety Line with an adjustable ATR buffer.
As new market structure develops, the EA can update the Safety Line and trail the Stop Loss accordingly.
If price closes through the active Safety Line, the position can be closed automatically.
Trendline Validation
Trendline Breaker does not simply connect two arbitrary points.
Each trendline candidate can be evaluated using:
-
Minimum number of confirmed touches
-
Minimum spacing between touches
-
Trendline age
-
ATR-based touch tolerance
-
Maximum permitted price violations
-
Maximum normalized trendline slope
-
Average touch accuracy
-
Trendline quality score
-
Safety Line quality score
The EA automatically compares available candidates and selects the strongest valid structure according to its internal scoring rules.
Closed-Candle Execution
Trading logic is evaluated once per newly completed candle.
The EA does not require an unfinished candle to confirm a breakout.
This makes the strategy deterministic and helps reduce signal changes caused by intrabar price movement.
Risk Management
Three position-sizing modes are available:
Risk % of Balance
Position size is calculated automatically from the selected percentage of account balance and the actual Stop Loss distance.
Risk Money
Specify the maximum amount of account currency to risk on a trade.
Fixed Lots
Use a fixed lot size.
The EA also respects symbol volume limits, broker volume steps, minimum volume requirements and available margin.
Exit Modes
Trendline Breaker supports two main trade-management approaches.
Dynamic Safety Line
The position follows the evolving Safety Line. The Stop Loss can tighten as new confirmed structure develops.
Optional Fixed Take Profit
A fixed Risk/Reward target can also be enabled.
Example:
Fixed RR = 3.0
Risk = 1R
Take Profit = 3R
When Fixed TP is disabled, the trade can remain open until the Safety Line logic closes it.
Additional Features
-
Automatic confirmed swing detection
-
Automatic trendline construction
-
Long and Short trading
-
Adjustable ATR breakout buffer
-
Optional minimum breakout candle body
-
Maximum entry-to-Safety-Line risk filter
-
Spread filter
-
Configurable Stop Loss ATR buffer
-
Optional fixed Risk/Reward Take Profit
-
Risk % Balance mode
-
Fixed monetary risk mode
-
Fixed lot mode
-
Broker volume and margin protection
-
Magic Number support
-
Custom trade comments
-
Long trading ON/OFF
-
Short trading ON/OFF
-
Multiple-position option
-
Trendline display ON/OFF
-
Swing-point display ON/OFF
-
Dashboard display ON/OFF
-
Debug logging option
On-Chart Dashboard
The built-in dashboard can display information such as:
-
Current strategy state
-
Selected trading direction
-
Action Line
-
Action Line touches and quality
-
Safety Line
-
Safety Line touches and quality
-
ATR
-
Risk distance in ATR
-
Breakout status
-
Current position
-
Entry price
-
Stop Loss
-
Floating P/L
Important
Trendline Breaker runs on the current chart symbol and timeframe.
Different symbols and timeframes have different volatility and market structure characteristics, so parameters may need to be adjusted accordingly.
Before using the EA on a live account, test it carefully in the MetaTrader 5 Strategy Tester and on a demo account.
Historical performance does not guarantee future results.
