Pro position-size calculator with full trade planner.
Live FX, crypto, and metals prices. Multi-currency. Single HTML file.
Plans a complete trade order in one place — give it your balance, risk %, direction, stop, and R:R target, and it returns Entry · SL · TP prices ready to paste into your broker, plus risk metrics, lot breakdown, and a visual price ladder.
- 📡 Live prices — FX (Frankfurter ECB), Crypto (Binance + CoinGecko fallback), Metals (goldprice.org → Gemini → Kraken cascade)
- 💱 Multi-currency accounts — USD · EUR · GBP · CHF · JPY · AUD · CAD · NZD with automatic conversion
- 📊 16 instruments — 9 FX pairs, 2 metals (XAU, XAG), 3 indexes (US30, NDX, SPX500), 2 crypto (BTC, ETH)
- 🎯 Two stop modes — Pips distance OR explicit Entry/SL prices (direction auto-detected)
- ⚖️ R:R target — presets (1:1, 1:1.5, 1:2, 1:3, 1:5) + custom input
- 🛡️ Manual lot override — type any lot size and all metrics recalculate around it
- 📋 Copy-to-clipboard — one button copies the full order plan
- 📈 Visual price ladder — SL · Entry · TP positions at a glance
- 🌐 Bilingual — ES / EN toggle, full UI translation
- 📱 Mobile-first — responsive down to 360px
- ⏰ Gold market awareness — detects CME Globex closed hours, freezes price + warns
Or clone and open index.html in any browser. No build, no install.
git clone https://github.com/othmarodev/position-size-calculator.git
cd position-size-calculator
open index.htmlRisk $ = Balance × (Risk% / 100)
Entry = Live market price (or your typed limit)
SL price = Entry ∓ (Stop pips × Pip Size) [- for Long, + for Short]
TP price = Entry ± (Stop pips × Pip Size × R:R) [+ for Long, - for Short]
Pip Value $ = Lot × Pip Size × Conv(quote → account ccy)
Lot Size = Risk $ / (Stop pips × Pip Value $)
Margin = (Units × Entry) / Leverage
Profit $ = Risk $ × R:R (if TP fills)
Currency conversion uses cross-rates from a single USD-based table refreshed daily from the ECB via Frankfurter.
| Source | What | Refresh | Reliability |
|---|---|---|---|
| Frankfurter (ECB) | FX rates | Daily | High — official central bank data |
| Binance | BTC, ETH | 10s polling | High — direct exchange ticker |
| CoinGecko | BTC, ETH fallback | 10s polling | Medium — aggregator |
| goldprice.org | XAU, XAG | 30s polling | High — spot reference |
| Gemini PAXG | XAU fallback | 30s polling | Medium — tokenized gold ±0.5% |
| Kraken XAUT | XAU fallback 2 | 30s polling | Medium — tokenized gold ±0.3% |
| CoinGecko PAXG/KAG | Metals secondary | 10s polling | Medium |
| Indexes (US30, NDX, SPX500) | — | constant estimate | Low — verify with broker |
All sources are CORS-open and require no auth. Indexes use constant estimates because no good public API exists — for serious index sizing, verify your broker's contract specs.
- Pure vanilla — single 1400-line
index.html - One dependency — Tailwind via CDN (for the dense styling). No npm, no build, no framework.
- Custom canvas-free design — pure HTML/CSS for the price ladder and all visual elements
- Bilingual i18n — embedded ES/EN dictionary, instant switching
- Pause when hidden —
visibilitychangepauses polling when the tab isn't active
ES2018+. Tested on Chrome, Safari, Firefox, Edge. Works on iOS Safari and Chrome mobile.
Originally a tool inside TraderLoft — a cinematic 3D hub for trading products. Extracted as a standalone open-source utility because position sizing is fundamental, and most online calculators are either bloated, ad-laden, or wrong about pip values across instruments.
This is a planning tool, not financial advice. Live prices have a slight delay vs your broker execution. Always verify specs and exact prices before sending an order. The author assumes no responsibility for trading losses.
MIT — see LICENSE. Use it, fork it, embed it, ship it.
Built with code, curiosity, and ☕ — from 🇨🇷 San José, Costa Rica · by Othmaro Fallas