How to resolve error in Algorithms for time dependent data (esp. Market Prediction)



Hi I am a newbie and I am trying to write a small app for predicting share price with any of the basic time dependent algorithms. I had come across this blog and am trying to use ARIMA model with errors.

This is my code after loading the required packages.

close <- SBIN.BO[,4]
fit <- auto.arima(y, seasonal=FALSE, xreg=fourier(close, K=4))
I am getting the following error.

Error in …fourier(x, K, 1:length(x)) : **
** K must be not be greater than period/2

Please give me more insight on the error and also on the input variables for auto.arima fit