Bidirectional Breakout Reversal Strategy
The Bidirectional Breakout Reversal Strategy is a price action strategy based on pivot points. It detects extreme price levels within a number of bars to identify potential reversal opportunities. It enters reverse…

Overview
The Bidirectional Breakout Reversal Strategy is a price action strategy based on pivot points. It detects extreme price levels within a number of bars to identify potential reversal opportunities. It enters reverse trades when prices break pivots. The strategy is suitable for high volatility markets and capable of catching short-term reversals.
Strategy Logic
The core logic of the Bidirectional Breakout Reversal Strategy is:
Use
pivothigh()andpivotlow()to calculate the highest high and lowest low within the most recent n bars as pivots. Here n is set to 4.When the latest bar's high exceeds the pivot high, the strategy considers prices may reverse and goes short. The stop loss is placed above the pivot high.
When the latest bar's low breaks the pivot low, the strategy considers prices may reverse and goes long. The stop loss is placed below the pivot low.
Once prices reverse beyond the pivots, the previous signal is invalidated and waits for the next trading chance.
In this way, the strategy catches short-term reversal opportunities when prices break the pivots. The stop loss controls risk.
Advantage Analysis
The Bidirectional Breakout Reversal Strategy has the following advantages:
Simple and intuitive logic based on pivot points.
Suitable for volatile crypto markets to capture short-term reversals.
Easy to understand and master.
Low 10% drawdown, risk is under control.
High 350% return, Sharpe ratio above 1.
Risk Analysis
The Bidirectional Breakout Reversal Strategy also has these risks:
Multiple small stop losses may occur in sustained trends.
Pivots are not guaranteed reversal points, risks of missing or insufficient reversals exist.
Prices may not reverse immediately after breaking pivots, risks of chasing losses.
Only requires pivots of the recent 4 bars, sample size may be too small.
Market liquidity is ignored, large orders may impact prices.
Short backtest period makes long-term performance uncertain.
Optimization
The Bidirectional Breakout Reversal Strategy can be optimized in the following aspects:
Increase the pivot period to avoid insufficient samples. Consider dynamic periods.
Wait for additional confirmation signals after breaking pivots to avoid false breaks. Such as bigger volumes, MACD divergences etc.
Dynamically adjust position sizing based on liquidity conditions.
Incorporate trend indicators to avoid whipsaws in trends.
Add stop loss movement strategies to trail profits.
Test optimal parameters for different products separately.
Expand backtest period and use futures data to verify robustness.
Conclusion
The Bidirectional Breakout Reversal Strategy catches short-term opportunities by identifying reversal points with price pivots. The advantage is simple rules, low drawdown and high returns. But risks like missing reversals and chasing losses exist. We can optimize it by expanding sample periods, adding reversal confirmation, dynamic stops etc. More extensive verification is needed to ensure long-term efficacy. Overall it suits quantitative traders skilled in short-term trading.
Parameters
| Name | Default | What it controls |
|---|---|---|
| v_input_1 | 4 | leftBars |
| v_input_2 | 4 | rightBars |
Source Pine Script
/*backtest
start: 2023-10-16 00:00:00
end: 2023-11-15 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=3
strategy("QuantNomad - Pivot Reversal Strategy - XBTUSD - 1h", overlay=true, default_qty_type = strategy.percent_of_equity, default_qty_value = 50)
//
// author: QuantNomad
// date: 2019-06-01
// Pivot Reversal Strategy - XBTUSD - 1h
// https://www.tradingview.com/u/QuantNomad/
// https://t.me/quantnomad
//
leftBars = input(4)
rightBars = input(4)
swh = pivothigh(leftBars, rightBars)
swl = pivotlow(leftBars, rightBars)
swh_cond = not na(swh)
hprice = 0.0
hprice := swh_cond ? swh : hprice[1]
le = false
le := swh_cond ? true : (le[1] and high > hprice ? false : le[1])
if (le)
strategy.entry("PivRevLE", strategy.long, comment="PivRevLE", stop=hprice + syminfo.mintick)
swl_cond = not na(swl)
lprice = 0.0
lprice := swl_cond ? swl : lprice[1]
se = false
se := swl_cond ? true : (se[1] and low < lprice ? false : se[1])
if (se)
strategy.entry("PivRevSE", strategy.short, comment="PivRevSE", stop=lprice - syminfo.mintick)
Published by ChaoZhang on the FMZ strategy square · last modified 2023-11-16. 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/Bidirectional-Breakout-Reversal-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 Dynamic Breakout StrategyPine Script · Breakout · 1h
- Kana Candle Breakout Strategy Based on Moving Average and Support ResistancePine Script · Breakout · 1h
- Momentum Breakout Moving Average StrategyPine Script · Breakout · 1d
- Moving Average Crossover and Upper Rail Breakthrough Impulse StrategyPine Script · Breakout · 1m
- Moving Average Support and Resistance Breakout StrategyPine Script · Breakout · 1d
- Multi Indicator Short Term Algorithmic Trading StrategyPine Script · Breakout · 4h