OPEN-SOURCE SCRIPT
Güncellendi

Smart Risk Manager

975
Smart Risk Manager is a visual risk-planning and position-sizing indicator designed to help traders build a structured trade plan directly on the chart.

The script calculates and displays:

* Account risk
* Risk amount
* Planned entry
* Stop level
* Stop distance
* Position size
* Position value
* Exposure percentage
* Risk:Reward
* Up to three target zones
* Target confluence sources
* Auto BOS setup status
* Manual trade plan status
* Entry / Stop / Target lines
* A customizable risk dashboard

This is an indicator, not a strategy. It does not place orders, does not execute trades, and does not produce TradingView Strategy Tester backtest results. The tool is intended for trade planning, educational risk management, and chart-based analysis only.

Important note

Smart Risk Manager does not guarantee profitable trades.

It does not predict future price movement.

It does not provide financial advice.

It does not replace a broker, a trading plan, or professional risk management.

All values are calculated from the user’s selected inputs and the chart’s price data. Users should always verify position size, tick value, contract multiplier, margin requirements, spread, commission, slippage, and broker-specific rules before using any calculated value in live trading.

Main purpose

The purpose of Smart Risk Manager is to help traders answer practical planning questions before entering a trade, such as:

* Where is the planned entry?
* Where is the stop?
* How much money is at risk?
* What position size matches the selected risk percentage?
* What is the approximate exposure?
* Where are possible targets?
* Which target levels have confluence?
* What is the approximate Risk:Reward profile?

The indicator is designed to make risk planning more visible and easier to review on the chart.

1. Account & Risk

The Account & Risk section allows the user to define the basic risk model.

Account Size

The user enters the total account size in the account currency.

Risk per Trade %

The user selects the maximum percentage of the account to risk if the stop level is reached.

For example, if Account Size is 10,000 and Risk per Trade is 1%, the planned risk amount is 100.

Instrument Type

The script includes instrument selection for:

* Stocks / Shares
* Forex / Units
* Crypto / Coins

This affects the display wording for the calculated position size.

Round size to whole units

When enabled, the calculated position size is rounded down to whole units. This is useful for stocks and shares.

When disabled, the script can display fractional sizing, which may be more suitable for crypto or some forex/CFD planning workflows.

Important limitation

The position-sizing calculation is generic. Some markets use contract multipliers, tick values, lot sizes, minimum order quantities, leverage, margin rules, spread costs, and currency conversions. Users must confirm the final order size with their broker or exchange.

2. Entry Logic Modes

The script includes two planning modes:

* Auto BOS
* Manual Plan

Auto BOS Mode

Auto BOS mode uses market structure to create a logical planning setup when price breaks a confirmed structure level.

The script detects confirmed pivot highs and pivot lows using the selected Structure Pivot Left and Structure Pivot Right settings.

A bullish Auto BOS setup can appear when price closes above the last confirmed structure high.

A bearish Auto BOS setup can appear when price closes below the last confirmed structure low.

The Auto BOS mode can be used to automatically create:

* Auto entry level
* Auto stop level
* Direction
* Setup reason
* Risk and target plan

Auto Direction

The user can choose:

Both
Allows both long and short Auto BOS planning setups.

Long Only
Allows only bullish Auto BOS planning setups.

Short Only
Allows only bearish Auto BOS planning setups.

Candle Confirmation

When enabled, the breakout candle must confirm direction:

* Long setup requires a bullish candle.
* Short setup requires a bearish candle.

Max Breakout Distance %

This filter helps avoid planning entries when price has already moved too far away from the broken structure level.

A value of 0 disables this filter.

Min Structure Range %

This filter helps avoid very small structures that may produce noisy or low-quality Auto BOS events.

Auto Stop Style

The script includes two Auto Stop styles:

Recent Pullback
Uses a recent pullback area for a closer stop.

Structure Swing
Uses the broader structure swing for a wider structural stop.

Auto Stop Buffer %

Adds a small buffer beyond the selected auto stop level.

