I am trying to make a stock prediction after the stock price moves above the 50sma. I have a data frame Teknologi_clean that contain 15 different stock and the historic price movment 1 and 3 months after the price moves above the sma. I am using gaupro to make a model of the historic price changes, and then try to predict the future price based of this model. Does anybody know how i can finish this code. The picture is an example of how i want the plot to be.Example

# Lage en funksjon for SMA
calculate_SMA <- function(Aksjer_SMA) {
  tq_get(Aksjer_SMA, from = "2018-01-01", to = "2024-01-01") %>%
    tq_mutate(select = close,
              mutate_fun = SMA,
              n = 50, col_rename = "sma") %>% 
    mutate(cross = if_else(close > sma, 1, 0), 
           first_cross = cross - lag(cross),
           price_1m = lead(close, 20), 
           price_3m = lead(close, 60)) %>% 
    filter(first_cross == 1) %>% 
    select(-first_cross, -cross) %>%
    mutate(across(contains("price"), ~ round((.x / close - 1) *100, 2), .names = "{.col}_change"))
}

# Utvalgte Teknologi aksjer
Aksjer <- c("ATEA.OL", "CRAYN.OL", "TEL.OL", "SCHB.OL", "NOD.OL", "ASTK.OL", "AUTO.OL", "BOUV.OL", "LINK.OL", "ITERA.OL", "VOLUE.OL", "STRO.OL", "TECH.OL", "SMCRT.OL", "PLT.OL")

# Use lapply to iterate over each stock symbol and calculate SMA
Aksje_data <- lapply(Aksjer, calculate_SMA)

# Sette all Aksje data inn i en dataframe
Teknologi <- bind_rows(Aksje_data)# Fjern manglende verdier fra datasettet f??r du bygger modellen
Teknologi_clean <- na.omit(Teknologi)

# Definer inputvariabler (X) og outputvariabler (z)
X <- as.matrix(Teknologi_clean[,c("close", "sma")])
Z <- as.matrix(Teknologi_clean[,c("price_1m")])

modell <- GauPro(X, Z, parallel = FALSE, kernel = "Gauss")

prediksjoner <- modell$predict(X)```