SCM

Forum: help

Monitor Forum | Start New Thread Start New Thread
RE: Access previous rows in AddSignal [ Reply ]
By: Khan Bax on 2016-02-01 09:37
[forum:42878]
It works.
Many thanks.

RE: Access previous rows in AddSignal [ Reply ]
By: Joshua Ulrich on 2016-01-29 15:57
[forum:42875]
It's too much work for me to try and test the solution I propose, because you did not provide a reproducible example. That said, try this:

add.signal(qs.strategy, name = "sigFormula",
arguments = list(
columns = c("Close","SMA10"),
formula = "(Close >= SMA10.Cross) & lag(Close < SMA10.Cross)",
cross = FALSE),
label = "CrossedAbove")

Access previous rows in AddSignal [ Reply ]
By: Khan Bax on 2016-01-28 13:43
[forum:42874]
Hi,
I am using the following line to add signals:
add.signal(
qs.strategy,name = "sigFormula", arguments = list(
columns = c("Close","SMA10"),
formula = "(Close >= SMA10.Cross)",cross = FALSE
), label = "CrossedAbove"
)

and want to add another condition:
Previous Close < Previous SMA10

I have tried the one below:
qs.strategy,name = "sigFormula", arguments = list(
columns = c("Close","SMA10"),
formula = "(Close >= SMA10) & (Close[nrow(Close) - 1] < SMA10[nrow(SMA10)-1])",cross = FALSE
), label = "CrossedAbove"
)

But It does not work.
Any help will be appreciated.
Thanks.

Thanks to:
Vienna University of Economics and Business Powered By FusionForge