Minimum R:R Filter

When enabled, Auto BOS setups appear only if the projected setup Risk:Reward is equal to or above the selected minimum value.

One active setup at a time

When enabled, the script prevents repeated same-direction Auto BOS setups until an opposite setup appears.

Show Auto BOS signals

This setting is OFF by default. When enabled, the script displays Auto Long BOS and Auto Short BOS markers on the chart.

Important note about Auto BOS

Auto BOS is a planning event based on confirmed structure. It is not an automatic buy or sell recommendation. It should be used as a planning reference and combined with the user’s own analysis.

3. Manual Plan Mode

Manual Plan mode allows the user to create a custom trade plan.

The user selects:

* Manual Direction
* Manual Entry Price
* Manual Stop Mode
* Target methods

Manual Direction

The user can choose:

Long
Creates a long-side plan.

Short
Creates a short-side plan.

Manual Entry Price

The user enters the planned entry price manually.

Manual Plan mode is useful when the trader already has a specific entry level and wants the script to calculate position size, risk, exposure, and target levels.

4. Stop Loss Methods

The script supports several stop calculation methods in Manual Plan mode.

Swing Structure

Uses the recent swing low for long plans or recent swing high for short plans.

ATR

Uses an ATR-based stop distance from the manual entry price.

For long plans, the stop is placed below entry.

For short plans, the stop is placed above entry.

Percent

Uses a percentage-based stop from the manual entry price.

Manual

Allows the user to enter a custom stop price.

Important stop placement rule

For a valid long plan, the stop must be below the entry.

For a valid short plan, the stop must be above the entry.

If the stop is placed incorrectly, the dashboard will show an invalid stop status.

5. Position Size Calculation

The script calculates position size from:

* Account Size
* Risk per Trade %
* Entry Price
* Stop Price
* Stop Distance

The general logic is:

Risk Amount = Account Size × Risk %

Position Size = Risk Amount ÷ Stop Distance

The script then displays:

* Risk Amount
* Stop Distance
* Position Size
* Position Value
* Exposure %

Risk Amount

The estimated amount that would be lost if the planned stop is reached, before considering real-world execution costs such as spread, slippage, commission, and broker rules.

Position Size

The calculated quantity based on the selected risk amount and stop distance.

Position Value

The approximate value of the planned position.

Exposure %

The position value compared with account size.

If exposure is above 100%, the dashboard highlights it as a potential leverage or overexposure condition.

6. Target Methods

The script can create target candidates from several sources.

The user can enable or disable each target method.

Available target methods:

* Swing Highs / Lows
* Fibonacci Extension
* Liquidity Equal Highs / Lows
* R-Multiple
* Manual prices

Swing Highs / Lows

For long plans, the script uses previous swing highs as potential target levels.

For short plans, it uses previous swing lows.

Fibonacci Extension

The script uses the selected swing lookback and Fibonacci extension levels to calculate possible target levels.

Default extension levels include:

* 127.2%
* 161.8%
* 261.8%

These levels can be changed in settings.

Liquidity Equal Highs / Lows

When enabled, the script looks for approximately equal highs or equal lows using the selected tolerance.

For long plans, equal highs can be used as possible upside liquidity targets.

For short plans, equal lows can be used as possible downside liquidity targets.

R-Multiple Targets

The script can calculate targets based on the risk distance.

Default R-Multiple targets include:

* 1R
* 2R
* 3R

Manual Targets

The user can enter up to three custom target prices manually.

7. Target Confluence

The script groups target candidates that are close to each other.

Confluence tolerance controls how close target levels must be to be grouped together.

If multiple target methods point to approximately the same area, the script marks the target as a confluence zone.

Examples of target confluence:

* Swing + Fibonacci
* R-Multiple + Fibonacci
* Liquidity + Swing
* Manual + R-Multiple

Targets with stronger confluence are visually highlighted differently from single-method targets.

Important note about targets

Targets are planning references only. They do not guarantee that price will reach them. They should be used as possible reference zones, not as guaranteed outcomes.

