Manual Trade Entry Flow
Legend
- Blue nodes → API operations
- Green nodes → Database operations
- Red nodes → Error states
- Purple nodes → Live trading operations
Manual Trade Entry Form
Required Fields
- Symbol: Trading symbol (e.g., YM1!, MET1, ES1!)
- Entry Date & Time: When the trade was entered
- Direction: Buy (Long) or Sell (Short)
- Entry Price: Entry price
- Stop Loss: Stop loss price
- Take Profit: Take profit price
Optional Fields
- Leverage: Default: 10
- Exit Date & Time: When trade was closed (if completed)
- Exit Price: Exit price (if completed)
- Result: Exit type (take_profit, stop_loss, etc.)
Validation Rules
Client-Side (JavaScript)
- Required Fields: All entry fields must be filled
- Direction Logic:
- Long (Buy):
SL < Entry Price < TP - Short (Sell):
TP < Entry Price < SL
- Long (Buy):
Server-Side (Node.js)
- Required Fields: Same as client-side
- Date Format: Valid ISO date/time format
- Data Types: Numeric validation for prices
Database Storage
Alert Record (alerts table)
- indicator_name:
'MANUAL ENTRY' - symbol, action, entry_price, stop_loss, take_profit
- entry_type: Same as direction
- leverage: User-provided or default 10
- status:
'pending'if no exit, or result if exit provided - raw_data: JSON with
{ manual: true, entryDateTime, exitDateTime, result } - timestamp: Entry date/time
Alert Result (alert_results table)
- Only inserted if exit details provided
- exit_price, exit_type, exit_time
- pnl, pnl_percent: Calculated from entry/exit prices
Live Trading Integration
If live trading is enabled:
- Manual trade can trigger live order placement
- Uses same live entry flow as TradingView alerts
- Order placed on TopstepX if validation passes
- Trade marked as
is_live = truewithtopstepOrderId
Post-Submission
- Success: Form resets, statistics refresh
- Error: Error message displayed, form remains filled
- Trade List: New trade appears in trade list after refresh