The definitive guide to testing your strategy with production-grade paper trading before risking real capital. From enabling your first paper trade to confidently going live — every step, every setting, every metric explained.
The Rule: never go live until paper trading shows consistent edge over at least 50–100 trades across different market conditions. If your strategy cannot win on paper with realistic costs, it will not win with real money.
In the main application, go to the Paper Trading tab. Toggle the Paper Trading switch to ON. This activates the paper engine without affecting any live broker connection.
Go to Paper Trading → Settings. Set Initial Balance to the amount you plan to trade with in real life (e.g., ₹1,00,000 or ₹5,00,000). This makes results directly comparable to your real capital.
Set these to match your broker's actual charges. Defaults are calibrated for Indian discount brokers (Zerodha / Shoonya / Angel One):
| Setting | Default | What It Is |
|---|---|---|
| Commission Rate | 0.03% | Brokerage per side (min ₹20 enforced) |
| STT Rate | 0.05% | Securities Transaction Tax (sell side) |
| Exchange Fee Rate | 0.05% | NSE/BSE transaction charge |
| SEBI Fee Rate | 0.01% | SEBI regulatory charge |
| Stamp Duty Rate | 0.05% | State stamp duty (buy side) |
| Slippage | 0.05% | Estimated price execution variance |
| Spread | 0.02% | Bid-ask spread estimate |
These should match what you plan to use in live trading:
| Setting | Default | Recommended Start |
|---|---|---|
| Risk Per Trade | 1.0% | 1–2% of your capital |
| Max Daily Loss | ₹500 | 2–5% of your capital |
| Max Drawdown | 20% | 15–25% of starting balance |
| Max Positions | 10 | 3–10 concurrent |
| Max Trades/Day | 50 | 5–20 for intraday |
| Default SL% | 2.0% | 1–3% depending on style |
| Default TP% | 4.0% | 2–6% (match your R:R target) |
This is the viability engine that prevents cost-negative trades from entering. Turn it ON and use these production defaults:
| Setting | Recommended | Purpose |
|---|---|---|
| Trade Quality Gate | ON | Enable cost-aware trade filtering |
| Non-Viable Mode | STRICT | Block poor-edge trades |
| Weak Tier Action | REJECT | Block marginal trades too |
| Min Expected Profit | ₹100 | Absolute minimum gross edge |
| Adaptive Min Edge | ON | Volatility-aware filtering |
| Adaptive Multiplier | 0.5 | Dynamic edge scaling factor |
| Min Volatility Floor | 0.1% | Prevents ultra-tight SL exploits |
| Min Samples | 30 | Trades needed before gate activates |
NSE equity: 09:15 → 15:30, square-off at 15:25. MCX: adjust to the commodity session. Signals outside these hours are ignored.
Your AmiBroker AFL sends signals via HTTP to the gateway. The gateway dispatches to the paper trading engine. No broker API is needed — paper mode runs entirely locally on your machine.
You are now ready. Start AmiBroker, load your strategy, and let it run during market hours. Paper trades will appear in the Dashboard tab in real time.
execute_signal()This is what makes paper results trustworthy. The system applies the full Indian market cost stack on every trade — both entry and exit. This is not simplified or averaged. Each component is calculated separately.
ENTRY SIDE:
Brokerage = max(notional × 0.03%, ₹20) ← minimum ₹20 per order
Stamp Duty = buy_notional × 0.05% ← charged on buy side only
Slippage = notional × 0.05% ← estimated execution variance
Spread = notional × 0.02% ← bid-ask cost
EXIT SIDE:
Brokerage = max(notional × 0.03%, ₹20)
STT = sell_notional × 0.05% ← charged on sell side only
Slippage = notional × 0.05%
Spread = notional × 0.02%
BOTH SIDES:
Exchange Fee = notional × 0.05% ← per side
SEBI Fee = notional × 0.01% ← per side
TOTAL COST = (all entry costs) + (all exit costs)
NET PNL = Gross PnL − Total Cost
BUY RELIANCE @ ₹2,450 × 10 shares
SELL @ ₹2,510 (target hit)
Gross P&L = (2510 − 2450) × 10 = ₹600
Total Cost ≈ ₹59.70
Net P&L = ₹600 − ₹59.70 = +₹540.30
Cost as % of notional = 0.24%
Kept 90% of gross edge ✅
BUY YESBANK @ ₹18.50 × 50 shares
SELL @ ₹19.10 (target hit)
Gross P&L = (19.10 − 18.50) × 50 = ₹30
Total Cost ≈ ₹44.80
Net P&L = ₹30 − ₹44.80 = −₹14.80
Trade "won" on price but LOST on costs ❌
Viability gate would have blocked this
per_share_profit = expected_move (target − entry)
per_share_cost = total_cost / quantity
viability_score = per_share_profit / per_share_cost
Per-share scoring is quantity-independent. It measures the true quality of the trade setup — not how big the position is.
volatility_unit = abs(entry − stop_loss)
// floor: entry × min_volatility_floor_pct
dynamic_min = volatility_unit × multiplier × qty
static_min = min_expected_profit (e.g., ₹100)
final_min = max(static_min, dynamic_min)
Adjusts automatically: tighter minimum in quiet markets, higher bar in volatile markets.
| Tier | Score Range | What It Means | Default Action (STRICT) |
|---|---|---|---|
| STRONG | ≥ 2.0 | Expected profit covers costs 2× or more | Allow |
| ACCEPTABLE | 1.2 – 1.99 | Solid edge, worth taking | Allow |
| WEAK | 0.8 – 1.19 | Marginal — barely beats costs | Reject (configurable to Warn) |
| REJECT | < 0.8 | Expected profit cannot cover costs | Reject |
| REJECT_ABSOLUTE | any | Total gross edge below minimum (e.g., < ₹100) | Hard reject always |
15:25 (configurable), all open positions close.Unified SL/TP Engine: Paper and live trading share the exact same TradingEngine for SL/TP evaluation. This means your paper exits will behave identically to live exits.
Every open trade shows in real time:
| Column | Meaning |
|---|---|
| Trade ID | Unique identifier (e.g., PAPER_000042) |
| Symbol | Stock/instrument name (RELIANCE, NIFTY, CRUDEOIL, etc.) |
| Side | BUY (long) or SELL (short) |
| Qty | Position quantity (may be adjusted by cost-aware sizing) |
| Entry Price | Price at which trade was opened |
| Current Price | Latest market price (updates on every tick) |
| PnL | Current unrealized profit/loss (includes cost estimate) |
| SL / TP | Active stop-loss and target levels |
| Duration | How long the trade has been open |
Winning trades ÷ total trades × 100. Aim for > 45% with proper R:R.
(WinRate × AvgWin) − (LossRate × AvgLoss). Must be positive.
Total wins ÷ total losses. Aim for > 1.5.
Largest peak-to-trough decline. Keep under 15–25%.
Risk-adjusted return: mean return ÷ standard deviation. > 1.0 is good, > 2.0 is excellent for intraday.
Total costs ÷ total gross PnL. Should be well below 30% — if costs eat more than 30% of your gross edge, the strategy is fragile.
The Golden Rule: No single metric tells the full story. A 70% win rate with ₹5 avg win and ₹50 avg loss is terrible. A 35% win rate with ₹100 avg win and ₹30 avg loss is excellent. Always check expectancy alongside win rate.
[STALE PRICE] in logs)DO NOT go live if any of these are true:
| Metric | Minimum To Go Live | Good Target | Excellent |
|---|---|---|---|
| Total Trades | 50+ | 100+ | 200+ |
| Expectancy | Positive | > ₹50/trade | > ₹150/trade |
| Win Rate | > 35% | > 45% | > 55% |
| Profit Factor | > 1.2 | > 1.8 | > 2.5 |
| Sharpe Ratio | > 0.5 | > 1.0 | > 2.0 |
| Max Drawdown | < 25% | < 15% | < 10% |
| Cost Efficiency | < 40% | < 25% | < 15% |
| Consecutive Losses | < 8 | < 5 | < 3 |
| Log Pattern | What It Means | Action |
|---|---|---|
Trade opened: RELIANCE BUY |
Trade passed all gates and is now active. | Normal operation. |
❌ Rejected: Viability tier=REJECT |
Per-share cost efficiency too weak. | Check if symbol is viable or increase qty. |
❌ Rejected: tier=REJECT_ABSOLUTE |
Total expected profit below minimum edge. | Normal for tiny moves. Strategy may need wider targets. |
[STALE PRICE] RELIANCE → 2.83s old |
Price feed was momentarily delayed. | Occasional = normal. Frequent = check connection. |
Trade closed: net PnL = −₹85 |
Trade hit SL or was squared off at loss. | Review if SL was too tight or entry was poor. |
Paper trade quantity uplift |
Qty was increased to overcome fixed minimum costs. | Normal for low-priced stocks. Watch capital usage. |
Weak viability allowed (STRICT + weak_action=WARN) |
Marginal trade allowed because Weak Tier = WARN. | Track these. Switch to REJECT if too many lose. |
min_volatility_floor_pct=0.0010 |
Volatility floor is being applied. | Check if your SL is unrealistically tight. |
| Setting | Default | Range | Where |
|---|---|---|---|
| Initial Balance | ₹1,00,000 | ₹10,000 – ₹10,00,00,000 | Settings tab |
| Risk Per Trade | 1.0% | 0.1% – 10% | Settings tab |
| Max Trades/Day | 50 | 1 – 500 | Settings tab |
| Max Positions | 10 | 1 – 100 | Settings tab |
| Max Daily Loss | ₹500 | ₹100 – ₹10,00,000 | Settings tab |
| Max Drawdown | 20% | 5% – 50% | Settings tab |
| Default SL% | 2.0% | 0.1% – 20% | Settings tab |
| Default TP% | 4.0% | 0.1% – 50% | Settings tab |
| Risk:Reward Ratio | 2.0 | 0.5 – 10.0 | Settings tab |
| Commission Rate | 0.03% | 0.00% – 1.00% | Settings tab |
| STT Rate | 0.05% | 0.00% – 1.00% | Settings tab |
| Exchange Fee | 0.05% | 0.00% – 1.00% | Settings tab |
| SEBI Fee | 0.01% | 0.00% – 1.00% | Settings tab |
| Stamp Duty | 0.05% | 0.00% – 1.00% | Settings tab |
| Slippage | 0.05% | 0.00% – 2.00% | Settings tab |
| Spread | 0.02% | 0.00% – 2.00% | Settings tab |
| Trade Quality Gate | ON | ON / OFF | Settings tab |
| Non-Viable Mode | STRICT | STRICT / WARN / OFF | Settings tab |
| Weak Tier Action | REJECT | REJECT / WARN | Settings tab |
| Min Expected Profit | ₹100 | ₹0 – ₹10,00,000 | Settings tab |
| Adaptive Min Edge | ON | ON / OFF | Settings tab |
| Adaptive Multiplier | 0.5 | 0.0 – 10.0 | Settings tab |
| Min Volatility Floor | 0.10% | 0.01% – 2.00% | Settings tab |
| Manual Override | OFF | ON / OFF | Settings tab |
| Min Gate Samples | 30 | 5 – 1000 | Settings tab |
| Score Threshold | 55.0 | 0 – 100 | Settings tab |
| Trading Start | 09:15 | — | Settings tab |
| Trading End | 15:30 | — | Settings tab |
| Square Off Time | 15:25 | — | Settings tab |
The Final Test: Open your paper trading history. Look at the worst 5 consecutive losing trades. If you can handle that same streak with real money and still follow your system — you are ready.