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.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Swing crypto depuis 2018, gold en intraday depuis 2ans. Chaque trade passe dans mon journal : tradoshi.com
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Swing crypto depuis 2018, gold en intraday depuis 2ans. Chaque trade passe dans mon journal : tradoshi.com
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.