OPEN-SOURCE SCRIPT
更新済 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.
リリースノート
Added Live-lot size calculations.オープンソーススクリプト
TradingViewの精神に則り、このスクリプトの作者はコードをオープンソースとして公開してくれました。トレーダーが内容を確認・検証できるようにという配慮です。作者に拍手を送りましょう!無料で利用できますが、コードの再公開はハウスルールに従う必要があります。
免責事項
これらの情報および投稿は、TradingViewが提供または承認する金融、投資、取引、またはその他の種類の助言もしくは推奨であることを意図したものではなく、またこれらに該当するものでもありません。詳細は利用規約をご覧ください。
オープンソーススクリプト
TradingViewの精神に則り、このスクリプトの作者はコードをオープンソースとして公開してくれました。トレーダーが内容を確認・検証できるようにという配慮です。作者に拍手を送りましょう!無料で利用できますが、コードの再公開はハウスルールに従う必要があります。
免責事項
これらの情報および投稿は、TradingViewが提供または承認する金融、投資、取引、またはその他の種類の助言もしくは推奨であることを意図したものではなく、またこれらに該当するものでもありません。詳細は利用規約をご覧ください。