Key Takeaways
Difficulty:Intermediate
Reliability:Moderate
Category:advanced
Timeframes:1H, 4H, Daily
ZigZag Indicator
advancedš 1H, 4H, Daily, Weekly
Connects significant highs and lows, filtering out minor price movements.
Formula
Code
New point when price moves by deviation % from last point
Detailed Explanation
ZigZag filters out random price movements to show significant swings.
**Important:** - The indicator REPAINTS - the last segment may change - Not for real-time trading signals - Best for historical pattern analysis
Parameters
Deviation
Default: 5
Minimum % move for new point
š Bullish Signals
Higher highs and higher lows pattern
š Bearish Signals
Lower highs and lower lows pattern
Python Implementation
Basic ZigZag concept
Python
def zigzag(df, deviation=0.05):
# Simplified ZigZag logic
pivots = []
last_pivot = df['close'].iloc[0]
direction = 0
for i, row in df.iterrows():
if direction == 0:
if row['close'] > last_pivot * (1 + deviation):
direction = 1
elif row['close'] < last_pivot * (1 - deviation):
direction = -1
# Continue logic...
return pivots
TradingView Pine Script
JavaScript
//@version=5
indicator("ZigZag", overlay=true)
// Use built-in ZigZag or custom implementation
š Use TradingView for Advanced Charting
Professional analysis tools with 100+ technical indicators
MT5 MQL5 Code
C++
int zz_handle = iCustom(_Symbol, _Period, "ZigZag", 12, 5, 3);
Common Mistakes
āUsing for real-time trading (repaints)
āNot understanding repaint behavior
Confirmation Signals
Fibonacci levels
Support/resistance
Volume
Best For
Elliott Wave analysisSwing high/low identificationPattern recognition
š” Pro Tips
- ā¢Repaints - last swing may change
- ā¢Excellent for wave counting
- ā¢Use for pattern identification, not direct signals
Last updated: December 29, 2024
Educational Disclaimer
This content is for educational purposes only and does not constitute financial or investment advice. Trading involves significant risk and you may lose your capital. Always consult a licensed financial advisor before making investment decisions.