8. Dashboard

Smart Risk Manager includes a customizable dashboard.

The dashboard displays:

Account
The account size entered by the user.

Risk %
The selected percentage of account risk.

Risk Amount
The estimated risk amount based on position size and stop distance.

Entry
The planned entry price.

Stop
The planned stop price.

Stop Distance
The distance between entry and stop, displayed in price units and percentage.

Position Size
The calculated quantity for the selected risk.

Position Value
The approximate value of the planned position.

Exposure
The position value as a percentage of account size.

Risk : Reward
The approximate Risk:Reward to the furthest selected target.

Setup Logic
Shows whether the plan is based on Auto BOS or Manual Plan.

Reason
Shows the current reason or status of the setup.

Targets From
Shows which target methods are enabled.

T1 / T2 / T3
Shows up to three calculated target levels.

Status
Shows the current planning status, such as:

* Waiting for BOS setup
* Set manual entry price
* Invalid stop placement
* No targets - enable method
* Leverage > 100%
* High risk per trade
* OK to plan

9. Dashboard Themes

The script includes several dashboard themes:

* Luxury Dark
* Midnight Blue
* Graphite Gold
* Classic Dark

The user can also choose:

* Dashboard position
* Dashboard size
* Alternate row shading

10. Entry / Stop / Target Lines

When enabled, the script draws visual lines on the chart:

Entry Line

Shows the planned entry level.

Stop Line

Shows the planned stop level.

Target Lines

Shows up to three target levels.

Target labels can include:

* Target price
* R-Multiple
* Estimated potential gain
* Target source method
* Confluence marker when multiple methods align

Line Length

Controls how far the planning lines extend to the right.

11. Alerts

The script includes alert conditions for:

Auto Long BOS

Triggered when a bullish Auto BOS planning setup is detected.

Auto Short BOS

Triggered when a bearish Auto BOS planning setup is detected.

STOP hit

Triggered when price reaches the displayed stop level.

Target 1 reached

Triggered when price reaches Target 1.

Target 2 reached

Triggered when price reaches Target 2.

Target 3 reached

Triggered when price reaches Target 3.

Important alert note

Alerts are notifications only. They do not place orders and do not confirm broker execution.

12. How to use Smart Risk Manager

A practical workflow:

1. Enter your account size.
2. Select your risk per trade.
3. Choose the instrument type.
4. Choose Auto BOS or Manual Plan.
5. If using Manual Plan, enter the planned entry price.
6. Choose a stop method or enter a manual stop price.
7. Enable the target methods you want to use.
8. Review position size, risk amount, exposure, and Risk:Reward in the dashboard.
9. Review Entry / Stop / Target lines on the chart.
10. Confirm all values with your broker before placing any real trade.

Suggested use cases

Smart Risk Manager can be useful for:

* Position sizing
* Pre-trade planning
* Risk review
* Stop distance review
* Exposure control
* Target planning
* Risk:Reward comparison
* Auto BOS setup planning
* Manual trade planning
* Educational risk-management study

13. Important limitations

This script does not execute trades.

This script is not a trading strategy.

This script does not provide Strategy Tester results.

This script does not guarantee profitable outcomes.

This script does not account for all broker-specific rules.

The calculated position size is a generic estimate.

Forex, futures, CFDs, and leveraged products may require contract-size, tick-value, pip-value, margin, and currency conversion adjustments.

Commissions, spreads, slippage, taxes, borrow fees, funding costs, and order execution differences are not included in the generic calculation.

Auto BOS setups are structure-based planning events, not automatic trade recommendations.

Pivot-based structure requires confirmation bars, so structure levels are confirmed after the selected pivot settings.

Target levels are possible planning references, not guaranteed price destinations.

Stop and target alerts are chart-level events, not broker fills.

Users are responsible for verifying all calculations and managing their own risk.

14. Originality and purpose

Smart Risk Manager combines several trade-planning tools into one organized dashboard:

