// Shared · Advanced XAU/USD risk calculator — window.RiskCalc // Lot size + stop / target (in $ price movement) → dollar risk, % of // account risked, reward and R:R, with a safe / caution / danger banner. // Gold contract = 100 oz per 1.00 lot, so a $1.00 price move = $100 per lot. // Thresholds: Safe ≤ 2% · Caution 2–5% · Danger > 5%. (function(){ const { useState, useMemo } = React; const CONTRACT = 100; // troy oz per 1.00 lot (standard XAUUSD) const LS_KEY = 'cg_riskcalc_v1'; const usd = n => (n<0?'-':'')+'$'+Math.abs(Number(n)||0).toLocaleString('en-US',{minimumFractionDigits:2,maximumFractionDigits:2}); function load(){ try{ return JSON.parse(localStorage.getItem(LS_KEY)||'{}'); }catch(e){ return {}; } } function band(pct){ if(pct<=2) return { key:'safe', label:'Safe', color:'var(--green)', bg:'rgba(52,211,153,.10)', border:'rgba(52,211,153,.35)', msg:'Within a healthy risk range.' }; if(pct<=5) return { key:'caution', label:'Caution', color:'var(--gold-2)', bg:'var(--gold-soft)', border:'var(--border-gold)', msg:'Above the usual 1–2% guideline — size down if you can.' }; return { key:'danger', label:'Too much',color:'var(--red)', bg:'rgba(248,113,113,.10)', border:'rgba(248,113,113,.4)', msg:'You are risking too much on one trade. Reduce your lot size or widen your account.' }; } function Inp({label, value, onChange, placeholder, prefix, suffix}){ return
Enter your account size, lot and stop distance to see the exact dollar risk and the percentage of your account on the line. Gold trades in 100 oz per 1.00 lot — a $1.00 price move is $100 per lot.
{has? b.msg : 'Fill in balance, lot and stop loss to calculate.'}
Educational tool · figures assume a standard 100 oz XAU/USD contract and your broker's USD account. Not financial advice.