This script is an interactive measurement tool that can be used to evaluate or keep track of trades. Like the long and short position drawing tools, it calculates a risk reward ratio and a risk-adjusted position size from the entry, stop and take profit levels, but it also does much more:
• It can be used to configure long or short trades.
• All monetary values can be expressed in any number of currencies.
• The value of tick/pip movement (which varies with the position's size) is displayed in the currency you have selected.
• The CAGR (Compound Annual Growth Rate) for the trade can be displayed.
• It does live tracking of the position.
• You can configure alerts on entries and exits.
█ HOW TO USE IT
Load the indicator on an active chart (see here if you don't know how).
When you first load this script on a chart, you will enter an interactive selection mode where the script asks you to pick three points in price and time on your chart by clicking on the chart. Directions will appear in a blue box at the bottom of the screen with each click of the mouse. The first selection is the entry point for the trade you are considering, which takes into account both the time and level you choose, the next are the take profit and stop levels. Once you have selected all three points, the script will draw trade zones and labels containing the trade metrics. The script determines if the trade is a long or short from the position of the take profit and stop loss levels in relation to the entry price. If the take profit level is above the entry price, the stop must be below and vice versa, otherwise an error occurs.
You can change levels by dragging the handles that appear when you select the indicator, or by entering new values in the script's settings. The only way to re-enter interactive mode is to re-add the indicator to your chart.
Once you place the position tool on a chart, it will appear at the same levels on all symbols you use. If your scale is not set to "Scale price chart only", the position tool's levels will be taken into account when scaling the chart, which can cause the symbol's bars to be compressed. If your scale is set to "Scale price chart only", the position tool will still be there, but it will not impact the scale of the chart's bars, so you won't see it if it sits outside the symbol's price scale.
If you select the position tool on your chart and delete it, this will also delete the indicator from the chart. You will need to re-add it if you want to draw another position tool. You can add multiple instances of the indicator if you need a position tool on more than one of your charts.
The position tool displays the following information for entries:
• The entry's price level with an '@' sign before it.
• Open or Closed P&L: For an open trade, the "Open P&L" displays the difference in money value between the entry level and the chart's current price.
For a closed trade, the "Closed P&L" displays the realized P&L on the trade.
• Quantity: The trade size, which takes into account the risk tolerance you set in the script's settings.
• RR: The reward to risk ratio expresses the relationship of the distance between the entry and the take profit level vs the entry and the stop level.
Example: A $100 stop with a $100 target will have a ratio of 1:1, whereas a $200 target with the same stop will have a 2:1 ratio.
• Per tick/pip: Represents the money value of a tick or pip movement.
• CAGR: The Compound Annual Growth Rate will be displayed on the main order label on trades that exceed one day in duration.
This value is calculated the same way as in our CAGR Custom Range indicator.
If the trade duration is less than one day, the metric will not be present in the display.
The stop and take profit levels display:
• Their price level with an '@' sign before it.
• Their distance from the entry in money value, percentage and ticks/pips.
• The projected end money value of the position if the level is reached. These values are calculated based on the trade size and the currency.
The settings in the "Trade sizing" section are used to calculate the position size and the monetary value of trades. Two types of risk can be chosen from the menu; a percentage based risk calculation, or a fixed money value. The risk is used to calculate the quantity of units to purchase to achieve that level of risk exposure. Example: An account size of $1000 and 10% risk will have a projected end amount of $900 if the stop loss is hit. The quantity is a product of this relationship; a projected number of units to allow for the equivalent of $100 of risk exposure over the change in price from the entry to the stop value.
The "Trade levels" allow you to manually set the entry, take profit and stop levels of an existing position tool on your chart.
You can control the appearance of the tool and the values it displays in the settings following these first two sections.
Three alerts that will trigger when you configure an alert on this indicator. The first will send an alert when the entry price is breached by price action if that price has not already been breached in the previous price history. This is dependant on the entry location you select when placing the indicator on the chart. The other two alerts will trigger when either the stop loss or the take profit level is breached to signal that a trade exit has occurred.
█ NOTES FOR Pine Script™ CODERS
• Interactive inputs are implemented for input.time() and input.price(). These specialized input functions allow users to interact with a script.
You can create one interactive input for both time and price values by using the same `inline` argument in a pair of input.time() and input.price() function calls.
• We use the `cagr()` function from our ta library.
• The script uses the runtime.error() function to throw an error if the stop and limit prices are not placed on opposing sides of the entry price.
• We use the `currency` parameter in a request.security() call to convert currencies.
Look first. Then leap.
Read more about the new tools and features we're building for you: https://www.tradingview.com/blog/en/
Zgodnie z prawdziwym duchem TradingView, autor tego skryptu opublikował go jako open-source, aby traderzy mogli go zrozumieć i zweryfikować. Brawo dla autora! Możesz używać go za darmo, ale ponowne wykorzystanie tego kodu w publikacji jest regulowane przez Dobre Praktyki. Możesz go oznaczyć jako ulubione, aby użyć go na wykresie.
Informacje i publikacje przygotowane przez TradingView lub jego użytkowników, prezentowane na tej stronie, nie stanowią rekomendacji ani porad handlowych, inwestycyjnych i finansowych i nie powinny być w ten sposób traktowane ani wykorzystywane. Więcej informacji na ten temat znajdziesz w naszym Regulaminie.