* Account risk calculation
* Position size calculation
* Auto BOS planning mode
* Manual trade planning mode
* Multiple stop methods
* Multiple target methods
* Target confluence grouping
* Exposure monitoring
* Visual Entry / Stop / Target lines
* Customizable dashboard themes
* Alert conditions for planning levels

The purpose of the script is to help traders build a clearer and more structured risk plan before making a trading decision.

Educational disclaimer

Smart Risk Manager is for educational and chart-analysis purposes only. It is not financial advice, investment advice, or a recommendation to buy or sell any financial instrument. Users should perform their own analysis and confirm all position-sizing and risk calculations with their broker or exchange before trading.
Sürüm Notları
Update Notes

This update improves the visual control and display behavior of the Smart Risk Manager indicator.

What changed:

• Added a new Labels settings section, allowing users to customize the size, background color, text color, and transparency of Entry, Stop, Target, and Confluence Target labels.

• Separated display controls for Entry / Stop lines and Target lines. Users can now hide Entry / Stop drawings independently from Target drawings.

• Improved target drawing logic. Target lines and labels are now shown only when at least one target method is enabled, such as Swing, Fibonacci, Liquidity, R-Multiple, or Manual Targets.

• Fixed an issue where old target drawings could remain visible on the chart after disabling target methods or display options.

• Added stronger cleanup logic for lines and labels to prevent outdated drawings from staying on the chart after settings are changed.

• Improved chart usability for users who run multiple indicators by giving them more control over label visibility and appearance.

This update does not change the core risk calculation logic. It focuses on display behavior, user customization, and cleaner chart management.

This indicator is intended as a risk and trade-planning tool. It does not provide financial advice or guarantee trading results. Users should apply their own analysis and risk management before making trading decisions.
Sürüm Notları
Update Notes

This update improves the Auto BOS entry behavior in Smart Risk Manager.

Previously, the AUTO ENTRY level could move up or down while the current live candle was still forming, because the auto entry was based on the active candle close before confirmation.

In this update, a new option was added:

Lock Auto Entry on candle close

When this option is enabled, the Auto BOS entry is saved only after the breakout candle closes. This helps keep the AUTO ENTRY level fixed after confirmation instead of moving with the live candle.

Additional improvements:

1. Auto BOS entries are now confirmed only after candle close when the lock option is enabled.
2. The saved Auto Entry level remains fixed after confirmation.
3. One Active Setup at a Time is now enabled by default to reduce repeated same-direction replacement signals.
4. The entry line now starts from the confirmed Auto BOS signal bar, making the visual plan easier to read.
5. The update improves stability of the displayed Entry, Stop, Targets, and dashboard values.

This update does not change the purpose of the script. Smart Risk Manager remains a risk-planning and position-sizing tool. It does not execute trades, does not provide financial advice, and does not guarantee any trading outcome.
Sürüm Notları
Update Notes

This update improves the chart display options in Smart Risk Manager.

The dashboard table is now OFF by default to keep the chart cleaner and reduce visual clutter. Users can still enable it from the settings using the new “Show Dashboard” option under the Display section.

When the dashboard is enabled, users can still customize its position, size, theme, and row shading.

This update also keeps the previous Auto BOS improvement: AUTO ENTRY can be locked only after the breakout candle closes when “Lock Auto Entry on candle close” is enabled. This helps prevent the Auto Entry level from moving with the live candle before confirmation.

Summary of changes:

1. Added a new “Show Dashboard” setting.
2. Dashboard table is OFF by default.
3. Dashboard position, size, theme, and row shading remain available when the dashboard is enabled.
4. Chart remains cleaner by default.
5. Auto Entry lock-on-close behavior remains included.

Smart Risk Manager remains a risk-planning and position-sizing indicator. It does not execute trades, does not provide financial advice, and does not guarantee any trading outcome.

Feragatname

Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, alım satım veya diğer türden tavsiye veya öneriler anlamına gelmez ve teşkil etmez. Kullanım Koşulları bölümünde daha fazlasını okuyun.