Logo

dev-resources.site

for different kinds of informations.

Price Pattern Based Double Bottom and Top Automated Trading Strategy

Published at
1/10/2025
Categories
trading
strategy
cryptocurrency
code
Author
fmzquant
Author
8 person written this
fmzquant
open
Price Pattern Based Double Bottom and Top Automated Trading Strategy

Image description

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:

  1. Setting monitoring period (default 100 periods) and lookback period (default 100 periods)
  2. Using technical analysis functions to calculate period highs and lows
  3. Comparing current prices with historical prices to determine formation of double bottoms or tops
  4. Automatically executing corresponding trade orders upon pattern confirmation
  5. Setting price breakthrough-based exit conditions for timely stop-loss or profit-taking

Strategy Advantages

  1. High automation: Strategy automatically identifies market patterns and executes trades, reducing manual intervention
  2. Good visualization: Clearly displays market patterns through zigzag lines for analysis and verification
  3. Flexible parameters: Monitoring period and lookback period can be adjusted for different market conditions
  4. Comprehensive risk control: Includes clear entry and exit conditions for risk management
  5. Strong adaptability: Particularly suitable for short-term markets (1-minute, 3-minute, 5-minute)

Strategy Risks

  1. False breakout risk: Market may exhibit false double bottom/top patterns leading to incorrect signals
  2. Slippage risk: May face significant slippage losses in fast-moving markets
  3. Parameter dependency: Strategy performance heavily relies on parameter settings
  4. Market environment dependency: Performs well in ranging markets but may generate frequent false signals in trending markets
  5. Technical limitations: May miss optimal entry points due to indicator lag

Strategy Optimization Directions

  1. Introduce additional technical indicators: Combine with RSI, MACD etc. to filter false signals
  2. Optimize parameter selection: Recommend optimizing monitoring and lookback periods through backtesting
  3. Enhance risk control: Add dynamic stop-loss and trailing stop-profit functions
  4. Add market environment recognition: Include trend identification to adjust parameters in different markets
  5. 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.

Strategy source code

/*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)

// Parameters
length = input.int(100, title="Term Length", defval=100)
lookback = input.int(100, title="Retrospective Check Period", defval=100)

// Finding Double Top and Bottom
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)

// Conditions for Opening a Transaction
longCondition = doubleBottom
shortCondition = doubleTop

// Transaction Closing Conditions
closeLongCondition = ta.highest(high, length) > high1 and low < low1
closeShortCondition = ta.lowest(low, length) < low1 and high > high1

// Opening a Transaction
if (longCondition)
    strategy.entry("Long", strategy.long, qty=1)

if (shortCondition)
    strategy.entry("Short", strategy.short, qty=1)

// Closing a Transaction
if (closeLongCondition)
    strategy.close("Long")

if (closeShortCondition)
    strategy.close("Short")

// Indicators and ZigZag Drawing on Chart
plotshape(series=longCondition, title="Double Bottom Found", 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)

// Continuously updating the zigzag line
// line.set_xy1(zigzagLine, bar_index[1], na)
// line.set_xy2(zigzagLine, bar_index, doubleBottom ? low : high)
Enter fullscreen mode Exit fullscreen mode

Strategy parameters

Image description

The original address: https://www.fmz.com/strategy/474885

strategy Article's
30 articles in total
Favicon
EMA-MACD Composite Strategy for Trend Scalping
Favicon
Dynamic Timing and Position Management Strategy Based on Volatility
Favicon
Multi-Market Adaptive Multi-Indicator Trend Following Strategy
Favicon
Multi-EMA Trend Following Strategy with SMMA Confirmation
Favicon
Multi-Indicator Trend Following Strategy with Bollinger Bands and ATR Dynamic Stop Loss
Favicon
Dynamic Pivot Points with Crossup Optimization System
Favicon
Multi-Timeframe Trend Dynamic ATR Tracking Strategy
Favicon
Multi-dimensional Gold Friday Anomaly Strategy Analysis System
Favicon
Mean Reversion Bollinger Band Dollar-Cost Averaging Investment Strategy
Favicon
First Principles - A Foundation for Groundbreaking Thinking
Favicon
Dynamic ATR Trend Following Strategy Based on Support Level Breakthrough
Favicon
Price Pattern Based Double Bottom and Top Automated Trading Strategy
Favicon
Multi-Indicator Adaptive Trading Strategy Based on RSI, MACD and Volume
Favicon
Multi-Moving Average Trend Following Strategy - Long-term Investment Signal System Based on EMA and SMA Indicators
Favicon
Dual EMA Crossover Strategy with Smart Risk-Reward Control
Favicon
Multi-Period EMA Crossover with RSI Momentum and ATR Volatility Based Trend Following Strategy
Favicon
Dual EMA Stochastic Trend Following Trading Strategy
Favicon
Multi-Wave Trend Crossing Risk Management Quantitative Strategy
Favicon
Dynamic EMA Trend Crossover Entry Quantitative Strategy
Favicon
Enhanced Mean Reversion Strategy with MACD-ATR Implementation
Favicon
Bollinger Bands Momentum Breakout Adaptive Trend Following Strategy
Favicon
Multi-Indicator Synergistic Trend Following Strategy with Dynamic Stop-Loss System
Favicon
Adaptive Range Trading System Based on Dual RSI Indicators
Favicon
Advanced Five-Day Cross-Analysis Strategy Based on RSI and MACD Integration
Favicon
Advanced Quantitative Trend Capture Strategy with Dynamic Range Filter
Favicon
Multi-Technical Indicator Trend Following Strategy with RSI Momentum Filter
Favicon
Advanced Trend Following Strategy with Adaptive Trailing Stop
Favicon
Multi-Timeframe Trend Following Strategy with ATR-Based Take Profit and Stop Loss
Favicon
Triple Supertrend and Bollinger Bands Multi-Indicator Trend Following Strategy
Favicon
Dual Moving Average Trend Following Strategy with Risk Management

Featured ones: