OPEN-SOURCE SCRIPT
Risk Manager & Position Sizer [martineye15]

Prop Firm Risk Manager & Position Sizer — a position-size calculator and rule checker built for funded-account and challenge traders. Place your entry, stop-loss and take-profit on the chart, and the panel returns the exact lot size for your chosen risk, then checks that trade against your prop-firm rules before you take it.
THE CORE IDEA: RISK IS FIXED, LOT SIZE FLOATS
Risk money = account size x risk % (or a fixed cash amount). Lot size = risk money / (stop distance x value per lot + commission). Widening the stop shrinks the position; tightening it grows the position. The money at risk never changes. Sizes are rounded DOWN to your broker's lot step, so actual risk never exceeds planned risk.
TRADE LEVELS
Entry, stop-loss and take-profit are interactive price inputs — click to place them when you add the indicator, then drag the price lines to re-plan and watch every number update live. Entry can follow the current price (market) or sit at a placed level (pending). Direction is derived from the stop's side of entry, or forced long/short to validate your geometry. Optionally, an ATR module sets the stop and target automatically at entry -/+ ATR x multiplier, using the chart timeframe or a higher one, and either the live or the last closed bar's ATR.
ACCOUNT & INSTRUMENT
Set your account size, account currency and risk (percent of account or a fixed cash amount). If the symbol's quote currency differs from your account currency, a conversion rate is fetched automatically (direct pair first, then inverse) and a warning appears if neither resolves. Broker specs are fully adjustable: contract size (auto-derived or manual, for the many CFD symbols whose specs differ from the exchange's), lot step, minimum and maximum lot, and round-trip commission per lot, which is treated as part of the loss. A manual lot override works in reverse: enter a size you already have in mind and the panel tells you the risk money and risk percentage it actually carries.
PROP-FIRM RULE ENGINE
Enter your firm's limits — maximum daily loss, maximum total drawdown, per-trade risk cap, maximum lots, maximum portfolio open risk, and profit target (typical challenge rules are 5% daily, 10% total, 10% target). Log how much you have already lost today and your running P/L, and the panel shows:
- Remaining daily loss budget, and whether this trade fits inside it
- How many identical losing trades it would take to breach the daily limit
- Remaining total drawdown buffer, reduced by any running loss
- Pass/fail on the per-trade risk cap, the lot cap, and combined open risk across positions
- Distance to your profit target, in money and in R multiples of this trade's risk
- A minimum risk:reward check
With hard block enabled, any failed check turns the panel header red and shows DO NOT TRADE.
PANEL, DRAWINGS & ALERTS
A dashboard table (four corner positions, normal or compact, dark or light) shows direction, levels, lot size, units, risk and reward in money and percent, risk:reward, per-pip value for the sized position, every rule check, and a plain-language warnings list explaining anything that is wrong or clamped. Entry, stop and target are drawn as labelled lines with shaded risk and reward zones. Alerts are available for entry, stop or target touches — with the computed lot size and risk in the message — and for any rule check flipping to fail.
HOW TO USE
Add the indicator, click to place entry, stop and target. Set your account size, currency and risk percentage, then enter your broker's contract size, lot step and commission (check these against your own account — CFD specs vary between brokers). Enter your firm's daily loss, drawdown, target and cap rules once. Before each trade, drag the levels to your plan, update the loss-taken-today and current P/L fields, read the lot size, and only take the trade if every check passes.
WHAT MAKES IT DIFFERENT
Most position sizers stop at the lot size. This one continues into the rules that actually end funded accounts: it treats the daily loss budget, the drawdown buffer and total open risk as constraints the trade must fit inside, tells you how many more losses you can survive today, expresses your remaining profit target in R multiples of the position in front of you, and can visibly block the trade when a rule fails. Commission is priced into the size, results are rounded conservatively, and every clamp or failure is explained in plain language rather than silently applied.
IMPORTANT LIMITATIONS — PLEASE READ
Pine Script cannot access your broker account. Account size, loss already taken today, current P/L and risk committed to other open positions are MANUAL inputs — the tool is only as accurate as what you enter, so keep them current during the session. It cannot read your live balance, equity, open positions, spread, swap or margin, and it cannot place, modify or close orders — this is a calculator and a checklist, not an execution tool. TradingView's symbol specifications may not match your prop firm's CFD specifications, which is what the manual contract size override is for: verify the lot size against your broker before trading. The total drawdown check assumes a static limit measured from the initial balance and does not model trailing drawdown. Figures update live with the current bar (ATR in "Current" mode changes as the bar forms); use the "Previous" ATR setting for stable values.
This is a calculation and decision-support tool. It is not a strategy, generates no trade signals, and is not financial advice. Always verify position sizes against your own broker and risk rules.
THE CORE IDEA: RISK IS FIXED, LOT SIZE FLOATS
Risk money = account size x risk % (or a fixed cash amount). Lot size = risk money / (stop distance x value per lot + commission). Widening the stop shrinks the position; tightening it grows the position. The money at risk never changes. Sizes are rounded DOWN to your broker's lot step, so actual risk never exceeds planned risk.
TRADE LEVELS
Entry, stop-loss and take-profit are interactive price inputs — click to place them when you add the indicator, then drag the price lines to re-plan and watch every number update live. Entry can follow the current price (market) or sit at a placed level (pending). Direction is derived from the stop's side of entry, or forced long/short to validate your geometry. Optionally, an ATR module sets the stop and target automatically at entry -/+ ATR x multiplier, using the chart timeframe or a higher one, and either the live or the last closed bar's ATR.
ACCOUNT & INSTRUMENT
Set your account size, account currency and risk (percent of account or a fixed cash amount). If the symbol's quote currency differs from your account currency, a conversion rate is fetched automatically (direct pair first, then inverse) and a warning appears if neither resolves. Broker specs are fully adjustable: contract size (auto-derived or manual, for the many CFD symbols whose specs differ from the exchange's), lot step, minimum and maximum lot, and round-trip commission per lot, which is treated as part of the loss. A manual lot override works in reverse: enter a size you already have in mind and the panel tells you the risk money and risk percentage it actually carries.
PROP-FIRM RULE ENGINE
Enter your firm's limits — maximum daily loss, maximum total drawdown, per-trade risk cap, maximum lots, maximum portfolio open risk, and profit target (typical challenge rules are 5% daily, 10% total, 10% target). Log how much you have already lost today and your running P/L, and the panel shows:
- Remaining daily loss budget, and whether this trade fits inside it
- How many identical losing trades it would take to breach the daily limit
- Remaining total drawdown buffer, reduced by any running loss
- Pass/fail on the per-trade risk cap, the lot cap, and combined open risk across positions
- Distance to your profit target, in money and in R multiples of this trade's risk
- A minimum risk:reward check
With hard block enabled, any failed check turns the panel header red and shows DO NOT TRADE.
PANEL, DRAWINGS & ALERTS
A dashboard table (four corner positions, normal or compact, dark or light) shows direction, levels, lot size, units, risk and reward in money and percent, risk:reward, per-pip value for the sized position, every rule check, and a plain-language warnings list explaining anything that is wrong or clamped. Entry, stop and target are drawn as labelled lines with shaded risk and reward zones. Alerts are available for entry, stop or target touches — with the computed lot size and risk in the message — and for any rule check flipping to fail.
HOW TO USE
Add the indicator, click to place entry, stop and target. Set your account size, currency and risk percentage, then enter your broker's contract size, lot step and commission (check these against your own account — CFD specs vary between brokers). Enter your firm's daily loss, drawdown, target and cap rules once. Before each trade, drag the levels to your plan, update the loss-taken-today and current P/L fields, read the lot size, and only take the trade if every check passes.
WHAT MAKES IT DIFFERENT
Most position sizers stop at the lot size. This one continues into the rules that actually end funded accounts: it treats the daily loss budget, the drawdown buffer and total open risk as constraints the trade must fit inside, tells you how many more losses you can survive today, expresses your remaining profit target in R multiples of the position in front of you, and can visibly block the trade when a rule fails. Commission is priced into the size, results are rounded conservatively, and every clamp or failure is explained in plain language rather than silently applied.
IMPORTANT LIMITATIONS — PLEASE READ
Pine Script cannot access your broker account. Account size, loss already taken today, current P/L and risk committed to other open positions are MANUAL inputs — the tool is only as accurate as what you enter, so keep them current during the session. It cannot read your live balance, equity, open positions, spread, swap or margin, and it cannot place, modify or close orders — this is a calculator and a checklist, not an execution tool. TradingView's symbol specifications may not match your prop firm's CFD specifications, which is what the manual contract size override is for: verify the lot size against your broker before trading. The total drawdown check assumes a static limit measured from the initial balance and does not model trailing drawdown. Figures update live with the current bar (ATR in "Current" mode changes as the bar forms); use the "Previous" ATR setting for stable values.
This is a calculation and decision-support tool. It is not a strategy, generates no trade signals, and is not financial advice. Always verify position sizes against your own broker and risk rules.
Skrip open-source
Dengan semangat TradingView yang sesungguhnya, pembuat skrip ini telah menjadikannya sebagai sumber terbuka, sehingga para trader dapat meninjau dan memverifikasi fungsinya. Salut untuk penulisnya! Meskipun Anda dapat menggunakannya secara gratis, perlu diingat bahwa penerbitan ulang kode ini tunduk pada Tata Tertib kami.
Custom TradingView indicators & strategies in Pine Script — Smart Money Concepts / ICT specialist. Available for freelance work: martineye15@gmail.com
Pernyataan Penyangkalan
Informasi dan publikasi ini tidak dimaksudkan, dan bukan merupakan, saran atau rekomendasi keuangan, investasi, trading, atau jenis lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Ketentuan Penggunaan.
Skrip open-source
Dengan semangat TradingView yang sesungguhnya, pembuat skrip ini telah menjadikannya sebagai sumber terbuka, sehingga para trader dapat meninjau dan memverifikasi fungsinya. Salut untuk penulisnya! Meskipun Anda dapat menggunakannya secara gratis, perlu diingat bahwa penerbitan ulang kode ini tunduk pada Tata Tertib kami.
Custom TradingView indicators & strategies in Pine Script — Smart Money Concepts / ICT specialist. Available for freelance work: martineye15@gmail.com
Pernyataan Penyangkalan
Informasi dan publikasi ini tidak dimaksudkan, dan bukan merupakan, saran atau rekomendasi keuangan, investasi, trading, atau jenis lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Ketentuan Penggunaan.