agentleFS
SKE-LabsSKE-Labs/agent-trading-skills/skills/technical-strategies/divergence-trading/SKILL.md

divergence-trading

Skill17 starsChanged 4 months agoApache-2.0View on GitHub

Define and test regular or hidden divergence at objective pivots. Use when aligning RSI, MACD, Stochastic, MFI, or volume features to exact price-pivot timestamps without counting correlated indicators as independent votes.

1 other project uses a version of this, 1 of them edited.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

5 rules. About 0 are common, 5 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈5

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use an objective pivot algorithm with fixed left/right bars or ATR reversal and exclude the unconfirmed right-edge pivot.

    line 43
  2. Distinctive:

    Treat the setup as a testable hypothesis, not a prediction.

    line 81
  3. Distinctive:

    Do not treat multiple price-derived oscillators as independent confirmation.

    line 89
  4. Distinctive:

    Test timeframe and regime interactions.

    line 92
  5. Distinctive:

    Keep unresolved divergences and failures in the evaluation sample.

    line 93

≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Divergence Trading

Divergence occurs when price and an indicator move in opposite directions, signaling potential trend change or continuation.

Divergence Types

Regular Divergence (Reversal)

TypePriceIndicatorSignal
Bullish RegularLower LowHigher LowMomentum weakening, potential reversal up
Bearish RegularHigher HighLower HighMomentum weakening, potential reversal down

Hidden Divergence (Continuation)

TypePriceIndicatorSignal
Bullish HiddenHigher LowLower LowUptrend pullback ending, continuation up
Bearish HiddenLower HighHigher HighDowntrend rally ending, continuation down

Multi-Indicator Detection

IndicatorBest ForExtreme Zone
RSIOB/OS exhaustion<30 or >70 for regular div
MACD histogramMomentum shiftsCompare histogram peaks/troughs with price
StochasticRanging markets<20 or >80 (skip mid-range div)
MFI (price/volume transform)Volume-aware momentumDefine pivots and compare slopes

RSI, MACD, and Stochastic are correlated transforms of price, while MFI also uses volume. Do not count them as independent votes or map the count to probability; compare each feature and any combination with a price-only baseline.

Validation Rules

  • Use an objective pivot algorithm with fixed left/right bars or ATR reversal and exclude the unconfirmed right-edge pivot.
  • Calibrate minimum/maximum spacing and optional oscillator zones by instrument/timeframe.
  • Match indicator values at the exact price-pivot timestamps; use closed data and specify equality tolerance.

Workflow

  1. Get indicator data:
    get_indicators(indicator_code="rsi", symbol=<symbol>, exchange=<exchange>, interval=<interval>)
    get_indicators(indicator_code="macd", symbol=<symbol>, exchange=<exchange>, interval=<interval>)
    get_indicators(indicator_code="stoch", symbol=<symbol>, exchange=<exchange>, interval=<interval>)
  2. Compare swings: For each indicator, identify last two significant peaks/troughs and compare direction vs price direction
  3. Evaluate: report each divergence and contextual feature separately; use a numeric score only if calibrated on held-out labels.
  4. Get candles for chart drawing:
    get_candles_around_date(symbol=<symbol>, exchange=<exchange>, interval=<interval>, date=<date>)
  5. Mark divergence on chart:
    draw_chart_analysis(action="create", drawing={
        "type": "trend",
        "points": [
            {"time": <first_low_time>, "price": <first_low_price>},
            {"time": <second_low_time>, "price": <second_low_price>}
        ],
        "options": {"text": "Bullish Divergence (RSI + MACD)"}
    })
  6. Wait for confirmation candle (engulfing, hammer, pin bar) at the divergence zone before entry

Evidence and Validation

  • Treat the setup as a testable hypothesis, not a prediction. Define thresholds, entry, invalidation, and exit before evaluating outcomes.
  • Calibrate on the same instrument, venue, session, and timeframe. Use closed candles and a held-out or walk-forward sample; record every variant tried.
  • Include spread, fees, slippage, borrow or funding, partial fills, and latency. Reject the setup when net expectancy is not positive or depends on one narrow parameter.
  • Return observed inputs, missing data, cost assumptions, entry, invalidation, exit, and a valid, watch, or no-trade status.
  • Research basis: The technical-analysis evidence review finds mixed performance and common data-snooping problems; multiple correlated oscillators do not create independent confirmation.

Key Rules

  • Do not treat multiple price-derived oscillators as independent confirmation.
  • Calibrate oscillator zones rather than declaring mid-range values meaningless.
  • Define an objective closed-bar entry and invalidate beyond the second pivot plus buffer.
  • Test timeframe and regime interactions; no timeframe is universally more reliable.
  • Keep unresolved divergences and failures in the evaluation sample.
  • Entry on confirmation candle close; stop beyond the second divergence swing point

Related Skills

  • rsi-divergence — focused RSI divergence framework; this skill extends it to multiple indicators
  • macd-trading — MACD histogram divergence is one of the four indicators in multi-indicator scoring

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.