OPEN-SOURCE SCRIPT

Partial Profit Calculator [TFO]

This indicator was built to help calculate the outcome of trades that utilize multiple profit targets and/or multiple entries.

In its simplest form, we can have a single entry and a single profit target. As shown below in this long trade example, the indicator will draw risk and reward boxes (red and green, respectively) with several annotations. On the left-hand side, all entries will be displayed (in this case there is only one entry, "E1"). On the bottom, the "SL" label indicates the trade's stop loss placement. On the top, all target prices are displayed (in this case there is only one target, "TP1"). Lastly, on the right-hand side a label will display the total R that is to be expected from a winning trade, where R is one's unit of risk.

snapshot

In the following example, we have two target prices - one at 18600 and one at 18700. You can input as many target prices as you'd like, separated by commas, i.e. "18600,18700" in this example. Make sure the values are separated by commas only, and not spaces, new lines, etc. As a result, we can see that the indicator draws where our profit targets would be with respect to our entry, E1. The indicator assumes that equal parts of the trade position are taken off at each target price. In this example on Nasdaq futures (NQ1!), since we have 2 target prices, this would be equivalent to assuming that we take exactly half the trade position off at TP1, and the remaining half of the position at TP2.

snapshot

If we wanted to take more of the position off at a certain target, we could simply duplicate the target price. Here I set the target prices to "18600,18600,18700" to enforce that two thirds of the position be taken off at TP1 and TP2, while the remaining third gets taken off at TP3.

snapshot

We can also show outcome annotations to describe how much R is generated from each possible trade outcome. Using the below chart as an example, the stop loss indicates a -1R loss. The total R from this trade criteria is 1.33 R, and each target price shows how much R is being generated if one were to take off an equal part of the position at said target prices. In this case, we would generate 0.17 R from taking one third of the position off at TP1, another 0.5 R from taking one third of the position off at TP2, and another 0.67 R from taking the remaining one third of the position off at TP3, all adding up to the total R indicated on the right-hand side label.

snapshot

Using multiple entries works the same way as using multiple target prices, where the input should indicate each entry price separated by commas. In this example I've used "18550,18450" to achieve an average price of 18500, as indicated by the "E_avg" label that appears when more than one entry price is utilized. We can also opt to display risk as dollars instead of R values, where you can input your desired risk per trade, and all values are shown as dollar amounts instead of R multiples, as shown below with a risk per trade of $100.

snapshot

This is meant to be an educational tool for trades that utilize multiple profit targets and/or entries. Hope you like it!
educationeducationalpartialprofitsprofitrewardriskriskreward

Script open-source

Dans le plus pur esprit TradingView, l'auteur de ce script l'a publié en open-source, afin que les traders puissent le comprendre et le vérifier. Bravo à l'auteur! Vous pouvez l'utiliser gratuitement, mais la réutilisation de ce code dans une publication est régie par nos Règles. Vous pouvez le mettre en favori pour l'utiliser sur un graphique.

Vous voulez utiliser ce script sur un graphique ?


Aussi sur:

Clause de non-responsabilité