High Low Breakout Trend Following Strategy
This strategy is named "High-Low Breakout Trend Following Strategy". It identifies new price highs and lows to determine trend direction, and trades breakouts of latest high/low points to follow trends. The specific…
This strategy is named "High-Low Breakout Trend Following Strategy". It identifies new price highs and lows to determine trend direction, and trades breakouts of latest high/low points to follow trends.
The specific logic is:
Calculate the highest high and lowest low over a certain period (e.g. 22 days).
When price breaks above the latest 1-day high, a buy signal is generated, flagging an uptrend.
When price breaks below the latest 1-day low, a sell signal is generated, flagging a downtrend.
Trend direction is checked to filter false signals. For example, new high price with bearish divergence is ignored for buying.
Only when indicators align with price trend will trades be taken on breakouts of the latest high/low points.
The advantage is capturing pivotal breakout timing, which often accompanies trend start or acceleration. But over-trading in ranging markets should be prevented.
In summary, watching key price area breakouts is essential in trend following. But confirmation with other indicators and parameter tuning based on actual conditions are needed to maximize the strategy's utility.
Parameters
| Name | Default | What it controls |
|---|---|---|
| v_input_1_hlc3 | 0 | price: hlc3 | high | low | open | hl2 | close | hlcc4 | ohlc4 |
| v_input_2 | 22 | LookBack |
| v_input_3 | 14 | length |
| v_input_4 | 2 | length2 |
Source Pine Script
/*backtest
start: 2023-08-13 00:00:00
end: 2023-09-12 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=1
strategy(title="HIGHER HIGH LOWER LOW STRATEGY", shorttitle="HH LL STRATEGY", overlay=true, calc_on_order_fills=true, initial_capital=100000, default_qty_type=strategy.percent_of_equity, currency="USD", default_qty_value=100)
////
//Higher High or Lower Low Entry Inputs
price = input(hlc3)
LookBack = input(22)
Highest = highest(LookBack)
Lowest = lowest(LookBack)
long = price > Highest[1]
short = price < Lowest[1]
//Divergence Check Inputs
length = input(14)
High_Guard = highest(length)
Low_Guard = lowest(length)
length2 = input(2)
long1 = long == 1 and Highest[1] > High_Guard[length2]
short1 = short == 1 and Lowest[1] < Low_Guard[length2]
plot(long and long[1], color=green, style=line)
plot(short and short[1], color=red, style=line)
strategy.entry("Long", strategy.long, when=long1)
strategy.entry("Short", strategy.short, when=short1)
Published by ChaoZhang on the FMZ strategy square · last modified 2023-09-13. 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/High-Low-Breakout-Trend-Following-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
- Bollinger Bands Breakout Trading StrategyPine Script · Breakout · 1h
- Bollinger Bands Dynamic Breakout StrategyPine Script · Breakout · 1h
- Cross period Value Area Breakout StrategyPine Script · Breakout · 1d
- Donchian Channel Breakout Strategy 442842Pine Script · Breakout · 4h
- Dynamic Support Resistance Breakout Moving Average Crossover StrategyPine Script · Breakout · 1d
- Dynamic Support and Resistance Adaptive Pivot Trading StrategyPine Script · Breakout · 1d