Long Breakout Range Trading Strategy
This is a trading strategy based on generating signals when price breaks out of a fixed lookback range. When price breaks above the highest high of the lookback period, long positions are taken; when price falls…
Overview
This is a trading strategy based on generating signals when price breaks out of a fixed lookback range. When price breaks above the highest high of the lookback period, long positions are taken; when price falls below the high, positions are closed. Trade direction can be easily switched.
Strategy Logic
Set lookback period parameter, e.g. 4 days.
Calculate highest high of the past 4 days.
Go long when today's high breaks out above this 4-day highest high.
Close positions when price fails to break the 4-day highest high.
Trade direction can be switched via the reverse parameter.
Advantage Analysis
Advantages of this strategy:
Breakout is simple and signals are clear.
Fixed breakout range avoids complex optimization and overfitting.
Easily switch between long/short, adaptable to various market conditions.
Lookback range filters noise for sustained trend tracking.
No complex indicators required, efficient strategy.
Risk Analysis
Main risks:
Fixed breakout range cannot adapt to market changes.
No stop loss exposes strategy to excessive losses beyond risk tolerance.
Fixed parameters vulnerable to market regime changes.
Excessive noise trades may increase transaction costs.
Lack of parameter optimization prevents achieving optimal results.
Optimization Directions
Improvements:
Optimize key parameters to find best combinations.
Introduce dynamic ranges based on ATR etc.
Consider adding trailing stop loss or fixed percentage stop loss.
Incorporate trend filter to avoid overtrading in ranging markets.
Test parameter robustness across more trading instruments.
Add machine learning for automatic parameter optimization.
Summary
Overall this is a very simple price breakout trading strategy. With enhancements like optimized parameter range, stop losses, trend filters and more, it can become an easy to implement and practical quantitative strategy.
Parameters
| Name | Default | What it controls |
|---|---|---|
| v_input_1 | 4 | Look Bak |
| v_input_2 | false | Trade reverse |
Source Pine Script
/*backtest
start: 2023-08-19 00:00:00
end: 2023-09-18 00:00:00
period: 2h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version = 2
////////////////////////////////////////////////////////////
// Copyright by HPotter v1.0 28/11/2016
// Breakout Range Long Strategy
// You can change long to short in the Input Settings
// Please, use it only for learning or paper trading. Do not for real trading.
////////////////////////////////////////////////////////////
strategy(title="Breakout Range Long Strategy Backtest", overlay = true)
look_bak = input(4, minval=1, title="Look Bak")
reverse = input(false, title="Trade reverse")
xHighest = highest(high, look_bak)
pos = iff(high > xHighest[1], 1, 0)
if (pos == 1 and strategy.position_size == 0 and reverse == false)
strategy.entry("Long", strategy.long)
if (pos == 1 and strategy.position_size == 0 and reverse == true)
strategy.entry("Short", strategy.short)
if (pos == 0 and strategy.position_size > 0)
strategy.close("Long")
if (pos == 0 and strategy.position_size < 0)
strategy.close("Short")
barcolor(strategy.position_size > 0 ? green: strategy.position_size < 0 ? red: blue)
plotshape(pos, style=shape.triangleup, location = location.belowbar, color = green)Published by ChaoZhang on the FMZ strategy square · last modified 2023-09-19. Collected in the Quant Trading Vault. Unvalidated research: re-test with your own data and costs before trusting it.
Build this with AgenKit
A spec is not a trading system. Paste this into your coding agent and AgenKit runs a specialist team — architecture, test-first build, risk gates, review — with paper trading on by default.
/agenkit build a production-grade trading bot with a backtest engine, risk controls and paper trading by default from strategies/Long-Breakout-Range-Trading-Strategy.md- npx agenkit install engineering-kit in your project
- Paste the command into your agent and approve each phase
- Get tests, backtest, risk controls and a paper-trading switch
Understand it first
Before you run this, read the lesson behind the idea and how to backtest it honestly. Specs like this one are the survivors of an unknown number of trials; deflate their results accordingly.
Related specs
- ATR Trailing Stops StrategyPine Script · Breakout · 1h
- ATR Trend Breakout StrategyPine Script · Breakout · 1d
- Advanced Multi Pattern Breakout Trading StrategyPine Script · Breakout · 1d
- BB Breakout StrategyPine Script · Breakout · 1d
- Bollinger Band Breakout Trend Following StrategyPine Script · Breakout · 1d
- Breakout Strategy Based on Turtle TradingPine Script · Breakout · 1d