/** * ICT Analysis Card Component * Displays Smart Money Concepts analysis in a visual format */ import React from 'react'; import { ArrowTrendingUpIcon, ArrowTrendingDownIcon, MinusIcon, ChartBarIcon, ExclamationTriangleIcon, CheckCircleIcon, XCircleIcon, } from '@heroicons/react/24/solid'; interface OrderBlock { type: 'bullish' | 'bearish'; high: number; low: number; midpoint: number; strength: number; valid: boolean; touched: boolean; } interface FairValueGap { type: 'bullish' | 'bearish'; high: number; low: number; midpoint: number; size_percent: number; filled: boolean; } interface ICTAnalysis { symbol: string; timeframe: string; market_bias: 'bullish' | 'bearish' | 'neutral'; bias_confidence: number; current_trend: string; order_blocks: OrderBlock[]; fair_value_gaps: FairValueGap[]; entry_zone?: { low: number; high: number }; stop_loss?: number; take_profits: { tp1?: number; tp2?: number; tp3?: number }; risk_reward?: number; signals: string[]; score: number; premium_zone: { low: number; high: number }; discount_zone: { low: number; high: number }; equilibrium: number; } interface ICTAnalysisCardProps { analysis: ICTAnalysis; onExecuteTrade?: (direction: 'buy' | 'sell', analysis: ICTAnalysis) => void; className?: string; } export const ICTAnalysisCard: React.FC = ({ analysis, onExecuteTrade, className = '', }) => { const getBiasIcon = () => { switch (analysis.market_bias) { case 'bullish': return ; case 'bearish': return ; default: return ; } }; const getBiasColor = () => { switch (analysis.market_bias) { case 'bullish': return 'bg-green-500/20 text-green-400 border-green-500/30'; case 'bearish': return 'bg-red-500/20 text-red-400 border-red-500/30'; default: return 'bg-gray-500/20 text-gray-400 border-gray-500/30'; } }; const getScoreColor = (score: number) => { if (score >= 70) return 'text-green-400'; if (score >= 50) return 'text-yellow-400'; return 'text-red-400'; }; const validOrderBlocks = analysis.order_blocks.filter(ob => ob.valid); const unfilledFVGs = analysis.fair_value_gaps.filter(fvg => !fvg.filled); return (
{/* Header */}

{analysis.symbol}

{analysis.timeframe}

ICT/SMC Analysis

{/* Score Badge */}
{analysis.score}

Setup Score

{/* Market Bias */}
{getBiasIcon()}

{analysis.market_bias} Bias

{Math.round(analysis.bias_confidence * 100)}% confidence • {analysis.current_trend}

{/* Key Levels Grid */} {analysis.entry_zone && (

Trade Setup

Entry Zone

{analysis.entry_zone.low.toFixed(5)} - {analysis.entry_zone.high.toFixed(5)}

{analysis.stop_loss && (

Stop Loss

{analysis.stop_loss.toFixed(5)}

)} {analysis.take_profits.tp1 && (

Take Profit 1

{analysis.take_profits.tp1.toFixed(5)}

)} {analysis.take_profits.tp2 && (

Take Profit 2

{analysis.take_profits.tp2.toFixed(5)}

)}
{analysis.risk_reward && (
Risk:Reward 1:{analysis.risk_reward}
)}
)} {/* Order Blocks */} {validOrderBlocks.length > 0 && (

Order Blocks ({validOrderBlocks.length})

{validOrderBlocks.slice(0, 3).map((ob, idx) => (
{ob.type === 'bullish' ? ( ) : ( )} {ob.low.toFixed(5)} - {ob.high.toFixed(5)}
{Math.round(ob.strength * 100)}% {ob.touched ? ( ) : ( )}
))}
)} {/* Fair Value Gaps */} {unfilledFVGs.length > 0 && (

Fair Value Gaps ({unfilledFVGs.length} unfilled)

{unfilledFVGs.slice(0, 3).map((fvg, idx) => (
{fvg.low.toFixed(5)} - {fvg.high.toFixed(5)} {fvg.size_percent.toFixed(2)}%
))}
)} {/* Signals */} {analysis.signals.length > 0 && (

Active Signals

{analysis.signals.slice(0, 6).map((signal, idx) => ( {signal.replace(/_/g, ' ')} ))}
)} {/* Premium/Discount Zones */}

Fibonacci Zones

Premium

{analysis.premium_zone.low.toFixed(5)}

Equilibrium

{analysis.equilibrium.toFixed(5)}

Discount

{analysis.discount_zone.high.toFixed(5)}

{/* Action Buttons */} {onExecuteTrade && analysis.score >= 50 && analysis.market_bias !== 'neutral' && ( )}
); }; export default ICTAnalysisCard;