From the course: Practical Python for Algorithmic Trading
Unlock the full course today
Join today to access over 23,400 courses taught by industry experts.
Anchored walk forward validation in backtesting - Python Tutorial
From the course: Practical Python for Algorithmic Trading
Anchored walk forward validation in backtesting
- [Instructor] To use the anchored walk forward validation in the backtesting strategy, we need to pre-process the data within the strategy class. First, we pre-process the training set whose data is taken from the backtest class. Therefore, self.data DF iloc to locate by the position from the very first day until let's say 600 days. And because this is the explanatory variable, I want all of the columns, but the last one. Remember that we take the data from DF. With this part of the code we are telling to take all of these columns. Now for the Y train, we do the same, but this time we select the last column. So far, we are only training the model on the first 600 days but we need to take action whether to buy or sell the stock. Even though we have those steps in these lines of code, they don't contain the anchored walk forward procedure. To do so, we need to create a new class, which I named walk forward anchored, and…
Contents
-
-
-
-
-
-
-
(Locked)
Why machine learning models overfit the data4m 21s
-
(Locked)
How to train models within the backtest2m 47s
-
(Locked)
Challenge: Train test with other tickers3m 5s
-
(Locked)
Walk forward validation in machine learning8m 31s
-
(Locked)
Anchored walk forward validation in backtesting5m 36s
-
(Locked)
Create library for backtesting strategies2m 50s
-
(Locked)
Interpret reports from walk forward validation approaches1m 12s
-
(Locked)
Challenge: Walk forward with other tickers5m 2s
-
(Locked)
-