Williams Alligator
This indicator combines the Williams Alligator with optional display toggles and Fractal signals. It's used to detect market trends and potential reversals.
🧠 Core Concepts
✅ 1. Williams Alligator
Developed by Bill Williams, the Alligator consists of three smoothed moving averages (SMMAs), each with a different period and forward offset:
ComponentLengthOffsetColorInterpretationJaw138BlueLong-term trend (slowest)Teeth85PinkMid-term trendLips53GreenShort-term trend (fastest)
When:
The lines are intertwined → Sleeping Alligator → market is ranging.
The lines open apart → Awakened Alligator → market is trending.
✅ 2. SMMA Function
A custom Smoothed Moving Average is calculated manually to match
smma := na(smma[1]) ? ta.sma(src, length) : (smma[1] * (length - 1) + src) / length
First value is simple average.
Then smoothed recursively.
✅ 3. Toggle Feature
The input.bool flags allow the user to enable/disable the Jaw, Teeth, and Lips lines independently.
✅ 4. Fractals
Fractals are 5-bar patterns showing possible reversals:
Up Fractal: Middle bar is highest of five → possible resistance.
Down Fractal: Middle bar is lowest of five → possible support.
They are plotted using plotshape() with offsets to center the shape on the middle bar (index -2).
📈 Visual Interpretation
Trending Market: If lips > teeth > jaw (in uptrend) or lips < teeth < jaw (in downtrend), the market is likely trending.
Ranging Market: If the lines cross over frequently, no clear trend exists.
Fractals can serve as:
Entry or exit points.
Zones to set stop-loss or take-profit.
✅ Strengths of this Script
Clear modular structure.
User-friendly toggles for line display.
Accurate representation of Alligator logic.
Useful fractal overlay for spotting reversals.
🛠️ Suggestions for Improvement
Add alerts for:
Fractals forming.
Alligator opening/closing (indicating trend start/end).
Coloring candles based on trend direction (optional).
Label current Alligator state: Sleeping, Awakening, Eating, etc.
Fractal confirmation logic (e.g., wait for breakout candle).
🧪 Backtesting Ideas
Buy when a down fractal forms and Alligator lines align bullishly (lips > teeth > jaw).
Sell when an up fractal forms and Alligator lines align bearishly.
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by GoCharting. Read more in the Terms of Use.
Related Scripts
Comments (0)
Loading comments…




