Using the POINTS() function combined with RATCHET() it’s possible to create a trailing stop tool based on any technical measure. Use this example in a Show Plot tool to plot a trailing stop 20% from the closing price of the bar on which you click. As the price rises the red line will maintain 20% away from the closing price, and will remain flat when the price falls.
Remember to save the tool as an indicator in the same tool view to add it to your toolbox.
//Get the mouse-click date
$V=POINTS().Point1.DateTime;
//Set % trail from CLOSE
PCT=CLOSE()*0.8;
//Use to set % trail from HIGH instead
//PCT=HIGH()*0.8;
//Calculate the 2% below the low on the date of the mouse-click
RATCHET(PCT, START=$V)
Is it possible to change the script that the % trailing script can also be applied when I click the high of a bar that is an important pivot high so that the % trailing stop works the same way as when I click the low of an important pivot low?
Another question: Is it also possible that the % trailing stop indicator stops calculating/plotting the red line when the price moves below/above the trailing stop red line? So it works the same way as the ATR Trailing Stop tool but instead using average true range it uses percent changes.
Or to formulate my questions in a different way: Can you create a tool that works like the ATR Trailing Stop but uses instead the average true range it uses percent changes?
Is it possible to use this when your technical measure includes user-configurable parameters? For example, in your script change it to something like
PCT = LOW() - VARTOLIST(VAL=$abc)
where $abc is a parameter that can be adjusted using the right-click properties screen? When I follow your approach, I don’t seem to have the capability of setting those parameters inside my script
I have a system for entry and exit stops that uses a single formula with different parameters for each market I trade, so this would be very handy for me.