import React, { useState } from 'react'; import { Plus, TrendingUp, TrendingDown,…
- User
import React, { useState } from 'react'; import { Plus, TrendingUp, TrendingDown, Calendar, DollarSign, Target, Clock, ArrowLeft, BarChart3, X, Menu } from 'lucide-react';
const TradingJournal = () => { const [trades, setTrades] = useState([]); const [showForm, setShowForm] = useState(false); const [currentStep, setCurrentStep] = useState(0); const [accountSize, setAccountSize] = useState(5109.02); const [activeTab, setActiveTab] = useState('dashboard');
const [newTrade, setNewTrade] = useState({ date: '', time: '', symbol: '', session: 'NONE', bias: 'NEUTRAL', riskPercent: '', rrr: '', positionSize: '', mode: 'BUY', entry: '', sl: '', tp: '', close: '', whyOpen: '', feelings: '', whyClose: '', confirmation: '' });
const sessions = ['NONE', 'ASIA', 'LONDON', 'NEW YORK']; const biases = ['NEUTRAL', 'BULLISH', 'BEARISH']; const modes = ['BUY', 'SELL'];
const formSteps = [ { title: 'Basic Info', fields: ['date', 'time', 'symbol', 'session', 'bias', 'mode'] }, { title: 'Trade Setup', fields: ['riskPercent', 'rrr', 'positionSize', 'entry', 'sl', 'tp'] }, { title: 'Exit & Close', fields: ['close', 'whyOpen', 'feelings'] }, { title: 'Analysis', fields: ['whyClose', 'confirmation'] } ];
const handleInputChange = (field, value) => { setNewTrade(prev => ({ ...prev, [field]: value })); };
const calculateResults = (trade) => { const entry = parseFloat(trade.entry) || 0; const close = parseFloat(trade.close) || 0; const positionSize = parseFloat(trade.positionSize) || 0;
codelet profit = 0; if (trade.mode === 'BUY') { profit = ((close - entry) / entry) * positionSize * accountSize; } else { profit = ((entry - close) / entry) * positionSize * accountSize; } const rewardPercent = (profit / accountSize) * 100; const actualRRR = trade.mode === 'BUY' ? (close - entry) / (entry - parseFloat(trade.sl || entry)) : (entry - close) / (parseFloat(trade.sl || entry) - entry); return { profit: profit.toFixed(2), rewardPercent: rewardPercent.toFixed(2), actualRRR: actualRRR.toFixed(2), result: profit > 0 ? 'WIN' : 'LOSS' };};
const addTrade = () => { if (!newTrade.date || !newTrade.time || !newTrade.symbol || !newTrade.entry) { alert('Please fill in required fields: Date, Time, Symbol, and Entry'); return; }
code - Assistant
- User
update and save as html
- Assistant