Hi, I follow your scripts a lot. For a few days I have been looking for a solution to a problem and I would like to ask you for help. It's about the trailing stop. Sorry for my English. I hope you will understand me. I write a practical example:
- I execute a long trade at price 100.
- I therefore insert a trailing stop at 10%. Consequently, the trailing stop will be positioned at price 90.
What I saw on Trading view and Pine Script is that:
- if the price rises to 101 (therefore + 1%), also the trailing stop will consequently move to 90.9 (+ 1%).
There is therefore a 10% trailing stop, but every 1% price increase also the trailing stop will move to + 1%. I will call it: 1% step
There are some brokers, however, that have different and customizable steps
.
For example, you can enter a 10% trailing stop (as above), but a 5% step.
In this case, then, this happens:
- I execute a long trade at price 100.
- I therefore insert a trailing stop at 10%. Consequently, the trailing stop will be positioned at price 90.
- if the price rises to 101 (therefore + 1%), the trailing stop this time will not move to 90.9 but will remain stationary at 90.
- when the price rises to 105 (therefore + 5%), the trailing stop will move to 94.5 (+ 5%).
- when the price rises to 110 (therefore + 10%), the trailing stop will move to 99 (+ 10%)
If I have been able to explain myself, in all cases you can choose a trailing stop at 10%. What changes is the percentage price increase that determines the movement of the trailing stop (the steps I mentioned above). It can move whenever the price rises to + 1% (1% step). It can move whenever the price rises to + 2% (2% step). And so on.
To facilitate understanding, I am attaching an image taken by a broker where there is the possibility to configure the step
. In this broker the minimum step is 5 points (or 0.05% on the Eur / Usd exchange) and it is customizable. On another broker (always on the Eur / Usd exchange) the step is instead of 0.001%, not customizable. In my strategy, which I sent you, on Tradingview's Pine Script (for example in the Eur / Usd exchange) the step is 0.01%
Each broker has different characteristics in the trailing stop and it is necessary to customize the step on Pine script.
I thought that among the values I enter to configure the trailing stop (for example: the tick, the input or the trail_points) they could also configure this aspect. An aspect that is fundamental to test my future strategies with Tradingview and Pine Script but which, despite numerous searches, I am unable to configure.
Configuring the value of the step is necessary so that the strategy on pine script reflects, as far as possible, the real operation with brokers.
Can you help me understand how to configure this aspect?