[R-SIG-Finance] rule delays

Ilya Kipnis ilya.kipnis at gmail.com
Fri May 27 08:47:54 CEST 2016


Stephen,

This might be a bit of a hack, but what I'd recommend is this:

Create a custom signal function (see my sigAND function in my IKTrading
package) that simply takes a signal and lags it by eight days, then put
that lagged signal with your original signal in a one-cancels-other order
set.

It's been a while since I formally wrote such code, but you can find such
an example here:
https://quantstrattrader.wordpress.com/2014/08/18/a-hammer-trading-system-demonstrating-custom-indicator-based-limit-orders-in-quantstrat/

Also, look up the R/Finance 2013 presentation on quantstrat that Brian
Peterson himself did which demonstrates this functionality as well.

Hope this helps.

-Ilya

On Fri, May 27, 2016 at 2:43 AM, Stephen Choularton <
stephen at organicfoodmarkets.com.au> wrote:

> Hi
>
> I am trying to implement Harry's Connor's RSI from his book Quantative
> Trading ...
>
> I have it working as is and have varied it to some shares in the ASX.
>
> However, I want to pursue the idea of a fixed time (8 day) sell rule that
> takes place if the normal rule doesn't produce a sale before.
>
> I added this rule at line 127 of the file 3. strategy.R:
>
> add.rule(strategy.st, name = "ruleSignal",
>     arguments = list(sigcol = "longExit",
>     sigval = TRUE,
>     orderqty = "all", delay = 691200,
>     ordertype = "market",
>     orderside = "long", TxnFees = txnFees,
>     replace = FALSE,
>     prefer = "Open"), type= "exit", path.dep = TRUE)
>
> but it seems to have no effect.
>
> I attach all the code. You run it in the numbered order of the files.
>
> I wonder if anyone can help me make this sort of rule work.
>
> -----------------------------------------------------------------------------------------------------------------------------------
>
> Stephen Choularton PhD, FIoD
> 0413 545 182
>
> _______________________________________________
> R-SIG-Finance at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only. If you want to post, subscribe first.
> -- Also note that this is not the r-help list where general R questions
> should go.
>

	[[alternative HTML version deleted]]



More information about the R-SIG-Finance mailing list