Splitting training and test set with financial data
I think what you're doing is correct, in fact it would be even more correct to introduce a gap between your test and train set, i.e.

train &lt;-head(stock_indicators,round(0.65*nrow(stock_indicators))) 
test &lt;- tail(stock_indicators,round(0.25*nrow(stock_indicators)))


The reason for this is time series data (usually) exhibits strong serial auto-correlation, so if you put the price for one day in your training set, and the next days price your test set they're a long way from independent and your test error is biased.

The reason you're not getting a good fit is that the data is probably not stationary, i.e. what's driving stock prices is changing over time and it's hard to forecast - if it wasn't everyone would do it perfectly.

Another way of doing the split is to split the data into blocks (say weeks) and then take 80% of the blocks for the training set and 20% for the test set. This is useful if say your data is seasonal (i.e. electricity demand), in which case using the last 20% isn't really representative of the full future you want to forecast. I'd argue stock prices aren't overly seasonal.