Generate P Value from stationary bootstrap following Politis & Romano (1994)

For my master thesis I am analyzing the performance of trading strategies. For this I need to avoid data snooping by utilising the FDR approach. I follow closely the procedure presented by Bajgrowicz & Scaillet (2012) in their paper Technical Trading revisited: False discoveries, persistence tests, and transaction costs. Journal of Financial Economics, Volume 106, Issue 3, December 2012, Pages 473-491 link

However I became a bit stuck. I have several different time series of returns generated with trading rules and a buy and hold portfolio. These trading rules are either on an intraday or daily basis. Now, Bajwgrowicz & Scaillet describe the following procedure (see attached picture, i hope it is fine to copy from the paper).  I now want to integrate this into R. For this i utilize the tsboot function and specified the parameters. Lets take for example one time series generated by the trading rules and name it ma.bt. However I am not sure if the formula and the parameters as I specified them are correct. the output I get from running the function is always somewhere around 0.4 or 0.5 - which does not make much sense for me as a p-value.

Hope everything is clear in my posted question. Excuse me if anything is posted wrong - it is my first time asking a question around here.

bootstrap.p <- function(rule, statistic = ts_function, b = 10) {
# statistic used as per step 2: AR function
ts_function <- function(tsb) {
ar.fit <- ar(tsb, demean = T)
c(ar.fit$order, mean(tsb), tsb) } # bootstrapping sample set.seed(1) ts <- tsboot(rule, statistic, R = 500, l = b, sim = "geom") # reshifting theta so that is meaned at 0 ts.H0 <- ts$t - mean(ts$t) p.value <- (mean(abs(ts.H0) > abs(ts$t0)))

return(p.value)
}

bootstrap.p(ma.bt)