Trading Guide
The backtesting platform includes a full trading simulation engine. Place orders, manage positions, set take-profit and stop-loss levels, and enforce prop firm-style rules - all while replaying historical market data.
Overview
There are two places to interact with the trading system:
- Bottom Panel - Order Panel (right side) - Quick order placement with Buy/Sell buttons, quantity, and order type
- Right Panel - Trading Tab (Tab 1) - Full account view with balance, position, pending orders, trade history, and statistics
Order Types
Market Orders
Market orders fill immediately at the current bar's close price.
- Click Buy or Sell with "Market" selected as the order type
- The order fills instantly and opens (or adds to) your position
- Best for immediate entries and exits
Limit Orders
Limit orders wait for the price to reach your specified level before filling.
- Select Limit as the order type and enter a price
- Buy Limit: Price must be set below the current market price. Fills when the bar's low reaches your price
- Sell Limit: Price must be set above the current market price. Fills when the bar's high reaches your price
- Use for entering at better prices or setting take-profit exits
Stop Orders
Stop orders trigger when the price moves past your specified level.
- Select Stop as the order type and enter a price
- Buy Stop: Price must be set above the current market price. Triggers when the bar's high reaches your price
- Sell Stop: Price must be set below the current market price. Triggers when the bar's low reaches your price
- Use for breakout entries or setting stop-loss exits
Placing Orders
From the Bottom Panel
- Set the Quantity using the +/- buttons or direct input
- Select the Order Type (Market, Limit, or Stop)
- For Limit/Stop orders, enter the Price
- Click Buy (green) or Sell (red)
From the Trading Tab (Tab 1)
The Trading tab in the right panel provides the same order controls with additional account context.
From the Chart (Right-Click)
Right-click on the TradingView chart to access the context menu, which includes options to place limit orders at the clicked price level. This provides a fast way to set orders at specific chart locations.
Position Management
Open Position
You can have one open position at a time (either long or short). When a position is open:
- A position badge appears on the chart at your entry price showing live P&L
- An entry line is drawn on the chart at the entry price
- The line color changes based on current unrealized P&L (green for profit, red for loss)
Closing a Position
Several ways to close your position:
- Flatten button - Closes all open positions immediately at market
- Close button on position badge - Click the X on the chart badge
- Opposite market order - Place a sell order while long (or buy while short) for the full quantity
- Take Profit / Stop Loss fills - Linked orders close the position automatically when triggered
- Auto-liquidation - Rules enforcement closes the position when a rule is breached
Reversing a Position
Click the Reverse button to close your current position and open an equal-sized position in the opposite direction in one action.
Per-Contract Fees
The trading engine supports per-contract fees (commissions). Fees are configured in your Backtesting Profile and are automatically deducted from your balance when trades are executed.
- Fees apply to every fill (entries, exits, scale-ins, scale-outs)
- Fee amount = contracts traded x fee per contract
- Gross P&L and fees are tracked separately in your trade history
- Net P&L = Gross P&L minus fees
Goals Integration
Trades placed during replay automatically count toward your backtesting goals. If you have goals tracking number of trades, they update in real time as you trade.
Draggable Orders & TP/SL
Setting Take Profit and Stop Loss by Dragging
When you have an open position, you can set Take Profit (TP) and Stop Loss (SL) orders by dragging directly from the position badge on the chart:
Take Profit
- Long position: Drag the position badge upward to set a TP
- Short position: Drag the position badge downward to set a TP
- A green preview line appears showing the projected P&L
- Release to place a limit order at that price, linked to your position
Stop Loss
- Long position: Drag the position badge downward to set a SL
- Short position: Drag the position badge upward to set a SL
- A red preview line appears showing the projected loss
- Release to place a stop order at that price, linked to your position
Adjusting Pending Orders
Pending limit and stop orders appear as lines on the chart with order badges. You can drag the order badge up or down to adjust the price without canceling and re-placing the order. The order updates in real time as you drag.
Scale-In and Scale-Out
You can add to or partially close a position:
- Scale-in: Place an additional order in the same direction to increase position size
- Scale-out: Place a partial order in the opposite direction to reduce position size
- When scaling in or out, linked TP/SL orders automatically sync their quantity to match the new position size
Linked Orders (OCO Behavior)
TP and SL orders created by dragging from the position badge are linked to the position. This means:
- When one linked order fills (e.g., your TP is hit), all other linked orders are automatically canceled
- When the position is closed by any means (flatten, market order, etc.), all linked TP/SL orders are automatically canceled
- This prevents orphaned orders from lingering after a trade is complete
- Linked order quantities automatically adjust when you scale in or scale out
Only orders created by dragging from the position badge are linked. Orders placed manually through the order panel are standalone and will remain active even if the position closes.
Cancel All Orders
Click Cancel All in the bottom panel to cancel all pending limit and stop orders at once. This removes all order lines from the chart.
Trading Rules (Prop Firm Simulation)
The Trading tab includes configurable rules that simulate prop firm account restrictions. When a rule is breached, the system automatically liquidates your position and blocks further trading.
Available Rules
| Rule | Description |
|---|---|
| Max Drawdown | Maximum total loss from your starting balance. If your account drops below this threshold, trading is locked. |
| Daily Loss Limit | Maximum loss allowed within a single trading day. The trading day resets at 6:00 PM Eastern Time (CME convention). If your daily loss exceeds this value, trading is locked for the rest of the day. |
| Max Contracts | Maximum position size allowed. Orders that would exceed this quantity are blocked. |
| Trailing Drawdown | Maximum loss from your peak equity (highest balance achieved). As your account grows, the drawdown threshold moves up with it. If equity drops below the trailing threshold, trading is locked. |
| Profit Target | When your account reaches this profit level, the position is automatically closed as a success and trading completes. |
Configuring Rules
- Open the Trading tab (Tab 1) in the right panel
- In the Account sub-tab, scroll to the Rules section
- Toggle each rule on/off using the switch
- Enter the rule value (dollar amount)
- Rules save automatically after a brief delay
How Auto-Liquidation Works
Rules are checked on every bar update while a position is open:
- The system calculates the exact price at which the rule would be breached
- If a bar's price action crosses that level, the position is closed at the precise breach price
- All pending orders are canceled
- Trading is locked - no new orders can be placed
- A notification appears explaining which rule was triggered
The Daily Loss Limit uses the CME trading day convention: a new trading day starts at 6:00 PM Eastern Time. Your daily loss counter resets at this time.
The trailing drawdown tracks your peak equity using intra-bar highs (for long positions) and lows (for short positions), providing accurate peak tracking even within individual bars.
Trading Tab (Tab 1)
The Trading tab in the right panel has 4 sub-tabs:
1. Account
Shows your account overview and rule configuration:
- Balance - Your current account balance (editable - click to change the starting balance)
- Realized P&L - Total profit/loss from closed trades
- Unrealized P&L - Current profit/loss on open position
- Net P&L - Combined realized + unrealized
- Rules - Configure the 5 trading rules described above
2. Orders
Shows your current trading state:
- Position - Displays "Flat" when no position, or shows side (Long/Short), quantity, entry price, current price, and live P&L
- Pending Orders - Lists all active limit and stop orders with type, side, quantity, and price. Each order has a cancel button
3. History
Two sub-tabs for reviewing past activity:
- Trades - Lists all completed trades with side, quantity, entry/exit prices, gross P&L, fees, and net P&L
- Orders - Full order audit trail showing every order placed, filled, or canceled, with status, prices, and timestamps
4. Stats
Live performance statistics updated after each trade:
- Cumulative P&L Chart - Visual graph of your P&L over time
- Total Trades
- Win Rate
- Wins / Losses
- Average Win / Average Loss
- Largest Win / Largest Loss
- Profit Factor - Gross profit divided by gross loss
- Expectancy - Average expected P&L per trade
- Risk/Reward Ratio
- Max Drawdown
- Consecutive Wins / Consecutive Losses
Chart Visuals
The trading system adds visual elements to the chart to help you track your activity:
Position Visuals
- Entry line - Horizontal line at your entry price, colored based on current P&L
- Position badge - Overlay at the entry price showing live P&L with a close button. Draggable to set TP/SL
- Y-axis labels - TP and SL price levels display on the price scale axis for quick reference
Order Visuals
- Order lines - Horizontal lines at each pending order's price level
- Order badges - Overlays showing order type and price. Draggable to adjust price
- Linked TP/SL orders show live projected P&L and use color coding (green for TP, red for SL)
- Standalone SL/TP orders also display price labels on the Y-axis
Execution Markers
- Entry arrows - Arrow markers on the chart at the bar where you entered a trade
- Exit arrows - Arrow markers at the bar where you exited
- Markers persist for the entire session and are restored when you return
Session Restoration
All trading state is saved per session and fully restored when you return:
- Open position - Side, quantity, entry price, and entry time restored. Position badge and entry line recreated on the chart
- Pending orders - All limit and stop orders restored with their prices. Order lines and badges recreated on the chart
- Account state - Balance, peak balance, realized P&L, fees, and daily tracking restored
- Trading rules - All rule configurations and their enabled/disabled state restored
- Trade history - Complete list of past trades and execution markers recreated on the chart
- Order history - Full audit trail of all orders (placed, filled, canceled)
- Statistics - Win rate, streaks, drawdown, and all other stats rebuilt from trade history
When you switch timeframes or symbols during a session, all chart visuals (position lines, order lines, execution markers) are automatically recreated to match the new view.
Resetting Trading Data
To start fresh within a session, use the Reset option in the Trading tab. This clears all trading data (positions, orders, trades, balance) for the current session while keeping your entry data and notes intact. A confirmation dialog is shown before resetting.
Tips
- Use the Order Panel for speed - The bottom panel is fastest for quick market orders during fast replay
- Use the Trading tab for management - Switch to Tab 1 to review orders, check stats, and configure rules
- Drag for TP/SL - Dragging from the position badge is the fastest way to set take-profit and stop-loss levels
- Set rules before trading - Configure max drawdown and daily loss limits to simulate real account conditions
- Watch the Stats tab - Review your win rate and profit factor regularly to track improvement
- Use right-click for precision - Right-click the chart at exact price levels to place limit orders
Troubleshooting
Orders Not Filling
- Limit and stop orders only fill when the bar's high/low reaches the order price
- Ensure the order price is on the correct side of the market (limit buy below market, stop buy above market, etc.)
- Check that replay is running - orders only check fills on new bar updates
Can't Place Orders
- Check if a trading rule has been breached (rules lock trading when violated)
- Ensure replay mode is active
- Verify the quantity is greater than zero
Position Visuals Missing
- Visuals are recreated on timeframe or symbol changes - wait for the chart to fully load
- Try switching timeframes and back to trigger visual recreation
Rule Triggered Unexpectedly
- Trailing drawdown uses intra-bar peaks, not just close prices - a spike within a bar can update the peak
- Daily loss limit resets at 6 PM ET, not midnight - check if you're near the reset boundary
- Review the exact rule value in the Account tab