technical-analysis — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited technical-analysis (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
Skill: Technical Analysis | Domain: trading | Category: analysis | Level: intermediate Tags:trading,analysis,technical,supply-demand,fibonacci,vwap,pivots,candlestick
High ──── ┐
│ Upper Wick (Shadow)
Open ─── [█] Body (Bullish: Close > Open = White/Green)
Close ── [█]
│ Lower Wick (Shadow)
Low ──── ┘
Body Color:
Green/White = Close ABOVE Open (Bullish)
Red/Black = Close BELOW Open (Bearish)#### Hammer (Bullish Reversal)
#### Inverted Hammer (Bullish Reversal)
#### Hanging Man (Bearish Reversal)
#### Shooting Star (Bearish Reversal)
#### Doji Patterns
| Doji Type | Shape | Signal | Reliability |
|---|---|---|---|
| Standard Doji | Open ≈ Close, equal wicks | Indecision | 50% (needs context) |
| Long-Legged Doji | Very long upper & lower wicks | High volatility indecision | 55% |
| Gravestone Doji | Open=Close at LOW, long upper wick | Bearish reversal at tops | 65% |
| Dragonfly Doji | Open=Close at HIGH, long lower wick | Bullish reversal at bottoms | 65% |
| Four Price Doji | All four prices identical | Extreme indecision (illiquid) | N/A |
| Rickshaw Man | Open≈Close in middle, very long wicks | Major indecision | 55% |
#### Marubozu (Strong Momentum)
| Type | Shape | Signal | Reliability |
|---|---|---|---|
| Bullish Marubozu | Large green body, NO wicks | Strong bullish momentum | 75–80% |
| Bearish Marubozu | Large red body, NO wicks | Strong bearish momentum | 75–80% |
| Opening Marubozu | No opening wick, has closing wick | Momentum fading at close | 60% |
| Closing Marubozu | No closing wick, has opening wick | Strong closing momentum | 65% |
#### Spinning Top
#### Belt Hold
#### Bullish Engulfing (★★★★ Reversal)
#### Bearish Engulfing (★★★★ Reversal)
#### Bullish Harami (Reversal)
#### Bearish Harami (Reversal)
#### Harami Cross
#### Tweezer Top (Bearish Reversal)
#### Tweezer Bottom (Bullish Reversal)
#### Piercing Line (Bullish Reversal)
#### Dark Cloud Cover (Bearish Reversal)
#### On Neck / In Neck (Continuation)
#### Morning Star (★★★★★ Bullish Reversal)
Candle 1: Large bearish (downtrend continuation)
Candle 2: Small body (gap down optional), star candle (indecision)
Candle 3: Large bullish, closes >50% into Candle 1's body
★ Most reliable triple candlestick pattern ★
Reliability: 78–83%#### Evening Star (★★★★★ Bearish Reversal)
Candle 1: Large bullish (uptrend continuation)
Candle 2: Small body (gap up optional), star candle
Candle 3: Large bearish, closes >50% into Candle 1's body
Reliability: 78–83%#### Morning Doji Star (Higher Reliability)
#### Evening Doji Star
#### Three White Soldiers (Bullish Continuation/Reversal)
#### Three Black Crows (Bearish Continuation/Reversal)
#### Abandoned Baby (Strongest Reversal Signal)
#### Three Inside Up (Bullish)
#### Three Inside Down (Bearish)
#### Upside/Downside Tasuki Gap (Continuation)
#### Rising Three Methods / Falling Three Methods
Source: "The BEST Candlestick Pattern Guide" — Data Trader (2.5M views, tested across career)
#### Three-Bar Continuation Pattern
Candle 1: Large body, bigger than average (sets direction)
Candle 2: Small opposite-color candle, body < 50% of Candle 1's body
Candle 3: Large candle same color as C1, closes beyond C2's close
Bullish: Large green → small red → large green (uptrend continuation)
Bearish: Large red → small green → large red (downtrend continuation)
Entry: Close of Candle 3
SL: Bottom wick of Candle 2 (bullish) / Top wick of C2 (bearish)
Best when: Forming during established trend, not at reversals#### Three-Bar Reversal Pattern
Candle 1: Large full body (establishes current trend)
Candle 2: Small body, SAME color as C1
Candle 3: Large full body, OPPOSITE color to C1 & C2
Strong signal: C3 body >= C1 body (higher success rate)
Weak signal: C3 body < C1 body (lower probability)
Bullish: Two red candles → large green (downtrend reversal)
Bearish: Two green candles → large red (uptrend reversal)
Entry: Close of Candle 3
SL: Lows of C2 (bullish) / Highs of C2 (bearish)#### Breakout Candles Pattern
Setup: 3+ small consolidation candles → 1 large breakout candle
- Consolidation candle color doesn't matter — size does (all small)
- More consolidation candles = higher probability breakout
- Breakout candle must have clearly larger body than consolidation candles
Entry: Close of breakout candle
SL: Opening price of breakout candle
Direction: Continue in direction of breakout candle#### Shrinking Candles Pattern (Momentum Exhaustion)
Setup: 3+ consecutive same-color candles, each SMALLER than the last
→ followed by large opposite-color candle
Shows: Trend gradually weakening → reversal confirmation
Strong signal: C4 closes beyond C2 (deeper reversal)
Bullish: 3+ shrinking red candles → large green candle
Bearish: 3+ shrinking green candles → large red candle
Entry: Close of the reversal candle
SL: Beyond the previous candle's extreme#### Combining Patterns with Key Levels (Strategy)
Step 1: Identify key level (S/R, trendline, Fib, or confluence zone)
Step 2: Wait for price to interact with the key level
Step 3: Look for one of the 6 patterns at that level:
- Engulfing, Pin Bar, 3-Bar Continuation, 3-Bar Reversal,
Breakout Candles, Shrinking Candles
Step 4: Enter on pattern completion, SL per pattern rules
Step 5: TP at 2:1 RR minimum
Note: Patterns work best on 1H+ timeframes. Less effective on LTF.
Confluence level (multiple key levels intersecting) = highest probability.#### Head and Shoulders (H&S)
Left Head Right
Shoulder: ▲ ▲ ▲
| ||| |
Neckline: ─┴──────┴┴──────┴─
Measured Move: Distance from Head to Neckline
Target = Neckline − (Head − Neckline)
Rules:
- Left shoulder: rally, pullback
- Head: higher rally, deeper pullback
- Right shoulder: lower rally, break below neckline
- Volume: decreasing through right shoulder
- Neckline break: high volume confirmation
Reliability: 83–85%
Retest: ~45% of breakouts retest neckline#### Inverse Head and Shoulders (Bullish)
#### Double Top (★★★★)
Peak 1 Peak 2
▲ ▲
/ \ / \
/ \ / \
──/─────\──/─────\── Support/Neckline
\/
Rules:
- Two peaks at approximately SAME price level (±1–3%)
- Valley between = neckline/support
- Volume: higher on left peak than right peak
- Breakdown: close below neckline = confirmation
Target = Neckline − (Peak − Neckline)
Reliability: 75–80%
Time between peaks: minimum 2 weeks for swing trading#### Double Bottom (Bullish)
#### Triple Top / Triple Bottom
#### Rounding Bottom (Saucer)
#### Ascending Triangle (Bullish Continuation/Reversal)
Resistance: ─────────────────── (Flat top)
/ / / /
/ / / / (Rising support)
Rules:
- Flat upper resistance + rising lower support
- Bullish in uptrend; reversal if at bottom of downtrend
- Breakout: above resistance with volume
- Target = Resistance + Height of triangle (at widest)
Reliability: 72–75%
False breakout rate: ~25%#### Descending Triangle (Bearish)
#### Symmetrical Triangle
#### Bull Flag (★★★★★)
Flag Pole: ╱ Strong, sharp rally (pole)
╱
╱───╮
│╲ Flag: tight, orderly pullback
│ ╲ (parallel channel, 20–40% pullback of pole)
╰──╱ Breakout: above flag resistance
╱
╱ Target = Flag Breakout + Flag Pole Length
Volume: Heavy on pole, light during flag, heavy on breakout
Reliability: 80–85%
Duration of flag: 1–4 weeks ideal#### Bear Flag (Bearish Continuation)
#### Bull Pennant
#### Bear Pennant
#### Rising Wedge (Bearish)
#### Falling Wedge (Bullish)
#### Cup and Handle (★★★★)
Cup: ╭──────────────╮
╱ ╲
╱ ╲
╱ ╲
Handle: 5–15% pullback
Breakout: above cup rim
Rules:
- Cup: U-shaped (rounded), not V-shaped
- Depth: 15–30% from rim to bottom (max 50%)
- Handle: forms in upper 50% of cup; <15% pullback
- Volume: heavy at breakout above handle resistance
- Duration: Cup = weeks to months; Handle = 1–4 weeks
Target = Handle breakout + Cup depth
Reliability: 75–80%#### Inverse Cup and Handle (Bearish)
Resistance → Price ceiling; sellers dominate
Support → Price floor; buyers dominateRole Reversal: Broken resistance becomes support; broken support becomes resistance
Strength Factors:
Key Levels (from swing high to swing low or vice versa):
23.6% → Minor support/resistance (weak)
38.2% → Moderate pullback level
50.0% → Psychological midpoint (not true Fibonacci but widely watched)
61.8% → "Golden Ratio" — MOST IMPORTANT level
78.6% → Deep retracement (= √0.618)
88.6% → Very deep (= 0.886 = √0.786); used in harmonic patterns
Entry Strategy:
Conservative: Wait for price to react at Fibonacci level + candle confirmation
Aggressive: Enter directly at Fibonacci level with tight stop
Stop Loss: Just beyond next Fibonacci level (e.g., short at 61.8%, stop above 78.6%)Common extension targets after retracement:
127.2% = 1st extension (= √1.272)
138.2%
161.8% = Most common major target
200.0% = Double the prior move
261.8% = Strong extension target
How to Draw:
Uptrend: From swing low (A) to swing high (B) to retracement low (C)
Target = C + (A to B distance × extension %)After swing high or low, count forward:
Bars 1, 2, 3, 5, 8, 13, 21, 34, 55, 89...
→ Significant reactions likely at these time intervals (Fibonacci sequence)#### Standard Pivot Points
PP = (High + Low + Close) ÷ 3
R3 = High + 2(PP − Low)
R2 = PP + (High − Low)
R1 = 2(PP) − Low
PP = Pivot Point
S1 = 2(PP) − High
S2 = PP − (High − Low)
S3 = Low − 2(High − PP)#### Fibonacci Pivot Points
PP = (High + Low + Close) ÷ 3
R1 = PP + 0.382 × (High − Low)
R2 = PP + 0.618 × (High − Low)
R3 = PP + 1.000 × (High − Low)
S1 = PP − 0.382 × (High − Low)
S2 = PP − 0.618 × (High − Low)
S3 = PP − 1.000 × (High − Low)#### Camarilla Pivot Points
R4 = Close + (High − Low) × 1.5
R3 = Close + (High − Low) × 1.25
R2 = Close + (High − Low) × 1.1666
R1 = Close + (High − Low) × 1.0833
S1 = Close − (High − Low) × 1.0833
S2 = Close − (High − Low) × 1.1666
S3 = Close − (High − Low) × 1.25
S4 = Close − (High − Low) × 1.5
Strategy: Fade at R3/S3; Breakout trade at R4/S4| Pivot Period | Chart Timeframe | Best For |
|---|---|---|
| Daily pivots | 15m–1h charts | Day trading |
| Weekly pivots | 4h–Daily charts | Swing trading |
| Monthly pivots | Daily–Weekly | Position trading |
High-Quality Demand Zone (4 criteria):
✓ Price departed quickly and strongly (large candles away from zone)
✓ Zone has NOT been revisited before current test
✓ Located at a lower timeframe support or key price level
✓ Formed at the beginning of a significant upswing
Lower-Quality Zone:
✗ Zone has been tested multiple times (each test = weaker zone)
✗ Price left slowly with small candles
✗ Zone is far from current market structureEntry at Demand Zone:
1. Mark zone boundaries (base of zone to top)
2. Wait for price to return to zone
3. Look for bullish reaction candle (engulfing, hammer, pin bar)
4. Enter long; stop below zone low
5. Target: Next supply zone above
Entry at Supply Zone:
1. Mark zone boundaries
2. Wait for price to reach zone
3. Look for bearish reaction candle
4. Enter short; stop above zone high
5. Target: Next demand zone below| Factor | Stronger | Weaker |
|---|---|---|
| Number of visits | First test | 3+ tests |
| Departure strength | Large, fast candles | Small, slow candles |
| Time since formation | Recent | Old (months/years) |
| Higher TF alignment | Yes | No |
| Volume at departure | High | Low |
Source: Trade with Pat — 284K views, 121-trade backtest: 79% win rate, 2,100% P&L
#### Step 1: Identify Institutional Demand/Supply Zone
Demand Zone Identification:
- Look for 3+ consecutive large same-color candles (impulsive move)
- 60+ pip move on forex = institutional activity (retail can't move this)
- Draw zone on the CANDLE BODY before the impulsive move (accumulation)
Zone Drawing Rules:
Large pre-move candle → Draw zone on BODY ONLY (tighter, cleaner)
Small pre-move candle → Draw WICK TO WICK
Multiple small candles → Group together as one zone
Required Confluence at Zone:
1. Fair Value Gap (FVG) — candles before and after don't cover the big candle
2. Historical S/R flip — zone was previously resistance, now support (or vice versa)
3. Both = "confluence stack" → highest probability#### Step 2: Trend Confirmation (3 Methods)
Method A — Swing Structure:
Uptrend: HH + HL sequence with breaks of structure
Downtrend: LH + LL sequence
Method B — EMA Filter:
Price above EMA with SEPARATION = trend confirmed
Price crossing above/below EMA repeatedly with no gap = choppy → SKIP
Method C — Higher TF Alignment:
Go to next HTF (e.g., H1 → H4) and confirm same swing structure
Both TFs trending same direction = green light#### Step 3: Entry Conditions
MOMENTUM FILTER (Critical):
✓ SLOW approach to zone — mixed candles, small bodies = TRADE
✗ FAST approach — one big candle slamming into zone = DO NOT TRADE
Entry Trigger:
1. Candle closes INSIDE zone or WICKS into zone
2. Wait for NEXT candle to be positive (green for demand, red for supply)
3. Enter on confirmation candle
Invalidation:
If candle CLOSES BELOW zone (demand) or ABOVE zone (supply) → SKIP
Stop Loss:
Option A: Tight to zone boundary
Option B: Below nearest wick + below EMA (dual protection)
Take Profit:
Default: 1:1 RR | Better: target recent swing H/L (1.4-1.8 RR)
Advanced: trailing stop — exit when candle CLOSES below trail (not wick)1. UNTESTED ZONE (Fresh Only)
- Only trade on FIRST test — already-tested zones have drastically lower hold rate
2. CANDLE CLOSE POSITION
- Wicking into zone = VALID | Closing inside zone = VALID
- Closing BELOW zone (demand) = INVALIDATED → do not trade
3. CONFLUENCE STACK
- Zone aligns with EMA S/R + historical S/R flip = stacked → highest probability
4. LOWEST DEMAND IS STRONGEST
- Multiple demand zones → LOWEST one holds best (deepest institutional accumulation)
- Inverse for supply: HIGHEST supply zone is strongest
5. DISCOUNTED PRICE (Fib Filter)
- Draw Fib retracement from swing low to swing high
- Entry must be BELOW 50% for demand (ABOVE 50% for supply)
6. BREAK OF STRUCTURE REQUIRED
- Confirm BOS exists before entering at zone
- If last swing high NOT broken → trend weakening → zone will likely fail
- No BOS = no trade (hard filter)Source: Trade with Pat — used daily on livestream
Setup (Intraday, 5m chart):
1. At 9:30 AM EST, mark range of first 3 five-minute candles (wick to wick)
2. Wait for price to BREAK AND CLOSE outside range (top = buy, bottom = sell)
3. This sets directional bias for the session
Execution:
4. After breakout confirms direction, wait for RETRACE to demand zone (if long)
5. Do NOT enter on breakout candle — wait for pullback to zone
6. Enter on positive reaction candle at demand zone
7. SL below zone, TP at recent structure or trailing stopSMA(n) = (P₁ + P₂ + ... + Pₙ) ÷ n
Key Levels:
20 SMA → Short-term trend (day trading)
50 SMA → Medium-term trend (swing trading)
100 SMA → Medium-long trend
200 SMA → Long-term trend (bull/bear market line)
Signals:
Price > 200 SMA → Bullish bias
Price < 200 SMA → Bearish bias
Golden Cross: 50 SMA crosses above 200 SMA → Bullish
Death Cross: 50 SMA crosses below 200 SMA → BearishEMA = Price × k + EMA(prev) × (1 − k)
k = 2 ÷ (n + 1)
EMA responds faster to recent price changes than SMA
Key Levels: 9, 21, 50, 100, 200 EMADEMA = 2 × EMA(n) − EMA(EMA(n))
→ Reduces EMA lag; smoother than EMAEMA1 = EMA(n)
EMA2 = EMA(EMA1)
EMA3 = EMA(EMA2)
TEMA = 3 × EMA1 − 3 × EMA2 + EMA3
→ Minimal lag; good for trending marketsWMA1 = WMA(n/2) × 2
WMA2 = WMA(n)
Raw HMA = WMA1 − WMA2
HMA = WMA(√n, Raw HMA)
→ Near-zero lag; very smooth; best for trend following
Crossover signals less whipsaw than EMA| Condition | Signal |
|---|---|
| Price > all MAs, MAs aligned up | Strong uptrend |
| Price < all MAs, MAs aligned down | Strong downtrend |
| Price crosses above 20 EMA | Short-term bullish |
| 9 EMA crosses above 21 EMA | Momentum shift bullish |
| 50 EMA crosses above 200 EMA (Golden Cross) | Long-term bullish |
| MAs converging / flat | Choppy, ranging market |
Standard Settings: 12, 26, 9
MACD Line = EMA(12) − EMA(26)
Signal Line = EMA(9) of MACD Line
Histogram = MACD Line − Signal Line
Signals:
1. Signal Line Crossover:
MACD crosses above Signal → Bullish entry
MACD crosses below Signal → Bearish entry
2. Zero Line Cross:
MACD crosses above 0 → Bullish (trend confirmation)
MACD crosses below 0 → Bearish
3. Histogram Divergence:
Price makes new high, histogram lower → Bearish divergence
Price makes new low, histogram higher → Bullish divergence
4. Centerline Strategies:
Buy pullbacks to 0 line in uptrend
Sell rallies to 0 line in downtrend
Best Timeframes: Daily for swing, 1h for day trading
Weakness: Lagging indicator; poor in ranging marketsADX measures TREND STRENGTH (not direction)
Range: 0–100
Calculation:
+DM = Current High − Previous High (if positive)
−DM = Previous Low − Current Low (if positive)
TR = max(High−Low, |High−PrevClose|, |Low−PrevClose|)
+DI = 100 × EMA(+DM) ÷ EMA(TR)
−DI = 100 × EMA(−DM) ÷ EMA(TR)
DX = 100 × |+DI − −DI| ÷ (+DI + −DI)
ADX = EMA(DX, 14)
ADX Interpretation:
< 20 → Weak/absent trend (ranging market)
20–25 → Trend beginning to form
25–40 → Moderate trend (use trend-following strategies)
40–60 → Strong trend
60+ → Very strong trend (potential exhaustion watch)
Direction via DI Lines:
+DI > −DI → Uptrend
−DI > +DI → Downtrend
+DI crosses above −DI → Bullish signal
−DI crosses above +DI → Bearish signal
Best Use: Filter for trend-following strategies
Only use breakout/trend strategies when ADX > 25Settings: Step = 0.02, Max = 0.20
Interpretation:
Dots below price → Uptrend; use as trailing stop
Dots above price → Downtrend; use as trailing stop
Price crosses dots → Trend reversal signal
Formula:
Rising SAR(t) = SAR(t-1) + AF × (EP − SAR(t-1))
AF starts at 0.02, increases by 0.02 each new high, max 0.20
EP = Extreme point (highest high in uptrend)
Use:
✓ Excellent trailing stop in strong trends
✓ Clear visual signals
✗ Poor in sideways/choppy markets (whipsaws)
Best combined with: ADX > 25 to confirm trending condition#### Five Components
1. Tenkan-sen (Conversion Line) = (9H + 9L) ÷ 2
→ 9-period midpoint; short-term trend
2. Kijun-sen (Base Line) = (26H + 26L) ÷ 2
→ 26-period midpoint; medium-term trend/support
3. Senkou Span A (Leading A) = (Tenkan + Kijun) ÷ 2, plotted 26 periods AHEAD
→ Forms top or bottom of Cloud (Kumo)
4. Senkou Span B (Leading B) = (52H + 52L) ÷ 2, plotted 26 periods AHEAD
→ Forms other edge of Cloud
5. Chikou Span (Lagging Span) = Current Close, plotted 26 periods BEHIND
→ Confirms trend; most important confirmation tool#### Cloud (Kumo) Interpretation
Price ABOVE Cloud → Bullish (trend bias = long)
Price BELOW Cloud → Bearish (trend bias = short)
Price INSIDE Cloud → Neutral / Consolidation
Green Cloud (Span A > Span B) → Bullish sentiment
Red Cloud (Span B > Span A) → Bearish sentiment
Thick Cloud → Strong support/resistance
Thin Cloud → Weak support/resistance (easier to break through)#### Ichimoku Signals
| Signal | Condition | Strength |
|---|---|---|
| TK Cross Bullish | Tenkan crosses above Kijun | Moderate |
| TK Cross Bearish | Tenkan crosses below Kijun | Moderate |
| Strong Bullish | TK cross above Cloud + Chikou above price | Strong |
| Strong Bearish | TK cross below Cloud + Chikou below price | Strong |
| Cloud Support | Price pullback to top of Cloud holds | Bullish |
| Cloud Resistance | Price rally to bottom of Cloud fails | Bearish |
| Kumo Twist | Cloud changes from red to green ahead | Bullish shift |
| Chikou Confirm | Chikou in open space (no obstruction) | Confirmation |
#### Perfect Ichimoku Buy Setup
All 5 criteria must be met:
✓ Price above Cloud
✓ Cloud is green (Span A > Span B)
✓ Tenkan above Kijun
✓ Chikou above price from 26 periods ago
✓ Price pulling back to Tenkan/Kijun for entrySettings: 14 periods (default)
RSI = 100 − (100 ÷ (1 + RS))
RS = Average Gain ÷ Average Loss (over 14 periods)
Levels:
RSI > 70 → Overbought (potential reversal short)
RSI < 30 → Oversold (potential reversal long)
RSI = 50 → Midpoint (trend confirmation)
Trend Trading:
RSI 40–90 range in uptrends (buy dips to 40–50)
RSI 10–60 range in downtrends (sell rallies to 50–60)#### RSI Divergence
Regular Bullish Divergence:
Price: Lower Low → Lower Low
RSI: Lower Low → HIGHER Low
Signal: Bullish reversal
Regular Bearish Divergence:
Price: Higher High → Higher High
RSI: Higher High → LOWER High
Signal: Bearish reversal
Hidden Bullish Divergence (Continuation):
Price: Higher Low
RSI: Lower Low
Signal: Uptrend continuation (buy the dip)
Hidden Bearish Divergence (Continuation):
Price: Lower High
RSI: Higher High
Signal: Downtrend continuation (sell the rally)#### RSI Failure Swings
Bullish Failure Swing (Strong Signal):
1. RSI falls below 30 (oversold)
2. RSI bounces above 30
3. RSI pulls back but STAYS ABOVE 30 (failure)
4. RSI breaks above recent peak → BUY SIGNAL
Bearish Failure Swing:
1. RSI rises above 70 (overbought)
2. RSI dips below 70
3. RSI bounces but STAYS BELOW 70 (failure)
4. RSI breaks below recent trough → SELL SIGNALSettings: %K=14, %D=3, Smooth=3
Fast Stochastic:
%K = (Current Close − Lowest Low) ÷ (Highest High − Lowest Low) × 100
%D = 3-period SMA of %K
Slow Stochastic (recommended):
Slow %K = Fast %D
Slow %D = 3-period SMA of Slow %K
Levels:
Above 80 → Overbought
Below 20 → Oversold
Signals:
%K crosses above %D in oversold territory → Buy
%K crosses below %D in overbought territory → Sell
Divergence with price → Reversal warning
Stochastic RSI: Applies RSI formula to Stochastic → more sensitiveSettings: 14 or 20 periods
CCI = (Typical Price − SMA) ÷ (0.015 × Mean Deviation)
Typical Price = (High + Low + Close) ÷ 3
Levels:
> +100 → Overbought / Strong trend (buy in strong uptrend)
< −100 → Oversold / Strong downtrend (sell in downtrend)
0 line → Neutral
Signals:
Crosses above +100 → Bullish breakout
Crosses below −100 → Bearish breakout
Returns to 0 from extreme → Possible reversal
Divergence → Leading reversal signal
Use: Good for cyclical markets; works well on commoditiesSettings: 14 periods
%R = (Highest High − Close) ÷ (Highest High − Lowest Low) × (−100)
Range: 0 to −100 (note: inverted scale)
0 to −20 → Overbought
−80 to −100 → Oversold
Signals (similar to Stochastic):
Exit from overbought (below −20) → Sell
Exit from oversold (above −80) → Buy
Divergence → Reversal signal
Note: Very similar to Stochastic; choose one, not bothSettings: 12 periods (daily), 9 (weekly)
ROC = ((Close − Close[n]) ÷ Close[n]) × 100
Signals:
ROC > 0 → Upward momentum
ROC < 0 → Downward momentum
Zero line cross → Momentum shift
Divergence → Reversal warning
Use: Relative Strength comparison across assets; momentum rankingIf Close > Previous Close: OBV = OBV(prev) + Volume
If Close < Previous Close: OBV = OBV(prev) − Volume
If Close = Previous Close: OBV = OBV(prev)
Interpretation:
OBV rising + Price rising → Confirmed uptrend
OBV falling + Price falling → Confirmed downtrend
OBV rising + Price flat → Accumulation (bullish)
OBV falling + Price flat → Distribution (bearish)
OBV diverges from price → Reversal warning
Key Insight: OBV should CONFIRM price action; divergence = warningVWAP = Σ(Typical Price × Volume) ÷ Σ Volume
Resets each trading session
VWAP Bands (Standard Deviation bands):
VWAP ± 1 SD → Contains ~68% of price action
VWAP ± 2 SD → Contains ~95% of price action
VWAP ± 3 SD → Extreme deviation (mean reversion opportunity)
Trading Strategies:
Above VWAP → Bullish; buy pullbacks to VWAP
Below VWAP → Bearish; sell rallies to VWAP
Institutional benchmark: Many algos and funds use VWAP
Price above VWAP = Buyers in control
Price below VWAP = Sellers in control
Day Trading Use:
Open above VWAP → Long bias
VWAP as support → Buy at VWAP, stop below
VWAP as resistance → Sell at VWAP, stop above
Mean Reversion:
Price at ±2 SD → Fade toward VWAP
Price at ±3 SD → Strong mean reversion signalMoney Flow Multiplier = ((Close − Low) − (High − Close)) ÷ (High − Low)
Money Flow Volume = MFM × Volume
A/D = Previous A/D + Current Money Flow Volume
Interpretation:
A/D rising → Accumulation (buying pressure)
A/D falling → Distribution (selling pressure)
Divergence from price → Strong reversal signal
Key: Accounts for WHERE close is within bar's rangeSettings: 14 periods
Typical Price = (H + L + C) ÷ 3
Money Flow = Typical Price × Volume
Positive MF: TP > Previous TP
Negative MF: TP < Previous TP
MFI = 100 − (100 ÷ (1 + (14-day Positive MF ÷ 14-day Negative MF)))
Levels:
> 80 → Overbought
< 20 → Oversold
Think of MFI as "Volume-Weighted RSI"
Divergence more significant due to volume confirmationSettings: 20 periods
CMF = 20-period Sum of (Money Flow Volume) ÷ 20-period Sum of Volume
Money Flow Volume = ((Close−Low) − (High−Close)) ÷ (High−Low) × Volume
Range: −1 to +1
> 0 → Buying pressure; bullish
< 0 → Selling pressure; bearish
> +0.25 → Strong buying
< −0.25 → Strong selling
Use: Confirm breakouts and trend directionEnhanced with: "The ONLY Volume Profile Trading Guide" — Trader Dale (396K views, 67% win rate over 9 yrs)
Key Levels:
POC (Point of Control) → Price level with MOST volume traded
VAH (Value Area High) → Upper boundary of Value Area
VAL (Value Area Low) → Lower boundary of Value Area
Value Area → Contains 68–70% of total session volume
HVN (High Volume Nodes) → Significant volume clusters → secondary entry points
LVN (Low Volume Nodes) → Sparse trading areas → rejection/fast-move zones
Types:
Session VP → Volume profile for single session
Fixed Range VP → User-defined time range
Visible Range VP → Current chart view
Composite VP → Multiple sessions combined#### Four Volume Profile Shapes
D-SHAPED (Balanced Market) — ~70% of trading is rotation
Shape: Heavy volume middle, low at edges
Trade: Short from top border, Long from bottom border → TP at opposite POC
Signals: Consolidation or pause/end of trend
P-SHAPED (Buyers Active)
Shape: Heavy volume at TOP, low at bottom
VALIDATION: Price MUST close ABOVE 50% of daily range (else invalid!)
Trade: Long from POC or volume bumps in low-volume zone
Signals: Uptrend in progress or rejection of lower prices
B-SHAPED (Sellers Active)
Shape: Heavy volume at BOTTOM, low at top
VALIDATION: Price MUST close BELOW 50% of daily range (else invalid!)
Trade: Short from POC or volume bumps in high-volume zone
Pro tip: Trade from BEGINNING of heavy zone, not exact POC (40% fewer missed trades)
THIN PROFILE (Very Strong Trend)
Shape: Thin line with scattered small volume bumps (no central heavy zone)
Why: Strong/fast trend — institutions can't build large positions
Trade: Volume bumps = aggressive institutional entry points → pullback entries
In uptrend: bumps = strong support. In downtrend: bumps = strong resistance.#### Volume Profile Entry Optimization
Traditional: Trade at exact POC → misses many trades
Better (Trader Dale method): Trade from BEGINNING (edge) of heavy volume zone
→ ~40% fewer missed trades, better risk/reward, enters before consolidation
Volume bumps in low-volume zones are AS IMPORTANT as POC:
Even small bumps = decisive institutional activity
Price respects these because institutions stepped in aggressively#### Highest-Probability VP Setup: Support-Turned-Resistance + Volume Cluster
1. Identify thin profile with significant volume cluster at a price level
2. Check if that level was historical support (or resistance)
3. Price broke through it → support flips to resistance (or vice versa)
4. Now you have DUAL confirmation at same level:
- Volume cluster (institutional activity)
- Price action (S/R flip)
5. Trade the level with high confidence
Macro rule: Don't trade against strong macro-news moves.
Institutions ignore technicals during news shocks → wait for stabilization.#### Volume Profile Decision Tree
D-shaped → Short resistance, Long support (rotation play)
P-shaped (close > 50% range) → Long at POC/bumps
B-shaped (close < 50% range) → Short at POC/bumps
Thin → Trade volume bumps as trend-pullback entries
Then: Is there S/R flip + volume cluster confluence? → 2X confirmationSettings: 20 SMA, ±2 Standard Deviations
Upper Band = 20 SMA + (2 × SD)
Middle Band = 20 SMA
Lower Band = 20 SMA − (2 × SD)
Key Metrics:
%B = (Price − Lower Band) ÷ (Upper Band − Lower Band)
%B > 1 → Price above upper band
%B = 0.5 → Price at middle band
%B < 0 → Price below lower band
Bandwidth = (Upper − Lower) ÷ Middle × 100
Expanding → Increasing volatility
Contracting → Decreasing volatility (squeeze = explosive move incoming)
BB Squeeze:
Bandwidth at 6-month low → Imminent breakout
Direction of breakout confirmed by volume and price action
Strategies:
Mean Reversion: Buy lower band, sell upper band (ranging markets only)
Trend Following: Price rides upper band = uptrend; sell first close inside band
Squeeze: Enter breakout direction with momentum confirmation
W-Bottom: Two touches of lower band; second higher → bullish reversal
M-Top: Two touches of upper band; second lower → bearish reversalSettings: 14 periods (standard)
True Range = max(High−Low, |High−PrevClose|, |Low−PrevClose|)
ATR = EMA(True Range, 14)
ATR Multipliers for Stop Loss:
Conservative: 2.0× ATR
Standard: 2.5× ATR
Aggressive: 1.5× ATR
Volatile markets: 3.0× ATR
ATR Position Sizing:
Dollar Risk ÷ (ATR × Multiplier) = Number of Shares/Contracts
ATR-Based Targets:
Target 1: 1.5× ATR from entry
Target 2: 3.0× ATR from entry
Target 3: 5.0× ATR from entry
ATR Channel:
Upper = Price + (1.5 × ATR)
Lower = Price − (1.5 × ATR)
Price outside channel = volatility expansionSettings: EMA=20, ATR=10, Multiplier=2
Middle Line = 20 EMA
Upper Channel = 20 EMA + (2 × ATR)
Lower Channel = 20 EMA − (2 × ATR)
Signals:
Price above upper channel → Strong uptrend / overbought
Price below lower channel → Strong downtrend / oversold
Price re-enters from upper → Potential reversal
Combined with Bollinger Bands:
BB inside Keltner Channels → SQUEEZE (low volatility)
BB outside Keltner Channels → Expansion phase
Squeeze + Momentum direction → Best breakout setupsSettings: 20 periods (day), 55 periods (Turtle Trading)
Upper = Highest High of n periods
Lower = Lowest Low of n periods
Middle = (Upper + Lower) ÷ 2
Turtle Trading System:
Entry: Price breaks 55-period Donchian high/low
Exit: Price breaks 20-period Donchian in opposite direction
Stop: 2× ATR from entry
Breakout Signals:
New 20-day high → Short-term bullish
New 55-day high → Longer-term bullish breakout
New 52-week high → Major bullish breakout signalFor Each Trading Style:
Day Trading:
Higher TF: Daily (trend bias)
Middle TF: 1-hour (setup confirmation)
Lower TF: 15-minute (entry timing)
Swing Trading:
Higher TF: Weekly (trend bias)
Middle TF: Daily (setup confirmation)
Lower TF: 4-hour (entry timing)
Scalping:
Higher TF: 15-minute (trend bias)
Middle TF: 5-minute (setup)
Lower TF: 1-minute (entry timing)Step 1: Higher TF → Determine primary trend direction
Is price above/below key MAs?
What phase is the market in?
Are we at key HTF support/resistance?
Step 2: Middle TF → Find setup
Is there a pullback in direction of HTF trend?
Is a pattern forming at key level?
Are momentum indicators aligned?
Step 3: Lower TF → Time entry
Look for trigger candle at LTF level
Entry after confirmation of reversal
Set stop just beyond LTF structureSource: "The Top Down Analysis Strategy I Will Use For Life" — Jdub Trades ($140K month)
Three sequential steps (MUST go in order — never start from execution):
Direction (HTF) → Location (MTF) → Execution (LTF)
Who controls? Where to trade? When to enter?TF Cheat Sheet by Trading Style:
| Style | Direction (HTF) | Location (MTF) | Execution (LTF) |
|---|---|---|---|
| Swing trading | Daily | 1H | 15M |
| Day trading | 4H | 15M / 1H | 5M |
| Scalping | 1H | 15M | 1M |
Three-Chart Layout (TradingView):
Critical rule: If HTF is bullish and LTF shows a short setup → DON'T TAKE IT. Wait for LTF alignment with HTF direction. Trading against HTF trend is the #1 reason setups fail despite looking "perfect" on the entry TF.
DLE Workflow:
1. HTF: Is it trending? (HH/HL or LH/LL) → set bias
2. MTF: Where are the key levels? (PDH, PDL, swing H/L) → set location
3. LTF: Is price at the key level? → wait for break + retest + confirmation → enter
4. Target: HTF key levels (look left on HTF for next objective)5-wave Impulse:
Rule 1: Wave 2 NEVER retraces more than 100% of Wave 1
Rule 2: Wave 3 is NEVER the shortest impulse wave
Rule 3: Wave 4 NEVER overlaps into Wave 1 price territory
(Exception: Diagonal triangles in Wave 1 or 5)Wave 1: Often muted; not widely recognized
Wave 2: Typically 50–61.8% retracement of Wave 1
Wave 3: Longest and strongest; 161.8% of Wave 1 common
Wave 4: Typically 38.2% retracement of Wave 3
Wave 5: Often equals Wave 1 in length; or 61.8% of W1+W3
Corrective Waves (A-B-C):
Zigzag: Sharp correction (5-3-5)
Flat: Sideways correction (3-3-5)
Triangle: Converging correction (3-3-3-3-3)
Complex: Combination of above (X waves connecting)| Wave | Typical Fibonacci Relationship |
|---|---|
| Wave 2 | 50%, 61.8%, 78.6% retrace of Wave 1 |
| Wave 3 | 161.8%, 261.8% of Wave 1 (from end of W2) |
| Wave 4 | 38.2%, 50% retrace of Wave 3 |
| Wave 5 | 61.8% or 100% of Wave 1 (from end of W4) |
| Wave A | 100% of Wave 5 often |
| Wave B | 50%, 61.8%, 78.6% retrace of Wave A |
| Wave C | 100%, 127.2%, 161.8% of Wave A |
Sources: "Elliott Wave Trading Was Impossible Until I Discovered These Price Action Clues" — The Secret Mindset (877K views); "Elliott Wave Basics Course" — Elliott Wave Street (live webinar)
Impulse Waves (1-2-3-4-5):
Wave 1: Least predictive. Sentiment still bearish — most see it as bear rally.
Sellers add shorts. Subdivides into 5 smaller waves.
Sometimes appears as leading diagonal (W4 can overlap W1 in diagonals).
Wave 2: Deep retracement (50%, 61.8%, or 78.6% of W1). Sellers feel assured downtrend continues.
MUST NOT break below W1 start. Forms zigzag or flat (ABC pattern).
KEY RULE: Must be SLOW. Fast W2 = NOT a real corrective wave = AVOID.
Slow price = institutions accumulating. Fast price = no big buyer support.
Wave 3: Biggest, most powerful. Best profit opportunity (1:3 to 1:5 RR).
Sellers' stops triggered at W1 high → fuels momentum.
Very shallow pullbacks — don't wait for retracement, enter ASAP.
Projection: 1.618x W1 (most common) or 2.618x W1.
Usually the extended wave among W1/W3/W5.
Wave 4: Shallow retracement (38.2% or 50% of W3). Profit-taking wave.
Range-bound, whipsawing, directionless — generates false breakouts.
Often forms triangle, flat, or zigzag. AVOID new positions here.
MUST NOT overlap W1 territory (unbreakable rule).
If W4 is fast → do NOT trade it. Same speed rule as W2.
Wave 5: Final impulse leg. "Retail wave" — everyone bullish, extreme valuations.
Momentum weaker than W3. Look for RSI/MACD/Stochastic divergence.
Lower volume than W3 = trend weakening, lock in profits.
Projection: 100% of W1 (most common) or 61.8% of W1 (from end of W4).Corrective Waves (A-B-C):
Wave A: Sharp move, similar psychology to W1. Most traders still bullish.
Subdivides as 5-wave or 3-wave pattern.
Wave B: BULL TRAP — draws in longs thinking trend is healthy.
Often creates double top near W5 high (fails to breach it).
Retraces 50%, 61.8%, or 78.6% of Wave A.
Best trade: FADE Wave B near its terminal point.
Wave C: Final corrective leg. Conviction shifts — uptrend deemed over.
Projection: 100% of A (most common), then 127.2% of A, then 161.8% of A.W2 and W4 must differ in as many ways as possible:
Price: W2 deep (61-78%) vs W4 shallow (38%) or vice versa
Time: W2 fast vs W4 slow or vice versa
Pattern: W2 zigzag vs W4 triangle/flat or vice versa
If W2 is simple ABC → expect W4 to be complex (triangle/combination)Source: Elliott Wave Street — "this advice will save you years of frustration"
SLOW corrective wave → HIGH probability setup (institutions accumulating)
FAST corrective wave → LOW probability → DO NOT TRADE
Why: Slow = big institutions buying against the correction (price can't fall fast)
Fast = no institutional support → trend likely continues against you
Apply to: W2, W4, Wave B, any ABC you plan to trade
Visual check: Compare speed of corrective move vs previous impulse move
Indicator check: Look for divergence between A and C legs (RSI/MACD)Best Trades (in order of probability):
1. After W2 ABC completion → ride W3 (highest RR: 1:3 to 1:5)
2. Fade Wave B near W5 high → ride Wave C
3. After W4 completion → ride W5 (weaker than W3)
Entry Rules:
1. Identify 5-wave impulse completion (W1)
2. Wait for SLOW 3-wave (ABC) corrective move
3. Confirm: divergence between A and C, or candlestick reversal at C
4. Enter at C completion OR when price clears W1 high/low
5. SL: below/above the corrective wave extreme
6. TP: previous swing high (W1 high), then project W3 target
Counter-Trend Trades (advanced — only after mastering trend-following):
Most aggressive: Sell at W5 completion + rejection/reversal signal
Moderate: Sell after 5-wave sequence completes + first impulse down
Conservative: Sell after 3-wave bounce (ABC) completes = trend trade in new direction
Fractal Application:
- Same wave structure repeats on ALL timeframes (monthly to 15-sec)
- Degrees are visible on same chart — no need to switch TF to label
- HTF wave count → MTF setup → LTF entry (same DLE framework)
- Weekly/Monthly: find where you are in the cycle
- Daily/4H: identify current wave for swing trades
- 1M/5M: scalp entries at ABC completionsSingle Zigzag: ABC (5-3-5) — sharp, deep correction
Double Zigzag: WXY (W=first zigzag, X=connector, Y=second zigzag)
Flat: ABC — B retraces 90-138.2% of A (tricky: fast B leg)
Triangle: ABCDE — converging, usually in W4 position
Combination: Mix of above connected by X waves
Leading Diagonal: Occurs in W1 or W5 position.
Looks like wedge (expanding or contracting).
W4 CAN overlap W1 territory (exception to normal rule).
Still 5-wave structure but with overlapping waves.□ W1, W3, W5 are trending (impulse). W2, W4 are corrections
□ W3 must NOT be shortest of W1/W3/W5 (need not be longest)
□ W2 can retrace up to 99% of W1 (never 100%)
□ W4 never enters W1 price territory (except leading diagonal)
□ W4 should not enter W2 price area
□ W2 and W4 display alternation (price, time, pattern)
□ Corrective waves you trade MUST be slow (speed filter)
□ Look for W5 divergence on RSI/MACD + lower volume
□ Beginners: ONLY trade with trend (buy W2/W4 completions)AB = CD (time and price symmetry)
BC: 61.8% or 78.6% of AB
CD: 127.2% or 161.8% of BC
Bullish ABCD: Buy at D
Bearish ABCD: Sell at D
Stop: Beyond D by structure
Target: B level (38.2% and 61.8% of AD)XA: Initial move
AB: 61.8% retrace of XA
BC: 38.2–88.6% retrace of AB
CD: 78.6% retrace of XA (PRZ = Potential Reversal Zone)
Note: BC can project 127.2–161.8% to locate D
Bullish Gartley: Buy at D (78.6% of XA)
Stop: Below X
Target 1: 61.8% of CD
Target 2: 127.2% of CD
Reliability: 65–70%XA: Initial move
AB: 78.6% retrace of XA
BC: 38.2–88.6% retrace of AB
CD: 127.2% OR 161.8% extension of XA (beyond X)
PRZ: 127.2–161.8% of XA
Reliability: 70–75%
Note: D extends BEYOND X (unlike Gartley)AB: 38.2–50% retrace of XA (key differentiator from Gartley)
BC: 38.2–88.6% retrace of AB
CD: 88.6% retrace of XA (PRZ)
Reliability: 72–78%
Tighter stops than Gartley; high accuracyAB: 38.2–61.8% retrace of XA
BC: 38.2–88.6% retrace of AB
CD: 161.8% extension of XA (deepest extension)
PRZ: 161.8% of XA
Reliability: 65–70%
Most extreme extension; use tight stopsInitial 0X move
X to A: Any move
A to B: 113% extension of 0A
B to C: 88.6% retrace of 0B or 161.8% of AB
PRZ at C: 88.6% of 0X or 113% of XAXA: Initial move
AB: 38.2–61.8% retrace of XA
BC: 127.2–141.4% extension of XA
CD: 78.6% retrace of XC (PRZ)
Reliability: 70–75%Entry: At PRZ (Potential Reversal Zone)
Confirmation: Wait for reversal candle at PRZ
Stop: Beyond the extreme of pattern (D or X depending on pattern)
Target 1: 38.2% retrace of CD
Target 2: 61.8% retrace of CD
Target 3: Full retracement to AB or beyond
Risk Management: Risk 1–1.5% per harmonic trade
Timeframes: Best on 1h, 4h, Daily chartsTPO (Time Price Opportunity): Letter assigned to each price traded in a given period
Initial Balance (IB): Price range of first 1 hour; sets the day's range expectation
Value Area: Price range containing 70% of volume/TPOs
POC: Most frequently traded price| Day Type | Characteristics | Trading Approach |
|---|---|---|
| Normal | Opens, finds value near open | Range trade IB extremes |
| Normal Variation | Breaks IB in one direction | Trade breakout direction |
| Trend Day | Strong directional move; range expands all day | Trend follow; don't fade |
| Double Distribution | Two distinct value areas | Trade between distributions |
| Neutral | Balanced; rotates but no breakout | Fade extremes |
| Spike and Distribution | Gap + auction finding value | Trade inside distribution |
1. Markets are always in the process of facilitating trade
2. Price moves to FIND responsive buyers and sellers
3. Price moves AWAY from value to advertise opportunity
4. When price finds two-sided trade, it consolidates (value)
5. When price fails to find trade, it moves away (trend)
Auction Phases:
Initiation → Price moves to discover new value
Responsive → Participants respond at extremes (mean reversion)
Facilitation → Price rotates within value area
Trading Signals:
Price above prior day VAH → Bullish; long opportunities
Price below prior day VAL → Bearish; short opportunities
Price returns to prior POC → Magnet effect
Price breaks out of prior day range + volume → Trending day| Feature | Market Profile | Volume Profile |
|---|---|---|
| Unit | TPO (time) | Volume |
| POC | Most TIME spent | Most VOLUME traded |
| Data need | TPO letters | Actual volume by price |
| Best use | Auction analysis | Liquidity analysis |
| Preference | Futures traders | Stock/equity traders |
Load for: multi-timeframe confluence scoring, timeframe bias calculation, TF weight system, confluence heat maps, multi-pair scanning.
| Pattern | Type | Reliability | Best Context |
|---|---|---|---|
| Abandoned Baby | Reversal | 85–90% | After extended trend |
| Morning/Evening Doji Star | Reversal | 83–87% | At key S/R |
| Morning/Evening Star | Reversal | 78–83% | At key S/R |
| Three White/Black Soldiers | Rev/Cont | 70–75% | After consolidation |
| Head & Shoulders | Reversal | 83–85% | At market tops/bottoms |
| Bullish/Bearish Engulfing | Reversal | 72–78% | At key levels |
| Cup & Handle | Continuation | 75–80% | After consolidation |
| Bull/Bear Flag | Continuation | 80–85% | Mid-trend |
| Double Top/Bottom | Reversal | 75–80% | Extended trend |
| Ascending/Descending Triangle | Continuation | 72–75% | In established trend |
| Hammer/Shooting Star | Reversal | 60–70% | At clear S/R |
| Doji | Indecision | 50–65% | Requires confirmation |
import pandas as pd, numpy as np
from scipy.signal import argrelextrema
FIB_LEVELS = [0, 0.236, 0.382, 0.5, 0.618, 0.786, 1.0]
FIB_EXTENSIONS = [1.0, 1.272, 1.414, 1.618, 2.0, 2.618]
class FibonacciEngine:
@staticmethod
def retracement(swing_high: float, swing_low: float, direction: str = "up") -> dict:
diff = swing_high - swing_low
levels = {}
for fib in FIB_LEVELS:
if direction == "up":
levels[f"{fib:.3f}"] = round(swing_high - fib * diff, 5)
else:
levels[f"{fib:.3f}"] = round(swing_low + fib * diff, 5)
return {
"direction": direction, "swing_high": swing_high, "swing_low": swing_low,
"levels": levels,
"golden_zone": f"{levels['0.618']} — {levels['0.786']}",
"strategy": "Buy at 0.618-0.786 in uptrend, sell at 0.618-0.786 in downtrend",
}
@staticmethod
def extension(point_a: float, point_b: float, point_c: float) -> dict:
diff = abs(point_b - point_a)
direction = 1 if point_b > point_a else -1
levels = {}
for ext in FIB_EXTENSIONS:
levels[f"{ext:.3f}"] = round(point_c + direction * diff * ext, 5)
return {"extensions": levels, "primary_target": levels["1.618"]}
@staticmethod
def auto_fib(df: pd.DataFrame, order: int = 10) -> dict:
"""Automatically detect last major swing and compute fibs."""
highs = argrelextrema(df["high"].values, np.greater, order=order)[0]
lows = argrelextrema(df["low"].values, np.less, order=order)[0]
if len(highs) == 0 or len(lows) == 0:
return {"error": "No swings found"}
last_high = df["high"].iloc[highs[-1]]
last_low = df["low"].iloc[lows[-1]]
last_high_idx = highs[-1]
last_low_idx = lows[-1]
direction = "up" if last_low_idx < last_high_idx else "down"
return FibonacciEngine.retracement(last_high, last_low, direction)
@staticmethod
def cluster_zones(fibs_list: list[dict], tolerance: float = 0.0005) -> list[dict]:
"""Find confluence zones where multiple fib levels cluster together."""
all_levels = []
for fib_set in fibs_list:
for level_name, price in fib_set.get("levels", {}).items():
all_levels.append(price)
all_levels.sort()
clusters = []
i = 0
while i < len(all_levels):
cluster = [all_levels[i]]
while i + 1 < len(all_levels) and all_levels[i + 1] - all_levels[i] < tolerance:
i += 1
cluster.append(all_levels[i])
if len(cluster) >= 2:
clusters.append({
"zone_center": round(np.mean(cluster), 5),
"zone_width": round(max(cluster) - min(cluster), 5),
"n_fibs_confluent": len(cluster),
"strength": "STRONG" if len(cluster) >= 3 else "MODERATE",
})
i += 1
return sorted(clusters, key=lambda c: c["n_fibs_confluent"], reverse=True)import pandas as pd, numpy as np
class IchimokuStrategy:
@staticmethod
def compute(df: pd.DataFrame, tenkan: int = 9, kijun: int = 26, senkou_b: int = 52) -> pd.DataFrame:
d = df.copy()
d["tenkan"] = (df["high"].rolling(tenkan).max() + df["low"].rolling(tenkan).min()) / 2
d["kijun"] = (df["high"].rolling(kijun).max() + df["low"].rolling(kijun).min()) / 2
d["senkou_a"] = ((d["tenkan"] + d["kijun"]) / 2).shift(kijun)
d["senkou_b"] = ((df["high"].rolling(senkou_b).max() + df["low"].rolling(senkou_b).min()) / 2).shift(kijun)
d["chikou"] = df["close"].shift(-kijun)
return d
@staticmethod
def full_signal(df: pd.DataFrame) -> dict:
d = IchimokuStrategy.compute(df)
c = d.iloc[-1]; p = d.iloc[-2]
above_cloud = c["close"] > max(c["senkou_a"], c["senkou_b"])
below_cloud = c["close"] < min(c["senkou_a"], c["senkou_b"])
tk_cross_up = c["tenkan"] > c["kijun"] and p["tenkan"] <= p["kijun"]
tk_cross_down = c["tenkan"] < c["kijun"] and p["tenkan"] >= p["kijun"]
kumo_bullish = c["senkou_a"] > c["senkou_b"]
chikou_above = d["chikou"].iloc[-kijun if len(d) > 26 else -1] > d["close"].iloc[-kijun if len(d) > 26 else -1] if len(d) > 26 else False
# 5-element confirmation
bull_count = sum([above_cloud, c["tenkan"] > c["kijun"], kumo_bullish, tk_cross_up, chikou_above])
bear_count = sum([below_cloud, c["tenkan"] < c["kijun"], not kumo_bullish, tk_cross_down, not chikou_above])
return {
"strategy": "ichimoku_complete",
"above_cloud": above_cloud, "below_cloud": below_cloud,
"tk_cross": "BULLISH" if tk_cross_up else "BEARISH" if tk_cross_down else "NONE",
"kumo_color": "BULLISH" if kumo_bullish else "BEARISH",
"bullish_confirmations": bull_count,
"bearish_confirmations": bear_count,
"signal": "STRONG BUY" if bull_count >= 4 else "BUY" if bull_count >= 3 and above_cloud
else "STRONG SELL" if bear_count >= 4 else "SELL" if bear_count >= 3 and below_cloud
else "WAIT — inside cloud or mixed signals",~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.