mshpun

Trailing Stops Loss V2 (Short & Long positions)

Greetings.

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
Release Notes: Small corrections
Release Notes: Tags added
Remove from Favorite Scripts Add to Favorite Scripts
Hi,
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.
Reply
Great stuff! Thanks for sharing, buddy :)
Reply
Hi,
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
Reply
dpanday aaahopper
@aaahopper, @aaahopper, @nilux, Do you have an answer on this?
Reply
nilux dpanday
@dpanday working on this already :)
Reply
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.
Reply
@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.

Reply
Home Stock Screener Forex Screener Crypto Screener Economic Calendar Shows How It Works Chart Features Pricing House Rules Moderators Website & Broker Solutions Widgets Charting Solutions Lightweight Charting Library Help Center Refer a friend Feature Request Blog & News FAQ Wiki Twitter
Profile Profile Settings Account and Billing Refer a friend My Support Tickets Help Center Ideas Published Followers Following Private Messages Chat Sign Out