Simulator
Overview & Purpose
The Simulator is the heart of PatternFoundry. It provides a full-featured trading environment where you can practice executing trades against realistic synthetic price action. The simulator includes:
- A professional candlestick chart with drawing tools and indicators
- A simulated order book with depth-of-market visualization
- Full order management (market, limit, stop-limit orders)
- Position tracking with drag-adjustable stop-loss and take-profit levels
- Comprehensive account statistics (balance, P&L, win rate, drawdown)
- Playback speed control from 0.25x to 200x
Generating a Session
To start a new simulation session:
- Select an Instrument — Choose from 14 built-in instruments (ES, NQ, CL, RTY, MES, MNQ, MCL, M2K, SPY, AAPL, MSFT, PLTR, TSLA, GME) or any custom characters you've created in the Chart Designer. Each instrument has appropriate tick sizes, point values, and margin requirements.
- Set History Depth — Select how much historical chart data to generate before the live session begins: 1 day, 1 week, 1 month, 3 months, 6 months, 1 year, or 2 years.
- Seed (Optional) — Enter a numeric seed to reproduce a specific session. Leave blank for a random seed. Sharing seeds with other traders lets you compare performance on identical price action.
- Click Generate to create the session.
Session generation typically takes 1–3 seconds. The system generates the full historical candle data and initializes the tick engine for real-time simulation.
Playback Controls
The playback toolbar at the bottom of the chart controls the simulation timeline:
| Control | Function |
|---|---|
| Play / Pause | Start or pause the real-time tick simulation |
| Speed Selector | Adjust playback speed: 0.25x, 0.5x, 1x, 2x, 5x, 10x, 25x, 50x, 100x, 200x |
At 1x speed, ticks arrive at realistic intervals matching the instrument's typical trading activity. Higher speeds compress time proportionally - at 10x, one minute of real time equals ten minutes of simulated market time.
Use slower speeds (0.25x–1x) when learning to read order flow and tape. Use faster speeds (10x–50x) for swing trading practice or to quickly build up chart history.
Placing Trades
PatternFoundry supports three order types:
Market Orders
Execute immediately at the current best available price. Click the Buy or Sell button in the order panel, or use keyboard shortcuts. Market orders experience realistic slippage based on available liquidity in the order book.
Limit Orders
Place an order to buy below or sell above the current price. The order rests in the book until price reaches your level. To place a limit order:
- Click the price level on the chart where you want the order
- Select "Limit" from the order type dropdown
- Set your quantity and optional SL/TP
- Confirm the order
Stop-Limit Orders
A two-price order: when price hits the stop price, a limit order is placed at the limit price. Useful for breakout entries with controlled slippage. The stop price triggers the order; the limit price defines the worst acceptable fill.
Managing Positions
Once a trade is filled, your position appears on the chart with visual markers:
- Entry line - Dashed line at your entry price (green for long, red for short)
- Stop-Loss (SL) - Red line below (long) or above (short) your entry. Drag this line to adjust your stop in real-time.
- Take-Profit (TP) - Green line above (long) or below (short) your entry. Drag this line to adjust your target.
- P&L label - Floating label showing unrealized profit/loss in real-time
To close a position, click the × on the position label or use the position panel's close button. Partial closes are supported - specify the number of contracts to close.
Account Tracking
The account panel displays real-time trading statistics:
| Metric | Description |
|---|---|
| Balance | Starting capital plus/minus realized P&L |
| Equity | Balance plus unrealized P&L from open positions |
| Realized P&L | Total profit/loss from closed trades |
| Unrealized P&L | Current profit/loss on open positions |
| Win Rate | Percentage of closed trades that were profitable |
| Profit Factor | Gross profit divided by gross loss |
| Max Drawdown | Largest peak-to-trough decline in equity |
| Trades | Total number of completed round-trip trades |
Timeframe Switching
Switch between multiple timeframes without losing your session state. Available timeframes:
- Tick chart - Every individual tick
- 1s, 5s, 15s, 30s - Sub-minute candles
- 1m, 3m, 5m, 15m, 30m - Minute candles
- 1H, 4H - Hourly candles
- 1D - Daily candles
All timeframes are computed from the same underlying tick data, so switching is instant and consistent. Drawings and indicators persist across timeframe changes.
Session Management
Sessions can be saved, loaded, exported, and imported:
| Action | Description |
|---|---|
| Save | Save current session state to your account (server-side). Includes all price data, positions, orders, drawings, and account state. |
| Load | Load a previously saved session and resume from where you left off. |
| Export | Download session as a JSON file to your local machine. |
| Import | Upload a previously exported JSON session file. |
Export sessions to share specific market scenarios with other traders for collaborative learning. Include the seed number so they can also generate the same session independently.
DOM (Depth of Market) Panel
The DOM panel shows the simulated order book in a vertical ladder format:
- Ask levels (red) - Sell orders resting above the current price
- Bid levels (green) - Buy orders resting below the current price
- Size bars - Horizontal bars showing relative volume at each price level
- Last trade - Highlighted row showing the most recent fill price
The DOM updates in real-time as the tick engine processes orders. You can click price levels in the DOM to quickly place limit orders at that price.
Drawing Tools
Access drawing tools from the toolbar on the left side of the chart. Available tools:
| Tool | Description | Usage |
|---|---|---|
| Line | Trend line between two points | Click start point, drag to end point |
| Horizontal Line | Infinite horizontal line at a price level | Click at desired price |
| Vertical Line | Infinite vertical line at a time point | Click at desired time |
| Arrow | Directional arrow between two points | Click start, drag to end |
| Channel | Parallel channel (two parallel lines) | Draw first line, then set channel width |
| Rectangle | Price/time zone highlight | Click corner, drag to opposite corner |
| Ellipse | Circular/elliptical highlight | Click center, drag to set radius |
| Fibonacci Retracement | Fib levels between swing high/low | Click swing start, drag to swing end |
| Gann Box | Gann time/price grid overlay | Click start corner, drag to end corner |
| Gann Fan | Gann angle lines from a pivot point | Click pivot point, drag to set angle |
| Text | Free-form text annotation | Click position, type your label |
| Long Position | Visual long trade with entry, SL, TP | Click entry, set SL and TP levels |
| Short Position | Visual short trade with entry, SL, TP | Click entry, set SL and TP levels |
All drawings can be selected, moved, resized, and deleted. Right-click a drawing to access its properties (color, style, line width). Use the lock button in the toolbar to prevent accidental modifications to your drawings.
Indicators
Built-in technical indicators available from the indicators menu:
| Indicator | Type | Default Period | Description |
|---|---|---|---|
| SMA | Overlay | 20 | Simple Moving Average - arithmetic mean of closing prices over N periods |
| EMA | Overlay | 20 | Exponential Moving Average - weighted average giving more weight to recent prices |
| VWAP | Overlay | Session | Volume Weighted Average Price - average price weighted by volume, resets each session |
| RSI | Oscillator | 14 | Relative Strength Index - momentum oscillator measuring speed of price changes (0–100) |
| MACD | Oscillator | 12/26/9 | Moving Average Convergence Divergence - trend-following momentum indicator |
| Bollinger Bands | Overlay | 20, 2σ | Price envelope based on standard deviation around an SMA |
| ATR | Oscillator | 14 | Average True Range - volatility indicator measuring the average range of candles |
Click the indicator name in the legend to toggle visibility. Click the gear icon to edit parameters. Click × to remove.
Closing a Session
When you're done trading, click the ✓ Close Session button in the playback bar. This finalizes the session and:
- Saves your session data (candles, trades, drawings) to the server
- Updates your trading account balance with the realized P&L
- Records the session in your Stats page history
- Makes the session available for replay via the Stats → Session History table
Margin System
The simulator enforces realistic margin requirements:
- Initial Margin — Checked when you place an order. If
quantity × initial_margin > balance, the order is rejected with a margin message. - Maintenance Margin — Checked on every tick while a position is open. If your equity (balance + unrealized P&L) falls below
quantity × maintenance_margin, your position is automatically liquidated with a "Margin Call" notification.
Keyboard Shortcuts
| Key | Action |
|---|---|
Space | Play / Pause simulation |
+ | Increase playback speed (next step) |
- | Decrease playback speed (previous step) |
B | Instant buy (market order with current panel settings, skips confirmation) |
S | Instant sell (market order with current panel settings, skips confirmation) |
Hotkeys are disabled when typing in input fields. B/S use whatever quantity, order type, SL, and TP values are set in the trade panel — they just skip the drag-to-confirm step.
Tips
• Use the scroll wheel to zoom in/out on the time axis. Hold Ctrl + scroll to zoom the price axis.
• Use slower speeds (0.25x–1x) when learning to read order flow and tape. Use faster speeds (10x–50x) for swing trading practice.
• Right-click a drawing to edit its color, style, and line width.
• Commissions are 1 tick per contract round-trip, calculated automatically.
PatternFoundry