expertoption

import React, { useState, useEffect, useRef } from 'react'; import { AreaChart, Area, XAxis, YAxis, CartesianGrid, Tooltip, ResponsiveContainer, ReferenceLine, Line } from 'recharts'; import { TrendingUp, TrendingDown, User, ShieldCheck, Zap, BarChart3, Wallet, Clock, ChevronDown, Settings, BrainCircuit, Sparkles, Activity, Search, Globe, Bitcoin, Landmark, Timer } from 'lucide-react'; const ASSETS = [ { id: 'eurusd', name: 'EUR/USD', type: 'Forex', icon: , payout: 0.82, volatility: 0.00012, basePrice: 1.0845 }, { id: 'btc', name: 'Bitcoin', type: 'Crypto', icon: , payout: 0.92, volatility: 0.0018, basePrice: 65200.00 }, { id: 'eth', name: 'Ethereum', type: 'Crypto', icon: , payout: 0.88, volatility: 0.0015, basePrice: 3450.00 }, { id: 'gold', name: 'Gold', type: 'Commodity', icon: , payout: 0.80, volatility: 0.0003, basePrice: 2150.00 }, ]; const App = () => { const [selectedAsset, setSelectedAsset] = useState(ASSETS[0]); const [showAssetList, setShowAssetList] = useState(false); const [data, setData] = useState([]); const [balance, setBalance] = useState(10000.00); const [investment, setInvestment] = useState(50); const [currentPrice, setCurrentPrice] = useState(0); const [forecasts, setForecasts] = useState([]); const [history, setHistory] = useState([]); const [searchQuery, setSearchQuery] = useState(''); // Generate initial historical data useEffect(() => { let initialData = []; let price = selectedAsset.basePrice; for (let i = 0; i < 50; i++) { price += (Math.random() - 0.5) * (price * selectedAsset.volatility); initialData.push({ time: i, price: parseFloat(price.toFixed(selectedAsset.id === 'btc' ? 2 : 5)), isForecast: false }); } setData(initialData); setCurrentPrice(initialData[initialData.length - 1].price); }, [selectedAsset]); // Main Loop: Price simulation and Multi-Timeframe AI Forecasting useEffect(() => { const interval = setInterval(() => { setData(prev => { if (prev.length === 0) return prev; const historical = prev.filter(d => !d.isForecast); const last = historical[historical.length - 1]; // 1. Simulate Next Real Price const drift = (Math.random() - 0.5) * (last.price * selectedAsset.volatility); const newRealPrice = parseFloat((last.price + drift).toFixed(selectedAsset.id === 'btc' ? 2 : 5)); setCurrentPrice(newRealPrice); const newHistory = [...historical.slice(1), { time: last.time + 1, price: newRealPrice, isForecast: false }]; // 2. Generate Multi-step Forecasts (5s, 10s, 20s, 30s, 60s) const timeframes = [5, 10, 20, 30, 60]; // Calculate simple momentum for the forecast const momentum = (newHistory[newHistory.length - 1].price - newHistory[newHistory.length - 8].price) / 8; const newForecasts = timeframes.map(t => { const expectedChange = (momentum * t) + ((Math.random() - 0.5) * (newRealPrice * selectedAsset.volatility * Math.sqrt(t))); const target = parseFloat((newRealPrice + expectedChange).toFixed(selectedAsset.id === 'btc' ? 2 : 5)); const confidence = Math.max(60, 95 - (t / 2) + (Math.random() * 5)); return { time: t, price: target, direction: target > newRealPrice ? 'UP' : 'DOWN', confidence: confidence.toFixed(1) }; }); setForecasts(newForecasts); // 3. Create Future Path Visuals (Visualizing the next 25 ticks) const futurePath = []; let tempPrice = newRealPrice; for (let j = 1; j <= 25; j++) { tempPrice += momentum + ((Math.random() - 0.5) * (newRealPrice * selectedAsset.volatility)); futurePath.push({ time: last.time + 1 + j, price: parseFloat(tempPrice.toFixed(selectedAsset.id === 'btc' ? 2 : 5)), isForecast: true }); } return [...newHistory, ...futurePath]; }); }, 1000); return () => clearInterval(interval); }, [selectedAsset]); const handleTrade = (direction) => { const tradeId = Date.now(); const entryPrice = currentPrice; const payout = investment * selectedAsset.payout; const newTrade = { id: tradeId, asset: selectedAsset.name, direction, amount: investment, entryPrice, status: 'PENDING', time: new Date().toLocaleTimeString() }; setHistory([newTrade, ...history]); // Simulate trade resolution after 3 seconds based on 5s forecast direction setTimeout(() => { setHistory(currentHistory => currentHistory.map(t => { if (t.id === tradeId) { const isWin = (direction === 'UP' && forecasts[0].direction === 'UP') || (direction === 'DOWN' && forecasts[0].direction === 'DOWN'); if (isWin) { setBalance(b => b + payout); return { ...t, status: 'WIN', profit: payout }; } else { setBalance(b => b - investment); return { ...t, status: 'LOSS', profit: -investment }; } } return t; }) ); }, 3000); }; return (
{/* Top Navbar */}
NEXT-GEN AI
{showAssetList && (
setSearchQuery(e.target.value)} />
{ASSETS.filter(a => a.name.toLowerCase().includes(searchQuery.toLowerCase())).map(asset => ( ))}
)}
Portfolio Balance ${balance.toLocaleString(undefined, { minimumFractionDigits: 2 })}
{/* Left Sidebar */} {/* Main Chart Area */}
{/* Multi-Step Forecast Indicators */}
{forecasts.map((f, i) => (
{f.time}s Forecast
{f.confidence}%
{f.direction === 'UP' ? : } {f.direction} {f.price}
))}
{/* Graph Container */}
{/* Price Overlay */}
Current Price
{currentPrice.toLocaleString(undefined, { minimumFractionDigits: selectedAsset.id === 'btc' ? 2 : 5 })}
{forecasts[0]?.direction === 'UP' ? '↑ BULLISH' : '↓ BEARISH'} AI SYNCED
{/* Historical Area */} !d.isForecast)} stroke="#3b82f6" strokeWidth={3} fill="url(#priceGradient)" isAnimationActive={false} /> {/* Predicted Path */} d.isForecast || d.time === data.filter(x => !x.isForecast).slice(-1)[0].time)} stroke="#3b82f6" strokeWidth={2} strokeDasharray="6 6" dot={false} isAnimationActive={false} /> {/* AI Signal Widget */}
AI Engine Active
Future Trend
Short (10s) {forecasts[1]?.direction}
Medium (30s) {forecasts[3]?.direction}
Long (60s) {forecasts[4]?.direction}
{/* Right Trading Panel */}
); }; export default App;