agentleFS
SKE-LabsSKE-Labs/agent-trading-skills/skills/chart-patterns/cup-and-handle/SKILL.md

cup-and-handle

Skill17 starsChanged 4 months agoApache-2.0View on GitHub

Define and test cup-and-handle breakout shapes. Use when measuring a rounded base, handle depth, lip break, retest, invalidation, and measured-move hypothesis without inferring accumulation.

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

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

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    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:

    Conservative: Wait for breakout + retest of lip (now support).

    line 90
  2. Distinctive:

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

    line 95
  3. Distinctive:

    NEVER enter before the handle forms — cup alone is incomplete

    line 102
  4. Distinctive:

    Treat a break below the cup midpoint as structural invalidation only when the chosen specification says so

    line 103

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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

Cup and Handle Pattern

A conventionally bullish continuation shape. Treat its geometry, breakout direction, and measured move as testable hypotheses rather than evidence of accumulation.

Pattern Structure

The Cup

  • Price rounds down from resistance, forms a "U" shaped bottom (not "V"), rises back to resistance
  • Duration and symmetry are market- and timeframe-specific; define minimum and maximum bars before scanning

The Handle

  • Small pullback from resistance into a declining flag/pennant
  • Define handle depth as (lip - handle_low) / (lip - cup_low) and reject only at a pretested threshold
  • Require the handle to remain above the cup midpoint only if that rule is part of the frozen specification
FactorPreferred seed definitionAlternative to test
Cup shapeRounded "U"Slightly V-shaped
Handle depthShallow relative to cupPredeclare a tested maximum
VolumeDecreasing in handleStable

Workflow

1. Get Exact Data

get_candles_around_date(symbol=<symbol>, exchange=<exchange>, interval=<interval>, date=<cup_bottom_date>)

2. Mark Key Structure

Cup lip (resistance level where both sides of the cup meet):

draw_chart_analysis(action="create", drawing={
    "type": "resistance",
    "points": [
        {"time": <left_lip_time>, "price": <lip_price>},
        {"time": <right_lip_time>, "price": <lip_price>}
    ],
    "options": {"text": "Lip"}
})

Cup bottom:

draw_chart_analysis(action="create", drawing={
    "type": "highlight",
    "points": [{"time": <bottom_time>, "price": <bottom_price>}],
    "options": {"text": "Cup Low"}
})

Handle boundaries (2 converging or parallel trend lines):

draw_chart_analysis(action="create", drawing={
    "type": "trend",
    "points": [
        {"time": <handle_high1_time>, "price": <handle_high1>},
        {"time": <handle_high2_time>, "price": <handle_high2>}
    ],
    "options": {"text": "Handle R"}
})

draw_chart_analysis(action="create", drawing={
    "type": "trend",
    "points": [
        {"time": <handle_low1_time>, "price": <handle_low1>},
        {"time": <handle_low2_time>, "price": <handle_low2>}
    ],
    "options": {"text": "Handle S"}
})

3. Enter

Standard: Enter on break above cup lip with volume spike. Stop below handle low. Aggressive: Enter as handle finds support. Tighter stop, higher risk. Conservative: Wait for breakout + retest of lip (now support). Target: Breakout level + cup depth (lip to bottom distance).

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: Lo, Mamaysky & Wang supports testing objectively defined chart patterns, not assuming that a named shape has a universal measured-move edge.

Key Rules

  • NEVER enter before the handle forms — cup alone is incomplete
  • Treat a break below the cup midpoint as structural invalidation only when the chosen specification says so
  • Measure relative volume during the handle and breakout; do not require an untested universal multiple
  • Failure at lip on second attempt = potential double top, not cup and handle

Related Skills

  • flag-pennant — The handle is essentially a small flag
  • double-top-bottom — Failed cup breakouts can become double tops

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.