OPEN-SOURCE SCRIPT
Risk Guard - Position Size & Risk Ceiling

What it does
Risk Guard sizes your position from the risk you are willing to take, and tells you immediately when that risk goes above the limit you set for yourself.
Most position size calculators stop at the arithmetic. This one adds the part that actually protects an account: a ceiling.
Why a ceiling
Many traders do not use a fixed risk per trade. They size up on strong setups and down on weak ones. That flexibility is fine, until one trade quietly goes far beyond what the account can absorb.
Risk Guard separates the two:
- Risk for THIS trade is what you are taking right now, and it can change every time.
- Your risk ceiling is your rule, and it does not change.
When the first goes above the second, the table switches to the alert colour and says so plainly.
How to use it
1. Add the indicator. It displays straight away, using the current price and one ATR as demonstration values, so you never face an empty table.
2. Open the settings and enter your own Entry and Stop in the Trade group. Add a Target if you want R:R.
3. Set your account size, the risk for this trade, and your ceiling.
4. Pick the sizing mode and the pip size that match your instrument.
Sizing modes
Lots: gold, forex, CFD. Set the contract size (XAUUSD standard is 100 oz per lot, forex standard is 100000).
Units: crypto and spot.
Whichever you pick, the position size is shown with its unit spelled out and the other unit in brackets, so it cannot be misread.
What it shows
Direction, account size, trade risk against your ceiling, amount at risk, stop distance in price and in pips, position size, R:R and gain at target.
Customisation
Every colour is configurable: header within limit, header when the ceiling is passed, table background, text, position size value, and the entry, stop and target lines. Text size, border width and table position can also be changed.
Notes
Pip size is a setting, not a guess: gold 0.1, forex majors 0.0001, JPY pairs 0.01, and 0 to hide pips on crypto.
The calculation is exact when the quote currency matches your account currency. On crosses where it does not, treat the result as an approximation.
This is a planning tool. It does not place orders and does not read your broker account.
Risk Guard sizes your position from the risk you are willing to take, and tells you immediately when that risk goes above the limit you set for yourself.
Most position size calculators stop at the arithmetic. This one adds the part that actually protects an account: a ceiling.
Why a ceiling
Many traders do not use a fixed risk per trade. They size up on strong setups and down on weak ones. That flexibility is fine, until one trade quietly goes far beyond what the account can absorb.
Risk Guard separates the two:
- Risk for THIS trade is what you are taking right now, and it can change every time.
- Your risk ceiling is your rule, and it does not change.
When the first goes above the second, the table switches to the alert colour and says so plainly.
How to use it
1. Add the indicator. It displays straight away, using the current price and one ATR as demonstration values, so you never face an empty table.
2. Open the settings and enter your own Entry and Stop in the Trade group. Add a Target if you want R:R.
3. Set your account size, the risk for this trade, and your ceiling.
4. Pick the sizing mode and the pip size that match your instrument.
Sizing modes
Lots: gold, forex, CFD. Set the contract size (XAUUSD standard is 100 oz per lot, forex standard is 100000).
Units: crypto and spot.
Whichever you pick, the position size is shown with its unit spelled out and the other unit in brackets, so it cannot be misread.
What it shows
Direction, account size, trade risk against your ceiling, amount at risk, stop distance in price and in pips, position size, R:R and gain at target.
Customisation
Every colour is configurable: header within limit, header when the ceiling is passed, table background, text, position size value, and the entry, stop and target lines. Text size, border width and table position can also be changed.
Notes
Pip size is a setting, not a guess: gold 0.1, forex majors 0.0001, JPY pairs 0.01, and 0 to hide pips on crypto.
The calculation is exact when the quote currency matches your account currency. On crosses where it does not, treat the result as an approximation.
This is a planning tool. It does not place orders and does not read your broker account.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Swing crypto depuis 2018, gold en intraday depuis 2ans. Chaque trade passe dans mon journal : tradoshi.com
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Swing crypto depuis 2018, gold en intraday depuis 2ans. Chaque trade passe dans mon journal : tradoshi.com
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.