OPEN-SOURCE SCRIPT
Atualizado DTC Lot Size Calculator

You set an Entry Price and Stop Price (click-to-place on the chart, or type them in). The script works backward from your risk percentage to tell you exactly how large a position you can take — lot size for forex/CFDs, or whole contracts for futures — so that a stop-out costs exactly what you intended to risk, not more.
It plots Entry, Stop, and R-multiple target lines (1R, 2R, 3R...) directly on the chart, and a compact table shows the full breakdown: risk amount, position size, commission, spread cost, required margin, and the resulting reward:risk ratio.
How the sizing works
Position size is solved from your planned Entry/Stop distance, not a live-recalculated one, so the lot size stays stable and doesn't silently drift every time price ticks. An optional "Reset entry to live price" toggle lets Entry track the current close while Stop stays fixed, so you can watch how a live-tracking price affects real risk without re-plotting manually every time.
True Risk (not just the target risk %) accounts for commission and spread cost, so the number you see is what you'd actually lose, not an idealized figure.
Futures contracts (ES, MES, NQ, MNQ, YM, MYM, RTY, M2K, CL, MCL, NG, GC, MGC, SI, HG, ZB, ZN, ZF, 6E, 6J, 6B, 6A, ZC, ZS, ZW, and CME BTC/ETH) use their real exchange tick size and tick value, and size in whole contracts only, no fractional micros. Spot metals (XAUUSD, XAGUSD, XPTUSD, XPDUSD) use standard 100oz/5000oz/50oz lot conventions matching their COMEX futures equivalents, since these are commonly mispriced by generic calculators.
Built-in safety checks
Risk % turns red with a caution mark above a threshold you set (default 3%). Stop distance turns red with a caution mark if it's unusually wide for a forex pair (default 15 pips). Margin % estimates how much of your account the position would tie up at your configured leverage, and warns if it exceeds 100%, catching cases where a risk-correct position size is still too large for the account to actually hold. A second, independently configurable account/risk table can be shown side by side for comparing two account sizes or risk profiles at once.
Why this is a distinct build, not a re-skin
The original by cryptonnnite was a single-instrument forex lot size calculator. This version adds: multi-asset contract specs (futures + metals), the planned-vs-live entry distinction and its safety fallback, commission+spread-inclusive true risk, the margin/leverage check, configurable warning thresholds, a second comparison account, and the auto dark/light theme system, all new logic layered on top of the original risk-sizing concept.
It plots Entry, Stop, and R-multiple target lines (1R, 2R, 3R...) directly on the chart, and a compact table shows the full breakdown: risk amount, position size, commission, spread cost, required margin, and the resulting reward:risk ratio.
How the sizing works
Position size is solved from your planned Entry/Stop distance, not a live-recalculated one, so the lot size stays stable and doesn't silently drift every time price ticks. An optional "Reset entry to live price" toggle lets Entry track the current close while Stop stays fixed, so you can watch how a live-tracking price affects real risk without re-plotting manually every time.
True Risk (not just the target risk %) accounts for commission and spread cost, so the number you see is what you'd actually lose, not an idealized figure.
Futures contracts (ES, MES, NQ, MNQ, YM, MYM, RTY, M2K, CL, MCL, NG, GC, MGC, SI, HG, ZB, ZN, ZF, 6E, 6J, 6B, 6A, ZC, ZS, ZW, and CME BTC/ETH) use their real exchange tick size and tick value, and size in whole contracts only, no fractional micros. Spot metals (XAUUSD, XAGUSD, XPTUSD, XPDUSD) use standard 100oz/5000oz/50oz lot conventions matching their COMEX futures equivalents, since these are commonly mispriced by generic calculators.
Built-in safety checks
Risk % turns red with a caution mark above a threshold you set (default 3%). Stop distance turns red with a caution mark if it's unusually wide for a forex pair (default 15 pips). Margin % estimates how much of your account the position would tie up at your configured leverage, and warns if it exceeds 100%, catching cases where a risk-correct position size is still too large for the account to actually hold. A second, independently configurable account/risk table can be shown side by side for comparing two account sizes or risk profiles at once.
Why this is a distinct build, not a re-skin
The original by cryptonnnite was a single-instrument forex lot size calculator. This version adds: multi-asset contract specs (futures + metals), the planned-vs-live entry distinction and its safety fallback, commission+spread-inclusive true risk, the margin/leverage check, configurable warning thresholds, a second comparison account, and the auto dark/light theme system, all new logic layered on top of the original risk-sizing concept.
Notas de Lançamento
Added Live-lot size calculations.Script de código aberto
Em verdadeiro espírito do TradingView, o criador deste script o tornou de código aberto, para que os traders possam revisar e verificar sua funcionalidade. Parabéns ao autor! Embora você possa usá-lo gratuitamente, lembre-se de que a republicação do código está sujeita às nossas Regras da Casa.
Aviso legal
As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.
Script de código aberto
Em verdadeiro espírito do TradingView, o criador deste script o tornou de código aberto, para que os traders possam revisar e verificar sua funcionalidade. Parabéns ao autor! Embora você possa usá-lo gratuitamente, lembre-se de que a republicação do código está sujeita às nossas Regras da Casa.
Aviso legal
As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.