Trailing Stops Loss V2 (Short & Long positions)


This is and update to my original indicator "Intraday Trailing Stop Loss".

With this update it allows you manually setup the your entry price for the trade and desired stop loss value for either long or short positions.
The trailing stop will dynamically follow the price movement if price goes into the desired direction and will not change when price goes in undesired direction.
When price will cross the indicator line, the signal will appear on chart suggesting terminate position.
It's also possible to set up a regular chart Alert based on this condition.

Example for Short position

To setup indicator click on "Settings" and enter

- Entry Price
- Position (short or long). Default is long.
- Stop loss in $. Default $0.2
- Time and Date of entry (Minute, Hour, Date, Month, Year). Indicator can span on multiple sessions.

To setup Alert.
- Right click on indicator line and select "Add Alert on ....." (first entry in list)
- Use all defaults

Due to Pine script limitations following is very important.

1. When indicator first time applied it will not show anything until all input values are entered.
2. As soon as input values are set it will appear on chart and could be adjusted further.
3. For indicator to work properly entered information should be as accurate as possible. For example if the entry price was not actually available on the time bar you using the indicator behaviour is not fully predictable.
4. Since absolute value of stop loss is used the indicator will not automatically work when you switch securities plotted on the chart. Multiple chart window can use separate indicator settings
Notes de version: Small corrections
Notes de version: Tags added
Supprimer des scripts favoris Ajouter aux scripts favoris
This is great!
I have been looking for a trailing stop loss with a date entry to start the indicator from.
I have also been looking for a volatility or ATR trailing stop loss with a date entry. I was able to add some code that allowed me to do this to your script which works on the long side but not the short side.
Would you be able to look at what I have done and see why it doesn't work on the short side? As I have pretty much zero coding experience.
Great stuff! Thanks for sharing, buddy :)
Great and easy script to follow.
What would you need to change to add it to scripts to avoid manually adding the price on a study?
Thank you
dpanday aaahopper
@aaahopper, @aaahopper, @nilux, Do you have an answer on this?
nilux dpanday
@dpanday working on this already :)
mshpun aaahopper
@aaahopper, That was my original intention to add entry price, date and time just with click on the chart. However due to Pine script limitations I did not find anything like this in study scripts.
It's possibly exists in strategy scripts, but I don't think it's possible to use strategy tools in study scripts.
@mshpun, That is great that people are working on that. I am not a great programmer, just know the basics and I found this great trailing stop-loss and another open source done by "emkill2005". The second links to the trade price and is so complicated I simply can't work it.
He has done the associations necessary for price and trailing stop-loss.

Accueil Filtre d'actions Filtre Forex Filtre Crypto Calendrier économique Comment ça marche Caractéristiques du graphique Prix Règles de conduite Modérateurs Solutions site web & courtier Widgets Solutions de cartographie Obtenir de l'aide Demande de fonctionnalité Blog & actualités Questions Fréquentes Wiki Twitter
Profil Paramètres du Profil Compte et Facturation Obtenir de l'aide Idées Publiées Suiveurs Suivi Messages privés dialogue en ligne Se Déconnecter