Guardrails
EdgeProof is designed so that the system is hard to break, not just hard to misconfigure. Guardrails are structural. They apply before any order reaches the broker.
Position sizing
Every position is sized by a dollar budget:
qty = floor(positionSizeUsd / (marketPrice × 100))
qty = max(qty, 1) // always at least 1 contract if budget allows
TRADING_POSITION_SIZE_USD defaults to $500. At $5.00 per contract ($500 notional value), that's 1 contract. At $2.50, that's 2 contracts.
Per-underlying cap
TRADING_MAX_CONTRACTS_PER_UNDERLYING (default: 2) limits how many contracts EdgeProof will hold across all strikes and expiries for one underlying ticker. If SPY already has 2 contracts, new SPY signals are skipped until a position closes.
Signal staleness
TRADING_MAX_SIGNAL_AGE_MINUTES (default: 60): signals older than this are discarded without attempting an order. Options pricing can move significantly in an hour; a stale entry is often worse than no entry.
Price ceiling (hard cap)
TRADING_HARD_CAP_PCT (default: 10%): if the current market price is more than 10% above the signal's recommended entry, the order is skipped. This prevents chasing momentum on late signals.
Exit rules (per position)
Configured via POSITIONS_DEFAULT_* vars. Defaults:
| Rule | Default | Meaning |
|---|---|---|
| Take-profit | +75% | Close when position value is 75% above entry |
| Stop-loss | −50% | Close when position value is 50% below entry |
| Trailing stop | −40% from peak | Close if price falls 40% from the highest mark |
| Trailing activation | +30% | Trailing stop only activates after a +30% gain |
| Max hold | 150h | Force-close after 150 hours regardless of P&L |
These are defaults applied to every position. Individual signals can set tighter rules via the signal text (EdgeProof's LLM extraction respects explicit targets when present).
Kill switch
edgeproof halt # pause entries, keep managing exits
edgeproof flatten # close everything, then halt
halt stops new trade entries within one monitor cycle. Open positions continue to be managed (exits still fire). No restart required to resume:
edgeproof resume
flatten places market orders to close all open positions, then halts. Use this before going offline for an extended period.
Trading hours
EdgeProof checks that the Alpaca clock says the market is open before placing entries. Exits may fire outside regular hours if the signal warrants it (e.g., pre-market stop-loss triggers via streaming). Use --bypass-trading-hours (supervisor dev mode only) to disable this check in testing.
Slippage control
TRADING_SLIPPAGE_PCT (default: 7%): limit orders are placed at midpoint × (1 + slippage) for buys. If the order doesn't fill, a retry at TRADING_RETRY_SLIPPAGE_PCT (default: 10%) is attempted after TRADING_RETRY_MIN_AGE_MINUTES.