Long versus short futures PnL
Direction changes the sign of the price-based PnL term. It does not change the quantity formula or remove either trading fee. Compare directions using the same assumptions rather than treating the example presets as trading recommendations.
The two gross PnL branches
The code first computes N = I × L, Q = N / E and C = Q × T. A long uses grossPnl = C − N. A short uses grossPnl = N − C. Thus a rising target price favors a long before fees, while a falling target favors a short. Both branches subtract totalFees afterward.
Same rising price, opposite directions
Use E = $50,000, T = $55,000, I = $1,000, L = 10 and fee 0.075%, with payback disabled. N is $10,000, Q is 0.2 and C is $11,000. A long has $1,000 gross PnL and $984.25 net PnL. A short has −$1,000 gross PnL and −$1,015.75 net PnL. Both pay $15.75 under these identical prices and fee assumptions.
A favorable short example
For the same starting inputs but T = $45,000, C is $9,000. The short earns $1,000 gross PnL. Entry fee is $7.50 and exit fee $6.75, totaling $14.25. Net PnL is $985.75, ROI 98.575% (98.58% displayed) and final equity $1,985.75. The opposite long has net PnL −$1,014.25.
Why equal percentage moves have different fees
A 10% rise produces an $11,000 exit value; a 10% fall produces a $9,000 exit value. Because the exit fee uses closingValue rather than the entry notional, the profitable long and profitable short examples have different fees. Applying twice the entry fee would erase this distinction and would not match the implemented formula.
Unchanged price and losses beyond margin
At T = E, both direction branches have zero gross PnL. With $10,000 notional and the 0.075% fee, each side costs $7.50, so both net results are −$15 and ROI is −1.5%. At adverse prices the model may report losses larger than the initial investment, since no account protection or exchange-specific loss cap is modeled.
Changing direction in the interface
The long and short buttons are explicit actions. Reset clears both prices, restores the default numeric assumptions and disables payback while retaining the selected direction. Each example preset instead explicitly sets a long position and replaces the example inputs. None of these actions executes a trade or fetches a market price.
Validation and precision
Entry and target prices, investment and leverage must be finite and positive; fee must be finite and nonnegative. Enabled payback must be between 0% and 100%. All derived arithmetic must remain finite. Both prices start blank; once either is filled, required-field validation applies. Display values are rounded, without intermediate currency rounding.
Model limitations
The calculation assumes a linear USD-denominated contract, fixed quantity and exact entry and exit prices. Funding, slippage, taxes, inverse contracts, maintenance margin and exchange-specific rules are excluded. Payback is hypothetical, not guaranteed. Results may show negative final equity. This is information, not financial advice.
Implementation basis
These statements follow the calculation callback, resetFields and preset handlers in components/Calculator.tsx. Numeric cases are checked by scripts/smoke-calculator.mjs. No external exchange fee, product availability or performance claim is made.