Logic for creating trading signal

Course Name: Financial Time Series Analysis for Trading, Section No: 14, Unit No: 1, Unit type: Notebook



Hi



Can you please explain the rational for the below trading signal logic 



data['signal'] = np.where(data.predicted_price.shift(1) < data.predicted_price, 1, -1)



Here we are comparing the predicted price (prior day) v/s predicted price (current day) and taking a trading position. Shouldnt we compare the price to actual and take the trasing position ?

Hi Ankit, 



As you have seen the course, we are using the trading model to predict prices. The idea for using predicted prices only is to test the effectiveness of the model. If we were to use the actual price, we are adding information to the model which wasn't present earlier while predicting the price and thus, analysing the performance of the model will not give us the real picture. 



You can try to create a strategy based on actual price but make sure there is no look-ahead bias when creating the signal.



Hope this helps.