Formulas and Calculations
Start Free 30-Day Trial
Distances and Base Values
Section titled “Distances and Base Values”tick_distance = abs(price_a - price_b) / tickSizerisk_per_contract = (abs(entry - stop) / tickSize) * tickValuereward_per_contract = (abs(target - entry) / tickSize) * tickValuerr = reward_per_contract / risk_per_contract(if risk is 0, result is invalid)
Quantity and Total Risk
Section titled “Quantity and Total Risk”quantity_from_cash = floor(risk_budget_cash / risk_per_contract)risk_total_cash = risk_per_contract * quantityrisk_pct = risk_total_cash / account_balance- Budget by %:
risk_budget_cash = account_balance * risk_pct_budget
Direction and Order Logic
Section titled “Direction and Order Logic”- Direction: long if
target > entry; short iftarget < entry; if Stop crosses Entry, the role is flipped to stay consistent. - Market vs Pending: near-market sends a Market order; distant entries use a pending order (
limit/stop) with optional StopLimit enforcement.
Key Validations
Section titled “Key Validations”- Stop required and minimum distance > 0.
- Quantity must be an integer and > 0; NaN, Infinity, and negatives are rejected.
- If
tickSize,tickValue, or account data is missing, Preflight is marked invalid and Risk Gate blocks submission.
Quick Reminders
Section titled “Quick Reminders”- Risk and reward are based on active NinjaTrader 8 instrument values; they do not include commissions or slippage.
- The circuit breaker activates when a critical rule fails and blocks until you press Reset.
- Panic cancels working/accepted orders and closes the position in the active instrument at market.
What It Measures and What It Does Not
Section titled “What It Measures and What It Does Not”- Measures: risk and reward from Entry/Stop/Target with official tick/point values; suggested quantity by budget; guardrail checks (margin, position, exposure, daily loss, stop present); Preflight and Risk Gate states.
- Does not measure: slippage, commissions, or taxes; correlation between instruments or multi-symbol hedging; network latency or broker availability (if data is missing it is marked unavailable, not OK); licensing, versions, or diagnostics.