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.
Create library for backtesting strategies - Python Tutorial
From the course: Practical Python for Algorithmic Trading
Create library for backtesting strategies
- [Instructor] To create a library of strategies, we only need to create a new file that is encoded with dot pi. And we will call it, for example, strategies. Now within this file, we will copy paste the strategies that we previously created, the regression, and also the WalkForwardAnchored. And, we need to import the objects we are using, such as the DecisionTreeRegressor and the strategy. So from back testing, import Strategy. And from sklearn.tree import DecisionTreeRegressor. Let's close the panel, to have a clearer view. And now it's time to create the unanchored walk forward class. Which, instead of anchoring a fixed day at the beginning of the dataset to train the model, the days in the anchored approach are moving along with the test set. We create the class in the strategies lettering. We can duplicate this class. We call it Unanchored. And the only thing that changes in this approach is how we select the X 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)
-