OPEN-SOURCE SCRIPT
已更新 Profit Loss Display Universal

Universal Profit Loss Display
is a chart overlay for quickly visualizing projected reward, risk, and reference levels from the current price.
The script lets you select:
- one main profit target
- one main stop loss level
- four additional reference sources
The sources can be any element of another indicator displayed on the current chart (using the TradingView's source parameter.
**How it works**
The indicator compares each selected level to the current price and estimates the move using your configured position base. This makes it useful for planning trades around fixed targets, stops, VWAPs, pivots, bands, or any custom level source.
For each active level, it displays the move from current price as price points, dollar value, or both. The profit target and stop loss also get dedicated value labels, and the script calculates a live reward-to-risk ratio in `R` format.
**Key features**
- Configurable `input.source` levels for profit target, stop loss, and 4 extra references
- Display mode selector: `Price Points`, `$ Value`, or `Both`
- Automatic leverage detection by asset class, with manual override
- Dollar projection based on chunk size and leverage
- Clean on-chart labels that only appear when a source is different from `close`
- Reward-to-risk ratio displayed directly on the chart
- Bottom-right info table showing active chunk size and leverage
**Best use cases**
- Pre-trade reward/risk planning
- Visual target and stop mapping
- Comparing multiple nearby levels from current price
- Quick dollar impact estimation without manual calculation
**Notes**
This is a planning helper, not a strategy or execution tool. Dollar projections do not include fees, spread, slippage, funding, or partial exits.
---------------------------------------------------------------------------------------------------------------------
**How To Use**
1. Add the indicator to your chart.
2. Set your main `Profit Target` and `Stop Loss Limit`.
These are the two primary levels used for the projected profit/loss labels and the `R` ratio.
3. Optionally assign `Extra Source 1-4`.
Use these for additional levels you want to monitor, such as VWAPs, pivots, moving averages, bands, or custom plotted values.
4. Choose your `Display Mode`.
- `Both` shows price distance and dollar value
- `Price Points` shows only the raw move from current price
- `$ Value` shows only the projected dollar impact
5. Set your `Chunk Size`.
This is the base position size used in the calculation.
6. Set `Leverage X`.
- Leave it at `0` to use automatic leverage by asset class
Automatic Leverage Rules
If Leverage X is set to 0, the script uses these defaults:
crypto: 5
forex: 30
futures: 10
cfd: 10
stock: 5
index: 20
fund: 5
anything else: 10
A small table in the bottom-right corner shows the active chunk size and leverage.
- Enter a manual value if you want to override auto leverage
7. Turn `Show Labels?` on or off as needed.
**What You Will See**
- A source label for the profit target
- A source label for the stop loss
- Source labels for up to 4 extra levels
- A dedicated profit value label
- A dedicated stop-loss value label
- An `R:x.x` reward-to-risk ratio label
- A bottom-right table showing current chunk size and leverage
**Important Behavior**
- Labels only appear when the selected source is different from `close`
- `close` acts as the default “off” state for any source input
- Labels are updated on the latest bar only
- The ratio is based on distance from current price to target and stop
**Practical Example**
If you are planning a trade:
- set `Profit Target` to your take-profit level
- set `Stop Loss Limit` to your invalidation level
- set `Chunk Size` to your standard trade allocation
- choose a leverage value or leave auto mode enabled
- use the extra sources for nearby confluence or reaction zones
This gives you an immediate view of:
- potential upside
- potential downside
- reward-to-risk ratio
- relative distance to other important levels
**Notes**
This script is a visual planning tool. It does not place trades and does not account for fees, slippage, spread, funding, or scaling in and out.
is a chart overlay for quickly visualizing projected reward, risk, and reference levels from the current price.
The script lets you select:
- one main profit target
- one main stop loss level
- four additional reference sources
The sources can be any element of another indicator displayed on the current chart (using the TradingView's source parameter.
**How it works**
The indicator compares each selected level to the current price and estimates the move using your configured position base. This makes it useful for planning trades around fixed targets, stops, VWAPs, pivots, bands, or any custom level source.
For each active level, it displays the move from current price as price points, dollar value, or both. The profit target and stop loss also get dedicated value labels, and the script calculates a live reward-to-risk ratio in `R` format.
**Key features**
- Configurable `input.source` levels for profit target, stop loss, and 4 extra references
- Display mode selector: `Price Points`, `$ Value`, or `Both`
- Automatic leverage detection by asset class, with manual override
- Dollar projection based on chunk size and leverage
- Clean on-chart labels that only appear when a source is different from `close`
- Reward-to-risk ratio displayed directly on the chart
- Bottom-right info table showing active chunk size and leverage
**Best use cases**
- Pre-trade reward/risk planning
- Visual target and stop mapping
- Comparing multiple nearby levels from current price
- Quick dollar impact estimation without manual calculation
**Notes**
This is a planning helper, not a strategy or execution tool. Dollar projections do not include fees, spread, slippage, funding, or partial exits.
---------------------------------------------------------------------------------------------------------------------
**How To Use**
1. Add the indicator to your chart.
2. Set your main `Profit Target` and `Stop Loss Limit`.
These are the two primary levels used for the projected profit/loss labels and the `R` ratio.
3. Optionally assign `Extra Source 1-4`.
Use these for additional levels you want to monitor, such as VWAPs, pivots, moving averages, bands, or custom plotted values.
4. Choose your `Display Mode`.
- `Both` shows price distance and dollar value
- `Price Points` shows only the raw move from current price
- `$ Value` shows only the projected dollar impact
5. Set your `Chunk Size`.
This is the base position size used in the calculation.
6. Set `Leverage X`.
- Leave it at `0` to use automatic leverage by asset class
Automatic Leverage Rules
If Leverage X is set to 0, the script uses these defaults:
crypto: 5
forex: 30
futures: 10
cfd: 10
stock: 5
index: 20
fund: 5
anything else: 10
A small table in the bottom-right corner shows the active chunk size and leverage.
- Enter a manual value if you want to override auto leverage
7. Turn `Show Labels?` on or off as needed.
**What You Will See**
- A source label for the profit target
- A source label for the stop loss
- Source labels for up to 4 extra levels
- A dedicated profit value label
- A dedicated stop-loss value label
- An `R:x.x` reward-to-risk ratio label
- A bottom-right table showing current chunk size and leverage
**Important Behavior**
- Labels only appear when the selected source is different from `close`
- `close` acts as the default “off” state for any source input
- Labels are updated on the latest bar only
- The ratio is based on distance from current price to target and stop
**Practical Example**
If you are planning a trade:
- set `Profit Target` to your take-profit level
- set `Stop Loss Limit` to your invalidation level
- set `Chunk Size` to your standard trade allocation
- choose a leverage value or leave auto mode enabled
- use the extra sources for nearby confluence or reaction zones
This gives you an immediate view of:
- potential upside
- potential downside
- reward-to-risk ratio
- relative distance to other important levels
**Notes**
This script is a visual planning tool. It does not place trades and does not account for fees, slippage, spread, funding, or scaling in and out.
版本注释
In this updated version one more extra source value is available.This way it can display the price differences along a TradingView Auto Anchored VWAP as it was requested.
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
If you want to support further development - buy me a coffee!
paypal.com/donate/?business=AZNKQRW42YLSS&amount=5&no_recurring=1&item_name=Support+further+development!¤cy_code=EUR
paypal.com/donate/?business=AZNKQRW42YLSS&amount=5&no_recurring=1&item_name=Support+further+development!¤cy_code=EUR
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
If you want to support further development - buy me a coffee!
paypal.com/donate/?business=AZNKQRW42YLSS&amount=5&no_recurring=1&item_name=Support+further+development!¤cy_code=EUR
paypal.com/donate/?business=AZNKQRW42YLSS&amount=5&no_recurring=1&item_name=Support+further+development!¤cy_code=EUR
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。