Here is the content from Trading for a Living
you may use the slope of a 22-day to define the trend. You need to choose the length of the lookback period for measuring noise level. it has to be long enough to track recent behavior but short enough to be relevant for current trading. A period of 10 to 20 days works well, or we can make our lookback period 100 days or so if we want to average long-term market
if the trend is up, mark all downside penetrations during the look-back period, add their depths, and divide the sum by the number of penetrations。 This gives you the Average Downside Penetration for the selected look back
if today's low is lower than yesterday's, do not move your stop lower since we are only allowed to raise stops on long positions, not lower them
Reverse these rules in downtrends. When a 22-day identifies a downtrend, count all the upside penetrations during the look-back period and find the Average Upside Penetration. Multiply it by a coefficient, starting with two. When you go short, place a stop twice he Average Upside Penetration above the previous day's high. Lower your stop whenever the market makes a lower high, but never raise it.
The important thing when you make an order is to hold your earning during a trending scenario. To avoid stopping loss by the variance in the market and to avoid big loss if the market shift to another direction in a short time.
From the graph there, I select the most recent trend up period in the Bitcoin and adjust the parameters according to this trend.
As you can see, the stop loss is away from the lowest price in bar, so that you will not be forced to exit the trade by small turbulence. You can hold your order and need to worry about missing the trend. But there are always sharp plunges in the uptrend. you can see two cursors on the graphic. The stop loss will help you avoid this plunge.
But in my opinion, this will be the hard stop loss in your trade. Help you to keep profit and avoid big loss. To maximize the profit, you had better to build you own strategy.
When I try to create this indicator, it is found that two rule for this indicator
1. you had better to use it in a clear trend range. Since the stop loss can only be higher in a long condition and lower in a short condition. If you use it in a volatile market., then stop loss doesn’t make any senses.
2. you need to adjust those parameters according to the market and the trend you are in. Some people like to avoid big loss, you can set them this depending on you experience
Last, this is getting from the view in the book, i didn’t do any back test for it. So please be careful to use it and let me know if you have any suggestions or ideas.