feat: Add Phase 4 advanced metrics and components
- Add advanced metrics dashboard with trade analytics - Add new trading components (EntryTypeAnalysis, MultiDayPositionTracker, NewsEventTracker, etc.) - Add strategy mode selector and trend confirmation - Add risk automation panel and slippage correlation analysis - Add daily trading plan enhancements with modal components - Add custom hooks (useApi, useLocalStorage, useAdvancedTradeMetrics) - Add broker service integration and trading API - Add test setup and vitest configuration - Include parquet data files for live market data - Add comprehensive documentation in docs/ folder
This commit is contained in:
@@ -0,0 +1,641 @@
|
||||
"""
|
||||
Trading Schools & Methodologies
|
||||
Comprehensive collection of trading approaches combining different schools of thought
|
||||
"""
|
||||
|
||||
from typing import Dict, List, Any
|
||||
from enum import Enum
|
||||
|
||||
|
||||
class TradingSchool(str, Enum):
|
||||
"""Major trading methodologies and schools"""
|
||||
ICT = "ict" # Inner Circle Trader / Smart Money Concepts
|
||||
WYCKOFF = "wyckoff" # Wyckoff Method
|
||||
ELLIOTT_WAVE = "elliott_wave" # Elliott Wave Theory
|
||||
MARKET_PROFILE = "market_profile" # Market Profile / Volume Profile
|
||||
ORDER_FLOW = "order_flow" # Order Flow / Footprint
|
||||
PRICE_ACTION = "price_action" # Pure Price Action
|
||||
TECHNICAL_ANALYSIS = "technical_analysis" # Classical Technical Analysis
|
||||
SUPPLY_DEMAND = "supply_demand" # Supply & Demand Zones
|
||||
FIBONACCI = "fibonacci" # Fibonacci-based Trading
|
||||
FUNDAMENTAL = "fundamental" # Fundamental Analysis for Gold
|
||||
SENTIMENT = "sentiment" # Market Sentiment Analysis
|
||||
SEASONAL = "seasonal" # Seasonal Patterns
|
||||
INTERMARKET = "intermarket" # Intermarket Analysis
|
||||
|
||||
|
||||
class TradingStrategy:
|
||||
"""Base class for trading strategies"""
|
||||
|
||||
@staticmethod
|
||||
def get_all_schools() -> Dict[str, Dict[str, Any]]:
|
||||
"""Get comprehensive information about all trading schools"""
|
||||
return {
|
||||
"ict_smc": {
|
||||
"name": "ICT / Smart Money Concepts",
|
||||
"school": TradingSchool.ICT,
|
||||
"description": "Inner Circle Trader methodology focusing on institutional order flow, liquidity sweeps, and market structure",
|
||||
"key_concepts": [
|
||||
"Order Blocks (OB)",
|
||||
"Fair Value Gaps (FVG/Imbalance)",
|
||||
"Liquidity Voids",
|
||||
"Break of Structure (BOS)",
|
||||
"Change of Character (ChoCh)",
|
||||
"Displacement",
|
||||
"Premium/Discount Zones",
|
||||
"London/NY Killzones",
|
||||
"Judas Swing",
|
||||
"Optimal Trade Entry (OTE 0.618-0.79)",
|
||||
"Stop Hunt/Liquidity Grab",
|
||||
"Market Maker Model (Accumulation, Manipulation, Distribution)"
|
||||
],
|
||||
"timeframes": ["5m", "15m", "1h", "4h", "1D"],
|
||||
"indicators": [], # Pure price action, minimal indicators
|
||||
"best_for": ["Day trading", "Swing trading", "Gold/Forex"],
|
||||
"sessions": ["London (3-5 AM EST)", "NY (8-11 AM EST)"],
|
||||
"entry_criteria": [
|
||||
"Identify market structure (bullish/bearish)",
|
||||
"Wait for BOS or ChoCh",
|
||||
"Find FVG or Order Block",
|
||||
"Look for liquidity sweep",
|
||||
"Enter on retracement to OTE (0.618-0.79 Fib)",
|
||||
"Target opposite liquidity"
|
||||
],
|
||||
"risk_management": {
|
||||
"stop_loss": "Above/below order block or FVG",
|
||||
"take_profit": "Opposite side liquidity, FVG, or major structure",
|
||||
"rr_ratio": "Minimum 1:2, typically 1:3+"
|
||||
}
|
||||
},
|
||||
"wyckoff": {
|
||||
"name": "Wyckoff Method",
|
||||
"school": TradingSchool.WYCKOFF,
|
||||
"description": "Volume-based methodology analyzing accumulation, distribution, and composite operator behavior",
|
||||
"key_concepts": [
|
||||
"Accumulation (Spring, Backup, SOS)",
|
||||
"Distribution (UTAD, SOW)",
|
||||
"Re-accumulation",
|
||||
"Re-distribution",
|
||||
"Cause and Effect",
|
||||
"Effort vs Result",
|
||||
"Composite Man/Operator",
|
||||
"Three Laws (Supply/Demand, Cause/Effect, Effort/Result)",
|
||||
"Volume Spread Analysis (VSA)",
|
||||
"Schematic Patterns (AR, ST, Creek, Spring)"
|
||||
],
|
||||
"timeframes": ["4h", "1D", "1W"],
|
||||
"indicators": ["Volume", "Volume Profile", "OBV"],
|
||||
"best_for": ["Position trading", "Swing trading"],
|
||||
"phases": ["Accumulation Phase", "Markup Phase", "Distribution Phase", "Markdown Phase"],
|
||||
"entry_criteria": [
|
||||
"Identify current phase",
|
||||
"Wait for spring (accumulation) or upthrust (distribution)",
|
||||
"Confirm with volume",
|
||||
"Enter on Sign of Strength (SOS) or Last Point of Support (LPS)",
|
||||
"Target: Measured move based on trading range"
|
||||
],
|
||||
"risk_management": {
|
||||
"stop_loss": "Below spring or support area",
|
||||
"take_profit": "Measured move from accumulation range",
|
||||
"rr_ratio": "Minimum 1:2"
|
||||
}
|
||||
},
|
||||
"elliott_wave": {
|
||||
"name": "Elliott Wave Theory",
|
||||
"school": TradingSchool.ELLIOTT_WAVE,
|
||||
"description": "Fractal pattern analysis based on wave structures and Fibonacci relationships",
|
||||
"key_concepts": [
|
||||
"Impulse Waves (1-2-3-4-5)",
|
||||
"Corrective Waves (A-B-C)",
|
||||
"Wave Degrees (Grand Super Cycle to Sub-Minuette)",
|
||||
"Fibonacci Extensions (1.618, 2.618)",
|
||||
"Fibonacci Retracements (0.382, 0.5, 0.618)",
|
||||
"Wave Personality (Wave 3 strongest)",
|
||||
"Alternation Principle",
|
||||
"Channeling Techniques",
|
||||
"Wave Equality",
|
||||
"Ending Diagonals",
|
||||
"Leading Diagonals"
|
||||
],
|
||||
"timeframes": ["1h", "4h", "1D", "1W"],
|
||||
"indicators": ["Fibonacci", "EMA", "RSI for divergence"],
|
||||
"best_for": ["Swing trading", "Position trading"],
|
||||
"entry_criteria": [
|
||||
"Identify current wave structure",
|
||||
"Enter at wave 2 or 4 retracement (0.618)",
|
||||
"Enter at wave C completion (corrective)",
|
||||
"Confirm with volume and momentum",
|
||||
"Target: Wave 3 = 1.618x Wave 1, Wave 5 = Wave 1"
|
||||
],
|
||||
"risk_management": {
|
||||
"stop_loss": "Below wave 1 start or key Fibonacci level",
|
||||
"take_profit": "Fibonacci extensions (1.618, 2.618)",
|
||||
"rr_ratio": "Minimum 1:3"
|
||||
}
|
||||
},
|
||||
"market_profile": {
|
||||
"name": "Market Profile / Volume Profile",
|
||||
"school": TradingSchool.MARKET_PROFILE,
|
||||
"description": "Time and volume-based analysis identifying value areas and market acceptance",
|
||||
"key_concepts": [
|
||||
"Point of Control (POC)",
|
||||
"Value Area (VA)",
|
||||
"Value Area High (VAH)",
|
||||
"Value Area Low (VAL)",
|
||||
"Initial Balance (IB)",
|
||||
"TPO (Time Price Opportunity)",
|
||||
"High Volume Nodes (HVN)",
|
||||
"Low Volume Nodes (LVN)",
|
||||
"Excess",
|
||||
"Poor Highs/Lows",
|
||||
"Single Prints",
|
||||
"Profiles (P-shaped, b-shaped, D-shaped)"
|
||||
],
|
||||
"timeframes": ["30m", "1h", "1D"],
|
||||
"indicators": ["Volume Profile", "VWAP", "Volume"],
|
||||
"best_for": ["Day trading", "Swing trading"],
|
||||
"entry_criteria": [
|
||||
"Identify POC and Value Area",
|
||||
"Enter at Value Area extremes (VAL/VAH)",
|
||||
"Trade rejections from LVN",
|
||||
"Target: Opposite side of value area or POC",
|
||||
"Look for acceptance/rejection at key levels"
|
||||
],
|
||||
"risk_management": {
|
||||
"stop_loss": "Beyond value area or single prints",
|
||||
"take_profit": "POC, opposite VA extreme, or LVN",
|
||||
"rr_ratio": "Minimum 1:2"
|
||||
}
|
||||
},
|
||||
"order_flow": {
|
||||
"name": "Order Flow Trading",
|
||||
"school": TradingSchool.ORDER_FLOW,
|
||||
"description": "Real-time bid/ask analysis, footprint charts, and institutional order detection",
|
||||
"key_concepts": [
|
||||
"Delta (Buy - Sell volume)",
|
||||
"Cumulative Delta",
|
||||
"Volume Imbalance",
|
||||
"Absorption",
|
||||
"Stacked Imbalances",
|
||||
"Exhaustion",
|
||||
"Iceberg Orders",
|
||||
"Tape Reading",
|
||||
"Bid/Ask Ladder",
|
||||
"Footprint Charts",
|
||||
"Volume Clusters",
|
||||
"Unfinished Business"
|
||||
],
|
||||
"timeframes": ["1m", "5m", "15m"],
|
||||
"indicators": ["Delta", "Volume Profile", "Cumulative Delta"],
|
||||
"best_for": ["Scalping", "Day trading"],
|
||||
"entry_criteria": [
|
||||
"Identify delta divergence",
|
||||
"Look for absorption at key levels",
|
||||
"Watch for stacked imbalances",
|
||||
"Enter on confirmation of institutional flow",
|
||||
"Target: Next volume cluster or imbalance"
|
||||
],
|
||||
"risk_management": {
|
||||
"stop_loss": "Tight stops beyond absorption zone",
|
||||
"take_profit": "Volume imbalance fill or delta reversal",
|
||||
"rr_ratio": "Minimum 1:1.5 (high win rate strategy)"
|
||||
}
|
||||
},
|
||||
"price_action": {
|
||||
"name": "Pure Price Action",
|
||||
"school": TradingSchool.PRICE_ACTION,
|
||||
"description": "Trading based solely on candlestick patterns, support/resistance, and market structure",
|
||||
"key_concepts": [
|
||||
"Support and Resistance",
|
||||
"Trend Lines",
|
||||
"Horizontal Levels",
|
||||
"Higher Highs / Higher Lows (HH/HL)",
|
||||
"Lower Highs / Lower Lows (LH/LL)",
|
||||
"Pin Bars",
|
||||
"Inside Bars",
|
||||
"Outside Bars",
|
||||
"Engulfing Patterns",
|
||||
"Double Tops/Bottoms",
|
||||
"Head & Shoulders",
|
||||
"Triangles, Flags, Pennants",
|
||||
"Break and Retest"
|
||||
],
|
||||
"timeframes": ["15m", "1h", "4h", "1D"],
|
||||
"indicators": [], # None, pure price action
|
||||
"best_for": ["All trading styles"],
|
||||
"entry_criteria": [
|
||||
"Identify trend and structure",
|
||||
"Wait for pattern formation at key level",
|
||||
"Enter on confirmation candle",
|
||||
"Target: Next major S/R level",
|
||||
"Look for confluence of multiple factors"
|
||||
],
|
||||
"risk_management": {
|
||||
"stop_loss": "Beyond pattern or S/R level",
|
||||
"take_profit": "Risk-reward based on structure",
|
||||
"rr_ratio": "Minimum 1:2"
|
||||
}
|
||||
},
|
||||
"supply_demand": {
|
||||
"name": "Supply & Demand Zones",
|
||||
"school": TradingSchool.SUPPLY_DEMAND,
|
||||
"description": "Zone-based trading focusing on areas of institutional activity and imbalance",
|
||||
"key_concepts": [
|
||||
"Demand Zones (buying pressure)",
|
||||
"Supply Zones (selling pressure)",
|
||||
"Fresh Zones (untested)",
|
||||
"Tested Zones (touched once)",
|
||||
"Rally-Base-Rally (RBR)",
|
||||
"Drop-Base-Drop (DBD)",
|
||||
"Rally-Base-Drop (RBD)",
|
||||
"Drop-Base-Rally (DBR)",
|
||||
"Flip Zones (S/D conversion)",
|
||||
"Strong Zones (sharp moves)",
|
||||
"Weak Zones (slow consolidation)"
|
||||
],
|
||||
"timeframes": ["15m", "1h", "4h", "1D"],
|
||||
"indicators": ["Minimal - sometimes volume"],
|
||||
"best_for": ["Day trading", "Swing trading"],
|
||||
"entry_criteria": [
|
||||
"Identify fresh demand/supply zones",
|
||||
"Wait for price to return to zone",
|
||||
"Enter on confirmation (pin bar, engulfing)",
|
||||
"Target: Opposite supply/demand zone",
|
||||
"Use limit orders in zone"
|
||||
],
|
||||
"risk_management": {
|
||||
"stop_loss": "Beyond zone (few pips/points)",
|
||||
"take_profit": "Next major zone or measured move",
|
||||
"rr_ratio": "Minimum 1:3"
|
||||
}
|
||||
},
|
||||
"fibonacci_trading": {
|
||||
"name": "Fibonacci-Based Trading",
|
||||
"school": TradingSchool.FIBONACCI,
|
||||
"description": "Trading using Fibonacci ratios for retracements, extensions, and time analysis",
|
||||
"key_concepts": [
|
||||
"Fibonacci Retracement (0.236, 0.382, 0.5, 0.618, 0.786)",
|
||||
"Fibonacci Extension (1.272, 1.414, 1.618, 2.618)",
|
||||
"Fibonacci Fans",
|
||||
"Fibonacci Arcs",
|
||||
"Fibonacci Time Zones",
|
||||
"Golden Ratio (1.618)",
|
||||
"Confluence Zones",
|
||||
"AB=CD Pattern",
|
||||
"Gartley Patterns",
|
||||
"Harmonic Patterns (Bat, Butterfly, Crab)"
|
||||
],
|
||||
"timeframes": ["1h", "4h", "1D"],
|
||||
"indicators": ["Fibonacci tools", "RSI for confirmation"],
|
||||
"best_for": ["Swing trading", "Position trading"],
|
||||
"entry_criteria": [
|
||||
"Identify completed impulse move",
|
||||
"Draw Fibonacci from swing low to swing high (or vice versa)",
|
||||
"Wait for retracement to 0.618 or 0.786",
|
||||
"Confirm with candlestick pattern or indicator",
|
||||
"Target: Fibonacci extensions (1.618, 2.618)"
|
||||
],
|
||||
"risk_management": {
|
||||
"stop_loss": "Beyond 0.786 or 1.0 level",
|
||||
"take_profit": "Fibonacci extensions",
|
||||
"rr_ratio": "Minimum 1:2"
|
||||
}
|
||||
},
|
||||
"gold_fundamental": {
|
||||
"name": "Gold Fundamental Analysis",
|
||||
"school": TradingSchool.FUNDAMENTAL,
|
||||
"description": "Trading gold based on macroeconomic factors and fundamental drivers",
|
||||
"key_concepts": [
|
||||
"US Dollar Strength (DXY inverse correlation)",
|
||||
"Real Interest Rates (negative = bullish gold)",
|
||||
"Inflation (CPI, PCE)",
|
||||
"Fed Policy (rate decisions, QE/QT)",
|
||||
"Geopolitical Tensions (safe haven)",
|
||||
"Central Bank Buying",
|
||||
"Bond Yields (10-year Treasury)",
|
||||
"Risk Sentiment (VIX, SPX correlation)",
|
||||
"Physical Demand (jewelry, industrial)",
|
||||
"Gold ETF Flows (GLD, IAU)",
|
||||
"Mining Production",
|
||||
"Seasonal Patterns (Indian wedding season)"
|
||||
],
|
||||
"timeframes": ["1D", "1W", "1M"],
|
||||
"indicators": ["DXY", "10Y Yield", "VIX", "Correlation analysis"],
|
||||
"best_for": ["Position trading", "Long-term investing"],
|
||||
"entry_criteria": [
|
||||
"Analyze macroeconomic backdrop",
|
||||
"USD weakness = gold strength",
|
||||
"Rising inflation + dovish Fed = bullish",
|
||||
"Geopolitical crisis = safe haven bid",
|
||||
"Technical confirmation on daily/weekly"
|
||||
],
|
||||
"risk_management": {
|
||||
"stop_loss": "Based on technical structure",
|
||||
"take_profit": "Major psychological levels ($2000, $2100, etc.)",
|
||||
"rr_ratio": "Variable, often 1:3+"
|
||||
}
|
||||
},
|
||||
"multi_timeframe": {
|
||||
"name": "Multi-Timeframe Analysis",
|
||||
"school": TradingSchool.TECHNICAL_ANALYSIS,
|
||||
"description": "Top-down analysis using multiple timeframes for confluence",
|
||||
"key_concepts": [
|
||||
"Top-Down Approach (Monthly → Weekly → Daily → 4H → 1H)",
|
||||
"Timeframe Confluence",
|
||||
"Higher TF Trend",
|
||||
"Lower TF Entry",
|
||||
"Trend Alignment",
|
||||
"S/R Level Confluence",
|
||||
"3 Timeframe Rule",
|
||||
"Risk-On/Risk-Off Daily",
|
||||
"Bias from HTF, Entry from LTF"
|
||||
],
|
||||
"timeframes": ["1M", "1W", "1D", "4H", "1H", "15M"],
|
||||
"indicators": ["EMA 21/55/200", "RSI", "MACD"],
|
||||
"best_for": ["All trading styles"],
|
||||
"entry_criteria": [
|
||||
"Identify HTF trend (Daily/Weekly)",
|
||||
"Find HTF S/R levels",
|
||||
"Wait for retracement on MTF",
|
||||
"Enter on LTF confirmation",
|
||||
"All timeframes aligned"
|
||||
],
|
||||
"risk_management": {
|
||||
"stop_loss": "Based on LTF structure",
|
||||
"take_profit": "HTF targets",
|
||||
"rr_ratio": "Minimum 1:3"
|
||||
}
|
||||
},
|
||||
"london_ny_session": {
|
||||
"name": "London/NY Session Trading",
|
||||
"school": TradingSchool.ICT,
|
||||
"description": "Trading based on major forex session characteristics and time-based patterns",
|
||||
"key_concepts": [
|
||||
"Asian Session (Low Volatility, Range)",
|
||||
"London Open (3 AM EST - High Volatility)",
|
||||
"London Killzone (2-5 AM EST)",
|
||||
"NY Open (8 AM EST - Highest Volatility)",
|
||||
"NY Killzone (8-11 AM EST)",
|
||||
"London/NY Overlap (8 AM-12 PM EST)",
|
||||
"Judas Swing (False move before real direction)",
|
||||
"London Close (12 PM EST)",
|
||||
"Asian Range Breakout",
|
||||
"Time-Based Entries"
|
||||
],
|
||||
"timeframes": ["5m", "15m", "1h"],
|
||||
"indicators": ["Minimal - ATR for volatility"],
|
||||
"best_for": ["Day trading gold/forex"],
|
||||
"entry_criteria": [
|
||||
"Identify Asian range",
|
||||
"Watch for London open breakout",
|
||||
"Fade false move (Judas Swing)",
|
||||
"Enter on true direction confirmation",
|
||||
"Most activity in London/NY killzones"
|
||||
],
|
||||
"risk_management": {
|
||||
"stop_loss": "Opposite side of range or FVG",
|
||||
"take_profit": "Intraday targets, session highs/lows",
|
||||
"rr_ratio": "Minimum 1:2"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@staticmethod
|
||||
def get_combined_strategies() -> Dict[str, Dict[str, Any]]:
|
||||
"""Get hybrid strategies combining multiple schools"""
|
||||
return {
|
||||
"smc_fibonacci": {
|
||||
"name": "SMC + Fibonacci Confluence",
|
||||
"schools": [TradingSchool.ICT, TradingSchool.FIBONACCI],
|
||||
"description": "Combine Smart Money Concepts with Fibonacci for high-probability entries",
|
||||
"setup": [
|
||||
"1. Identify market structure (BOS/ChoCh) using SMC",
|
||||
"2. Mark FVG and Order Blocks",
|
||||
"3. Draw Fibonacci from last swing low to swing high",
|
||||
"4. Look for confluence: FVG/OB + 0.618/0.79 Fib level",
|
||||
"5. Enter at confluence zone during killzone",
|
||||
"6. Target: Opposite liquidity + Fib extension"
|
||||
],
|
||||
"indicators": [],
|
||||
"timeframes": ["15m", "1h", "4h"],
|
||||
"win_rate": "65-75%",
|
||||
"rr_ratio": "1:3"
|
||||
},
|
||||
"wyckoff_vsa": {
|
||||
"name": "Wyckoff + Volume Spread Analysis",
|
||||
"schools": [TradingSchool.WYCKOFF, TradingSchool.ORDER_FLOW],
|
||||
"description": "Combine Wyckoff accumulation/distribution with volume analysis",
|
||||
"setup": [
|
||||
"1. Identify Wyckoff phase (Accumulation/Distribution)",
|
||||
"2. Look for spring or upthrust",
|
||||
"3. Confirm with volume: High volume on spring = bullish",
|
||||
"4. Check for effort vs result divergence",
|
||||
"5. Enter on LPS (Last Point of Support) or LPSY",
|
||||
"6. Target: Measured move from trading range"
|
||||
],
|
||||
"indicators": ["Volume", "Volume Profile", "OBV"],
|
||||
"timeframes": ["4h", "1D"],
|
||||
"win_rate": "60-70%",
|
||||
"rr_ratio": "1:3"
|
||||
},
|
||||
"elliott_fibonacci": {
|
||||
"name": "Elliott Wave + Fibonacci",
|
||||
"schools": [TradingSchool.ELLIOTT_WAVE, TradingSchool.FIBONACCI],
|
||||
"description": "Natural combination - Elliott Wave theory is based on Fibonacci",
|
||||
"setup": [
|
||||
"1. Count wave structure (Impulse 1-2-3-4-5)",
|
||||
"2. Wait for Wave 2 or 4 correction",
|
||||
"3. Fib retracement: Wave 2 = 0.618, Wave 4 = 0.382",
|
||||
"4. Enter at Fib level with confirmation",
|
||||
"5. Target: Wave 3 = 1.618x Wave 1, Wave 5 = Wave 1",
|
||||
"6. Use Fib extensions for profit targets"
|
||||
],
|
||||
"indicators": ["Fibonacci", "EMA 21/55", "RSI"],
|
||||
"timeframes": ["1h", "4h", "1D"],
|
||||
"win_rate": "60-70%",
|
||||
"rr_ratio": "1:3"
|
||||
},
|
||||
"supply_demand_session": {
|
||||
"name": "Supply/Demand + Session Trading",
|
||||
"schools": [TradingSchool.SUPPLY_DEMAND, TradingSchool.ICT],
|
||||
"description": "Trade fresh S/D zones during high-liquidity sessions",
|
||||
"setup": [
|
||||
"1. Mark fresh supply/demand zones on 4H/1D",
|
||||
"2. Wait for price to approach zone during killzone",
|
||||
"3. Enter on confirmation in London/NY session",
|
||||
"4. Higher probability during high-volume periods",
|
||||
"5. Target: Opposite zone or session high/low"
|
||||
],
|
||||
"indicators": ["Volume", "ATR"],
|
||||
"timeframes": ["15m", "1h", "4h"],
|
||||
"win_rate": "65-75%",
|
||||
"rr_ratio": "1:3"
|
||||
},
|
||||
"multi_method_confluence": {
|
||||
"name": "Multi-Method Confluence",
|
||||
"schools": [TradingSchool.ICT, TradingSchool.FIBONACCI, TradingSchool.SUPPLY_DEMAND, TradingSchool.PRICE_ACTION],
|
||||
"description": "Ultimate confluence: Multiple methodologies confirming same zone",
|
||||
"setup": [
|
||||
"1. Identify trend and structure (Price Action)",
|
||||
"2. Mark Supply/Demand zones",
|
||||
"3. Draw Fibonacci retracements",
|
||||
"4. Identify FVG and Order Blocks (SMC)",
|
||||
"5. Find confluence: All methods pointing to same zone",
|
||||
"6. Enter only at maximum confluence during killzone",
|
||||
"7. Target: Multiple method targets"
|
||||
],
|
||||
"indicators": [],
|
||||
"timeframes": ["15m", "1h", "4h"],
|
||||
"win_rate": "70-80%",
|
||||
"rr_ratio": "1:3+",
|
||||
"difficulty": "Advanced"
|
||||
},
|
||||
"fundamental_technical": {
|
||||
"name": "Fundamental + Technical Combo",
|
||||
"schools": [TradingSchool.FUNDAMENTAL, TradingSchool.TECHNICAL_ANALYSIS],
|
||||
"description": "Use fundamentals for bias, technicals for entry/exit",
|
||||
"setup": [
|
||||
"1. Analyze gold fundamentals (USD, rates, geopolitics)",
|
||||
"2. Determine fundamental bias (bullish/bearish)",
|
||||
"3. Wait for technical setup aligned with bias",
|
||||
"4. Use SMC, S/D, or Fibonacci for precise entry",
|
||||
"5. Enter with fundamental and technical confluence",
|
||||
"6. Hold longer-term positions"
|
||||
],
|
||||
"indicators": ["DXY", "10Y Yield", "EMA 50/200", "RSI"],
|
||||
"timeframes": ["1D", "1W"],
|
||||
"win_rate": "65-75%",
|
||||
"rr_ratio": "1:4+",
|
||||
"holding_period": "Days to weeks"
|
||||
}
|
||||
}
|
||||
|
||||
@staticmethod
|
||||
def get_indicator_presets_for_school(school: TradingSchool) -> Dict[str, Any]:
|
||||
"""Get recommended indicators for each trading school"""
|
||||
presets = {
|
||||
TradingSchool.ICT: {
|
||||
"indicators": [], # Pure price action
|
||||
"tools": ["Market Structure", "FVG Finder", "Order Block Detector"],
|
||||
"note": "ICT/SMC uses minimal to no indicators"
|
||||
},
|
||||
TradingSchool.WYCKOFF: {
|
||||
"indicators": ["Volume", "OBV", "Volume Profile"],
|
||||
"tools": ["Volume Spread Analysis"],
|
||||
"note": "Volume is critical for Wyckoff"
|
||||
},
|
||||
TradingSchool.ELLIOTT_WAVE: {
|
||||
"indicators": ["Fibonacci", "EMA 21", "EMA 55", "RSI"],
|
||||
"tools": ["Wave Counter", "Fibonacci Extensions"],
|
||||
"note": "Fibonacci is integral to Elliott Wave"
|
||||
},
|
||||
TradingSchool.MARKET_PROFILE: {
|
||||
"indicators": ["Volume Profile", "VWAP", "Volume"],
|
||||
"tools": ["TPO Chart", "Value Area Calculation"],
|
||||
"note": "Time and volume distribution is key"
|
||||
},
|
||||
TradingSchool.ORDER_FLOW: {
|
||||
"indicators": ["Delta", "Cumulative Delta", "Volume"],
|
||||
"tools": ["Footprint Chart", "Bid/Ask Ladder", "Order Book"],
|
||||
"note": "Requires specialized order flow tools"
|
||||
},
|
||||
TradingSchool.PRICE_ACTION: {
|
||||
"indicators": [], # Minimal
|
||||
"tools": ["Candlestick Patterns", "S/R Levels", "Trend Lines"],
|
||||
"note": "Pure price action, no indicators"
|
||||
},
|
||||
TradingSchool.SUPPLY_DEMAND: {
|
||||
"indicators": ["Volume (optional)"],
|
||||
"tools": ["Zone Drawer", "Base Identifier"],
|
||||
"note": "Zones are key, indicators optional"
|
||||
},
|
||||
TradingSchool.FIBONACCI: {
|
||||
"indicators": ["Fibonacci Retracement", "Fibonacci Extension", "RSI", "MACD"],
|
||||
"tools": ["Fib Tools", "Harmonic Pattern Scanner"],
|
||||
"note": "Fibonacci levels are primary tool"
|
||||
},
|
||||
TradingSchool.FUNDAMENTAL: {
|
||||
"indicators": ["DXY", "10Y Yield", "VIX", "Correlation Heatmap"],
|
||||
"tools": ["Economic Calendar", "Central Bank Tracker"],
|
||||
"note": "Macro analysis is primary, technicals for timing"
|
||||
},
|
||||
TradingSchool.TECHNICAL_ANALYSIS: {
|
||||
"indicators": ["EMA 21/55/200", "RSI 14", "MACD", "BB 20", "ATR 14"],
|
||||
"tools": ["Multi-Timeframe Analysis"],
|
||||
"note": "Classic indicator suite"
|
||||
}
|
||||
}
|
||||
return presets.get(school, {})
|
||||
|
||||
@staticmethod
|
||||
def get_risk_models() -> Dict[str, Dict[str, Any]]:
|
||||
"""Advanced risk management models"""
|
||||
return {
|
||||
"kelly_criterion": {
|
||||
"name": "Kelly Criterion Position Sizing",
|
||||
"formula": "f* = (bp - q) / b",
|
||||
"variables": {
|
||||
"f*": "Fraction of capital to risk",
|
||||
"b": "Odds received (reward:risk ratio - 1)",
|
||||
"p": "Probability of winning",
|
||||
"q": "Probability of losing (1 - p)"
|
||||
},
|
||||
"example": {
|
||||
"win_rate": 0.60,
|
||||
"rr_ratio": 2.0,
|
||||
"calculation": "f* = (2 * 0.60 - 0.40) / 2 = 0.40 or 40%",
|
||||
"recommended": "Use half-Kelly (20%) for safety"
|
||||
},
|
||||
"best_for": "High win rate, consistent strategies"
|
||||
},
|
||||
"fixed_fractional": {
|
||||
"name": "Fixed Fractional Risk",
|
||||
"description": "Risk fixed percentage of capital per trade",
|
||||
"recommended": {
|
||||
"conservative": "1-2% per trade",
|
||||
"moderate": "2-3% per trade",
|
||||
"aggressive": "3-5% per trade"
|
||||
},
|
||||
"best_for": "All traders, most reliable method"
|
||||
},
|
||||
"volatility_based": {
|
||||
"name": "ATR-Based Position Sizing",
|
||||
"description": "Adjust position size based on market volatility",
|
||||
"formula": "Position Size = (Account Risk $) / (ATR * Multiplier)",
|
||||
"example": {
|
||||
"account": 100000,
|
||||
"risk_pct": 0.02,
|
||||
"atr": 15.0,
|
||||
"multiplier": 1.5,
|
||||
"position_size": "(100000 * 0.02) / (15 * 1.5) = 88.89 units"
|
||||
},
|
||||
"best_for": "Volatility-sensitive strategies"
|
||||
},
|
||||
"time_based": {
|
||||
"name": "Time-Based Risk Adjustment",
|
||||
"description": "Reduce risk during low liquidity or high event risk",
|
||||
"rules": {
|
||||
"normal_hours": "Full position size",
|
||||
"low_liquidity": "50% position size",
|
||||
"news_events": "25% position size or avoid",
|
||||
"weekend_gaps": "Reduced or no overnight positions"
|
||||
},
|
||||
"best_for": "Day traders, news-sensitive markets"
|
||||
},
|
||||
"correlation_based": {
|
||||
"name": "Correlation-Adjusted Risk",
|
||||
"description": "Account for correlated positions",
|
||||
"rules": {
|
||||
"uncorrelated": "Full risk per position",
|
||||
"low_correlation": "75% risk adjustment",
|
||||
"high_correlation": "50% risk adjustment",
|
||||
"perfect_correlation": "Count as one position"
|
||||
},
|
||||
"example": "Gold + Silver high correlation → reduce combined risk",
|
||||
"best_for": "Multi-asset traders"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Global instance
|
||||
trading_schools = TradingStrategy()
|
||||
Reference in New Issue
Block a user