wyckoff-trading
Original:🇨🇳 Chinese
Translated
1 scriptsChecked / no sensitive code detected
Wyckoff Method Trading Skill. Analyze stock trends based on the Wyckoff Method, identify accumulation/distribution phases, and determine entry and exit points (signals like Spring, JAC, UT, etc.). This skill is triggered when users mention stock trading, Wyckoff, stock analysis, buy signals, sell signals, etc.
3installs
Sourcecyrainfall/cyx_skills
Added on
NPX Install
npx skill4agent add cyrainfall/cyx_skills wyckoff-tradingTags
Translated version includes tags in frontmatterSKILL.md Content (Chinese)
View Translation Comparison →Wyckoff Method Trading Skill
This skill helps users analyze stock trends, identify market phases, and determine entry and exit points based on the Wyckoff Method.
Core Capabilities
- Data Acquisition - Obtain real-time/historical market data via REST API or WebSocket
- Structure Identification - Identify Accumulation zones, Distribution zones, and Trading Ranges
- Signal Judgment - Recognize classic Wyckoff signals such as Spring, JAC, UT, Shakeout
- Trading Decision-Making - Provide trading recommendations combined with the nine buy tests
Data Acquisition Module
This skill uses Baostock library to get A-share stock data
Installation
bash
pip install baostock pandasData Acquisition
Baostock is an open-source database designed specifically for A-shares, no registration required, with stable data.
python
import baostock as bs
import pandas as pd
def get_kline_data(stock_code, period='daily', limit=200):
"""Obtain historical K-line data for Wyckoff analysis
Args:
stock_code: Stock code, such as '300435' (Shenzhen Growth Enterprise Market) or '600519' (Shanghai Main Board)
period: Daily('daily')/Weekly('weekly')/Monthly('monthly')
limit: Number of days to retrieve
Returns:
list: List of K-line data dictionaries
"""
# Convert stock code format
if stock_code.startswith('6'):
code = f'sh.{stock_code}'
else:
code = f'sz.{stock_code}'
# Calculate date range
end_date = pd.Timestamp.now().strftime('%Y-%m-%d')
start_date = (pd.Timestamp.now() - pd.Timedelta(days=limit*2)).strftime('%Y-%m-%d')
# Log in to get data
bs.login()
rs = bs.query_history_k_data_plus(
code,
'date,code,open,high,low,close,volume,amount,pctChg',
start_date=start_date,
end_date=end_date,
frequency='d'
)
data_list = []
while (rs.error_code == '0') & rs.next():
data_list.append(rs.get_row_data())
bs.logout()
if data_list:
df = pd.DataFrame(data_list, columns=rs.fields)
df = df.rename(columns={
'date': 'trade_time', 'open': 'open', 'close': 'close',
'high': 'high', 'low': 'low', 'volume': 'volume',
'amount': 'amount', 'pctChg': 'pct_chg'
})
# Convert data types
df['close'] = df['close'].astype(float)
df['volume'] = df['volume'].astype(float)
df['high'] = df['high'].astype(float)
df['low'] = df['low'].astype(float)
return df.to_dict('records')
return []
def get_index_data(index_code='sh.000001', limit=200):
"""Obtain market index data
Args:
index_code: Index code, such as 'sh.000001' (Shanghai Composite Index), 'sz.399001' (Shenzhen Component Index)
limit: Number of days to retrieve
"""
end_date = pd.Timestamp.now().strftime('%Y-%m-%d')
start_date = (pd.Timestamp.now() - pd.Timedelta(days=limit*2)).strftime('%Y-%m-%d')
bs.login()
rs = bs.query_history_k_data_plus(
index_code,
'date,code,open,high,low,close,volume,amount,pctChg',
start_date=start_date,
end_date=end_date,
frequency='d'
)
data_list = []
while (rs.error_code == '0') & rs.next():
data_list.append(rs.get_row_data())
bs.logout()
if data_list:
df = pd.DataFrame(data_list, columns=rs.fields)
return df.to_dict('records')
return []
def get_stock_basics():
"""Obtain basic information of all A-share stocks"""
bs.login()
rs = bs.query_stock_basic()
data_list = []
while (rs.error_code == '0') & rs.next():
data_list.append(rs.get_row_data())
bs.logout()
return pd.DataFrame(data_list, columns=rs.fields)Wyckoff Analysis Framework
Market Phase Identification
| Phase | Characteristics | Trading Direction |
|---|---|---|
| Accumulation | Price consolidates at low levels, volume shrinks then expands | Prepare to buy |
| Markup | Uptrend with volume confirmation | Hold/add positions |
| Distribution | Price consolidates at high levels, volume expands then shrinks | Prepare to sell |
| Markdown | Downtrend with increasing volume | Wait/short sell |
Key Concepts
- SC (Selling Climax) - Panic selling low, usually accompanied by huge volume
- BC (Buying Climax) - Frenzy buying high, usually accompanied by huge volume
- AR (Automatic Rally) - Automatic rally to test selling pressure
- ST (Secondary Test) - Secondary test to verify support/resistance
- SOS (Sign of Strength) - Bullish signal, volume surge with upward breakout
- SOW (Sign of Weakness) - Bearish signal, volume surge with downward break
- LPS (Last Point of Support) - Final support level, pullback low
- UT (Upthrust) - False breakout then pullback, tests resistance before falling
- UTAD (Upthrust After Distribution) - False breakout after distribution phase
Detailed Wyckoff Phases
Accumulation Phase Detailed Steps
Phase A(Initial Phase)
├── SC:Panic selling, volume surges, price hits new low
├── AR:Automatic rally to test selling pressure
├── ST:Secondary test to verify SC support
└── Characteristic: Volume gradually shrinks
Phase B(Accumulation Phase)
├── Range consolidation: Price fluctuates between upper track and SC low
├── ST tests: Multiple tests of SC support level
├── Volume shrinkage on pullbacks: Volume decreases during each pullback
└── Characteristic: Fluctuation range gradually narrows
Phase C(Testing Phase)
├── Spring: Breaks support quickly then rebounds sharply (core buy signal)
├── Shakeout: Shakeout to accumulate shares
└── Characteristic: Obvious buy signals appear
Phase D(Breakout Phase)
├── SOS: Volume surge breaks above upper track of range (bullish signal)
├── Pullback: Volume shrinks as price pulls back to near upper track
├── LPS: Final support point, pullback does not break previous low
└── Characteristic: Uptrend is confirmed
Phase E(Departure Phase)
├── Price rises: Leaves accumulation zone
├── Volume expands: Demand dominates
└── Characteristic: Enters uptrendDistribution Phase Detailed Steps
Phase A(Initial Phase)
├── BC:Frenzy buying, volume surges, price hits new high
├── AR:Automatic pullback to test buying pressure
├── ST:Secondary test to verify BC resistance
└── Characteristic: Volume starts to shrink
Phase B(Distribution Phase)
├── Range consolidation: Price fluctuates between lower track and BC high
├── UT: False breakout then pullback, tests resistance
├── UTAD: False breakout after distribution
└── Characteristic: Fluctuation range gradually narrows
Phase C(Distribution Confirmation)
├── UT: Price briefly breaks above range upper track then pulls back
├── SOW: Bearish signal, volume surge with downward break
└── Characteristic: Breaks below range lower edge
Phase D(Downtrend Confirmation)
├── SOS: Volume surge with downward move (false breakout reversal)
├── Weak rebounds: Each rebound fails to reach previous highs
└── Characteristic: Downtrend is confirmed
Phase E(Departure Phase)
├── Price falls: Leaves distribution zone
├── Volume expands: Supply dominates
└── Characteristic: Enters downtrendDetailed Wyckoff Signal System
Buy Signal Details
1. Spring
Classic buy signal at the end of accumulation phase:
Judgment Criteria:
1. Context: Price is in lower half of consolidation range or near support
2. Breakdown: Briefly and sharply breaks below support zone (creates panic)
3. Rebound: Price quickly pulls back into range, closing above support
4. Volume: May surge during breakdown (panic selling), then shrinks after rebound
5. Confirmation: Subsequent pullback with shrinking volume finds support2. JAC - Jump Across the Creek
Buy point after resistance breakout and pullback:
Judgment Criteria:
1. Identify "Creek": Horizontal resistance formed by previous highs
2. Breakout: Long bullish candle with significant volume expansion (demand absorbs all supply)
3. Pullback: Price pulls back to near pre-breakout platform with shrinking volume
4. Confirmation: Volume is extremely low during pullback (supply exhausted)3. Shakeout
Similar to Spring but more aggressive:
Judgment Criteria:
1. Context: Accumulation phase after long-term consolidation
2. Sharp drop: Sudden sharp decline in short term, creating illusion of distribution
3. Quick rebound: Quickly pulls back and hits new high
4. Volume: Huge volume during drop, shrinking after rebound4. Automatic Rally (AR)
Rebound test after SC:
Judgment Criteria:
1. Context: Appears after SC
2. Rebound amplitude: Usually significant
3. Volume: May expand
4. Significance: Tests intensity of selling pressure5. Secondary Test (ST)
Important signal to verify support/resistance:
Judgment Criteria:
1. Context: After AR, price tests SC or BC again
2. Position: Close to SC low or BC high
3. Volume: Should shrink (verifies effective support/resistance)
4. Significance: Confirms shift in supply-demand relationshipBullish/Bearish Signals
SOS (Sign of Strength) - Bullish Signal
Judgment Criteria:
1. Volume surge with rise: Volume increases significantly
2. Closing price: Closes at or near intraday high
3. Context: Appears after pullback
4. Significance: Strong demand, bullish outlookSOW (Sign of Weakness) - Bearish Signal
Judgment Criteria:
1. Volume surge with drop: Volume increases significantly
2. Closing price: Closes at or near intraday low
3. Context: Appears after rebound
4. Significance: Strong supply, bearish outlookLPS (Last Point of Support) - Final Support Point
Judgment Criteria:
1. Position: Pullback low in uptrend
2. Volume: Shrinks
3. Does not break previous low: Higher than previous low
4. Significance: Likely to rise againSell Signal Details
UT (Upthrust)
Sell signal in distribution phase:
Judgment Criteria:
1. Context: After long-term uptrend or high-level consolidation
2. Breakout: Briefly breaks above range upper track or previous high
3. Pullback: Price quickly falls back into range, closing weakly
4. Volume: May surge during breakout (institutional distribution)
5. Confirmation: Subsequent break below range lower edge (SOW) → sell or shortUTAD (Upthrust After Distribution)
False breakout after distribution completion:
Judgment Criteria:
1. Context: After distribution zone is formed
2. Breakout: Price breaks above distribution zone upper track
3. Pullback: Closes at low level
4. Confirmation: Subsequent break below distribution zone lower edge
5. Significance: Trend reversal signalDistribution Zone Characteristics
- Price fluctuates back and forth in range
- Each rally's high gradually decreases (downtrend line)
- Volume expands at high levels, shrinks at low levels
- Breaks below range lower edge after UT signal appears
Trend Line Analysis
Trend Line Drawing Principles
Uptrend Line:
- Connect two or more sequentially rising lows
- Price should trade above the trend line
- Breaking below may indicate pullback
Downtrend Line:
- Connect two or more sequentially falling highs
- Price should trade below the trend line
- Breaking above may indicate reversalApplication of Trend Lines in Wyckoff Analysis
Accumulation Zone Trend Line Characteristics:
- Breaks downtrend line during rise
- Pullbacks do not break previous lows
- Trend line angle gradually steepens
Distribution Zone Trend Line Characteristics:
- Breaks uptrend line during fall
- Rebounds do not reach previous highs
- Trend line angle gradually flattensVolume-Price Relationship Analysis
Volume Confirmation Principles
Volume-Price Confirmation (Healthy Signal):
├── Rise with volume expansion: Demand follows
├── Fall with volume shrinkage: Supply exhausted
├── Breakout with volume expansion: Valid breakout
└── Pullback with volume shrinkage: Pullback may end
Volume-Price Divergence (Warning Signal):
├── Rise with volume shrinkage: Insufficient demand
├── Fall with volume expansion: Strong supply
├── Breakout with volume shrinkage: False breakout
└── Rebound with volume expansion: May continue fallingVolume Patterns
Accumulation Zone Volume Characteristics:
├── Initial phase: Huge volume during SC
├── Middle phase: Gradually shrinks
├── Late phase: Volume expands during breakout
└── Overall: Low volume at lows, high volume at highs
Distribution Zone Volume Characteristics:
├── Initial phase: Huge volume during BC
├── Middle phase: Volume expands at highs
├── Late phase: Volume expands during fall
└── Overall: High volume at highs, low volume at lowsNine Buy Tests
Satisfy as many test criteria as possible before buying:
- Trend Test - Market index is in uptrend (judge using index data)
- Relative Strength - Stock outperforms market (RS line upward)
- Range Consolidation - Stock is forming a consolidation range (accumulation zone)
- Cause & Effect - Consolidation period is sufficiently long
- Final Shakeout - Spring or shakeout pattern appears
- Bullish Signal - SOS (volume surge with rise) appears
- Final Support - LPS (pullback with shrinking volume) appears
- No Negative News - No sudden major negative news in the market
- Market Synchronization - Market index is also in accumulation or early markup phase
Each satisfied test increases the winning rate of the trade.
Risk Management
Stop-Loss Setting
- Spring Entry: Stop-loss below Spring low
- JAC Entry: Stop-loss below the "Creek" (resistance level)
- UT Exit: Stop-loss above UT high
Position Management
- Satisfy 5-6 buy tests: 30% position
- Satisfy 7-8 buy tests: 50% position
- Satisfy all 9 buy tests: 70% position
Exit Strategy
- Reduce positions when SOW signal appears
- Liquidate positions when important support is broken
- Sell in batches when target return is achieved
Output Format
After analysis, output in the following format:
## Stock Analysis Report: [Stock Code]
### 1. Market Phase Judgment
- Current Phase: Accumulation/Markup/Distribution/Markdown
- Confidence: High/Medium/Low
### 2. Key Signals
[List identified signals and dates]
### 3. Buy/Sell Recommendation
- Signal Type: Spring / JAC / UT / ...
- Entry Price: XXX
- Stop-Loss Price: XXX
- Take-Profit Price: XXX
- Position Recommendation: X%
### 4. Nine Buy Test Results
1. Trend Test: ✓/✗
2. Relative Strength: ✓/✗
...
### 5. Risk Warning
[Explain current risks]Notes
- Data First - Wyckoff analysis is based on objective volume-price data, do not rely on subjective guesses
- Follow the Trend - Prioritize stocks that align with the market trend
- Be Patient - Good entry points require waiting, avoid frequent trading
- Strict Execution - Must execute stop-loss orders, do not adjust temporarily
- Continuous Learning - Mastering the Wyckoff Method requires extensive practice
- Data Source - This skill uses Baostock to obtain data, supporting historical K-line analysis; real-time market data can be used with other interfaces