SAR {TTR} | R Documentation |
The Parabolic Stop-and-Reverse calculates a trailing stop. Developed by J. Welles Wilder.
SAR(HL, accel=c(0.02, 0.2))
HL |
Object able to be coerced to a matrix, which contains High-Low prices. |
accel |
accel[1]: Acceleration factor. accel[2]: Maximum acceleration factor. |
The calculation for the SAR is quite complex. See the URLs in the references section for calculation notes.
The SAR assumes that you are always in the market, and calculates the Stop And Reverse point when you would close a long position and open a short position or vice versa.
A vector containing the Parabolic Stop and Reverse values.
Josh Ulrich
The following site(s) were used to code/document this indicator:
http://www.linnsoft.com/tour/techind/sar.htm
http://www.fmlabs.com/reference/SAR.htm
See ATR
and ADX
, which were also developed by Welles Wilder.
data(ttrc) sar <- SAR(ttrc[,c("High","Low")])