Description Usage Arguments Details Value See Also Examples
View source: R/protective_stops.R
The safezone stop was developed by Alexander Elder. The safezone stop is described in his book "Come Into My Trading Room" pages 173-180.
1 |
x |
An object that is coercible to xts or matrix and contains High-Low prices. |
n |
Number of lookback periods for the safezone period. Default is 10. |
coef |
Coefficient for multiplying the average downside (or upside) penetration. Default is 2. |
prevent |
Prevents the stop from lowering for x days. Default is 5. |
trend |
Indicates if the safezone stop should be calculated for the up-trend or down-trend. Default is "up". Possible values are "up" or "down". |
Once you have defined a 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.
If the trend is up, mark all downside penetrations during the lookback period, add their depths, and divide the sum by the number of penetrations. This gives you the average downside penetration for the selected lookback period. Multiply the average downside penetration by a coefficient, to place stops farther away from the market than the average level of noise. The results are subtracted from yesterday's low to create the stop. To prevent the stop from lowering too fast, the prevent lookback option will keep the maximum calculated stop for the specified lookback. The rules are reversed for down trend calculations.
Returns the safezone exit points which can be used as stop loss in a trend following strategy.
Other protective stops:
ATR_stop()
,
chandelier()
Other Alexander Elder functions:
alert_marker()
,
thermometer()
1 2 3 4 5 6 7 8 9 10 11 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.