[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M77WZ4Y5PKA0RM5574JRKNS6":3,"skill-same:01M77WZ4Y5PKA0RM5574JRKNS6":47},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":27,"repositoryHtmlUrl":28,"repositoryHomepageUrl":29,"ownerHtmlUrl":30,"ownerBlogUrl":6,"ownerDescription":31,"updatedAt":32,"install":33,"resources":46},"01M77WZ4Y5PKA0RM5574JRKNS6","trading",null,"Comprehensive trading knowledge base covering fundamentals, technicals, strategies, backtesting, and risk management. Use when building trading apps or evaluating strategies.","Lord1Egypt\u002Fawesome-skill-forge","Lord1Egypt","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F99746359?v=4","01M7592YDNT0XK9WJ0T2MQVPDN","Mohamed Mounir Ali AL Keshita","01M75GRFNHC8VZNWEB8DKDE433",3,"MIT","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fcommunity\u002Fclawhub\u002Ft\u002Ftrading-strategies\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: trading\ndescription: Comprehensive trading knowledge base covering fundamentals, technicals, strategies, backtesting, and risk management. Use when building trading apps or evaluating strategies.\n---\n\n# Trading Skill — Complete Reference\n\n## Purpose\nComprehensive trading knowledge base covering fundamentals, technicals, strategies, backtesting, and risk management. Use when building trading apps, evaluating strategies, or making trading decisions.\n\n---\n\n## 1. TRADING STYLES\n\n### Scalping\n- Hold: seconds to minutes\n- Goal: profit from tiny price movements\n- Pros: many opportunities, reduced exposure to big moves\n- Cons: high transaction costs, stressful, tiny profit per trade\n- Best for: highly liquid markets with tight spreads\n\n### Day Trading\n- Hold: minutes to hours (close all by market close)\n- Goal: profit from intraday price movements\n- Pros: no overnight risk, high profit potential per trade\n- Cons: high risk, emotional pressure, costs add up\n- Best for: volatile stocks with clear intraday patterns\n\n### Swing Trading\n- Hold: days to months\n- Goal: catch short-to-intermediate moves\n- Pros: lower costs, more analysis time, less stressful\n- Cons: overnight risk, may miss long-term moves\n- Best for: trending markets with pullbacks\n\n### Position Trading\n- Hold: months to years\n- Goal: profit from major long-term trends\n- Pros: lowest costs, highest profit potential, most flexibility\n- Cons: capital tied up, exposed to macro events\n- Best for: fundamentally strong companies in sector uptrends\n\n---\n\n## 2. FUNDAMENTAL ANALYSIS\n\n### Key Metrics\n\n**P\u002FE Ratio (Price-to-Earnings)**\n- Formula: `Share Price \u002F Earnings Per Share`\n- S&P 500 average: ~30 (as of late 2025)\n- Low (\u003C15): potentially undervalued or troubled\n- High (>30): potentially overvalued or high growth expected\n- Compare WITHIN same industry only\n- Forward P\u002FE uses projected earnings; Trailing P\u002FE uses last 12 months\n\n**P\u002FB Ratio (Price-to-Book)**\n- Formula: `Share Price \u002F Book Value Per Share`\n- Book Value = total assets - intangible assets - liabilities\n- P\u002FB \u003C 1 = trading below asset value (potential bargain)\n- Most useful for capital-heavy industries (banks, manufacturing)\n\n**Debt-to-Equity Ratio**\n- Formula: `Total Liabilities \u002F Shareholders' Equity`\n- High = heavy debt reliance (risky in downturns)\n- Compare within industry — some sectors carry more debt naturally\n\n**Revenue Growth Rate**\n- Year-over-year revenue increase\n- Consistent > spiky\n- Accelerating growth rate = strongest signal\n\n**Free Cash Flow (FCF)**\n- Cash generated after capital expenditures\n- Positive FCF = real cash generation, not accounting tricks\n- FCF Yield = FCF \u002F Market Cap (higher = better value)\n\n**EPS Growth (Earnings Per Share)**\n- Consistent EPS growth over 3-5 years = strong signal\n- Check quality: operations vs one-time events\n\n**Return on Equity (ROE)**\n- Formula: `Net Income \u002F Shareholders' Equity`\n- ROE > 15% = generally good management efficiency\n\n**Dividend Yield & Payout Ratio**\n- Yield = Annual Dividend \u002F Share Price\n- Payout = Dividends \u002F Net Income\n- Payout > 80% may be unsustainable\n\n---\n\n## 3. TECHNICAL INDICATORS\n\n### RSI (Relative Strength Index)\n- **Formula:** `RSI = 100 - (100 \u002F (1 + (Avg Gain \u002F Avg Loss)))` over 14 periods\n- Scale: 0-100\n- **>70 = Overbought** (potential sell)\n- **\u003C30 = Oversold** (potential buy)\n- **Strengths:** Simple, effective in ranging markets\n- **Weaknesses:** Stays >70 for extended periods in strong uptrends — don't auto-sell\n- **RSI Divergence:** Price makes new high but RSI makes lower high = bearish (momentum weakening)\n- **Swing Rejection:** RSI crosses 30 upward → dips but stays above 30 → breaks prior high = bullish entry\n- **Best in:** Ranging\u002Fsideways markets. Combine with ADX to filter.\n\n### MACD (Moving Average Convergence Divergence)\n- **MACD Line** = 12-period EMA - 26-period EMA\n- **Signal Line** = 9-period EMA of MACD Line\n- **Histogram** = MACD Line - Signal Line\n- **Buy:** MACD crosses ABOVE signal line\n- **Sell:** MACD crosses BELOW signal line\n- **Divergence:** MACD rising while price falling = potential reversal\n- **Strengths:** Good trend-following indicator\n- **Weaknesses:** Lagging, many false positives in sideways markets\n- **Best combined with ADX** — only trust MACD signals when ADX > 25 (confirming trend)\n\n### Bollinger Bands\n- **Middle Band** = 20-day SMA\n- **Upper Band** = SMA + 2 standard deviations\n- **Lower Band** = SMA - 2 standard deviations\n- 95% of price action stays within bands\n- **Squeeze:** Bands narrow → low volatility → breakout imminent (direction unknown)\n- **Bollinger Bounce:** Price off lower band toward middle = buy; off upper toward middle = sell\n- **Breakout:** Price outside bands with volume = trend continuation\n- **Strengths:** Visual, adapts to volatility\n- **Weaknesses:** Secondary indicator — always confirm with RSI\u002FMACD\n- Created by John Bollinger in the 1980s\n\n### Moving Averages\n- **SMA (Simple):** Equal weight all periods\n- **EMA (Exponential):** More weight on recent prices (faster reaction)\n- Key periods: 5, 9, 20, 50, 100, 200 day\n- **Golden Cross:** 50-day crosses ABOVE 200-day = strong bullish\n- **Death Cross:** 50-day crosses BELOW 200-day = strong bearish\n- MAs act as dynamic support\u002Fresistance levels\n- Use longer MAs for volatile stocks to avoid false signals\n\n### Volume\n- Confirms price movements\n- Price up + high volume = strong bullish\n- Price up + low volume = weak rally, likely to reverse\n- Price down + high volume = strong selling pressure\n- Price down + low volume = lack of selling conviction\n- 60-80% of daily volume is algorithmic\n\n### Ichimoku Cloud (Ichimoku Kinko Hyo)\n- **5 Components:**\n  - Tenkan-sen (Conversion Line): (9-period high + 9-period low) \u002F 2\n  - Kijun-sen (Base Line): (26-period high + 26-period low) \u002F 2\n  - Senkou Span A: (Tenkan + Kijun) \u002F 2, plotted 26 periods ahead\n  - Senkou Span B: (52-period high + 52-period low) \u002F 2, plotted 26 periods ahead\n  - Chikou Span: Current close plotted 26 periods back\n- **The Cloud (Kumo):** Area between Span A and Span B = support\u002Fresistance zone\n- **Buy:** Price above cloud, Tenkan crosses above Kijun\n- **Sell:** Price below cloud, Tenkan crosses below Kijun\n- **Strengths:** All-in-one indicator (trend, momentum, support\u002Fresistance)\n- **Weaknesses:** Complex visually, lagging in fast markets\n- **Best in:** Trending markets. Avoid in ranging\u002Fsideways.\n- Michael Automates created an AI-improved Ichimoku strategy that performs well\n\n### Super Trend\n- **Formula:** Based on ATR (Average True Range) and a multiplier\n- Upper Band = (High + Low) \u002F 2 + (Multiplier × ATR)\n- Lower Band = (High + Low) \u002F 2 - (Multiplier × ATR)\n- **Buy:** Price crosses above Super Trend line\n- **Sell:** Price crosses below Super Trend line\n- **Strengths:** Simple, good trend-following, clear signals\n- **Weaknesses:** Late entries, bad in ranging markets\n- AI iteration took Super Trend from 44% to 3,605% P&L in Michael Automates' testing\n\n### VWAP (Volume-Weighted Average Price)\n- **Formula:** `Sum(Price × Volume) \u002F Total Volume` (intraday only)\n- Above VWAP = bullish intraday\n- Below VWAP = bearish intraday\n- Institutional benchmark — they buy below VWAP, sell above\n- Resets daily — intraday tool only\n\n---\n\n## 4. SIGNAL COMBINATIONS\n\n### Strong Buy Signal (High Confidence)\nAll of these together:\n- RSI \u003C 30 (oversold) AND recovering\n- MACD crossing above signal line\n- Price bouncing off lower Bollinger Band\n- Volume increasing on the bounce\n- Price above 200-day MA (long-term uptrend intact)\n- Fundamentals solid (P\u002FE reasonable, FCF positive, revenue growing)\n\n### Moderate Buy Signal\n- RSI between 40-50 in an uptrend (pullback buy)\n- Price touching 50-day MA support\n- MACD histogram turning positive\n- Volume above average\n\n### Trend-Following Entry\n- Golden Cross (50-day crosses above 200-day)\n- Price breaks above resistance with high volume\n- ADX > 25 confirming trend strength\n- Buy on first pullback after breakout\n\n### Strong Sell Signal\n- RSI > 70 in a ranging market\n- Price hitting upper Bollinger Band with declining volume\n- MACD crossing below signal line\n- Price reaching prior resistance level\n\n**RULE: Never rely on a single indicator. Always combine 2-3 minimum.**\n\n---\n\n## 5. POSITION SIZING\n\n### The 1% Rule\nNever risk more than 1% of total account on a single trade.\n- Account: $1,000 → max risk per trade: $10\n- If stop-loss is $2 below entry → buy 5 shares max\n- Keeps you alive through losing streaks\n\n### Kelly Criterion\n- `f = (bp - q) \u002F b`\n- b = win\u002Floss ratio, p = win probability, q = loss probability\n- Gives optimal position size based on historical win rate\n- **Use half-Kelly** for safety (most professionals do)\n\n### Example\n- Win rate: 55%, average win: $200, average loss: $100\n- Kelly: f = (2 × 0.55 - 0.45) \u002F 2 = 0.325 (32.5% of account)\n- Half-Kelly: 16.25% — still aggressive, many pros use quarter-Kelly\n\n---\n\n## 6. EXIT STRATEGIES\n\n### Stop-Loss Types\n- **Fixed percentage:** Sell if price drops X% (typically 5-8%)\n- **ATR-based:** Stop at entry minus 2× Average True Range (adjusts for volatility)\n- **Support-based:** Stop below key support level or moving average\n- **Trailing stop:** Moves up with price, locks in profits (e.g., trail by 5%)\n\n### Take-Profit Methods\n- **Fixed target:** Pre-set price target (e.g., 2:1 or 3:1 risk\u002Freward)\n- **Technical target:** Previous resistance level, Fibonacci extension\n- **Trailing:** Let winners run with trailing stop\n\n### The 3 Hardest Sells\n1. **Cutting losses** — \"it'll come back\" kills accounts. Honor your stops.\n2. **Taking profits too early** — use trailing stops to let winners run\n3. **Holding through earnings** — volatility spikes. Reduce position or hedge.\n\n---\n\n## 7. STRATEGY ARCHETYPES\n\n### Mean Reversion\n- **Theory:** Prices revert to their historical average over time\n- **Entry:** Buy when RSI \u003C 30 or price 2+ standard deviations below mean\n- **Exit:** Sell when RSI > 70 or price returns to mean\n- **Tools:** Z-scores, Bollinger Bands, RSI\n- **Best in:** Range-bound\u002Fsideways markets\n- **Weakness:** Fails badly in strong trending markets (price keeps going)\n- **Key stat:** Z-score above 1.5 or below -1.5 signals opportunity\n\n### Momentum\n- **Theory:** Stocks that are going up tend to keep going up (and vice versa)\n- **Entry:** Buy stocks with strongest 3-6 month performance\n- **Exit:** Sell when momentum weakens (MACD crossover, RSI divergence)\n- **Philosophy:** \"Buy high, sell higher\" — opposite of value investing\n- **Best in:** Trending markets with clear direction\n- **Weakness:** Sudden reversals can be devastating\n- **Key tools:** Trend lines, MACD, RSI, relative strength vs index\n\n### Moving Average Crossover\n- **Entry:** Buy on Golden Cross (50-day crosses above 200-day)\n- **Exit:** Sell on Death Cross (50-day crosses below 200-day)\n- **Pros:** Simple, catches major trends\n- **Cons:** Very lagging — you'll miss the first 10-20% of a move and give back 10-20% at the end\n- **Variant:** Use shorter MAs (9\u002F21) for faster signals but more noise\n\n### Bollinger Band Squeeze\n- **Entry:** When bands contract to minimum width, enter on the breakout direction with volume confirmation\n- **Exit:** When price reaches opposite band or bands start contracting again\n- **Key:** The squeeze only tells you a big move is coming — NOT the direction\n- **Must combine with:** Volume, MACD, or other directional indicator\n\n### Pairs Trading\n- **Origin:** Morgan Stanley, mid-1980s\n- **How:** Find two highly correlated stocks (0.80+ correlation). When they diverge, go long the underperformer, short the outperformer\n- **Profit:** When they converge back to historical correlation\n- **Market-neutral:** Hedged against broad market moves\n- **Risk:** Correlation can break permanently (one company's fundamentals change)\n- **Example:** Coca-Cola vs Pepsi, Visa vs Mastercard\n\n### VWAP Reversion (Intraday)\n- **Entry:** Buy below VWAP when overall trend is bullish\n- **Exit:** Sell above VWAP or at end of day\n- **Best for:** Day trading liquid stocks\n- **Why it works:** Institutional traders use VWAP as a benchmark\n\n---\n\n## 8. BACKTESTING\n\n### The 4 Deadly Biases\n1. **Optimization Bias (Curve Fitting):** Over-tuning to historical data. Fix: minimal parameters, out-of-sample testing\n2. **Look-Ahead Bias:** Using future data accidentally. Fix: strict chronological processing\n3. **Survivorship Bias:** Only testing stocks that exist today. Fix: survivorship-free datasets or recent data\n4. **Psychological Tolerance Bias:** A 25% drawdown looks fine on a chart but feels devastating in real-time\n\n### Key Metrics\n| Metric | Formula | Good | Great |\n|--------|---------|------|-------|\n| Sharpe Ratio | (Return - Risk-Free) \u002F Std Dev | >1 | >2 |\n| Max Drawdown | Worst peak-to-trough | \u003C20% | \u003C10% |\n| Win Rate | Wins \u002F Total Trades | >40% | >55% |\n| Profit Factor | Gross Profits \u002F Gross Losses | >1.5 | >2 |\n| Risk\u002FReward | Avg Win \u002F Avg Loss | >2:1 | >3:1 |\n\n**Expected Return per Trade:** `(Win% × Avg Win) + (Loss% × Avg Loss)` — must be positive\n\n### Drawdown Math (Critical)\n- 10% loss → need 11% gain to recover\n- 20% loss → need 25% gain to recover\n- 30% loss → need 43% gain to recover\n- 50% loss → need 100% gain to recover\n- **The math gets exponentially worse.** Avoiding big losses > chasing big wins.\n\n### Process\n1. Define strategy rules with zero ambiguity\n2. Get clean OHLCV data (Open, High, Low, Close, Volume)\n3. Build engine (Python: backtrader, vectorbt, quantstats)\n4. Split: 70% training \u002F 30% out-of-sample validation\n5. Run Monte Carlo simulation (randomize trade order) for robustness\n6. Paper trade winners for 3+ months\n7. Go live small — start with minimum position sizes\n\n### Michael Automates Backtesting Workflow (Proven)\nHis backtesting engine ($99) does this — we can replicate for free:\n1. **Get historical OHLCV data** (from CCXT\u002FBinance\u002FAlpaca — free)\n2. **AI creates Python version** of your trading strategy\n3. **Run backtest locally** → get metrics\n4. **Compare with TradingView numbers** to verify accuracy\n5. **If numbers don't match:** Export TradingView Excel report, do trade-by-trade comparison\n6. **AI can auto-fix discrepancies** by modifying the backtest engine code\n7. **Critical settings:** Commission = 0.1%, timezone = UTC, date range = not full history\n\n**Auto-download data:**\n- CCXT pulls from Binance, Coinbase, Kraken automatically\n- Store in `\u002Fdata\u002Fcache\u002F` folder by asset and timeframe\n- Format: `BTC_USDT_1d.csv`, `ETH_USDT_4h.csv`, etc.\n\n### Data Sources\n- **Free:** Yahoo Finance (yfinance), Alpha Vantage, Alpaca, Polygon.io free tier, CCXT (100+ crypto exchanges)\n- **Paid:** Norgate, Nasdaq Data Link (Quandl)\n- **Warning:** Yahoo Finance has survivorship bias\n- **Best for crypto:** CCXT + Binance (most history, most pairs)\n- **Best for stocks:** Alpaca (free, clean data, built-in paper trading)\n\n---\n\n## 9. RISK MANAGEMENT\n\n### Core Rules\n- **1% Rule:** Never risk more than 1% of account per trade\n- **Daily Loss Limit:** Stop trading if down 3% in a day\n- **Correlation Risk:** Don't hold 5 tech stocks — one sector crash kills you\n- **Position Limits:** Max 5-10 open positions at once\n- **Cash Reserve:** Always keep 20-30% cash for opportunities\n\n### Circuit Breakers\n- Hit daily loss limit → done for the day\n- Hit weekly loss limit (5%) → reduce position sizes 50%\n- Hit monthly loss limit (10%) → pause, review all strategies\n- 3 consecutive losses → take a break, re-evaluate\n\n### Fees & Slippage (Often Ignored)\n- Commission-free doesn't mean cost-free — there's still the spread\n- Slippage: the difference between expected and actual execution price\n- High-frequency strategies amplify these costs\n- **Always include fees + slippage in backtests** or results are meaningless\n\n---\n\n## 10. COMMON MISTAKES\n\n1. **Trading without a plan** → Write rules BEFORE trading\n2. **Ignoring position sizing** → The 1% rule exists for a reason\n3. **Moving stop-losses** → Set them and honor them\n4. **Averaging down** → Adding to losers hoping they'll recover\n5. **Overtrading** → More trades ≠ more profit (costs eat you alive)\n6. **Single indicator reliance** → Always combine 2-3 indicators\n7. **Not accounting for fees** → Especially in backtests\n8. **Skipping paper trading** → Going live without 3+ months of validation\n9. **Revenge trading** → Trying to win back losses with bigger bets\n10. **Ignoring the macro** → Individual stocks don't exist in a vacuum\n\n---\n\n## 11. TOOLS & APIS\n\n### Broker APIs\n- **Alpaca** — Commission-free, great API, paper trading built in (RECOMMENDED for us)\n- **Interactive Brokers** — Most comprehensive, supports everything\n- **TD Ameritrade\u002FSchwab** — thinkorswim API\n\n### Data APIs\n- **Alpha Vantage** — Free tier (5 calls\u002Fmin), stocks + crypto + forex\n- **Polygon.io** — Real-time and historical, free tier\n- **Yahoo Finance** — Free via yfinance (unreliable, survivorship bias)\n- **Alpaca Market Data** — Included with account\n\n### Python Stack\n- **pandas** — Data manipulation\n- **numpy** — Numerical computing\n- **ta-lib \u002F pandas-ta** — Technical indicators\n- **backtrader** — Full backtesting framework\n- **vectorbt** — Fast vectorized backtesting\n- **quantstats** — Portfolio analytics\n- **scikit-learn** — ML pattern recognition\n- **alpaca-trade-api** — Broker integration\n\n### Architecture\n```\n[Data Feed] → [Indicator Engine] → [Signal Generator] → [Risk Manager] → [Order Executor]\n     ↑                                                           |\n     └──────────── [Backtesting Engine] ←────────────────────────┘\n                          ↓\n                   [Performance Analytics]\n```\n\n---\n\n## 12. CRYPTO-SPECIFIC STRATEGIES (From Video Research)\n\n### Super Trend Strategy\n- Built-in TradingView indicator\n- AI can iterate: base version (44% P&L) → optimized V4 (3,605% P&L)\n- Process: give AI base → \"improve it\" → backtest → repeat overnight\n- Test on multiple assets to avoid overfitting\n\n### Strategy Tournament (Evolution Method)\n- Create 10 different strategies with different parameters\u002Flogic\n- Run all 10 in parallel with small positions ($100 each)\n- After 1-2 weeks: cut losers, keep winners\n- Create variations of winners, repeat process\n- Natural selection for trading strategies\n\n### Market Regime Detection\n- Run separate strategies for trending vs ranging markets\n- AI detects current regime and switches strategies automatically\n- Trend-following for trending markets, mean reversion for ranging\n\n### Prediction Market Strategies (Polymarket)\n- **15-Minute Windows:** BTC up\u002Fdown resolution every 15 minutes\n- **Late Entry:** Look at trend in last 3-4 minutes, enter in that direction\n- **Arbitrage:** When both sides cost \u003C$1 total = guaranteed profit\n- **Mention Markets:** AI studies speech patterns to predict word usage\n- **Sports Scanner:** AI researches obscure low-volume markets for edges\n- **Counter-Trend AI:** Bet against AI consensus (contrarian)\n- **Wallet Analysis:** Copy successful wallets → AI reverse-engineers their strategy\n- KEY: Not dependent on bull\u002Fbear markets — works always\n\n### Multi-Agent Trading Architecture\n- **Coordinator:** Delegates tasks, manages priorities, daily briefing\n- **Quant Scanner:** Scans 30+ coins every 15 min with CCXT, confluence scoring\n- **Researcher:** Daily news\u002Fintel scanning, deep dives\n- **Alert Agent:** Formats and delivers signals\n- **Security Agent:** 24hr audit for malicious code, prompt injections, bugs\n- Each agent needs a detailed \"soul\" (personality + instructions)\n- Agents work in parallel, not sequentially\n\n### Crypto Exchange APIs\n- **Hyperliquid** — Decentralized perps, no KYC, good API\n- **Blofin** — Centralized, API with trading perms (disable withdrawals!)\n- **CCXT Library** — Open-source, supports 100+ exchanges, start read-only\n- **Alpaca** — Stocks (commission-free, paper trading built in)\n\n### AI Strategy Iteration Workflow (KEY — From Michael Automates)\nThis is the single most powerful workflow from all our research:\n1. **Pick a base strategy** (e.g., Super Trend, RSI+MACD, Bollinger Squeeze)\n2. **AI backtests it** → gets baseline metrics (P&L, drawdown, win rate, Sharpe)\n3. **Tell AI \"improve this\"** → it modifies parameters, adds filters, changes logic\n4. **AI creates V2, V3, V4...** each iteration potentially better\n5. **Compare AI numbers with TradingView** to verify accuracy\n6. **LET IT RUN OVERNIGHT** — wake up to results\n7. **Score across multiple assets** (BTC, ETH, SOL, SPY, AAPL) to avoid overfitting\n8. **Only keep strategies that work on 3+ different assets**\n9. Repeat until you have top 3 strategies → paper trade those\n\n**Michael's results:** Super Trend went from 44% P&L → 3,605% P&L through this process.\n\n**Critical anti-overfitting rules:**\n- Test on multiple assets, not just one\n- Use walk-forward validation (train on years 1-3, test on years 4-5)\n- If a strategy only works on one asset, it's overfit — discard it\n- Commission must be set to 0.1% (not 0%)\n- TradingView timezone must be UTC for number matching\n\n### Strategy Tournament (From Alex Carter)\n1. Create 10 different strategies (vary parameters, timeframes, indicators)\n2. Run ALL 10 in parallel with small positions ($100 each)\n3. Track for 1-2 weeks\n4. Kill bottom 5 performers\n5. Create mutations\u002Fvariations of top 5\n6. Run new tournament\n7. Repeat — \"evolution for trading strategies\"\n8. After 3-4 rounds, surviving strategies are battle-tested\n\n### Counter-Trend Against AI Crowd (From Coin Bureau)\n- Most AI trading bots use similar data and strategies\n- When AI crowd consensus is heavy one direction, bet the opposite\n- Works because: AI herding creates overcrowded trades that reverse\n- Requires: monitoring what popular AI strategies are doing\n- Best for: short-term contrarian plays in crypto and prediction markets\n\n### Divergence Trading (From Coin Bureau)\n- Use TBT Divergence indicator on 15-minute timeframe\n- Contrarian entry when price makes new high\u002Flow but indicator doesn't confirm\n- Specifically: price up but RSI\u002FMACD diverging = weakening momentum\n- Enter against the trend on confirmed divergence\n- Best for: short-term crypto and Polymarket 15-min windows\n\n### Critical Crypto Trading Rules\n- NEVER enable withdrawal permissions on API keys\n- Whitelist your IP on centralized exchanges\n- Store keys in .env files, never hardcoded\n- Use testnet\u002Fpaper trading first\n- Rotate API keys every few months\n- Run on dedicated machine (not personal computer)\n- Daily security audit via cron job\n\n---\n\n## 13. POLYMARKET (PREDICTION MARKETS)\n\n### How It Works\n- Binary markets: buy Yes\u002FNo shares in real-world outcomes\n- Correct = $1.00 payout, wrong = $0.00\n- Price = probability (Yes at $0.70 = market thinks 70% likely)\n- Runs on Polygon (Ethereum L2), uses USDC.e\n- Python SDK: `py-clob-client`\n- Public data API (no auth): `gamma-api.polymarket.com`\n\n### Strategy Types\n1. **Arbitrage** — Yes + No \u003C $1.00 = free money (rare, need speed)\n2. **Late Entry** — 15-min BTC windows, enter last 3-4 min when trend is clear\n3. **Mention Markets** — AI analyzes speech patterns to predict word usage\n4. **Obscure Sports** — Low-volume markets with inefficient pricing\n5. **Wallet Analysis** — Reverse-engineer top performers' strategies\n6. **Market Making** — Provide liquidity, profit from spread (advanced)\n\n### Why AI Has an Edge\n- Can process more data than any human (speeches, news, stats)\n- 24\u002F7 monitoring of all markets simultaneously\n- Niche markets have little competition = more mispricing\n- Uncorrelated to stock\u002Fcrypto markets — works in any cycle\n\n### Market Making (Advanced)\n- Place both buy and sell orders, profit from the spread\n- Requires: understanding inventory risk, dynamic spread adjustment\n- Need algorithm to adjust quotes based on position, volatility, flow\n- Complex math but AI handles research and implementation\n- Start with wide spreads in low-volume markets, tighten as you learn\n- Risk: getting stuck holding losing positions if market moves fast\n\n### TBO Cloud Strategy (Coin Bureau — Proprietary)\n- Trending Breakout indicator on 4-hour timeframe\n- Advanced moving average strategy — details not public\n- Combined with TBT Divergence indicator for entry\u002Fexit\n- We can build similar: EMA cloud (9\u002F21\u002F55 EMAs) with breakout confirmation\n- Key concept: cloud acts as dynamic support\u002Fresistance, breakout above = long\n\n### Key Insight\nBuild scanner first (read-only, free). Paper trade. Then go live small.\n\n---\n\n## 14. CRYPTO vs STOCK STRATEGIES — WHAT TRANSFERS\n\n### Strategies That Work in BOTH Markets\n| Strategy | Stocks | Crypto | Notes |\n|----------|--------|--------|-------|\n| Trend Following | ✅ | ✅ | Works in any market with trends |\n| Mean Reversion | ✅ | ✅ | Better in stocks (more mean-reverting) |\n| RSI\u002FMACD Signals | ✅ | ✅ | Same indicators, different parameters |\n| Bollinger Bands | ✅ | ✅ | Adjust for volatility differences |\n| Pairs Trading | ✅ | ✅ | Stocks: KO\u002FPEP. Crypto: BTC\u002FETH |\n| Moving Average Crossover | ✅ | ✅ | Universal trend indicator |\n| Ichimoku Cloud | ✅ | ✅ | Works anywhere with enough volume |\n| Strategy Tournament | ✅ | ✅ | Run 10 strategies, evolve winners |\n| AI Iteration | ✅ | ✅ | Give AI base strategy, let it improve |\n\n### Key Differences\n| Factor | Stocks | Crypto |\n|--------|--------|--------|\n| Hours | 9:30 AM - 4 PM ET | 24\u002F7\u002F365 |\n| Volatility | Lower (1-3% daily avg) | Higher (5-10%+ daily avg) |\n| Leverage | 2x (margin), options for more | 10-100x available |\n| Regulation | Heavy (SEC, FINRA) | Light (evolving) |\n| Data Quality | Excellent (decades) | Good (5-10 years) |\n| Fees | Commission-free (Alpaca) | 0.1% typical |\n| Short Selling | Restricted (uptick rule) | Easy (perps) |\n| Pattern Day Trading | $25K minimum (PDT rule) | No restriction |\n| Market Manipulation | Illegal, enforced | Common, less enforcement |\n\n### What Needs Adjusting for Stocks\n- **Wider MA periods** — crypto is faster, use longer MAs for stocks to filter noise\n- **Lower leverage** — 2x max for stocks vs 5-10x crypto\n- **Market hours** — need pre\u002Fafter-hours data handling, overnight gaps\n- **PDT Rule** — if under $25K, limited to 3 day trades per 5 business days\n- **Earnings events** — stocks have scheduled volatility events quarterly\n- **Sector correlation** — stocks in same sector move together more than crypto\n- **Volume patterns** — stocks have predictable volume curves (open, close spikes)\n\n### Bottom Line\n**Yes, the core strategies transfer to stocks.** The math is the same. What changes:\n1. Parameters (slower timeframes for stocks)\n2. Risk settings (lower leverage, wider stops)\n3. Schedule (market hours vs 24\u002F7)\n4. Starting capital ($25K for day trading stocks due to PDT rule, or use swing trading to avoid it)\n\n**Best starting point for stocks:** Alpaca (free, commission-free, paper trading built in, great API). Same strategies, just tune the parameters.\n\n---\n\n## 15. MULTI-AGENT TRADING DESK (From Coin Bureau)\n\n### Architecture\nEach agent gets a detailed \"soul\" (personality + priorities + instructions). Without a soul, agents produce generic output.\n\n### Agent Roles\n1. **Coordinator (Betty)** — Manager agent. Delegates tasks, manages priorities, monitors agent health, delivers daily briefing. Never does the work itself.\n\n2. **Quant Scanner** — Scans 30+ coins every 15 minutes via cron job. Uses CCXT for OHLCV data. Runs indicators (RSI, MACD, Bollinger, etc). Produces confluence score for each signal. Rules: never places trades without operator approval.\n\n3. **Researcher** — Runs daily. Scans news, X\u002FTwitter, market updates. Produces morning research brief. Focused on narratives, sectors, new listings.\n\n4. **Alert Agent** — Formats signals from quant scanner into actionable alerts. Pushes to Discord channels. Includes: asset, timeframe, direction, confidence score, entry\u002Fexit suggestions.\n\n5. **Security Agent (Radar)** — 24hr security audit. Checks for malicious code, prompt injections, bugs. Quality assurance on all strategy code before deployment. Non-negotiable.\n\n6. **Backtesting Agent** — Validates strategies against historical data before deployment.\n\n7. **Trading Agent** — Executes trades on exchange APIs. Only activated after paper trading period.\n\n### Notification Pipeline (Discord Recommended)\n- Private Discord server with bot admin privileges\n- Bot creates channels per category (signals, research, alerts, P&L)\n- Curated alerts — only coins\u002Fmarkets you care about\n- Much better than Telegram (categories, threads, searchable)\n\n### Key Insight From Coin Bureau\n\"Your output is only as good as your input.\" Generic prompts = generic agents. Spend time writing detailed soul descriptions for each agent. Include:\n- Exact responsibilities\n- What data to use\n- What format to output\n- What rules to follow\n- What to never do\n\n### Cost Reality\n- Claude Max ($200\u002Fmo) — unlimited for heavy agent usage\n- API credits alternative: $1,000-10,000\u002Fmo depending on volume\n- Ollama (free) — can run specific tasks locally but less smart\n- Strategy: use Claude for complex work, Ollama for routine scans\n\n---\n\n## 16. OUR APPROACH\n\n### Phase 1: Foundation\n- Set up Alpaca paper trading (free)\n- Build data pipeline for historical OHLCV data\n- Implement core indicators: RSI, MACD, Bollinger, MAs, Volume\n- Build backtesting engine with walk-forward validation\n\n### Phase 2: Strategy Development\n- Backtest all 6 strategy archetypes against 5-10 years of data\n- Find highest Sharpe ratio + lowest max drawdown combo\n- Monte Carlo simulations for robustness\n- Paper trade top 2-3 strategies simultaneously\n\n### Phase 3: Live (After 3+ Months Paper)\n- Minimum position sizes\n- AI-driven condition analysis (use Claude to interpret market context)\n- Full risk management: 1% rule, daily limits, circuit breakers\n- Dashboard monitoring all positions, signals, performance\n\n### Key Principles\n1. Paper trade until proven over 3+ months\n2. Position sizing > entry signals\n3. Risk management is the ONLY thing that keeps you in the game\n4. No single indicator is reliable alone\n5. Past performance ≠ future results\n6. Start with stocks, not crypto (more data, less manipulation)\n7. Account for fees, slippage, and taxes ALWAYS\n","# Trading Skill — Complete Reference\n\n## Purpose\nComprehensive trading knowledge base covering fundamentals, technicals, strategies, backtesting, and risk management. Use when building trading apps, evaluating strategies, or making trading decisions.\n\n---\n\n## 1. TRADING STYLES\n\n### Scalping\n- Hold: seconds to minutes\n- Goal: profit from tiny price movements\n- Pros: many opportunities, reduced exposure to big moves\n- Cons: high transaction costs, stressful, tiny profit per trade\n- Best for: highly liquid markets with tight spreads\n\n### Day Trading\n- Hold: minutes to hours (close all by market close)\n- Goal: profit from intraday price movements\n- Pros: no overnight risk, high profit potential per trade\n- Cons: high risk, emotional pressure, costs add up\n- Best for: volatile stocks with clear intraday patterns\n\n### Swing Trading\n- Hold: days to months\n- Goal: catch short-to-intermediate moves\n- Pros: lower costs, more analysis time, less stressful\n- Cons: overnight risk, may miss long-term moves\n- Best for: trending markets with pullbacks\n\n### Position Trading\n- Hold: months to years\n- Goal: profit from major long-term trends\n- Pros: lowest costs, highest profit potential, most flexibility\n- Cons: capital tied up, exposed to macro events\n- Best for: fundamentally strong companies in sector uptrends\n\n---\n\n## 2. FUNDAMENTAL ANALYSIS\n\n### Key Metrics\n\n**P\u002FE Ratio (Price-to-Earnings)**\n- Formula: `Share Price \u002F Earnings Per Share`\n- S&P 500 average: ~30 (as of late 2025)\n- Low (\u003C15): potentially undervalued or troubled\n- High (>30): potentially overvalued or high growth expected\n- Compare WITHIN same industry only\n- Forward P\u002FE uses projected earnings; Trailing P\u002FE uses last 12 months\n\n**P\u002FB Ratio (Price-to-Book)**\n- Formula: `Share Price \u002F Book Value Per Share`\n- Book Value = total assets - intangible assets - liabilities\n- P\u002FB \u003C 1 = trading below asset value (potential bargain)\n- Most useful for capital-heavy industries (banks, manufacturing)\n\n**Debt-to-Equity Ratio**\n- Formula: `Total Liabilities \u002F Shareholders' Equity`\n- High = heavy debt reliance (risky in downturns)\n- Compare within industry — some sectors carry more debt naturally\n\n**Revenue Growth Rate**\n- Year-over-year revenue increase\n- Consistent > spiky\n- Accelerating growth rate = strongest signal\n\n**Free Cash Flow (FCF)**\n- Cash generated after capital expenditures\n- Positive FCF = real cash generation, not accounting tricks\n- FCF Yield = FCF \u002F Market Cap (higher = better value)\n\n**EPS Growth (Earnings Per Share)**\n- Consistent EPS growth over 3-5 years = strong signal\n- Check quality: operations vs one-time events\n\n**Return on Equity (ROE)**\n- Formula: `Net Income \u002F Shareholders' Equity`\n- ROE > 15% = generally good management efficiency\n\n**Dividend Yield & Payout Ratio**\n- Yield = Annual Dividend \u002F Share Price\n- Payout = Dividends \u002F Net Income\n- Payout > 80% may be unsustainable\n\n---\n\n## 3. TECHNICAL INDICATORS\n\n### RSI (Relative Strength Index)\n- **Formula:** `RSI = 100 - (100 \u002F (1 + (Avg Gain \u002F Avg Loss)))` over 14 periods\n- Scale: 0-100\n- **>70 = Overbought** (potential sell)\n- **\u003C30 = Oversold** (potential buy)\n- **Strengths:** Simple, effective in ranging markets\n- **Weaknesses:** Stays >70 for extended periods in strong uptrends — don't auto-sell\n- **RSI Divergence:** Price makes new high but RSI makes lower high = bearish (momentum weakening)\n- **Swing Rejection:** RSI crosses 30 upward → dips but stays above 30 → breaks prior high = bullish entry\n- **Best in:** Ranging\u002Fsideways markets. Combine with ADX to filter.\n\n### MACD (Moving Average Convergence Divergence)\n- **MACD Line** = 12-period EMA - 26-period EMA\n- **Signal Line** = 9-period EMA of MACD Line\n- **Histogram** = MACD Line - Signal Line\n- **Buy:** MACD crosses ABOVE signal line\n- **Sell:** MACD crosses BELOW signal line\n- **Divergence:** MACD rising while price falling = potential reversal\n- **Strengths:** Good trend-following indicator\n- **Weaknesses:** Lagging, many false positives in sideways markets\n- **Best combined with ADX** — only trust MACD signals when ADX > 25 (confirming trend)\n\n### Bollinger Bands\n- **Middle Band** = 20-day SMA\n- **Upper Band** = SMA + 2 standard deviations\n- **Lower Band** = SMA - 2 standard deviations\n- 95% of price action stays within bands\n- **Squeeze:** Bands narrow → low volatility → breakout imminent (direction unknown)\n- **Bollinger Bounce:** Price off lower band toward middle = buy; off upper toward middle = sell\n- **Breakout:** Price outside bands with volume = trend continuation\n- **Strengths:** Visual, adapts to volatility\n- **Weaknesses:** Secondary indicator — always confirm with RSI\u002FMACD\n- Created by John Bollinger in the 1980s\n\n### Moving Averages\n- **SMA (Simple):** Equal weight all periods\n- **EMA (Exponential):** More weight on recent prices (faster reaction)\n- Key periods: 5, 9, 20, 50, 100, 200 day\n- **Golden Cross:** 50-day crosses ABOVE 200-day = strong bullish\n- **Death Cross:** 50-day crosses BELOW 200-day = strong bearish\n- MAs act as dynamic support\u002Fresistance levels\n- Use longer MAs for volatile stocks to avoid false signals\n\n### Volume\n- Confirms price movements\n- Price up + high volume = strong bullish\n- Price up + low volume = weak rally, likely to reverse\n- Price down + high volume = strong selling pressure\n- Price down + low volume = lack of selling conviction\n- 60-80% of daily volume is algorithmic\n\n### Ichimoku Cloud (Ichimoku Kinko Hyo)\n- **5 Components:**\n  - Tenkan-sen (Conversion Line): (9-period high + 9-period low) \u002F 2\n  - Kijun-sen (Base Line): (26-period high + 26-period low) \u002F 2\n  - Senkou Span A: (Tenkan + Kijun) \u002F 2, plotted 26 periods ahead\n  - Senkou Span B: (52-period high + 52-period low) \u002F 2, plotted 26 periods ahead\n  - Chikou Span: Current close plotted 26 periods back\n- **The Cloud (Kumo):** Area between Span A and Span B = support\u002Fresistance zone\n- **Buy:** Price above cloud, Tenkan crosses above Kijun\n- **Sell:** Price below cloud, Tenkan crosses below Kijun\n- **Strengths:** All-in-one indicator (trend, momentum, support\u002Fresistance)\n- **Weaknesses:** Complex visually, lagging in fast markets\n- **Best in:** Trending markets. Avoid in ranging\u002Fsideways.\n- Michael Automates created an AI-improved Ichimoku strategy that performs well\n\n### Super Trend\n- **Formula:** Based on ATR (Average True Range) and a multiplier\n- Upper Band = (High + Low) \u002F 2 + (Multiplier × ATR)\n- Lower Band = (High + Low) \u002F 2 - (Multiplier × ATR)\n- **Buy:** Price crosses above Super Trend line\n- **Sell:** Price crosses below Super Trend line\n- **Strengths:** Simple, good trend-following, clear signals\n- **Weaknesses:** Late entries, bad in ranging markets\n- AI iteration took Super Trend from 44% to 3,605% P&L in Michael Automates' testing\n\n### VWAP (Volume-Weighted Average Price)\n- **Formula:** `Sum(Price × Volume) \u002F Total Volume` (intraday only)\n- Above VWAP = bullish intraday\n- Below VWAP = bearish intraday\n- Institutional benchmark — they buy below VWAP, sell above\n- Resets daily — intraday tool only\n\n---\n\n## 4. SIGNAL COMBINATIONS\n\n### Strong Buy Signal (High Confidence)\nAll of these together:\n- RSI \u003C 30 (oversold) AND recovering\n- MACD crossing above signal line\n- Price bouncing off lower Bollinger Band\n- Volume increasing on the bounce\n- Price above 200-day MA (long-term uptrend intact)\n- Fundamentals solid (P\u002FE reasonable, FCF positive, revenue growing)\n\n### Moderate Buy Signal\n- RSI between 40-50 in an uptrend (pullback buy)\n- Price touching 50-day MA support\n- MACD histogram turning positive\n- Volume above average\n\n### Trend-Following Entry\n- Golden Cross (50-day crosses above 200-day)\n- Price breaks above resistance with high volume\n- ADX > 25 confirming trend strength\n- Buy on first pullback after breakout\n\n### Strong Sell Signal\n- RSI > 70 in a ranging market\n- Price hitting upper Bollinger Band with declining volume\n- MACD crossing below signal line\n- Price reaching prior resistance level\n\n**RULE: Never rely on a single indicator. Always combine 2-3 minimum.**\n\n---\n\n## 5. POSITION SIZING\n\n### The 1% Rule\nNever risk more than 1% of total account on a single trade.\n- Account: $1,000 → max risk per trade: $10\n- If stop-loss is $2 below entry → buy 5 shares max\n- Keeps you alive through losing streaks\n\n### Kelly Criterion\n- `f = (bp - q) \u002F b`\n- b = win\u002Floss ratio, p = win probability, q = loss probability\n- Gives optimal position size based on historical win rate\n- **Use half-Kelly** for safety (most professionals do)\n\n### Example\n- Win rate: 55%, average win: $200, average loss: $100\n- Kelly: f = (2 × 0.55 - 0.45) \u002F 2 = 0.325 (32.5% of account)\n- Half-Kelly: 16.25% — still aggressive, many pros use quarter-Kelly\n\n---\n\n## 6. EXIT STRATEGIES\n\n### Stop-Loss Types\n- **Fixed percentage:** Sell if price drops X% (typically 5-8%)\n- **ATR-based:** Stop at entry minus 2× Average True Range (adjusts for volatility)\n- **Support-based:** Stop below key support level or moving average\n- **Trailing stop:** Moves up with price, locks in profits (e.g., trail by 5%)\n\n### Take-Profit Methods\n- **Fixed target:** Pre-set price target (e.g., 2:1 or 3:1 risk\u002Freward)\n- **Technical target:** Previous resistance level, Fibonacci extension\n- **Trailing:** Let winners run with trailing stop\n\n### The 3 Hardest Sells\n1. **Cutting losses** — \"it'll come back\" kills accounts. Honor your stops.\n2. **Taking profits too early** — use trailing stops to let winners run\n3. **Holding through earnings** — volatility spikes. Reduce position or hedge.\n\n---\n\n## 7. STRATEGY ARCHETYPES\n\n### Mean Reversion\n- **Theory:** Prices revert to their historical average over time\n- **Entry:** Buy when RSI \u003C 30 or price 2+ standard deviations below mean\n- **Exit:** Sell when RSI > 70 or price returns to mean\n- **Tools:** Z-scores, Bollinger Bands, RSI\n- **Best in:** Range-bound\u002Fsideways markets\n- **Weakness:** Fails badly in strong trending markets (price keeps going)\n- **Key stat:** Z-score above 1.5 or below -1.5 signals opportunity\n\n### Momentum\n- **Theory:** Stocks that are going up tend to keep going up (and vice versa)\n- **Entry:** Buy stocks with strongest 3-6 month performance\n- **Exit:** Sell when momentum weakens (MACD crossover, RSI divergence)\n- **Philosophy:** \"Buy high, sell higher\" — opposite of value investing\n- **Best in:** Trending markets with clear direction\n- **Weakness:** Sudden reversals can be devastating\n- **Key tools:** Trend lines, MACD, RSI, relative strength vs index\n\n### Moving Average Crossover\n- **Entry:** Buy on Golden Cross (50-day crosses above 200-day)\n- **Exit:** Sell on Death Cross (50-day crosses below 200-day)\n- **Pros:** Simple, catches major trends\n- **Cons:** Very lagging — you'll miss the first 10-20% of a move and give back 10-20% at the end\n- **Variant:** Use shorter MAs (9\u002F21) for faster signals but more noise\n\n### Bollinger Band Squeeze\n- **Entry:** When bands contract to minimum width, enter on the breakout direction with volume confirmation\n- **Exit:** When price reaches opposite band or bands start contracting again\n- **Key:** The squeeze only tells you a big move is coming — NOT the direction\n- **Must combine with:** Volume, MACD, or other directional indicator\n\n### Pairs Trading\n- **Origin:** Morgan Stanley, mid-1980s\n- **How:** Find two highly correlated stocks (0.80+ correlation). When they diverge, go long the underperformer, short the outperformer\n- **Profit:** When they converge back to historical correlation\n- **Market-neutral:** Hedged against broad market moves\n- **Risk:** Correlation can break permanently (one company's fundamentals change)\n- **Example:** Coca-Cola vs Pepsi, Visa vs Mastercard\n\n### VWAP Reversion (Intraday)\n- **Entry:** Buy below VWAP when overall trend is bullish\n- **Exit:** Sell above VWAP or at end of day\n- **Best for:** Day trading liquid stocks\n- **Why it works:** Institutional traders use VWAP as a benchmark\n\n---\n\n## 8. BACKTESTING\n\n### The 4 Deadly Biases\n1. **Optimization Bias (Curve Fitting):** Over-tuning to historical data. Fix: minimal parameters, out-of-sample testing\n2. **Look-Ahead Bias:** Using future data accidentally. Fix: strict chronological processing\n3. **Survivorship Bias:** Only testing stocks that exist today. Fix: survivorship-free datasets or recent data\n4. **Psychological Tolerance Bias:** A 25% drawdown looks fine on a chart but feels devastating in real-time\n\n### Key Metrics\n| Metric | Formula | Good | Great |\n|--------|---------|------|-------|\n| Sharpe Ratio | (Return - Risk-Free) \u002F Std Dev | >1 | >2 |\n| Max Drawdown | Worst peak-to-trough | \u003C20% | \u003C10% |\n| Win Rate | Wins \u002F Total Trades | >40% | >55% |\n| Profit Factor | Gross Profits \u002F Gross Losses | >1.5 | >2 |\n| Risk\u002FReward | Avg Win \u002F Avg Loss | >2:1 | >3:1 |\n\n**Expected Return per Trade:** `(Win% × Avg Win) + (Loss% × Avg Loss)` — must be positive\n\n### Drawdown Math (Critical)\n- 10% loss → need 11% gain to recover\n- 20% loss → need 25% gain to recover\n- 30% loss → need 43% gain to recover\n- 50% loss → need 100% gain to recover\n- **The math gets exponentially worse.** Avoiding big losses > chasing big wins.\n\n### Process\n1. Define strategy rules with zero ambiguity\n2. Get clean OHLCV data (Open, High, Low, Close, Volume)\n3. Build engine (Python: backtrader, vectorbt, quantstats)\n4. Split: 70% training \u002F 30% out-of-sample validation\n5. Run Monte Carlo simulation (randomize trade order) for robustness\n6. Paper trade winners for 3+ months\n7. Go live small — start with minimum position sizes\n\n### Michael Automates Backtesting Workflow (Proven)\nHis backtesting engine ($99) does this — we can replicate for free:\n1. **Get historical OHLCV data** (from CCXT\u002FBinance\u002FAlpaca — free)\n2. **AI creates Python version** of your trading strategy\n3. **Run backtest locally** → get metrics\n4. **Compare with TradingView numbers** to verify accuracy\n5. **If numbers don't match:** Export TradingView Excel report, do trade-by-trade comparison\n6. **AI can auto-fix discrepancies** by modifying the backtest engine code\n7. **Critical settings:** Commission = 0.1%, timezone = UTC, date range = not full history\n\n**Auto-download data:**\n- CCXT pulls from Binance, Coinbase, Kraken automatically\n- Store in `\u002Fdata\u002Fcache\u002F` folder by asset and timeframe\n- Format: `BTC_USDT_1d.csv`, `ETH_USDT_4h.csv`, etc.\n\n### Data Sources\n- **Free:** Yahoo Finance (yfinance), Alpha Vantage, Alpaca, Polygon.io free tier, CCXT (100+ crypto exchanges)\n- **Paid:** Norgate, Nasdaq Data Link (Quandl)\n- **Warning:** Yahoo Finance has survivorship bias\n- **Best for crypto:** CCXT + Binance (most history, most pairs)\n- **Best for stocks:** Alpaca (free, clean data, built-in paper trading)\n\n---\n\n## 9. RISK MANAGEMENT\n\n### Core Rules\n- **1% Rule:** Never risk more than 1% of account per trade\n- **Daily Loss Limit:** Stop trading if down 3% in a day\n- **Correlation Risk:** Don't hold 5 tech stocks — one sector crash kills you\n- **Position Limits:** Max 5-10 open positions at once\n- **Cash Reserve:** Always keep 20-30% cash for opportunities\n\n### Circuit Breakers\n- Hit daily loss limit → done for the day\n- Hit weekly loss limit (5%) → reduce position sizes 50%\n- Hit monthly loss limit (10%) → pause, review all strategies\n- 3 consecutive losses → take a break, re-evaluate\n\n### Fees & Slippage (Often Ignored)\n- Commission-free doesn't mean cost-free — there's still the spread\n- Slippage: the difference between expected and actual execution price\n- High-frequency strategies amplify these costs\n- **Always include fees + slippage in backtests** or results are meaningless\n\n---\n\n## 10. COMMON MISTAKES\n\n1. **Trading without a plan** → Write rules BEFORE trading\n2. **Ignoring position sizing** → The 1% rule exists for a reason\n3. **Moving stop-losses** → Set them and honor them\n4. **Averaging down** → Adding to losers hoping they'll recover\n5. **Overtrading** → More trades ≠ more profit (costs eat you alive)\n6. **Single indicator reliance** → Always combine 2-3 indicators\n7. **Not accounting for fees** → Especially in backtests\n8. **Skipping paper trading** → Going live without 3+ months of validation\n9. **Revenge trading** → Trying to win back losses with bigger bets\n10. **Ignoring the macro** → Individual stocks don't exist in a vacuum\n\n---\n\n## 11. TOOLS & APIS\n\n### Broker APIs\n- **Alpaca** — Commission-free, great API, paper trading built in (RECOMMENDED for us)\n- **Interactive Brokers** — Most comprehensive, supports everything\n- **TD Ameritrade\u002FSchwab** — thinkorswim API\n\n### Data APIs\n- **Alpha Vantage** — Free tier (5 calls\u002Fmin), stocks + crypto + forex\n- **Polygon.io** — Real-time and historical, free tier\n- **Yahoo Finance** — Free via yfinance (unreliable, survivorship bias)\n- **Alpaca Market Data** — Included with account\n\n### Python Stack\n- **pandas** — Data manipulation\n- **numpy** — Numerical computing\n- **ta-lib \u002F pandas-ta** — Technical indicators\n- **backtrader** — Full backtesting framework\n- **vectorbt** — Fast vectorized backtesting\n- **quantstats** — Portfolio analytics\n- **scikit-learn** — ML pattern recognition\n- **alpaca-trade-api** — Broker integration\n\n### Architecture\n```\n[Data Feed] → [Indicator Engine] → [Signal Generator] → [Risk Manager] → [Order Executor]\n     ↑                                                           |\n     └──────────── [Backtesting Engine] ←────────────────────────┘\n                          ↓\n                   [Performance Analytics]\n```\n\n---\n\n## 12. CRYPTO-SPECIFIC STRATEGIES (From Video Research)\n\n### Super Trend Strategy\n- Built-in TradingView indicator\n- AI can iterate: base version (44% P&L) → optimized V4 (3,605% P&L)\n- Process: give AI base → \"improve it\" → backtest → repeat overnight\n- Test on multiple assets to avoid overfitting\n\n### Strategy Tournament (Evolution Method)\n- Create 10 different strategies with different parameters\u002Flogic\n- Run all 10 in parallel with small positions ($100 each)\n- After 1-2 weeks: cut losers, keep winners\n- Create variations of winners, repeat process\n- Natural selection for trading strategies\n\n### Market Regime Detection\n- Run separate strategies for trending vs ranging markets\n- AI detects current regime and switches strategies automatically\n- Trend-following for trending markets, mean reversion for ranging\n\n### Prediction Market Strategies (Polymarket)\n- **15-Minute Windows:** BTC up\u002Fdown resolution every 15 minutes\n- **Late Entry:** Look at trend in last 3-4 minutes, enter in that direction\n- **Arbitrage:** When both sides cost \u003C$1 total = guaranteed profit\n- **Mention Markets:** AI studies speech patterns to predict word usage\n- **Sports Scanner:** AI researches obscure low-volume markets for edges\n- **Counter-Trend AI:** Bet against AI consensus (contrarian)\n- **Wallet Analysis:** Copy successful wallets → AI reverse-engineers their strategy\n- KEY: Not dependent on bull\u002Fbear markets — works always\n\n### Multi-Agent Trading Architecture\n- **Coordinator:** Delegates tasks, manages priorities, daily briefing\n- **Quant Scanner:** Scans 30+ coins every 15 min with CCXT, confluence scoring\n- **Researcher:** Daily news\u002Fintel scanning, deep dives\n- **Alert Agent:** Formats and delivers signals\n- **Security Agent:** 24hr audit for malicious code, prompt injections, bugs\n- Each agent needs a detailed \"soul\" (personality + instructions)\n- Agents work in parallel, not sequentially\n\n### Crypto Exchange APIs\n- **Hyperliquid** — Decentralized perps, no KYC, good API\n- **Blofin** — Centralized, API with trading perms (disable withdrawals!)\n- **CCXT Library** — Open-source, supports 100+ exchanges, start read-only\n- **Alpaca** — Stocks (commission-free, paper trading built in)\n\n### AI Strategy Iteration Workflow (KEY — From Michael Automates)\nThis is the single most powerful workflow from all our research:\n1. **Pick a base strategy** (e.g., Super Trend, RSI+MACD, Bollinger Squeeze)\n2. **AI backtests it** → gets baseline metrics (P&L, drawdown, win rate, Sharpe)\n3. **Tell AI \"improve this\"** → it modifies parameters, adds filters, changes logic\n4. **AI creates V2, V3, V4...** each iteration potentially better\n5. **Compare AI numbers with TradingView** to verify accuracy\n6. **LET IT RUN OVERNIGHT** — wake up to results\n7. **Score across multiple assets** (BTC, ETH, SOL, SPY, AAPL) to avoid overfitting\n8. **Only keep strategies that work on 3+ different assets**\n9. Repeat until you have top 3 strategies → paper trade those\n\n**Michael's results:** Super Trend went from 44% P&L → 3,605% P&L through this process.\n\n**Critical anti-overfitting rules:**\n- Test on multiple assets, not just one\n- Use walk-forward validation (train on years 1-3, test on years 4-5)\n- If a strategy only works on one asset, it's overfit — discard it\n- Commission must be set to 0.1% (not 0%)\n- TradingView timezone must be UTC for number matching\n\n### Strategy Tournament (From Alex Carter)\n1. Create 10 different strategies (vary parameters, timeframes, indicators)\n2. Run ALL 10 in parallel with small positions ($100 each)\n3. Track for 1-2 weeks\n4. Kill bottom 5 performers\n5. Create mutations\u002Fvariations of top 5\n6. Run new tournament\n7. Repeat — \"evolution for trading strategies\"\n8. After 3-4 rounds, surviving strategies are battle-tested\n\n### Counter-Trend Against AI Crowd (From Coin Bureau)\n- Most AI trading bots use similar data and strategies\n- When AI crowd consensus is heavy one direction, bet the opposite\n- Works because: AI herding creates overcrowded trades that reverse\n- Requires: monitoring what popular AI strategies are doing\n- Best for: short-term contrarian plays in crypto and prediction markets\n\n### Divergence Trading (From Coin Bureau)\n- Use TBT Divergence indicator on 15-minute timeframe\n- Contrarian entry when price makes new high\u002Flow but indicator doesn't confirm\n- Specifically: price up but RSI\u002FMACD diverging = weakening momentum\n- Enter against the trend on confirmed divergence\n- Best for: short-term crypto and Polymarket 15-min windows\n\n### Critical Crypto Trading Rules\n- NEVER enable withdrawal permissions on API keys\n- Whitelist your IP on centralized exchanges\n- Store keys in .env files, never hardcoded\n- Use testnet\u002Fpaper trading first\n- Rotate API keys every few months\n- Run on dedicated machine (not personal computer)\n- Daily security audit via cron job\n\n---\n\n## 13. POLYMARKET (PREDICTION MARKETS)\n\n### How It Works\n- Binary markets: buy Yes\u002FNo shares in real-world outcomes\n- Correct = $1.00 payout, wrong = $0.00\n- Price = probability (Yes at $0.70 = market thinks 70% likely)\n- Runs on Polygon (Ethereum L2), uses USDC.e\n- Python SDK: `py-clob-client`\n- Public data API (no auth): `gamma-api.polymarket.com`\n\n### Strategy Types\n1. **Arbitrage** — Yes + No \u003C $1.00 = free money (rare, need speed)\n2. **Late Entry** — 15-min BTC windows, enter last 3-4 min when trend is clear\n3. **Mention Markets** — AI analyzes speech patterns to predict word usage\n4. **Obscure Sports** — Low-volume markets with inefficient pricing\n5. **Wallet Analysis** — Reverse-engineer top performers' strategies\n6. **Market Making** — Provide liquidity, profit from spread (advanced)\n\n### Why AI Has an Edge\n- Can process more data than any human (speeches, news, stats)\n- 24\u002F7 monitoring of all markets simultaneously\n- Niche markets have little competition = more mispricing\n- Uncorrelated to stock\u002Fcrypto markets — works in any cycle\n\n### Market Making (Advanced)\n- Place both buy and sell orders, profit from the spread\n- Requires: understanding inventory risk, dynamic spread adjustment\n- Need algorithm to adjust quotes based on position, volatility, flow\n- Complex math but AI handles research and implementation\n- Start with wide spreads in low-volume markets, tighten as you learn\n- Risk: getting stuck holding losing positions if market moves fast\n\n### TBO Cloud Strategy (Coin Bureau — Proprietary)\n- Trending Breakout indicator on 4-hour timeframe\n- Advanced moving average strategy — details not public\n- Combined with TBT Divergence indicator for entry\u002Fexit\n- We can build similar: EMA cloud (9\u002F21\u002F55 EMAs) with breakout confirmation\n- Key concept: cloud acts as dynamic support\u002Fresistance, breakout above = long\n\n### Key Insight\nBuild scanner first (read-only, free). Paper trade. Then go live small.\n\n---\n\n## 14. CRYPTO vs STOCK STRATEGIES — WHAT TRANSFERS\n\n### Strategies That Work in BOTH Markets\n| Strategy | Stocks | Crypto | Notes |\n|----------|--------|--------|-------|\n| Trend Following | ✅ | ✅ | Works in any market with trends |\n| Mean Reversion | ✅ | ✅ | Better in stocks (more mean-reverting) |\n| RSI\u002FMACD Signals | ✅ | ✅ | Same indicators, different parameters |\n| Bollinger Bands | ✅ | ✅ | Adjust for volatility differences |\n| Pairs Trading | ✅ | ✅ | Stocks: KO\u002FPEP. Crypto: BTC\u002FETH |\n| Moving Average Crossover | ✅ | ✅ | Universal trend indicator |\n| Ichimoku Cloud | ✅ | ✅ | Works anywhere with enough volume |\n| Strategy Tournament | ✅ | ✅ | Run 10 strategies, evolve winners |\n| AI Iteration | ✅ | ✅ | Give AI base strategy, let it improve |\n\n### Key Differences\n| Factor | Stocks | Crypto |\n|--------|--------|--------|\n| Hours | 9:30 AM - 4 PM ET | 24\u002F7\u002F365 |\n| Volatility | Lower (1-3% daily avg) | Higher (5-10%+ daily avg) |\n| Leverage | 2x (margin), options for more | 10-100x available |\n| Regulation | Heavy (SEC, FINRA) | Light (evolving) |\n| Data Quality | Excellent (decades) | Good (5-10 years) |\n| Fees | Commission-free (Alpaca) | 0.1% typical |\n| Short Selling | Restricted (uptick rule) | Easy (perps) |\n| Pattern Day Trading | $25K minimum (PDT rule) | No restriction |\n| Market Manipulation | Illegal, enforced | Common, less enforcement |\n\n### What Needs Adjusting for Stocks\n- **Wider MA periods** — crypto is faster, use longer MAs for stocks to filter noise\n- **Lower leverage** — 2x max for stocks vs 5-10x crypto\n- **Market hours** — need pre\u002Fafter-hours data handling, overnight gaps\n- **PDT Rule** — if under $25K, limited to 3 day trades per 5 business days\n- **Earnings events** — stocks have scheduled volatility events quarterly\n- **Sector correlation** — stocks in same sector move together more than crypto\n- **Volume patterns** — stocks have predictable volume curves (open, close spikes)\n\n### Bottom Line\n**Yes, the core strategies transfer to stocks.** The math is the same. What changes:\n1. Parameters (slower timeframes for stocks)\n2. Risk settings (lower leverage, wider stops)\n3. Schedule (market hours vs 24\u002F7)\n4. Starting capital ($25K for day trading stocks due to PDT rule, or use swing trading to avoid it)\n\n**Best starting point for stocks:** Alpaca (free, commission-free, paper trading built in, great API). Same strategies, just tune the parameters.\n\n---\n\n## 15. MULTI-AGENT TRADING DESK (From Coin Bureau)\n\n### Architecture\nEach agent gets a detailed \"soul\" (personality + priorities + instructions). Without a soul, agents produce generic output.\n\n### Agent Roles\n1. **Coordinator (Betty)** — Manager agent. Delegates tasks, manages priorities, monitors agent health, delivers daily briefing. Never does the work itself.\n\n2. **Quant Scanner** — Scans 30+ coins every 15 minutes via cron job. Uses CCXT for OHLCV data. Runs indicators (RSI, MACD, Bollinger, etc). Produces confluence score for each signal. Rules: never places trades without operator approval.\n\n3. **Researcher** — Runs daily. Scans news, X\u002FTwitter, market updates. Produces morning research brief. Focused on narratives, sectors, new listings.\n\n4. **Alert Agent** — Formats signals from quant scanner into actionable alerts. Pushes to Discord channels. Includes: asset, timeframe, direction, confidence score, entry\u002Fexit suggestions.\n\n5. **Security Agent (Radar)** — 24hr security audit. Checks for malicious code, prompt injections, bugs. Quality assurance on all strategy code before deployment. Non-negotiable.\n\n6. **Backtesting Agent** — Validates strategies against historical data before deployment.\n\n7. **Trading Agent** — Executes trades on exchange APIs. Only activated after paper trading period.\n\n### Notification Pipeline (Discord Recommended)\n- Private Discord server with bot admin privileges\n- Bot creates channels per category (signals, research, alerts, P&L)\n- Curated alerts — only coins\u002Fmarkets you care about\n- Much better than Telegram (categories, threads, searchable)\n\n### Key Insight From Coin Bureau\n\"Your output is only as good as your input.\" Generic prompts = generic agents. Spend time writing detailed soul descriptions for each agent. Include:\n- Exact responsibilities\n- What data to use\n- What format to output\n- What rules to follow\n- What to never do\n\n### Cost Reality\n- Claude Max ($200\u002Fmo) — unlimited for heavy agent usage\n- API credits alternative: $1,000-10,000\u002Fmo depending on volume\n- Ollama (free) — can run specific tasks locally but less smart\n- Strategy: use Claude for complex work, Ollama for routine scans\n\n---\n\n## 16. OUR APPROACH\n\n### Phase 1: Foundation\n- Set up Alpaca paper trading (free)\n- Build data pipeline for historical OHLCV data\n- Implement core indicators: RSI, MACD, Bollinger, MAs, Volume\n- Build backtesting engine with walk-forward validation\n\n### Phase 2: Strategy Development\n- Backtest all 6 strategy archetypes against 5-10 years of data\n- Find highest Sharpe ratio + lowest max drawdown combo\n- Monte Carlo simulations for robustness\n- Paper trade top 2-3 strategies simultaneously\n\n### Phase 3: Live (After 3+ Months Paper)\n- Minimum position sizes\n- AI-driven condition analysis (use Claude to interpret market context)\n- Full risk management: 1% rule, daily limits, circuit breakers\n- Dashboard monitoring all positions, signals, performance\n\n### Key Principles\n1. Paper trade until proven over 3+ months\n2. Position sizing > entry signals\n3. Risk management is the ONLY thing that keeps you in the game\n4. No single indicator is reliable alone\n5. Past performance ≠ future results\n6. Start with stocks, not crypto (more data, less manipulation)\n7. Account for fees, slippage, and taxes ALWAYS\n",{"name":5,"description":7},"master","4aa004da461d820f4ea5499e58eb8d196cf99016","community\u002Fclawhub\u002Ft\u002Ftrading-strategies",0,"https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge","https:\u002F\u002Fskill-explorer-rho.vercel.app","https:\u002F\u002Fgithub.com\u002FLord1Egypt","Unbreakable. Unstoppable. Unmatched⚡.\r\n Speaker of machine tongues 🤖  | World-builder of decentralized dreams 🌐 | Defender of the digital realm🛡️.","2026-06-10 08:21:01",{"source":8,"skillName":5,"commands":34,"prompt":44,"zipAvailable":45},[35,38,41],{"tool":36,"command":37},"npx","npx skills add Lord1Egypt\u002Fawesome-skill-forge --skill trading",{"tool":39,"command":40},"bunx","bunx skills add Lord1Egypt\u002Fawesome-skill-forge --skill trading",{"tool":42,"command":43},"pnpm","pnpm dlx skills add Lord1Egypt\u002Fawesome-skill-forge --skill trading","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fcommunity\u002Fclawhub\u002Ft\u002Ftrading-strategies\u002FSKILL.md",true,[],[48,55,62,69,76,83],{"skillNo":49,"name":50,"nameZh":6,"description":51,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":52,"categories":53,"keywords":54,"publishedAt":19},"01M785WKJB99G3STR1NF9NRTJW","youtube-content","YouTube transcripts to summaries, threads, blogs.","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fskills\u002Fyoutube-content\u002FSKILL.md",[],[],{"skillNo":56,"name":57,"nameZh":6,"description":58,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":59,"categories":60,"keywords":61,"publishedAt":19},"01M785WEFHB0G2S9YA6EPR3H0E","xurl","X\u002FTwitter via xurl CLI: post, search, DM, media, v2 API.","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fskills\u002Fxurl\u002FSKILL.md",[],[],{"skillNo":63,"name":64,"nameZh":6,"description":65,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":66,"categories":67,"keywords":68,"publishedAt":19},"01M785W98EDN4EFJXJPMQEHCRC","touchdesigner-mcp","Control a running TouchDesigner instance via twozero MCP — create operators, set parameters, wire connections, execute Python, build real-time visuals. 36 native tools.","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fskills\u002Ftouchdesigner-mcp\u002FSKILL.md",[],[],{"skillNo":70,"name":71,"nameZh":6,"description":72,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":73,"categories":74,"keywords":75,"publishedAt":19},"01M785W5S9FP3QBH2V191E025P","test-driven-development","TDD: enforce RED-GREEN-REFACTOR, tests before code.","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fskills\u002Ftest-driven-development\u002FSKILL.md",[],[],{"skillNo":77,"name":78,"nameZh":6,"description":79,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":80,"categories":81,"keywords":82,"publishedAt":19},"01M785W2AS08NSSH9YATCV6FJB","teams-meeting-pipeline","Operate the Teams meeting summary pipeline via Hermes CLI — summarize meetings, inspect pipeline status, replay jobs, manage Microsoft Graph subscriptions.","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fskills\u002Fteams-meeting-pipeline\u002FSKILL.md",[],[],{"skillNo":84,"name":85,"nameZh":6,"description":86,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":87,"categories":88,"keywords":89,"publishedAt":19},"01M785VXKW4T34BTP1SCHW1R7F","systematic-debugging","4-phase root cause debugging: understand bugs before fixing.","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fskills\u002Fsystematic-debugging\u002FSKILL.md",[],[]]