Stock price prediction with neuralnet package in R : I have build an neural network with the neuralnet package in R to predict stock prices. My model and code works well, but I am getting an accuracy around 97-99%, which makes me a bit skeptical if an overfitting of the model exists.

This is my Dataset I am using (which is already scaled)

[Dataset Scaled][1]


And this is my original Dataset (not scaled), which I need to calc the accuaracy.

[Dataset not scalled][2]

And this is my code to build and test the model:

    normalize <- function(x) {
    return ((x - min(x)) / (max(x) - min(x)))
    }
    
    nn_df <- as.data.frame(lapply(nn_df, normalize))    
    
    nn_df_train = as.data.frame(nn_df[1:1965,]) #1965
    nn_df_test = as.data.frame(nn_df[1966:2808,]) #843
      
    # NN for Sentiment GI
    nn_model <- neuralnet(GSPC.Close ~ GSPC.Open +GSPC.Low + GSPC.High + SentimentGI, data = nn_df_train, hidden=5, linear.output=TRUE, threshold=0.01)
    
    plot(nn_model)
    
    nn_model$result.matrix
    
    nn_pred <- compute(nn_model, nn_df_test)
    nn_pred$net.result
    
    results <- data.frame(actual = nn_df_test$GSPC.Close, prediction = nn_pred$net.result)
    results
    
    #calc accuracy
    predicted = results$prediction * abs(diff(range(nn_org$GSPC.Close))) + min(nn_org$GSPC.Close)
    actual = results$actual * abs(diff(range(nn_org$GSPC.Close))) + min(nn_org$GSPC.Close)
    comparison = data.frame(predicted,actual)
    #deviation=((actual-predicted)/actual)
    deviation= abs((actual-predicted)/actual)
    comparison=data.frame(predicted,actual,deviation)
    accuracy=1-abs(mean(deviation))
    accuracy


  [1]: https://gofile.io/?c=KUzbLW
  [2]: https://gofile.io/?c=zenlWe