Type/to search

ZigZag Pattern Recognition Short-term Trading Strategy

Common strategy
Created: 2024-01-23 15:09:13
Last modified: 3 years ago
1
Follow
1802
Followers

img

Overview

This strategy identifies candlestick patterns based on the ZigZag indicator and sets entry windows, take profit and stop loss prices using Fibonacci retracements for short-term trading. The strategy supports 13 types of patterns for both long and short trends, including Bat, Butterfly, Gartley etc.

Strategy Logic

  1. Identify potential reversal points using the ZigZag indicator
  2. Calculate the most recent 4 reversal points and check if they match any of the 13 predefined patterns
  3. Enter trade if a pattern is matched and price enters the Fibonacci 0.382 retracement area
  4. Set take profit to 0.618 retracement level, stop loss to -0.618 retracement level
  5. Valid patterns include common ones like Bat, Butterfly, Gartley, as well as some reverse patterns such as Anti-Bat, Anti-Butterfly etc

Advantage Analysis

  1. The ZigZag indicator effectively filters out market noise and identifies clearer trend reversal points
  2. Multiple patterns increase opportunities to enter trades while controlling risks
  3. Fibonacci retracement levels standardize entry, take profit and stop loss

Risk Analysis

  1. The ZigZag indicator is sensitive to parameters, optimization is needed to find the best parameter combination
  2. Too many fitted patterns increase curve fitting risks, real trading performance may underperform backtest results
  3. Only the most recent 4 reversal points considered, more complex patterns are ignored
  4. No re-test of retracement breakouts considered, may cause premature stop loss

Optimization Directions

  1. Optimize ZigZag parameters to find the best combination
  2. Add validity checks for patterns, e.g. confirmation of key points by closing prices
  3. Expand pattern library to increase entry opportunities
  4. Add re-test mechanism of retracements to lower stop loss risks

Conclusion

This strategy identifies trend reversal points using the ZigZag indicator and candlestick patterns, and sets standardized entry/exit logic with Fibonacci retracement zones. With optimized parameters and adjusted stop loss mechanisms, it has the potential to achieve good real trading results. The key is finding the best parameter combinations and tuning stop losses accordingly.

Source
Pine
/*backtest
start: 2023-12-01 00:00:00
end: 2023-12-31 23:59:59
period: 2h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=4

strategy(title='[STRATEGY][RS]ZigZag PA Strategy V4', shorttitle='S', overlay=true)
useHA = input(false, title='Use Heikken Ashi Candles')
Strategy parameters
Strategy parameters
Use Heikken Ashi Candles
Use Alt Timeframe
Alt Timeframe
Show Patterns
Display Fibonacci 0.000:
Display Fibonacci 0.236:
Display Fibonacci 0.382:
Display Fibonacci 0.500:
Display Fibonacci 0.618:
Display Fibonacci 0.764:
Display Fibonacci 1.000:
Trade size:
Fib. Rate to use for Entry Window:
Fib. Rate to use for TP:
Fib. Rate to use for SL:
Comment
All comments (0)
No data
No data
  • 1
Forums
PINE Language
Get the app
iPhone Download
© 2015 - ∞ INVENTOR PTE LTD (SG)