[R-SIG-Finance] Trailing stop in Andreas Clenow trend-following system

Ingo Boland ingo.boland at gmail.com
Thu Dec 3 10:03:04 CET 2015

Good morning,

I'm trying to rebuild the basic strategy out of Andreas Clenow's book
"Following the trend in quantstrat but struggling with the trailing stop.
The rules are as follows (only for long trades):

1.     *Entry rule*: Buy open tomorrow when close is higher or equal to the
highest close of the past 50 days

2*.*     *Filter*: Long entries only if SMA50 >= SMA100

3.     *Closing*: Sell open tomorrow when breakout to the downside or SMA50
< SMA100

4.     *Trailing stop (and this seems to be the difficult one)*: Sell open
tomorrow when close price is lower than highest high since deal entry minus
3 times the current ATR (100days) - current ATR and not the ATR at deal

5.     *Position sizing*: Risking always a fixed amount

I read about the idea of just adding an indicator which is triggering the
stop but the problem is that this indicator has to depend on the entry
dates of the strategy. My idea was to alter the indicator in the mktdata
object every time I enter a trade via the ordersizing function osFUN. But
this didn't work.

Does anyone have a solution for this problem?

Kind regards,

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20151203/57473725/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Quantstrat_ClenowTrend.R
Type: application/octet-stream
Size: 5106 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20151203/57473725/attachment.obj>

More information about the R-SIG-Finance mailing list