From c52fcf913a9d460e3cd9a2fc513de941a4977eaf Mon Sep 17 00:00:00 2001 From: shikokuchuo <53399081+shikokuchuo@users.noreply.github.com> Date: Sun, 18 Aug 2024 14:54:43 +0100 Subject: [PATCH] try fix #9 --- R/strat.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/strat.R b/R/strat.R index 793e45ce..7dbab609 100644 --- a/R/strat.R +++ b/R/strat.R @@ -165,7 +165,7 @@ strat <- function(x, s2posn <- c(NA, s2cond[1:(end - 1L)], rep(NA, p2)) s2txn <- c(NA, s2posn[-1L] - s2posn[-xlen]) s2txn[s2posn == 1 & is.na(s2txn)] <- 1 - if (s2posn[end] == 1) s2txn[end + 1L] <- -1 + if (s2posn[end] == 0) s2txn[end + 1L] <- 1 s1entry <- which(s1txn == 1) s2exit <- which(s2txn == 1)