From 5eb64cb474ce0cff01fac290e18e1256d9f3b306 Mon Sep 17 00:00:00 2001 From: Zhongwei Li Date: Sat, 29 Nov 2025 18:49:51 +0800 Subject: [PATCH] Initial commit --- .claude-plugin/plugin.json | 12 + README.md | 3 + plugin.lock.json | 64 ++ skills/trading-plan-generator/SKILL.md | 729 ++++++++++++++++ .../references/risk_management.md | 585 +++++++++++++ .../references/trading_psychology.md | 660 ++++++++++++++ .../scripts/generate_plan.sh | 810 ++++++++++++++++++ .../scripts/position_calculator.sh | 104 +++ .../scripts/validate_plan.sh | 179 ++++ 9 files changed, 3146 insertions(+) create mode 100644 .claude-plugin/plugin.json create mode 100644 README.md create mode 100644 plugin.lock.json create mode 100644 skills/trading-plan-generator/SKILL.md create mode 100644 skills/trading-plan-generator/references/risk_management.md create mode 100644 skills/trading-plan-generator/references/trading_psychology.md create mode 100755 skills/trading-plan-generator/scripts/generate_plan.sh create mode 100755 skills/trading-plan-generator/scripts/position_calculator.sh create mode 100755 skills/trading-plan-generator/scripts/validate_plan.sh diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json new file mode 100644 index 0000000..45b2b8b --- /dev/null +++ b/.claude-plugin/plugin.json @@ -0,0 +1,12 @@ +{ + "name": "trading-plan-generator", + "description": "Generate comprehensive trading plans with risk management, position sizing, entry/exit strategies, and performance tracking to trade with discipline and consistency.", + "version": "0.0.0-2025.11.28", + "author": { + "name": "James Rochabrun", + "email": "jamesrochabrun@gmail.com" + }, + "skills": [ + "./skills/trading-plan-generator" + ] +} \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..e11c1f2 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# trading-plan-generator + +Generate comprehensive trading plans with risk management, position sizing, entry/exit strategies, and performance tracking to trade with discipline and consistency. diff --git a/plugin.lock.json b/plugin.lock.json new file mode 100644 index 0000000..31467c2 --- /dev/null +++ b/plugin.lock.json @@ -0,0 +1,64 @@ +{ + "$schema": "internal://schemas/plugin.lock.v1.json", + "pluginId": "gh:jamesrochabrun/skills:trading-plan-generator", + "normalized": { + "repo": null, + "ref": "refs/tags/v20251128.0", + "commit": "547cd5fe1e0bdf603df42d6640aa787754f85ae5", + "treeHash": "ebc607d3fcb552ea741c6ace159ad7191213ab260967a64545bbb7f230e68fe0", + "generatedAt": "2025-11-28T10:17:56.608671Z", + "toolVersion": "publish_plugins.py@0.2.0" + }, + "origin": { + "remote": "git@github.com:zhongweili/42plugin-data.git", + "branch": "master", + "commit": "aa1497ed0949fd50e99e70d6324a29c5b34f9390", + "repoRoot": "/Users/zhongweili/projects/openmind/42plugin-data" + }, + "manifest": { + "name": "trading-plan-generator", + "description": "Generate comprehensive trading plans with risk management, position sizing, entry/exit strategies, and performance tracking to trade with discipline and consistency." + }, + "content": { + "files": [ + { + "path": "README.md", + "sha256": "7f8325e8e7b8360d55689a7eb9391f9013d5529f35133c2264ff9d695199f479" + }, + { + "path": ".claude-plugin/plugin.json", + "sha256": "6cd435ec2755820118ca2eaabcd42513bbd9a0e201687345de3d8651ea6542fb" + }, + { + "path": "skills/trading-plan-generator/SKILL.md", + "sha256": "215aa17c2e1184905e4bcddb5d2249934bd130e68d9b1c0a461d1c024da7c685" + }, + { + "path": "skills/trading-plan-generator/references/trading_psychology.md", + "sha256": "981d8e2aa5114b2ef0cf6b8c8fe0ebf7fae496bb935a7ffd425d8599aa09d091" + }, + { + "path": "skills/trading-plan-generator/references/risk_management.md", + "sha256": "fabc74dbe26e72c9ab479829ebd5394875ea7da85296ad4f9df7eeee4fe8f296" + }, + { + "path": "skills/trading-plan-generator/scripts/validate_plan.sh", + "sha256": "c6614e2aa49ca07614fb334c2625189fdb41fe8819c3455b11203ae0b35fb06e" + }, + { + "path": "skills/trading-plan-generator/scripts/position_calculator.sh", + "sha256": "fa529b6263344b7a5a35f61372033fae14c9882d862ab1e2ed57df2334e7e37c" + }, + { + "path": "skills/trading-plan-generator/scripts/generate_plan.sh", + "sha256": "3b2124d4432174bedd790efcd7ce1b335e95c840cac7830595656a2c53deced0" + } + ], + "dirSha256": "ebc607d3fcb552ea741c6ace159ad7191213ab260967a64545bbb7f230e68fe0" + }, + "security": { + "scannedAt": null, + "scannerVersion": null, + "flags": [] + } +} \ No newline at end of file diff --git a/skills/trading-plan-generator/SKILL.md b/skills/trading-plan-generator/SKILL.md new file mode 100644 index 0000000..9ed16d6 --- /dev/null +++ b/skills/trading-plan-generator/SKILL.md @@ -0,0 +1,729 @@ +--- +name: trading-plan-generator +description: Generate comprehensive trading plans with risk management, position sizing, entry/exit strategies, and performance tracking to trade with discipline and consistency. +--- + +# Trading Plan Generator + +A comprehensive skill for creating disciplined, rule-based trading plans that help you manage risk, control emotions, and trade consistently. + +## What This Skill Does + +Helps you create professional trading plans for: +- **Day Trading** - Intraday positions, quick scalps +- **Swing Trading** - Multi-day to multi-week positions +- **Position Trading** - Long-term trend following +- **Options Trading** - Directional and income strategies +- **Investing** - Long-term portfolio management + +## Why You Need a Trading Plan + +**Without a plan:** +- Emotional, impulsive decisions +- Inconsistent position sizing +- No clear entry/exit rules +- Revenge trading after losses +- Account blowup risk +- Can't identify what works + +**With a plan:** +- Disciplined, rule-based trading +- Consistent risk management +- Clear decision framework +- Emotional control +- Long-term profitability +- Measurable improvement + +**The Stats:** +- 90% of traders fail (most have no plan) +- Professional traders ALL have written plans +- Plan + discipline = edge + +## Core Components of a Trading Plan + +### 1. Trading Goals & Mindset +- Financial goals (realistic) +- Time commitment +- Risk tolerance +- Trading philosophy +- Success definition + +### 2. Risk Management (MOST IMPORTANT) +- Maximum risk per trade (1-2% recommended) +- Maximum daily loss limit +- Maximum drawdown tolerance +- Position sizing rules +- Stop-loss requirements +- Risk/reward minimums + +### 3. Market Selection +- What markets you trade (stocks, forex, crypto, options) +- Liquidity requirements +- Price range preferences +- Sector focus (if any) +- What you DON'T trade + +### 4. Trading Setup Criteria +- Entry signals (technical/fundamental) +- Confirmation requirements +- Timeframes used +- Pattern recognition +- Market condition filters + +### 5. Entry Rules +- Exact entry triggers +- Order types (market, limit, stop) +- Position sizing calculation +- Scaling in (if allowed) +- Time-of-day restrictions + +### 6. Exit Rules +- Stop-loss placement (hard rules) +- Take-profit targets +- Trailing stop strategies +- Time-based exits +- Scaling out rules +- Break-even stops + +### 7. Trade Management +- When to adjust stops +- When to add to position +- When to reduce size +- When to exit early +- Never scenarios (what you never do) + +### 8. Psychology & Discipline +- Pre-market routine +- Emotional state check +- Tilt recognition +- Break requirements +- End-of-day review +- Accountability measures + +### 9. Performance Tracking +- Trade journal requirements +- Metrics to track +- Review frequency +- Improvement process +- Strategy adjustment criteria + +## Risk Management Frameworks + +### The 1% Rule (Recommended for Most Traders) +**Never risk more than 1% of account on single trade** + +**Example:** +- Account size: $50,000 +- Maximum risk per trade: $500 (1%) +- Stock entry: $100 +- Stop-loss: $98 +- Risk per share: $2 +- Position size: $500 / $2 = 250 shares +- Total position: $25,000 (50% of account) +- Actual risk: $500 (1% of account) + +**Benefits:** +- Can survive 20+ consecutive losses +- Removes emotion from sizing +- Consistent risk across trades +- Protects capital + +### The 2R Minimum Rule +**Only take trades with 2:1 reward-to-risk or better** + +**Example:** +- Entry: $100 +- Stop: $98 (risk = $2) +- Target: $104 (reward = $4) +- R:R = 2:1 ✅ + +**Why it matters:** +- Can be profitable with 40% win rate +- Forces selective trading +- Improves overall edge + +### Maximum Drawdown Limit +**Hard stop trading if down X% from peak** + +**Recommendations:** +- Conservative: 10% drawdown → stop trading +- Moderate: 15% drawdown → stop trading +- Aggressive: 20% drawdown → stop trading + +**When hit:** +1. Stop trading immediately +2. Review all trades +3. Identify mistakes +4. Paper trade until recovered mentally +5. Resume with reduced size + +## Trading Styles + +### Day Trading +**Definition:** Open and close all positions same day + +**Characteristics:** +- Multiple trades per day +- No overnight risk +- Pattern Day Trader rules ($25K minimum) +- High screen time requirement +- Quick decisions + +**Best for:** +- Full-time traders +- High risk tolerance +- Quick decision makers +- Pattern recognition skills + +**Key rules:** +- Never hold overnight +- Reduce size near close +- Stop trading after daily loss limit +- First 30 min often volatile + +### Swing Trading +**Definition:** Hold positions 2-10 days + +**Characteristics:** +- 2-5 trades per week +- Overnight risk acceptable +- Part-time friendly +- Technical + fundamental mix + +**Best for:** +- Part-time traders +- Day job professionals +- Trend followers +- Patient traders + +**Key rules:** +- Always use stop-losses +- Check positions before/after market +- Respect earnings dates +- Weekend gap risk consideration + +### Position Trading +**Definition:** Hold positions weeks to months + +**Characteristics:** +- Long-term trend following +- Fundamental focus +- Low trade frequency +- Larger position sizes + +**Best for:** +- Investors with edge +- Low time availability +- Fundamental analysts +- Macro trend followers + +**Key rules:** +- Wide stops (volatility-based) +- Focus on major trends +- Ignore daily noise +- Strong thesis required + +## Entry Strategies + +### Technical Entry Methods + +**1. Breakout Entry** +- Price breaks above resistance +- Increased volume confirmation +- Wait for pullback or buy breakout +- Stop below breakout level + +**2. Pullback Entry** +- Wait for trend pullback +- Enter at support/moving average +- Continuation confirmation +- Stop below support + +**3. Reversal Entry** +- Identify overextended move +- Look for reversal signals +- Multiple confirmations required +- Wider stops needed + +**4. Pattern Completion** +- Specific pattern (flag, triangle, etc.) +- Pattern completion signal +- Volume confirmation +- Target based on pattern + +### Fundamental Entry Triggers + +**For Stocks:** +- Earnings surprise +- Guidance raise +- Product launch +- Sector rotation +- Insider buying +- Short squeeze setup + +**For Macro:** +- Fed policy change +- Economic data surprise +- Geopolitical event +- Seasonality + +## Exit Strategies + +### Stop-Loss Methods + +**1. Percentage Stop** +- Fixed % below entry +- Simple and clear +- Example: 2% below entry + +**2. Support/Resistance Stop** +- Below key technical level +- Makes technical sense +- Varies by setup + +**3. ATR-Based Stop** +- 1.5-2x Average True Range +- Adapts to volatility +- Prevents whipsaw + +**4. Time Stop** +- Exit if no progress in X days +- Frees up capital +- Prevents dead money + +### Take-Profit Methods + +**1. Fixed R Multiple** +- 2R, 3R, 4R targets +- Predetermined exit +- Consistent methodology + +**2. Technical Target** +- Previous resistance +- Fibonacci extension +- Measured move +- Pattern target + +**3. Trailing Stop** +- Move stop as profit grows +- Lock in gains +- Ride trends longer + +**4. Partial Profits** +- Take 50% at 2R +- Trail remaining 50% +- Reduces regret +- Balances risk/reward + +## Position Sizing Formulas + +### Fixed Dollar Risk +``` +Position Size = Account Risk $ / (Entry - Stop) + +Example: +- Account: $50,000 +- Risk per trade: $500 (1%) +- Entry: $100 +- Stop: $97 +- Risk per share: $3 +- Shares: $500 / $3 = 166 shares +``` + +### Fixed Percentage Risk +``` +Position Size = (Account × Risk %) / (Entry - Stop) + +Example: +- Account: $50,000 +- Risk: 1% +- Entry: $50 +- Stop: $48 +- Risk per share: $2 +- Shares: ($50,000 × 0.01) / $2 = 250 shares +``` + +### Kelly Criterion (Advanced) +``` +Position Size % = (Win Rate × Avg Win - Loss Rate × Avg Loss) / Avg Win + +Example: +- Win rate: 55% +- Avg win: $500 +- Loss rate: 45% +- Avg loss: $300 +- Kelly: (0.55 × $500 - 0.45 × $300) / $500 = 28% +- Use 1/4 Kelly = 7% position size (conservative) +``` + +**Warning:** Kelly can be aggressive, use fractional Kelly + +## Trading Psychology + +### Pre-Market Routine +- [ ] Review previous day's trades +- [ ] Check overnight news +- [ ] Identify key levels +- [ ] Plan potential setups +- [ ] Check emotional state +- [ ] Confirm risk limits + +### Emotional State Check +**Don't trade if:** +- Angry or frustrated +- Desperate for money +- Revenge mindset +- Distracted or tired +- Overconfident +- Fearful + +**Green light to trade:** +- Calm and focused +- Following plan +- Accepting of losses +- Patient for setups +- Clear-headed + +### Tilt Recognition +**Warning signs:** +- Increasing position size +- Abandoning stops +- Taking marginal setups +- Revenge trading +- Checking P&L constantly +- Breaking rules + +**When tilting:** +1. Stop trading immediately +2. Close all positions +3. Take a break (hour/day/week) +4. Review what triggered it +5. Return when calm + +### Daily Loss Limit +**Critical rule:** Stop trading at daily loss limit + +**Example:** +- Daily limit: -2% of account +- Account: $50,000 +- Stop at: -$1,000 loss + +**Why it matters:** +- Prevents blowup days +- Forces you to stop tilting +- Tomorrow is another day +- Protects capital + +## Market Conditions & Filters + +### When to Trade +- [ ] Market trending clearly +- [ ] Volatility in normal range +- [ ] Volume above average +- [ ] Your setups present +- [ ] Clear technical levels +- [ ] Emotional state good + +### When NOT to Trade +- [ ] Choppy, rangebound market +- [ ] Major news pending (FOMC, etc.) +- [ ] Low volume (holidays) +- [ ] Extreme volatility +- [ ] No clear setups +- [ ] Emotional/tilting + +### Market Regime Recognition + +**Bull Market:** +- Buy dips +- Longer holds +- Reduce short exposure +- Follow momentum + +**Bear Market:** +- Sell rips +- Shorter holds +- Reduce long exposure +- Focus on defense + +**Sideways/Choppy:** +- Reduce size +- Take quick profits +- Avoid breakout trades +- Trade ranges + +## Performance Tracking + +### Metrics to Track + +**Win Rate:** +- % of trades profitable +- Target: >50% for day trading, >40% for swing + +**Average Win vs Average Loss:** +- Avg $ won on winners +- Avg $ lost on losers +- Should be 1.5:1 or better + +**Profit Factor:** +- Gross profit / Gross loss +- >1.5 is good, >2.0 is excellent + +**Expectancy:** +- (Win Rate × Avg Win) - (Loss Rate × Avg Loss) +- Must be positive to be profitable + +**Maximum Drawdown:** +- Largest peak-to-trough decline +- Track and improve over time + +**Sharpe Ratio:** +- Return / Volatility +- >1.0 is good + +### Trade Journal Requirements + +**For each trade log:** +- Date and time +- Ticker/instrument +- Entry price and size +- Stop-loss and target +- Exit price and reason +- P&L ($ and %) +- Setup/pattern +- Market condition +- Emotional state +- Mistakes made +- Lessons learned +- Screenshot + +### Review Schedule + +**Daily:** +- Review all trades +- Calculate P&L +- Note mistakes +- Plan next day + +**Weekly:** +- Calculate weekly metrics +- Identify patterns +- Best/worst trades +- Rule compliance % + +**Monthly:** +- Full performance review +- Strategy adjustments +- Goal progress +- Mindset check + +## Common Mistakes to Avoid + +### ❌ Fatal Errors + +**1. No Stop-Loss** +- One bad trade can wipe account +- ALWAYS use stops +- No exceptions + +**2. Overleveraging** +- Position size too large +- Can't handle normal volatility +- Forced exits at worst time + +**3. Revenge Trading** +- Trading to "get back" losses +- Emotional decisions +- Breaks all rules + +**4. Moving Stops** +- Moving stop to avoid loss +- Invalidates risk management +- Path to blowup + +**5. Averaging Down Losers** +- Adding to losing position +- Doubles down on mistake +- Increases risk dramatically + +**6. No Plan** +- Winging it +- Inconsistent decisions +- Can't improve + +### ✅ Best Practices + +**1. Risk < Reward** +- Always 2:1 R:R minimum +- Selective trading +- Math works in your favor + +**2. Consistent Sizing** +- Same risk each trade +- Removes emotion +- Sustainable growth + +**3. Follow Your Plan** +- Even when uncomfortable +- Trust the process +- Track compliance + +**4. Take Breaks** +- After losses +- When tilting +- Regularly + +**5. Keep Learning** +- Review trades +- Study markets +- Adapt and improve + +## Using This Skill + +### Generate a Trading Plan + +```bash +./scripts/generate_plan.sh +``` + +Interactive workflow guides you through: +1. Trading style and goals +2. Risk management rules +3. Market and setup selection +4. Entry and exit criteria +5. Psychology and discipline +6. Performance tracking + +### Validate Your Plan + +```bash +./scripts/validate_plan.sh path/to/plan.md +``` + +Checks for: +- Risk management defined +- Position sizing rules +- Entry/exit criteria +- Stop-loss requirements +- Performance tracking +- Completeness + +### Calculate Position Size + +```bash +./scripts/position_calculator.sh +``` + +Quick calculator for: +- Shares based on risk +- Risk amount +- R:R ratio +- Compliance check + +### Access References + +``` +references/risk_management.md - Complete risk frameworks +references/trading_psychology.md - Mental game and discipline +references/technical_setups.md - Chart patterns and entries +references/performance_metrics.md - Tracking and improvement +``` + +## Trading Plan Checklist + +- [ ] **Clear trading goals** defined +- [ ] **Risk per trade** specified (1-2% recommended) +- [ ] **Daily loss limit** set and hard stop +- [ ] **Position sizing** formula defined +- [ ] **Markets traded** clearly identified +- [ ] **Entry criteria** specific and measurable +- [ ] **Stop-loss rules** mandatory for every trade +- [ ] **Take-profit strategy** defined +- [ ] **Trade management** rules for scaling +- [ ] **Emotional checks** before trading +- [ ] **Trade journal** template ready +- [ ] **Performance metrics** to track +- [ ] **Review schedule** committed to + +## Quick Start + +### Beginner Trader Template +- Risk: 0.5% per trade +- Style: Swing trading +- Daily loss: -1.5% +- Minimum R:R: 3:1 +- Simple technical setups +- Conservative sizing + +### Experienced Trader Template +- Risk: 1-2% per trade +- Style: Your preference +- Daily loss: -3% +- Minimum R:R: 2:1 +- Advanced setups +- Discretionary management + +## Important Disclaimers + +**This skill provides frameworks, not financial advice.** + +- Trading involves substantial risk +- Past performance ≠ future results +- Only trade with risk capital +- Educate yourself thoroughly +- Consider working with professionals +- Comply with all regulations +- You are responsible for your decisions + +**Risk Warning:** +- You can lose all your capital +- Leverage amplifies losses +- Emotional control is critical +- No guaranteed profits +- Most traders lose money + +## Best Practices + +### 1. Start Small +- Paper trade first +- Then micro positions +- Prove profitability +- Then scale up + +### 2. Focus on Process +- Not on money +- Follow rules +- Track metrics +- Improve systematically + +### 3. Protect Capital +- Risk management first +- Survive to trade tomorrow +- Slow and steady wins + +### 4. Stay Disciplined +- Plan your trades +- Trade your plan +- No exceptions +- Review constantly + +### 5. Keep Learning +- Markets evolve +- Adapt strategies +- Learn from mistakes +- Study the best + +## Summary + +A trading plan is your blueprint for success. It: +- **Protects** your capital with risk management +- **Guides** decisions with clear rules +- **Controls** emotions through discipline +- **Tracks** performance for improvement +- **Builds** consistency over time + +**Remember:** The goal isn't to get rich quick. It's to trade consistently, manage risk properly, and compound gains over time. + +--- + +**"Plan your trade, trade your plan, and manage your risk. Everything else is noise."** diff --git a/skills/trading-plan-generator/references/risk_management.md b/skills/trading-plan-generator/references/risk_management.md new file mode 100644 index 0000000..dc88e09 --- /dev/null +++ b/skills/trading-plan-generator/references/risk_management.md @@ -0,0 +1,585 @@ +# Risk Management for Traders + +The single most important factor determining trading success. + +--- + +## Why Risk Management Matters + +**The brutal truth:** +- 90% of traders lose money +- Most blow up their accounts +- #1 reason: Poor risk management + +**What separates winners from losers:** +- NOT better analysis +- NOT better indicators +- NOT market prediction +- **Risk management and discipline** + +**Your job as a trader:** +- Protect capital FIRST +- Make money SECOND + +--- + +## The 1% Rule + +**Never risk more than 1% of account on single trade** + +### Why 1%? + +**Survival math:** +- 10 losses in a row = -10% drawdown +- 20 losses in a row = -20% drawdown +- Still in the game + +**Compare to 5% risk:** +- 10 losses in a row = -50% drawdown +- Need 100% return just to break even +- Likely game over + +### How to Calculate + +``` +Risk Amount = Account Size × 0.01 + +Example: +$50,000 account × 1% = $500 max risk per trade +``` + +### Position Sizing with 1% Rule + +``` +Shares = Risk Amount / (Entry - Stop) + +Example: +- Account: $50,000 +- Risk: $500 (1%) +- Entry: $100 +- Stop: $98 +- Risk per share: $2 +- Position: $500 / $2 = 250 shares +``` + +**Key insight:** Position SIZE changes, but RISK stays constant + +--- + +## Daily Loss Limits + +**Hard stop when you hit daily loss limit** + +### Recommended Limits + +| Trader Type | Daily Loss Limit | +|-------------|------------------| +| Conservative | -1% | +| Moderate | -2% | +| Aggressive | -3% | + +### Why Daily Limits Matter + +**Prevents:** +- Revenge trading +- Emotional spirals +- Blowup days +- Tilt-induced disasters + +**Example:** +- $50,000 account +- 2% daily limit = -$1,000 +- Hit limit → DONE for the day +- No exceptions + +### What to Do When Hit + +1. Close ALL positions +2. Step away from computer +3. Physical activity (walk/exercise) +4. Review trades later (not now) +5. Resume next day with clear head + +**Remember:** There's always tomorrow + +--- + +## Maximum Drawdown + +**Stop trading at X% drawdown from peak** + +### Recommended Limits + +- Conservative: 10% +- Moderate: 15% +- Aggressive: 20% + +### When Hit + +1. **STOP trading immediately** +2. Take minimum 1 week break +3. Full trade review +4. Identify systematic issues +5. Paper trade only +6. Return with reduced size + +### Why This Matters + +**Psychology of drawdown:** +- -10% requires +11% to recover +- -20% requires +25% to recover +- -50% requires +100% to recover + +**Each % down becomes harder to recover** + +--- + +## Risk:Reward Ratios + +**Only take trades with favorable R:R** + +### Minimum Standards + +**Conservative:** 3:1 +**Moderate:** 2:1 +**Aggressive:** 1.5:1 + +### The Math + +With 2:1 R:R, you can be profitable at 40% win rate: + +``` +10 trades: +- 4 wins × 2R = +8R +- 6 losses × 1R = -6R +- Net: +2R profit +``` + +### How to Calculate + +``` +R = Risk (Entry - Stop) +Reward = Target - Entry + +R:R = Reward / Risk + +Example: +- Entry: $100 +- Stop: $98 (Risk = $2) +- Target: $106 (Reward = $6) +- R:R = $6 / $2 = 3:1 ✓ +``` + +**Rule:** If R:R < your minimum → SKIP THE TRADE + +--- + +## Position Sizing Methods + +### 1. Fixed Dollar Risk (Recommended) + +**Same dollar risk every trade** + +``` +Shares = Risk $ / (Entry - Stop) +``` + +**Pros:** +- Simple and consistent +- Easy to track +- Protects capital + +**Cons:** +- Doesn't scale with wins/losses + +--- + +### 2. Fixed Percentage Risk + +**Same % risk every trade** + +``` +Shares = (Account × Risk %) / (Entry - Stop) +``` + +**Pros:** +- Scales with account +- Compounds wins +- Simple + +**Cons:** +- Also compounds losses + +--- + +### 3. Volatility-Based (ATR) + +**Position size based on volatility** + +``` +Risk $ / (ATR × Multiplier) +``` + +**Pros:** +- Adapts to market conditions +- Prevents whipsaw + +**Cons:** +- More complex +- Requires calculation + +--- + +### 4. Kelly Criterion (Advanced) + +**Optimal position sizing based on edge** + +``` +Kelly % = (Win Rate × Avg Win - Loss Rate × Avg Loss) / Avg Win +``` + +**WARNING:** +- Can be very aggressive +- Use fractional Kelly (1/4 or 1/2) +- Only for experienced traders +- Requires accurate statistics + +--- + +## Stop-Loss Strategies + +### Never Trade Without Stops + +**Why stops are mandatory:** +- Limits losses +- Removes emotion +- Protects from disasters +- Enables risk calculation + +**No exceptions. Ever.** + +### Stop-Loss Methods + +**1. Fixed Percentage** +- X% below entry +- Simple and clear +- Example: 2% below entry + +**2. Technical Level** +- Below support +- Below swing low +- Makes logical sense + +**3. ATR-Based** +- 1.5-2× Average True Range +- Adapts to volatility +- Prevents whipsaw + +**4. Time Stop** +- Exit if no progress in X days +- Frees capital +- Cuts losers + +### Stop-Loss Rules + +**✓ DO:** +- Set stop BEFORE entry +- Use actual stop orders (not mental) +- Place stops at logical levels +- Honor stops always + +**✗ NEVER:** +- Move stop further from entry +- Remove stop "just this once" +- Use mental stops +- Hope price comes back + +--- + +## Position Concentration + +**Don't put all eggs in one basket** + +### Maximum Position Limits + +**Single position:** +- Conservative: 10% of account +- Moderate: 20% of account +- Aggressive: 30% of account + +**Sector exposure:** +- Maximum 30-40% in single sector +- Diversify across sectors +- Correlation matters + +**Total exposure:** +- Day trading: 100% (close daily) +- Swing trading: 60-80% +- Position trading: Varies + +### Why Concentration Matters + +**Example:** +- 50% in one position +- Stock drops 20% +- Account drops 10% +- Hard to recover + +**Better:** +- 10% in one position +- Stock drops 20% +- Account drops 2% +- Manageable + +--- + +## Correlation Risk + +**Avoid correlated positions** + +### Understanding Correlation + +**High correlation example:** +- Long tech stock A +- Long tech stock B +- Both move together +- Double exposure to tech risk + +**Better diversification:** +- Different sectors +- Different market caps +- Different strategies +- True diversification + +--- + +## Leverage and Margin + +**Leverage amplifies BOTH gains and losses** + +### Margin Risk + +**2:1 Margin:** +- 50% loss = margin call +- Forced liquidation +- Game over + +**Recommended:** +- Use margin sparingly +- Never max out margin +- Maintain buffer +- Understand margin requirements + +### Options Leverage + +**Options can expire worthless** +- 100% loss possible +- Time decay (theta) +- Volatility risk (vega) +- Requires different risk management + +**Options risk limit:** +- Max 5-10% of account in options +- Treat each option as high risk +- Never bet the farm + +--- + +## Risk Management Checklist + +**Before EVERY trade:** +- [ ] Position size calculated +- [ ] Risk ≤ 1% (or your limit) +- [ ] Stop-loss identified +- [ ] R:R ≥ 2:1 (or your minimum) +- [ ] Within daily loss limit +- [ ] Not overexposed to sector +- [ ] Account for correlation +- [ ] Emotionally prepared to take loss + +**If ANY unchecked → DON'T TAKE TRADE** + +--- + +## Account Preservation + +**Capital preservation rules:** + +1. **Never go all-in** + - Keep reserves + - Opportunities come again + +2. **Accept losses quickly** + - Small losses are OK + - Don't let small become big + +3. **Don't average down** + - Adding to losers doubles risk + - Compounds mistakes + +4. **Take breaks after losses** + - Prevent revenge trading + - Clear your head + +5. **Reduce size in drawdown** + - Trade smaller when losing + - Build confidence back + +--- + +## Common Risk Management Mistakes + +### ❌ Fatal Errors + +**1. No stop-loss** +Result: One trade wipes account + +**2. Risk too much per trade** +Result: Few losses = blown account + +**3. Moving stops** +Result: Invalidates risk management + +**4. Revenge trading** +Result: Emotional decisions, bigger losses + +**5. Averaging down** +Result: Doubling down on mistakes + +**6. Over-leveraging** +Result: Margin call, forced exit + +**7. Ignoring correlation** +Result: Concentrated risk in disguise + +### ✓ Best Practices + +**1. Consistent position sizing** +Same risk every trade + +**2. Hard daily loss limits** +Stop when hit, no exceptions + +**3. Honest stop placement** +Logical levels, not wishes + +**4. R:R minimum** +Quality over quantity + +**5. Diversification** +Don't concentrate risk + +**6. Regular reviews** +Track and improve + +--- + +## Risk vs Reward Balance + +**High Probability vs High R:R** + +### High Win Rate (60-70%) +- Smaller R:R (1.5:1) +- More trades +- Steady equity curve +- Example: Mean reversion + +### High R:R (3:1+) +- Lower win rate (30-40%) +- Fewer trades +- Volatile equity curve +- Example: Trend following + +**Both can be profitable if managed correctly** + +--- + +## Position Sizing Examples + +### Example 1: Moderate Risk + +``` +Account: $50,000 +Risk per trade: 1% = $500 +Entry: $50 +Stop: $48 +Risk per share: $2 + +Position: $500 / $2 = 250 shares +Position value: $12,500 (25% of account) +Actual risk: $500 (1% of account) +``` + +### Example 2: Tight Stop + +``` +Account: $50,000 +Risk per trade: 1% = $500 +Entry: $100 +Stop: $99 +Risk per share: $1 + +Position: $500 / $1 = 500 shares +Position value: $50,000 (100% of account) +Actual risk: $500 (1% of account) +``` + +**Key:** Position SIZE varies, but RISK stays constant + +--- + +## Emergency Procedures + +### When Things Go Wrong + +**Circuit breaker triggered:** +1. Stop trading immediately +2. Close positions if possible +3. Assess damage +4. Don't panic trade + +**Flash crash:** +1. Don't chase +2. Check your stops +3. Wait for stability +4. Review risk exposure + +**Account down big:** +1. STOP trading +2. Take mandatory break +3. Full review +4. Return with smaller size + +--- + +## Risk Management Quotes + +**"Rule No. 1: Never lose money. Rule No. 2: Never forget rule No.1"** - Warren Buffett + +**"The goal of a successful trader is to make the best trades. Money is secondary."** - Alexander Elder + +**"Risk comes from not knowing what you're doing."** - Warren Buffett + +**"Don't focus on making money; focus on protecting what you have."** - Paul Tudor Jones + +--- + +## Summary + +**Risk management is:** +- Your edge +- Your protection +- Your discipline +- Your success factor + +**Remember:** +- Small consistent gains > Home runs +- Protect capital first +- There's always another trade +- Survive to trade tomorrow + +**The math is simple:** +- Lose 50% → Need 100% to recover +- Lose 10% → Need 11% to recover + +**Trade small, trade smart, trade long-term** diff --git a/skills/trading-plan-generator/references/trading_psychology.md b/skills/trading-plan-generator/references/trading_psychology.md new file mode 100644 index 0000000..952eb66 --- /dev/null +++ b/skills/trading-plan-generator/references/trading_psychology.md @@ -0,0 +1,660 @@ +# Trading Psychology + +Master your mind, master the markets. + +--- + +## Why Psychology Matters + +**Technical analysis:** 20% of success +**Risk management:** 30% of success +**Psychology:** 50% of success + +**The hard truth:** +- You are your own worst enemy +- Emotions destroy accounts +- Discipline beats intelligence +- The market exposes psychological weaknesses + +--- + +## The Emotional Cycle of Trading + +### Stage 1: Optimism +- First wins +- "This is easy!" +- Overconfidence building +- Taking bigger positions + +### Stage 2: Excitement +- String of wins +- Feeling invincible +- Breaking rules +- Maximum risk + +### Stage 3: Thrill +- Biggest position yet +- Ignoring warnings +- "I can't lose" +- Peak overconfidence + +### Stage 4: Euphoria +- Top of cycle +- Taking ANY trade +- No risk management +- Disaster imminent + +### Stage 5: Anxiety +- First big loss +- "Just bad luck" +- Revenge trading starts +- Doubling down + +### Stage 6: Denial +- "Market is wrong" +- Moving stops +- Averaging down +- Refusing to accept loss + +### Stage 7: Fear +- Watching losses grow +- Paralyzed +- Can't exit +- Hope replacing strategy + +### Stage 8: Desperation +- All-in trades +- Gambling, not trading +- Breaking all rules +- Account in danger + +### Stage 9: Panic +- Forced exits +- Margin calls +- Capitulation +- Major loss realized + +### Stage 10: Capitulation +- Give up +- "Trading doesn't work" +- Blame external factors +- Quit or start over + +### Stage 11: Despondency +- Depression +- Lost confidence +- Consider quitting +- Seeking answers + +### Stage 12: Depression +- Lowest point +- Questioning everything +- But...learning begins + +### Stage 13: Hope +- Education phase +- Developing plan +- Paper trading +- Slow rebuild + +### Stage 14: Relief +- Small wins return +- Following plan +- Confidence building +- Sustainable approach + +**Then cycle repeats at smaller scale** + +**Goal:** Flatten the cycle through discipline + +--- + +## Common Psychological Traps + +### 1. Revenge Trading + +**What it is:** +- Trading to "get back" losses +- Emotional, not strategic +- Larger positions +- Breaks all rules + +**Why it happens:** +- Ego hurt +- Feel need to "win" +- Loss aversion +- Impatience + +**How to avoid:** +- Hard daily loss limits +- Mandatory cool-down periods +- Accept losses as business cost +- Focus on process, not money + +--- + +### 2. FOMO (Fear of Missing Out) + +**What it is:** +- Chasing moves without setup +- Entering late +- Ignoring risk +- "Everyone else is making money" + +**Why it happens:** +- Social comparison +- Greed +- Impatience +- Scarcity mindset + +**How to avoid:** +- Wait for YOUR setup +- Ignore what others are doing +- Abundance mindset (opportunities come again) +- Follow plan strictly + +--- + +### 3. Overconfidence + +**What it is:** +- Taking outsized risk after wins +- Ignoring risk management +- "I can't lose" +- Breaking rules + +**Why it happens:** +- Recent wins +- Confirmation bias +- Ego +- Misunderstanding edge + +**How to avoid:** +- Fixed position sizing always +- Review losers, not just winners +- Remember: market is humbling +- Track compliance, not just P&L + +--- + +### 4. Analysis Paralysis + +**What it is:** +- Over-analyzing +- Can't pull trigger +- Waiting for "perfect" setup +- Missing trades + +**Why it happens:** +- Fear of being wrong +- Perfectionism +- Too many indicators +- No clear plan + +**How to avoid:** +- Simple setup criteria +- Binary decision framework +- Accept imperfect trades +- Losses are part of game + +--- + +### 5. Loss Aversion + +**What it is:** +- Refusing to take small loss +- Moving stops +- Hoping for recovery +- Small loss becomes big + +**Why it happens:** +- Pain of being wrong +- Sunk cost fallacy +- Ego protection +- Loss hurts more than gain feels good + +**How to avoid:** +- Stops are non-negotiable +- View losses as business expense +- Protect capital first +- Smaller losses = stay in game + +--- + +### 6. Confirmation Bias + +**What it is:** +- Seeking info that confirms view +- Ignoring contrary evidence +- Refusing to exit losing trade +- Doubling down on mistakes + +**Why it happens:** +- Need to be right +- Selective perception +- Ego protection +- Prior commitment + +**How to avoid:** +- Actively seek contrary evidence +- Play devil's advocate +- Follow price action, not opinion +- Be wrong quickly + +--- + +## Discipline Framework + +### Pre-Trade + +**Checklist before EVERY trade:** +- [ ] Meets setup criteria? +- [ ] R:R acceptable? +- [ ] Position size calculated? +- [ ] Stop-loss identified? +- [ ] Within daily risk limit? +- [ ] Calm and focused? +- [ ] Following plan? + +**If ANY "no" → Don't trade** + +### During Trade + +**Rules while in position:** +- Check portfolio 2-3x max per day +- Don't watch every tick +- Trust your stop +- Don't interfere unless rule-based +- Avoid social media/chat + +### Post-Trade + +**After every trade:** +- Log trade in journal +- Note what went right/wrong +- Capture lessons +- Review compliance +- Don't dwell on outcome + +--- + +## Emotional State Management + +### Pre-Market Routine + +**Daily checklist (15-30 min):** +- [ ] Adequate sleep (7+ hours)? +- [ ] Hydrated and fed? +- [ ] Calm and centered? +- [ ] No major life stress? +- [ ] Ready to accept losses? +- [ ] Following plan today? + +**If feeling off → Reduce size or skip day** + +### Recognizing Tilt + +**Warning signs:** +- Increasing position size +- Abandoning stops +- Taking marginal setups +- Checking P&L constantly +- Feeling anxious/desperate +- Anger at market +- Rushing into trades + +**When tilting:** +1. STOP immediately +2. Close positions +3. Walk away +4. Physical reset (exercise) +5. Don't resume until calm + +### Cool-Down Periods + +**After any loss:** +- Minimum 15-30 minutes +- Walk, breathe, reset +- Review trade objectively +- Return only when calm + +**After 2 consecutive losses:** +- 1 hour minimum +- Full review of both trades +- Confirm plan compliance +- Reduce size if continuing + +**After 3 consecutive losses:** +- DONE for the day +- Full day review tomorrow +- Don't force it +- Tomorrow is new day + +--- + +## Mindset Shifts + +### From Outcome to Process + +**Wrong focus:** +- "I need to make $X today" +- "I need to win this trade" +- "I can't afford to lose" + +**Right focus:** +- "Did I follow my plan?" +- "Was my risk management correct?" +- "What can I learn?" + +### From Prediction to Probabilities + +**Wrong thinking:** +- "This trade WILL work" +- "I know what market will do" +- "I can't be wrong" + +**Right thinking:** +- "This has good probability" +- "I don't know, but R:R is good" +- "I can be wrong and still profitable" + +### From Money to Process + +**Wrong focus:** +- Daily P&L +- "How much did I make?" +- Comparing to others + +**Right focus:** +- Plan compliance +- "Did I execute well?" +- Personal improvement + +--- + +## Handling Losses + +### Accept Losses as Business Cost + +**Truth:** +- Losses are inevitable +- Even 70% win rate = 30% losses +- Losses are data, not failure +- Cost of doing business + +**Mindset:** +- "This is expected" +- "I planned for this" +- "On to next trade" +- No emotion + +### Learn from Every Loss + +**After each loss ask:** +- Did I follow my plan? +- Was setup valid? +- Was risk management correct? +- What can I improve? + +**Categories of losses:** +1. **Good loss:** Followed plan, just didn't work +2. **Bad loss:** Broke rules +3. **Learning loss:** New insight gained + +**Good losses are OK. Learn from bad ones.** + +--- + +## Handling Wins + +### Don't Get Overconfident + +**After big win:** +- Resist urge to increase size +- Follow plan as always +- One win doesn't mean edge +- Stay humble + +### Avoid Euphoria + +**Warning signs:** +- Feeling invincible +- "I figured it out" +- Itching to trade more +- Looking for any setup + +**Remedy:** +- Stick to plan +- Take break if needed +- Remember: regression to mean +- Past performance ≠ future + +--- + +## Daily Practices + +### Morning + +**Before market open:** +- Review plan +- Check emotional state +- Set intentions +- Prepare workspace +- Identify setups +- Set risk limits + +### During Session + +**While trading:** +- Follow checklist +- One trade at a time +- Take breaks +- Stay hydrated +- Avoid news during trades +- Trust process + +### Evening + +**After market close:** +- Journal all trades +- Calculate P&L +- Review compliance +- Note lessons +- Prepare for tomorrow +- Disconnect from markets + +--- + +## Accountability Systems + +### Trade Journal + +**Required entries:** +- Setup and reasoning +- Emotional state +- Rule compliance +- Mistakes made +- Lessons learned + +### Performance Review + +**Weekly:** +- Win rate +- Avg win/loss +- Compliance % +- Emotional patterns +- Improvement areas + +**Monthly:** +- Full performance analysis +- Goal progress +- Strategy refinement +- Psychological assessment + +### External Accountability + +**Consider:** +- Trading buddy +- Mentor +- Trading journal app +- Community (carefully) + +--- + +## Meditation & Mindfulness + +### Why It Helps + +**Benefits for traders:** +- Emotional regulation +- Impulse control +- Focus and clarity +- Stress reduction +- Better decisions + +### Simple Practice + +**Daily meditation (10 min):** +1. Sit comfortably +2. Focus on breath +3. Notice thoughts +4. Return to breath +5. No judgment + +**Before trading:** +- 5 minutes breathing +- Center yourself +- Set intention +- Begin calm + +--- + +## Physical Health + +### Sleep + +**Critical for trading:** +- 7-9 hours minimum +- Consistent schedule +- No trading if tired +- Sleep > trading + +### Exercise + +**Benefits:** +- Stress management +- Mental clarity +- Emotional regulation +- Energy levels + +**Recommendation:** +- 30 min daily minimum +- Before or after trading +- Not during market hours + +### Nutrition + +**Avoid:** +- Excessive caffeine +- Sugar spikes +- Trading hungry + +**Prefer:** +- Balanced meals +- Steady energy +- Hydration + +--- + +## Dealing with Drawdowns + +### Normal Part of Trading + +**Reality:** +- All traders have drawdowns +- Expect them +- Plan for them +- Survive them + +### During Drawdown + +**Actions:** +1. Review all trades +2. Verify plan compliance +3. Reduce position size +4. Take break if needed +5. Focus on process +6. Trust recovery + +**Don't:** +- Increase size to "get back" +- Abandon plan +- Change strategy mid-stream +- Panic + +--- + +## Quotes for Mindset + +**"The goal of a successful trader is to make the best trades. Money is secondary."** - Alexander Elder + +**"In trading, the impossible happens about twice a year."** - Henri M. Simoes + +**"The market is a device for transferring money from the impatient to the patient."** - Warren Buffett + +**"The most important quality for an investor is temperament, not intellect."** - Warren Buffett + +**"Rule No. 1: Never lose money. Rule No. 2: Don't forget rule No. 1."** - Warren Buffett + +**"It's not whether you're right or wrong, but how much money you make when you're right and how much you lose when you're wrong."** - George Soros + +--- + +## Psychological Checklist + +**Before trading session:** +- [ ] Adequate sleep +- [ ] Calm and focused +- [ ] No major stress +- [ ] Following plan +- [ ] Prepared to lose +- [ ] No revenge mindset + +**During trading:** +- [ ] Checking P&L minimally +- [ ] Following checklist +- [ ] Taking breaks +- [ ] Trusting stops +- [ ] No tilt signs + +**After trading:** +- [ ] Journaled all trades +- [ ] Reviewed objectively +- [ ] Noted lessons +- [ ] Disconnected +- [ ] Ready for tomorrow + +--- + +## Summary + +**Trading psychology is:** +- 50% of success +- Controllable +- Improvable +- Critical + +**Master these:** +- Emotional control +- Discipline +- Process focus +- Loss acceptance +- Patience + +**Remember:** +- Markets are uncertain +- Outcomes are random +- Process is controllable +- Discipline wins long-term + +**Your edge isn't prediction. It's consistency.** diff --git a/skills/trading-plan-generator/scripts/generate_plan.sh b/skills/trading-plan-generator/scripts/generate_plan.sh new file mode 100755 index 0000000..9b6b287 --- /dev/null +++ b/skills/trading-plan-generator/scripts/generate_plan.sh @@ -0,0 +1,810 @@ +#!/bin/bash + +# Trading Plan Generation Script +# Interactive workflow for creating comprehensive trading plans + +set -e + +# Colors +GREEN='\033[0;32m' +BLUE='\033[0;34m' +YELLOW='\033[1;33m' +RED='\033[0;31m' +MAGENTA='\033[0;35m' +CYAN='\033[0;36m' +NC='\033[0m' + +# Header +echo -e "${BLUE}╔══════════════════════════════════════════════════╗${NC}" +echo -e "${BLUE}║ Trading Plan Generator ║${NC}" +echo -e "${BLUE}╚══════════════════════════════════════════════════╝${NC}" +echo "" +echo -e "${YELLOW}⚠️ IMPORTANT: This generates a framework, not financial advice${NC}" +echo -e "${YELLOW} Trading involves substantial risk of loss${NC}" +echo "" + +# Helper function for prompts +prompt_input() { + local prompt_text="$1" + local var_name="$2" + local required="$3" + + while true; do + echo -e "${CYAN}${prompt_text}${NC}" + read -r input + + if [ -n "$input" ]; then + eval "$var_name=\"$input\"" + break + elif [ "$required" != "true" ]; then + eval "$var_name=\"\"" + break + else + echo -e "${RED}This field is required.${NC}" + fi + done +} + +# Step 1: Trading Style and Goals +echo -e "${MAGENTA}━━━ Step 1: Trading Style & Goals ━━━${NC}" +echo "" + +echo "Select your primary trading style:" +echo "1) Day Trading (close all positions same day)" +echo "2) Swing Trading (hold 2-10 days)" +echo "3) Position Trading (hold weeks to months)" +echo "4) Options Trading (directional or income)" +echo "5) Mix of styles" +echo "" + +prompt_input "Enter number (1-5):" STYLE_NUM true + +case $STYLE_NUM in + 1) TRADING_STYLE="Day Trading" ;; + 2) TRADING_STYLE="Swing Trading" ;; + 3) TRADING_STYLE="Position Trading" ;; + 4) TRADING_STYLE="Options Trading" ;; + 5) TRADING_STYLE="Mixed Approach" ;; + *) TRADING_STYLE="Swing Trading" ;; +esac + +echo "" +prompt_input "Account size (USD):" ACCOUNT_SIZE true +prompt_input "Monthly return target (%):" MONTHLY_TARGET false +prompt_input "Time commitment (hours/day):" TIME_COMMIT false + +# Step 2: Risk Management (CRITICAL) +echo "" +echo -e "${MAGENTA}━━━ Step 2: Risk Management (MOST IMPORTANT) ━━━${NC}" +echo "" + +echo "Risk per trade (% of account):" +echo "1) 0.5% (Very Conservative)" +echo "2) 1.0% (Recommended for most)" +echo "3) 2.0% (Aggressive)" +echo "4) Custom" +echo "" + +prompt_input "Enter number (1-4):" RISK_NUM true + +case $RISK_NUM in + 1) RISK_PER_TRADE="0.5" ;; + 2) RISK_PER_TRADE="1.0" ;; + 3) RISK_PER_TRADE="2.0" ;; + 4) prompt_input "Enter custom risk % (e.g., 1.5):" RISK_PER_TRADE true ;; + *) RISK_PER_TRADE="1.0" ;; +esac + +# Calculate dollar risk +DOLLAR_RISK=$(echo "scale=2; $ACCOUNT_SIZE * $RISK_PER_TRADE / 100" | bc) + +echo "" +echo -e "${GREEN}✓ Risk per trade: ${RISK_PER_TRADE}% = \$${DOLLAR_RISK}${NC}" +echo "" + +prompt_input "Daily loss limit (% of account):" DAILY_LOSS_LIMIT true +prompt_input "Maximum drawdown before break (% of account):" MAX_DRAWDOWN true + +echo "" +echo "Minimum Risk:Reward ratio:" +echo "1) 2:1 (Conservative)" +echo "2) 3:1 (Recommended)" +echo "3) 1.5:1 (Aggressive)" +echo "" + +prompt_input "Enter number (1-3):" RR_NUM true + +case $RR_NUM in + 1) MIN_RR="2:1" ;; + 2) MIN_RR="3:1" ;; + 3) MIN_RR="1.5:1" ;; + *) MIN_RR="2:1" ;; +esac + +# Step 3: Markets and Instruments +echo "" +echo -e "${MAGENTA}━━━ Step 3: Markets & Instruments ━━━${NC}" +echo "" + +echo "Primary market:" +echo "1) US Stocks" +echo "2) Options" +echo "3) Forex" +echo "4) Crypto" +echo "5) Futures" +echo "6) Multiple" +echo "" + +prompt_input "Enter number (1-6):" MARKET_NUM true + +case $MARKET_NUM in + 1) PRIMARY_MARKET="US Stocks" ;; + 2) PRIMARY_MARKET="Options" ;; + 3) PRIMARY_MARKET="Forex" ;; + 4) PRIMARY_MARKET="Crypto" ;; + 5) PRIMARY_MARKET="Futures" ;; + 6) PRIMARY_MARKET="Multiple markets" ;; + *) PRIMARY_MARKET="US Stocks" ;; +esac + +prompt_input "Sector focus (or 'Any'):" SECTOR_FOCUS false +prompt_input "Minimum liquidity (avg daily volume):" MIN_LIQUIDITY false +prompt_input "Price range preference (e.g., \$20-200):" PRICE_RANGE false + +# Step 4: Entry Strategy +echo "" +echo -e "${MAGENTA}━━━ Step 4: Entry Strategy ━━━${NC}" +echo "" + +echo "Primary setup type:" +echo "1) Breakouts" +echo "2) Pullbacks/Retracements" +echo "3) Reversals" +echo "4) Pattern completion" +echo "5) Multiple setups" +echo "" + +prompt_input "Enter number (1-5):" SETUP_NUM false + +case $SETUP_NUM in + 1) SETUP_TYPE="Breakouts" ;; + 2) SETUP_TYPE="Pullbacks/Retracements" ;; + 3) SETUP_TYPE="Reversals" ;; + 4) SETUP_TYPE="Pattern completion" ;; + 5) SETUP_TYPE="Multiple setup types" ;; + *) SETUP_TYPE="TBD" ;; +esac + +prompt_input "Primary timeframe for analysis:" TIMEFRAME false +prompt_input "Required confirmation signals:" CONFIRMATIONS false +prompt_input "Entry order type (Market/Limit):" ORDER_TYPE false + +# Step 5: Exit Strategy +echo "" +echo -e "${MAGENTA}━━━ Step 5: Exit Strategy ━━━${NC}" +echo "" + +echo "Stop-loss method:" +echo "1) Fixed percentage (e.g., 2% below entry)" +echo "2) Technical level (support/resistance)" +echo "3) ATR-based (1.5x-2x ATR)" +echo "4) Combination" +echo "" + +prompt_input "Enter number (1-4):" STOP_NUM true + +case $STOP_NUM in + 1) STOP_METHOD="Fixed percentage" ;; + 2) STOP_METHOD="Technical level" ;; + 3) STOP_METHOD="ATR-based" ;; + 4) STOP_METHOD="Combination approach" ;; + *) STOP_METHOD="Fixed percentage" ;; +esac + +echo "" +echo "Take-profit strategy:" +echo "1) Fixed R multiple (e.g., 2R, 3R)" +echo "2) Technical target" +echo "3) Trailing stop" +echo "4) Partial profits (scale out)" +echo "" + +prompt_input "Enter number (1-4):" TP_NUM false + +case $TP_NUM in + 1) TP_STRATEGY="Fixed R multiple" ;; + 2) TP_STRATEGY="Technical target" ;; + 3) TP_STRATEGY="Trailing stop" ;; + 4) TP_STRATEGY="Partial profits" ;; + *) TP_STRATEGY="Fixed R multiple" ;; +esac + +prompt_input "Do you allow position scaling in/out? (Yes/No):" SCALING false + +# Step 6: Psychology and Discipline +echo "" +echo -e "${MAGENTA}━━━ Step 6: Psychology & Discipline ━━━${NC}" +echo "" + +prompt_input "Pre-market routine duration (minutes):" ROUTINE_TIME false +prompt_input "Maximum trades per day:" MAX_TRADES_DAY false +prompt_input "Cool-down period after loss (minutes/hours):" COOLDOWN false + +echo "" +echo "Conditions when you MUST NOT trade:" +echo "(e.g., 'After 2 losses in a row', 'When tired', 'Before major news')" +echo "" +prompt_input "No-trade condition 1:" NO_TRADE_1 false +prompt_input "No-trade condition 2:" NO_TRADE_2 false +prompt_input "No-trade condition 3:" NO_TRADE_3 false + +# Step 7: Performance Tracking +echo "" +echo -e "${MAGENTA}━━━ Step 7: Performance Tracking ━━━${NC}" +echo "" + +echo "Trade journal method:" +echo "1) Spreadsheet" +echo "2) Trading platform" +echo "3) Dedicated software" +echo "4) Paper notebook" +echo "" + +prompt_input "Enter number (1-4):" JOURNAL_NUM false + +case $JOURNAL_NUM in + 1) JOURNAL_METHOD="Spreadsheet" ;; + 2) JOURNAL_METHOD="Trading platform" ;; + 3) JOURNAL_METHOD="Dedicated software (e.g., Edgewonk)" ;; + 4) JOURNAL_METHOD="Paper notebook" ;; + *) JOURNAL_METHOD="Spreadsheet" ;; +esac + +echo "" +echo "Review frequency:" +echo "1) Daily only" +echo "2) Daily + Weekly" +echo "3) Daily + Weekly + Monthly" +echo "" + +prompt_input "Enter number (1-3):" REVIEW_NUM false + +case $REVIEW_NUM in + 1) REVIEW_FREQ="Daily" ;; + 2) REVIEW_FREQ="Daily and Weekly" ;; + 3) REVIEW_FREQ="Daily, Weekly, and Monthly" ;; + *) REVIEW_FREQ="Daily and Weekly" ;; +esac + +# Generate filename +FILENAME="trading_plan_$(date +%Y%m%d).md" + +# Output directory +OUTPUT_DIR="." +if [ ! -z "$1" ]; then + OUTPUT_DIR="$1" +fi + +OUTPUT_FILE="$OUTPUT_DIR/$FILENAME" + +# Generate the plan +echo "" +echo -e "${BLUE}Generating your trading plan...${NC}" +echo "" + +cat > "$OUTPUT_FILE" << EOF +# Trading Plan + +**Created:** $(date +%Y-%m-%d) +**Account Size:** \$${ACCOUNT_SIZE} +**Trading Style:** ${TRADING_STYLE} + +--- + +## ⚠️ CRITICAL DISCLAIMER + +This trading plan is a personal framework for managing trading decisions. It does NOT constitute financial advice. Trading involves substantial risk of loss. Only trade with capital you can afford to lose. + +--- + +## 1. Trading Goals & Philosophy + +### Financial Goals +- **Account Size:** \$${ACCOUNT_SIZE} +- **Monthly Target:** ${MONTHLY_TARGET:-TBD}% +- **Focus:** Consistent execution over returns + +### Time Commitment +- **Daily Time:** ${TIME_COMMIT:-TBD} hours +- **Trading Style:** ${TRADING_STYLE} +- **Market Hours:** [Specify your trading hours] + +### Trading Philosophy +[Write your personal trading philosophy - what you believe about markets, why you trade this way, your edge] + +**Example:** +"I believe markets trend, and I have an edge in identifying early-stage trends with technical analysis. My success comes from discipline, not prediction. I focus on process over profits." + +--- + +## 2. Risk Management (MOST IMPORTANT) + +### Position Sizing Rules + +**Risk Per Trade: ${RISK_PER_TRADE}%** +- Maximum risk per position: \$${DOLLAR_RISK} +- NEVER exceed this amount on a single trade +- Calculate position size BEFORE entering + +**Position Size Formula:** +\`\`\` +Shares = Risk Amount / (Entry Price - Stop Price) + = \$${DOLLAR_RISK} / (Entry - Stop) +\`\`\` + +**Example:** +- Entry: \$100 +- Stop: \$98 +- Risk per share: \$2 +- Position: \$${DOLLAR_RISK} / \$2 = $(echo "scale=0; $DOLLAR_RISK / 2" | bc) shares + +### Daily Loss Limit + +**HARD STOP at -${DAILY_LOSS_LIMIT}% daily loss** + +- Maximum daily loss: \$$(echo "scale=2; $ACCOUNT_SIZE * $DAILY_LOSS_LIMIT / 100" | bc) +- When hit: STOP TRADING immediately +- Close all positions +- Step away from computer +- Review what went wrong +- Resume next day with clear head + +**No exceptions. This rule protects your account.** + +### Maximum Drawdown + +**Break from trading at -${MAX_DRAWDOWN}% drawdown** + +- Stop trading if account drops ${MAX_DRAWDOWN}% from peak +- Take minimum 1 week break +- Paper trade only +- Review all trades +- Identify systematic issues +- Resume only when mentally ready + +### Risk:Reward Requirements + +**Minimum R:R: ${MIN_RR}** + +- Only take trades with ${MIN_RR} or better +- Measure before entry +- If R:R doesn't meet minimum → skip trade +- Quality over quantity + +### Stop-Loss Rules + +**EVERY trade MUST have a stop-loss** + +- **Method:** ${STOP_METHOD} +- Set stop BEFORE entry +- Enter stop order immediately after fill +- NEVER move stop further from entry +- Accept the loss if stopped out + +### Position Concentration + +**Maximum positions:** +- Day trading: [Specify max concurrent positions] +- Swing trading: [Specify max concurrent positions] +- Maximum sector exposure: [e.g., 30% in any one sector] + +--- + +## 3. Markets & Instruments + +### Primary Market +**${PRIMARY_MARKET}** + +### Specific Criteria +- **Sector Focus:** ${SECTOR_FOCUS:-Any sector} +- **Minimum Liquidity:** ${MIN_LIQUIDITY:-1M+ shares daily volume} +- **Price Range:** ${PRICE_RANGE:-\$20-500} +- **Market Cap:** [Specify if relevant] + +### What I Trade +- [List specific criteria] +- [Examples of ideal stocks/instruments] + +### What I DON'T Trade +- [ ] Penny stocks (< \$5) +- [ ] Illiquid stocks (< 500K volume) +- [ ] IPOs in first month +- [ ] Earnings day (specify approach) +- [ ] Biotech binary events +- [ ] [Add other exclusions] + +--- + +## 4. Entry Strategy + +### Primary Setup +**${SETUP_TYPE}** + +### Setup Criteria + +**Must-have conditions:** +1. [Specific technical condition] +2. [Specific technical condition] +3. [Specific technical condition] + +**Confirmation signals:** +- ${CONFIRMATIONS:-Volume confirmation, trend alignment} +- [Additional confirmations] + +**Timeframes:** +- **Analysis:** ${TIMEFRAME:-Daily} +- **Entry:** [Entry timeframe] +- **Filter:** [Higher timeframe trend] + +### Entry Rules + +**Order Type:** ${ORDER_TYPE:-Limit order} + +**Exact entry trigger:** +1. [Specific price level or signal] +2. [Confirmation requirement] +3. [Additional filters] + +**Position sizing:** +- Calculate using formula in Section 2 +- Risk: \$${DOLLAR_RISK} per trade +- Size accordingly + +**Time restrictions:** +- ${TRADING_STYLE} specific timing +- [e.g., "No entries in first 15 minutes" for day trading] +- [e.g., "No entries Friday afternoon" for swing trading] + +--- + +## 5. Exit Strategy + +### Stop-Loss + +**Method:** ${STOP_METHOD} + +**Rules:** +- Set immediately after entry +- Use stop order (not mental stop) +- NEVER move stop further from entry +- Can move to break-even after [specify when] +- Accept losses without hesitation + +**Stop placement:** +- [Specific methodology] +- Example: [Concrete example] + +### Take-Profit + +**Strategy:** ${TP_STRATEGY} + +**Specific targets:** +- Primary target: [e.g., 2R or specific level] +- Secondary target: [if scaling out] +- Trail: [trailing stop method if applicable] + +**Scaling out:** ${SCALING:-Not allowed} +- [If yes, specify scale-out rules] + +### Trade Management + +**When to exit early:** +- [ ] Loss of momentum +- [ ] Reversal pattern +- [ ] Time stop hit (no progress in X days) +- [ ] Market condition change +- [ ] Better opportunity elsewhere + +**When to add to position:** +- [ ] ${SCALING} (specify if allowed) + +**When to trail stop:** +- [Specific rules] + +--- + +## 6. Market Filters + +### When TO Trade + +**Market conditions:** +- [ ] Clear trend present +- [ ] Volatility in normal range (e.g., VIX < 30) +- [ ] Volume above average +- [ ] My setups present +- [ ] No major news pending + +**Personal conditions:** +- [ ] Well-rested +- [ ] Calm and focused +- [ ] Following plan +- [ ] No external stress +- [ ] Within risk limits + +### When NOT TO Trade + +**Market conditions:** +- [ ] Choppy, rangebound market +- [ ] Extreme volatility +- [ ] Major news pending (FOMC, etc.) +- [ ] Low volume (holidays) +- [ ] Gap and crap environment + +**Personal conditions:** +- ${NO_TRADE_1} +- ${NO_TRADE_2} +- ${NO_TRADE_3} +- [ ] Emotional/tilting +- [ ] Hit daily loss limit +- [ ] Consecutive losses (specify number) + +--- + +## 7. Psychology & Discipline + +### Pre-Market Routine + +**Time required:** ${ROUTINE_TIME:-30} minutes + +**Daily checklist:** +- [ ] Review previous day's trades +- [ ] Check overnight news and catalysts +- [ ] Identify key support/resistance levels +- [ ] Mark potential setups +- [ ] Set risk limits in trading platform +- [ ] Emotional state check (calm and focused?) +- [ ] Hydrated and alert? + +### Trading Rules + +**Maximum trades per day:** ${MAX_TRADES_DAY:-3-5 trades} + +**Cool-down period:** ${COOLDOWN:-30 minutes after any loss} + +**Break requirements:** +- After 2 consecutive losses: 1 hour break +- After 3 consecutive losses: Done for the day +- After hitting daily loss limit: Done for the day + +### Tilt Recognition + +**Warning signs I'm tilting:** +- Increasing position size +- Abandoning stops +- Taking marginal setups +- Checking P&L constantly +- Feeling anxious or desperate +- Anger at market + +**When tilting:** +1. Close ALL positions immediately +2. Stop trading for the day +3. Physical activity (walk, gym) +4. Review what triggered it +5. Don't resume until calm + +### Emotional State Check + +**Before each trade ask:** +- Am I calm and rational? +- Am I following my plan? +- Is this revenge trading? +- Would I take this if starting fresh today? + +**If any answer is concerning → SKIP THE TRADE** + +--- + +## 8. Performance Tracking + +### Trade Journal + +**Method:** ${JOURNAL_METHOD} + +**Required for each trade:** +- [ ] Date and time +- [ ] Ticker/symbol +- [ ] Setup type +- [ ] Entry price and size +- [ ] Stop-loss and target +- [ ] Exit price and reason +- [ ] P&L (\$ and %) +- [ ] R multiple (1R, 2R, etc.) +- [ ] Market condition +- [ ] Emotional state (1-10) +- [ ] Mistakes made +- [ ] What I did right +- [ ] Lessons learned +- [ ] Screenshot of chart + +### Metrics to Track + +**Weekly:** +- Total P&L +- Win rate +- Average win vs average loss +- Profit factor +- Best trade +- Worst trade +- Rule compliance % + +**Monthly:** +- All weekly metrics +- Maximum drawdown +- Sharpe ratio +- Expectancy +- Number of trades +- Best setup type +- Time-of-day analysis + +### Review Schedule + +**${REVIEW_FREQ}** + +**Daily Review (15 minutes):** +- Review all trades +- Calculate P&L +- Note rule violations +- Identify improvements +- Plan for next day + +**Weekly Review (30 minutes):** +- Calculate weekly metrics +- Identify patterns (what works/doesn't) +- Best and worst trades analysis +- Rule compliance check +- Adjustments needed? + +**Monthly Review (1 hour):** +- Full performance analysis +- Goal progress check +- Strategy refinement +- Mindset and discipline assessment +- Plan for next month + +--- + +## 9. Plan Compliance + +### Rules I Will NEVER Break + +1. **NEVER trade without a stop-loss** +2. **NEVER risk more than ${RISK_PER_TRADE}% per trade** +3. **NEVER trade past daily loss limit (-${DAILY_LOSS_LIMIT}%)** +4. **NEVER move stops further from entry** +5. **NEVER add to losing positions** +6. **NEVER trade when emotional** +7. **NEVER skip the trade journal** + +### Accountability + +**How I'll stay accountable:** +- [ ] Trading journal review +- [ ] Weekly performance check +- [ ] Trading buddy/mentor check-ins +- [ ] [Other accountability measures] + +**Consequences for breaking rules:** +- 1 violation: Document why and how to prevent +- 2 violations in a week: Reduce size 50% +- 3 violations: Paper trade only for 1 week + +--- + +## 10. Plan Evolution + +### When to Review This Plan +- Monthly minimum +- After major changes in performance +- After strategy adjustments +- After market regime change + +### When to Adjust This Plan +- Consistent profitability → consider increasing risk slightly +- Consistent losses → reduce risk, review everything +- Market conditions change → adapt filters +- Personal circumstances change → adjust time commitment + +### What Never Changes +- Risk management discipline +- Trade journal requirement +- Stop-loss mandate +- Daily loss limit + +--- + +## Appendix A: Position Size Calculator + +**Quick reference:** + +| Entry - Stop | Position Size (for \$${DOLLAR_RISK} risk) | +|--------------|-------------------------------------------| +| \$1 | $(echo "scale=0; $DOLLAR_RISK / 1" | bc) shares | +| \$2 | $(echo "scale=0; $DOLLAR_RISK / 2" | bc) shares | +| \$3 | $(echo "scale=0; $DOLLAR_RISK / 3" | bc) shares | +| \$5 | $(echo "scale=0; $DOLLAR_RISK / 5" | bc) shares | + +**Formula:** Shares = \$${DOLLAR_RISK} / (Entry - Stop) + +--- + +## Appendix B: Trade Checklist + +**Before EVERY trade:** +- [ ] Setup matches my criteria +- [ ] R:R is ${MIN_RR} or better +- [ ] Position size calculated (risk = \$${DOLLAR_RISK}) +- [ ] Stop-loss level identified +- [ ] Within daily loss limit +- [ ] Emotional state good +- [ ] Market conditions favorable +- [ ] No news pending +- [ ] Have clear exit plan + +**If ANY box unchecked → DON'T TAKE THE TRADE** + +--- + +## Appendix C: Resources + +**Recommended reading:** +- "Trading in the Zone" - Mark Douglas +- "The New Trading for a Living" - Alexander Elder +- "Reminiscences of a Stock Operator" - Edwin Lefèvre + +**Tools:** +- Trading platform: [Your platform] +- Charting: [Your charting software] +- Journal: ${JOURNAL_METHOD} +- Screener: [Your screener] + +--- + +## Commitment + +I commit to following this trading plan with discipline and consistency. I understand that success comes from process, not individual trades. I will track my performance, learn from mistakes, and continuously improve. + +**Signed:** ___________________ +**Date:** $(date +%Y-%m-%d) + +--- + +## Plan Version History + +| Version | Date | Changes | +|---------|------|---------| +| 1.0 | $(date +%Y-%m-%d) | Initial plan created | + +EOF + +echo -e "${GREEN}✅ Trading plan generated successfully!${NC}" +echo "" +echo -e "File location: ${BLUE}$OUTPUT_FILE${NC}" +echo "" +echo -e "${YELLOW}━━━ CRITICAL NEXT STEPS ━━━${NC}" +echo "" +echo "1. ${GREEN}READ${NC} the entire plan carefully" +echo "2. ${GREEN}CUSTOMIZE${NC} the [TBD] sections with your specifics" +echo "3. ${GREEN}COMMIT${NC} to following it (sign and date)" +echo "4. ${GREEN}PRINT${NC} and keep it visible while trading" +echo "5. ${GREEN}REVIEW${NC} before every trading session" +echo "6. ${GREEN}TRACK${NC} your compliance daily" +echo "" +echo -e "${RED}⚠️ Remember:${NC}" +echo " • Trading involves substantial risk" +echo " • This plan doesn't guarantee profits" +echo " • Discipline is everything" +echo " • Protect your capital FIRST" +echo "" +echo -e "${CYAN}Tip: Use validate_plan.sh to check completeness${NC}" +echo "" diff --git a/skills/trading-plan-generator/scripts/position_calculator.sh b/skills/trading-plan-generator/scripts/position_calculator.sh new file mode 100755 index 0000000..0bfb1e1 --- /dev/null +++ b/skills/trading-plan-generator/scripts/position_calculator.sh @@ -0,0 +1,104 @@ +#!/bin/bash + +# Position Size Calculator +# Quick calculator for trading position sizes + +# Colors +GREEN='\033[0;32m' +BLUE='\033[0;34m' +YELLOW='\033[1;33m' +RED='\033[0;31m' +CYAN='\033[0;36m' +NC='\033[0m' + +echo -e "${BLUE}╔══════════════════════════════════════════════════╗${NC}" +echo -e "${BLUE}║ Position Size Calculator ║${NC}" +echo -e "${BLUE}╚══════════════════════════════════════════════════╝${NC}" +echo "" + +# Get inputs +read -p "$(echo -e ${CYAN}"Account size (\$): "${NC})" ACCOUNT_SIZE +read -p "$(echo -e ${CYAN}"Risk per trade (%): "${NC})" RISK_PERCENT +read -p "$(echo -e ${CYAN}"Entry price (\$): "${NC})" ENTRY_PRICE +read -p "$(echo -e ${CYAN}"Stop-loss price (\$): "${NC})" STOP_PRICE + +# Calculate +RISK_AMOUNT=$(echo "scale=2; $ACCOUNT_SIZE * $RISK_PERCENT / 100" | bc) +RISK_PER_SHARE=$(echo "scale=4; $ENTRY_PRICE - $STOP_PRICE" | bc) + +if (( $(echo "$RISK_PER_SHARE <= 0" | bc -l) )); then + echo -e "${RED}Error: Stop price must be below entry price${NC}" + exit 1 +fi + +POSITION_SIZE=$(echo "scale=0; $RISK_AMOUNT / $RISK_PER_SHARE" | bc) +POSITION_VALUE=$(echo "scale=2; $POSITION_SIZE * $ENTRY_PRICE" | bc) +PERCENT_OF_ACCOUNT=$(echo "scale=2; $POSITION_VALUE / $ACCOUNT_SIZE * 100" | bc) + +# Calculate R multiples +TARGET_2R=$(echo "scale=2; $ENTRY_PRICE + ($RISK_PER_SHARE * 2)" | bc) +TARGET_3R=$(echo "scale=2; $ENTRY_PRICE + ($RISK_PER_SHARE * 3)" | bc) + +echo "" +echo -e "${BLUE}━━━ Position Size Calculation ━━━${NC}" +echo "" +echo -e "Risk Amount: ${GREEN}\$${RISK_AMOUNT}${NC} (${RISK_PERCENT}% of account)" +echo -e "Risk Per Share: \$${RISK_PER_SHARE}" +echo "" +echo -e "${YELLOW}POSITION SIZE: ${POSITION_SIZE} shares${NC}" +echo "" +echo -e "Position Value: \$${POSITION_VALUE}" +echo -e "% of Account: ${PERCENT_OF_ACCOUNT}%" +echo "" + +# Warnings +if (( $(echo "$PERCENT_OF_ACCOUNT > 50" | bc -l) )); then + echo -e "${RED}⚠️ WARNING: Position is ${PERCENT_OF_ACCOUNT}% of account${NC}" + echo -e "${RED} This is high concentration - ensure this is intentional${NC}" + echo "" +fi + +echo -e "${BLUE}━━━ Profit Targets (R Multiples) ━━━${NC}" +echo "" +echo -e "2R Target: \$${TARGET_2R} = ${GREEN}\$$(echo "scale=2; $RISK_AMOUNT * 2" | bc)${NC} profit" +echo -e "3R Target: \$${TARGET_3R} = ${GREEN}\$$(echo "scale=2; $RISK_AMOUNT * 3" | bc)${NC} profit" +echo "" + +echo -e "${BLUE}━━━ Risk:Reward Analysis ━━━${NC}" +echo "" + +# Optional: Ask for target price +read -p "$(echo -e ${CYAN}"Enter target price (or press Enter to skip): "${NC})" TARGET_PRICE + +if [ -n "$TARGET_PRICE" ]; then + REWARD=$(echo "scale=2; ($TARGET_PRICE - $ENTRY_PRICE) * $POSITION_SIZE" | bc) + RR_RATIO=$(echo "scale=2; $REWARD / $RISK_AMOUNT" | bc) + + echo "" + echo -e "Entry: \$${ENTRY_PRICE}" + echo -e "Target: \$${TARGET_PRICE}" + echo -e "Stop: \$${STOP_PRICE}" + echo "" + echo -e "Potential Reward: ${GREEN}\$${REWARD}${NC}" + echo -e "Risk Amount: ${RED}\$${RISK_AMOUNT}${NC}" + echo "" + + if (( $(echo "$RR_RATIO >= 2" | bc -l) )); then + echo -e "R:R Ratio: ${GREEN}${RR_RATIO}:1 ✓${NC}" + echo -e " ${GREEN}Good risk:reward ratio${NC}" + elif (( $(echo "$RR_RATIO >= 1.5" | bc -l) )); then + echo -e "R:R Ratio: ${YELLOW}${RR_RATIO}:1${NC}" + echo -e " ${YELLOW}Acceptable, but aim for 2:1+${NC}" + else + echo -e "R:R Ratio: ${RED}${RR_RATIO}:1 ✗${NC}" + echo -e " ${RED}Poor risk:reward - consider skipping this trade${NC}" + fi +fi + +echo "" +echo -e "${CYAN}━━━ Trade Summary ━━━${NC}" +echo "" +echo "BUY ${POSITION_SIZE} shares at \$${ENTRY_PRICE}" +echo "STOP at \$${STOP_PRICE}" +echo "RISK: \$${RISK_AMOUNT} (${RISK_PERCENT}%)" +echo "" diff --git a/skills/trading-plan-generator/scripts/validate_plan.sh b/skills/trading-plan-generator/scripts/validate_plan.sh new file mode 100755 index 0000000..9102c0a --- /dev/null +++ b/skills/trading-plan-generator/scripts/validate_plan.sh @@ -0,0 +1,179 @@ +#!/bin/bash + +# Trading Plan Validation Script +# Checks trading plan completeness and critical risk management + +set -e + +# Colors +GREEN='\033[0;32m' +BLUE='\033[0;34m' +YELLOW='\033[1;33m' +RED='\033[0;31m' +NC='\033[0m' + +if [ $# -lt 1 ]; then + echo "Usage: $0 " + exit 1 +fi + +PLAN_FILE="$1" + +if [ ! -f "$PLAN_FILE" ]; then + echo -e "${RED}✗ Error: File not found: $PLAN_FILE${NC}" + exit 1 +fi + +echo -e "${BLUE}╔════════════════════════════════════════════════╗${NC}" +echo -e "${BLUE}║ Trading Plan Validation Report ║${NC}" +echo -e "${BLUE}╚════════════════════════════════════════════════╝${NC}" +echo "" +echo -e "File: ${BLUE}$PLAN_FILE${NC}" +echo "" + +CRITICAL_ISSUES=0 +WARNINGS=0 +PASSED=0 + +# Function to check section +check_section() { + local name="$1" + local pattern="$2" + local critical="$3" + + if grep -qi "$pattern" "$PLAN_FILE"; then + echo -e "${GREEN}✓${NC} $name" + ((PASSED++)) + return 0 + else + if [ "$critical" = "true" ]; then + echo -e "${RED}✗${NC} $name - CRITICAL MISSING" + ((CRITICAL_ISSUES++)) + else + echo -e "${YELLOW}⚠${NC} $name - recommended" + ((WARNINGS++)) + fi + return 1 + fi +} + +echo -e "${BLUE}━━━ CRITICAL Risk Management (Must Have) ━━━${NC}" +echo "" + +check_section "Risk per trade defined" "Risk Per Trade\|risk.*per.*trade" true +check_section "Daily loss limit set" "Daily Loss Limit\|daily.*loss" true +check_section "Stop-loss methodology" "Stop.*Loss.*Rules\|stop.*loss.*method" true +check_section "Position sizing formula" "Position.*Size.*Formula\|position.*sizing" true +check_section "Maximum drawdown limit" "Maximum Drawdown\|max.*drawdown" true + +echo "" +echo -e "${BLUE}━━━ Essential Strategy Components ━━━${NC}" +echo "" + +check_section "Trading style defined" "Trading Style\|Day Trading\|Swing Trading\|Position Trading" true +check_section "Entry criteria" "Entry.*Strategy\|Entry.*Rules\|Entry.*Criteria" true +check_section "Exit strategy" "Exit.*Strategy\|Take.*Profit\|Profit.*Target" true +check_section "Market selection" "Markets.*Instruments\|What I Trade" true +check_section "Risk:Reward minimum" "Risk.*Reward\|R:R\|RR.*ratio" true + +echo "" +echo -e "${BLUE}━━━ Psychology & Discipline ━━━${NC}" +echo "" + +check_section "No-trade conditions" "When NOT to Trade\|No.*Trade.*Condition" false +check_section "Pre-market routine" "Pre.*Market.*Routine\|Daily.*checklist" false +check_section "Tilt recognition" "Tilt\|Emotional.*State.*Check" false +check_section "Trade journal plan" "Trade Journal\|Performance Tracking" true + +echo "" +echo -e "${BLUE}━━━ Quality Checks ━━━${NC}" +echo "" + +# Check for dangerous patterns +if grep -qi "no stop\|without stop\|mental stop" "$PLAN_FILE"; then + echo -e "${RED}✗${NC} DANGER: References trading without stops" + ((CRITICAL_ISSUES++)) +else + echo -e "${GREEN}✓${NC} Requires stop-losses" + ((PASSED++)) +fi + +# Check risk percentage +if grep -Eq "[3-9]\.?[0-9]*%.*risk|risk.*[3-9]\.?[0-9]*%" "$PLAN_FILE"; then + echo -e "${YELLOW}⚠${NC} Risk per trade >3% detected - very aggressive" + ((WARNINGS++)) +elif grep -Eq "[0-9]+\.?[0-9]*%.*risk|risk.*[0-9]+\.?[0-9]*%" "$PLAN_FILE"; then + echo -e "${GREEN}✓${NC} Risk percentage defined" + ((PASSED++)) +fi + +# Check for TBD placeholders +TBD_COUNT=$(grep -c "TBD\|\[Specify\]\|\[Add\]\|\[List\]" "$PLAN_FILE" || true) +if [ "$TBD_COUNT" -gt 5 ]; then + echo -e "${YELLOW}⚠${NC} $TBD_COUNT placeholder sections need completion" + ((WARNINGS++)) +elif [ "$TBD_COUNT" -gt 0 ]; then + echo -e "${GREEN}✓${NC} Most sections completed ($TBD_COUNT placeholders remaining)" + ((PASSED++)) +else + echo -e "${GREEN}✓${NC} All sections completed" + ((PASSED++)) +fi + +# Check for signed commitment +if grep -q "Signed:.*___\|Signed:\s*$" "$PLAN_FILE"; then + echo -e "${YELLOW}⚠${NC} Plan not signed yet" + ((WARNINGS++)) +else + echo -e "${GREEN}✓${NC} Plan appears to be committed to" + ((PASSED++)) +fi + +echo "" +echo -e "${BLUE}╔════════════════════════════════════════════════╗${NC}" +echo -e "${BLUE}║ Validation Summary ║${NC}" +echo -e "${BLUE}╚════════════════════════════════════════════════╝${NC}" +echo "" +echo -e "Checks passed: ${GREEN}$PASSED${NC}" +echo -e "Warnings: ${YELLOW}$WARNINGS${NC}" +echo -e "Critical issues: ${RED}$CRITICAL_ISSUES${NC}" +echo "" + +if [ "$CRITICAL_ISSUES" -gt 0 ]; then + echo -e "${RED}❌ TRADING PLAN VALIDATION FAILED${NC}" + echo "" + echo -e "${RED}Critical issues MUST be addressed before trading.${NC}" + echo "" + echo "Required sections:" + echo " • Risk per trade (0.5-2% recommended)" + echo " • Daily loss limit (hard stop)" + echo " • Stop-loss methodology (mandatory)" + echo " • Position sizing formula" + echo " • Entry and exit criteria" + echo "" + exit 1 +elif [ "$WARNINGS" -gt 3 ]; then + echo -e "${YELLOW}⚠ Plan validation passed with warnings${NC}" + echo "" + echo "Address warnings to improve plan quality:" + echo " • Complete TBD sections" + echo " • Define no-trade conditions" + echo " • Add pre-market routine" + echo " • Sign and commit to plan" + echo "" + exit 0 +else + echo -e "${GREEN}✅ TRADING PLAN VALIDATION PASSED!${NC}" + echo "" + echo "Your plan includes critical risk management components." + echo "" + echo -e "${BLUE}Next steps:${NC}" + echo " 1. Print and keep visible while trading" + echo " 2. Review before every session" + echo " 3. Track compliance daily" + echo " 4. Review/adjust monthly" + echo "" + echo -e "${YELLOW}Remember: A plan is only valuable if you follow it.${NC}" + echo "" + exit 0 +fi