Price Pattern Based Double Bottom and Top Automated Trading Strategy
This is an automated trading strategy based on chart pattern recognition. The strategy primarily makes trading decisions by identifying double bottom and double top formations in the market, monitoring price…

Overview
This is an automated trading strategy based on chart pattern recognition. The strategy primarily makes trading decisions by identifying double bottom and double top formations in the market, monitoring price movements over specific time periods, and automatically executing trade orders when qualifying patterns emerge. The strategy utilizes the zigzag indicator to visualize these key price patterns, helping traders understand market trends intuitively.
Strategy Principle
The core logic of the strategy is to identify double bottom and double top patterns through technical analysis. The specific implementation includes the following key steps:
- Setting monitoring period (default 100 periods) and lookback period (default 100 periods)
- Using technical analysis functions to calculate period highs and lows
- Comparing current prices with historical prices to determine formation of double bottoms or tops
- Automatically executing corresponding trade orders upon pattern confirmation
- Setting price breakthrough-based exit conditions for timely stop-loss or profit-taking
Strategy Advantages
- High automation: Strategy automatically identifies market patterns and executes trades, reducing manual intervention
- Good visualization: Clearly displays market patterns through zigzag lines for analysis and verification
- Flexible parameters: Monitoring period and lookback period can be adjusted for different market conditions
- Comprehensive risk control: Includes clear entry and exit conditions for risk management
- Strong adaptability: Particularly suitable for short-term markets (1-minute, 3-minute, 5-minute)
Strategy Risks
- False breakout risk: Market may exhibit false double bottom/top patterns leading to incorrect signals
- Slippage risk: May face significant slippage losses in fast-moving markets
- Parameter dependency: Strategy performance heavily relies on parameter settings
- Market environment dependency: Performs well in ranging markets but may generate frequent false signals in trending markets
- Technical limitations: May miss optimal entry points due to indicator lag
Strategy Optimization Directions
- Introduce additional technical indicators: Combine with RSI, MACD etc. to filter false signals
- Optimize parameter selection: Recommend optimizing monitoring and lookback periods through backtesting
- Enhance risk control: Add dynamic stop-loss and trailing stop-profit functions
- Add market environment recognition: Include trend identification to adjust parameters in different markets
- Optimize position management: Dynamically adjust trading size based on market volatility
Summary
This is a well-designed and practical automated trading strategy. Through accurate identification of double bottom and top patterns, combined with flexible parameter settings and comprehensive risk control, it effectively captures short-term market reversal opportunities. While certain risks exist, through continuous optimization and improvement, this strategy has the potential to become a reliable trading tool.
Source Pine Script
/*backtest
start: 2024-12-04 00:00:00
end: 2024-12-11 00:00:00
period: 3m
basePeriod: 3m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Double Bottom and Top Hunter", overlay=true)
// Parametreler
length = input.int(100, title="Dönem Uzunluğu", defval=100)
lookback = input.int(100, title="Geriye Dönük Kontrol Süresi", defval=100)
// İkili Dip ve Tepe Bulma
low1 = ta.lowest(low, length)
high1 = ta.highest(high, length)
low2 = ta.valuewhen(low == low1, low, 1)
high2 = ta.valuewhen(high == high1, high, 1)
doubleBottom = (low == low1 and ta.lowest(low, lookback) == low1 and low == low2)
doubleTop = (high == high1 and ta.highest(high, lookback) == high1 and high == high2)
// İşlem Açma Koşulları
longCondition = doubleBottom
shortCondition = doubleTop
// İşlem Kapatma Koşulları
closeLongCondition = ta.highest(high, length) > high1 and low < low1
closeShortCondition = ta.lowest(low, length) < low1 and high > high1
// İşlem Açma
if (longCondition)
strategy.entry("Long", strategy.long, qty=1)
if (shortCondition)
strategy.entry("Short", strategy.short, qty=1)
// İşlem Kapatma
if (closeLongCondition)
strategy.close("Long")
if (closeShortCondition)
strategy.close("Short")
// Grafik Üzerinde Göstergeler ve ZigZag Çizimi
plotshape(series=longCondition, title="İkili Dip Bulundu", location=location.belowbar, color=color.green, style=shape.labelup, text="LONG")
plotshape(series=shortCondition, title="İkili Tepe Bulundu", location=location.abovebar, color=color.red, style=shape.labeldown, text="SHORT")
// var line zigzagLine = na
// if (doubleBottom or doubleTop)
// zigzagLine := line.new(x1=bar_index[1], y1=na, x2=bar_index, y2=doubleBottom ? low : high, color=doubleBottom ? color.green : color.red, width=2)
// Zigzag çizgisini sürekli güncelleme
// line.set_xy1(zigzagLine, bar_index[1], na)
// line.set_xy2(zigzagLine, bar_index, doubleBottom ? low : high)Published by ChaoZhang on the FMZ strategy square · last modified 2024-12-12. 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/Price-Pattern-Based-Double-Bottom-and-Top-Automated-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
- Bollinger Bands Dynamic Breakout StrategyPine Script · Breakout · 1h
- Bull Market Tracking SystemPine Script · Breakout · 1h
- Cross boundary Dynamic Range Quantitative Trading Strategy Based on Bollinger BandsPine Script · Breakout · 3h
- Darvas Box Breakout and Risk Management Strategy DarvasPine Script · Breakout · 1d
- MA Trendline Breakthrough StrategyPine Script · Breakout · 1d
- Momentum Breakout Moving Average StrategyPine Script · Breakout · 1d