yacoubb / stock-trading-ml

A stock trading bot that uses machine learning to make price predictions.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to increase "prediction" timeframe?

paradixe opened this issue · comments

Hi yacoub, how do I increase how many days or timeframe in advance the model prints out at the end?

Currently, the csv_to_dataset method in util.py uses next_day_open_values as the target output. You could add an offset to this. I modified lines 18 and 21 of this file as such:

next_day_open_values_normalised = np.array([data_normalised[:, 0][i + history_points + offset].copy() for i in range(len(data_normalised) - history_points - offset)])
next_day_open_values_normalised = np.expand_dims(next_day_open_values_normalised, -1)
next_day_open_values = np.array([data[:, 0][i + history_points + offset].copy() for i in range(len(data) - history_points - offset)])

Notice the offset variable. If you set this to 5, you are predicting values 1 week in the future (5 working days) and so on.