How To Add A Stop Loss To A Vectorized Backtest
This is not for the faint-hearted! Vectorized backtests for analysis of trading strategies are phenomenally fast. However, they can be quite complex to implement. Adding stop-loss and profit-take functions can be even more difficult because of the path dependency of the signals. Here, I show you how this is done and how to think about vectorization in general.
We start with a simple MA-crossover backtest and then build the stop and profit and then create early exit signals, which we combine with the original ones.
The entire backtest for two stocks starting form 1983 runs in 20 milliseconds!
For more exclusive content check out our AAA Quants Academy https://aaaquants.com/academy
Shape, co-create and improve our content based on your individual needs fill out this short survey (it only takes 3-5 minutes)
https://forms.gle/Uz1kyboh8MLvgK4JA
All our links in one place https://beacons.ai/aaaquants
Check out our playlists:
Algo Trading from Scratch
https://youtube.com/playlist?list=PLoZCNTbHxGBcyFiTXWPEHHteMFhPVFzgJ
High Performance Backtesting and Trading with NautilusTrader
https://youtube.com/playlist?list=PLoZCNTbHxGBcGN8LiVLyh8d9LwCKLEhZu
Feature Engineering For Financial Applications
https://youtube.com/playlist?list=PLoZCNTbHxGBdjxrCb0QjH3p11sh173xl2 Disclaimer: https://aaaquants.com/disclaimer/
Видео How To Add A Stop Loss To A Vectorized Backtest автора PythonВдохновитель
Видео How To Add A Stop Loss To A Vectorized Backtest автора PythonВдохновитель
Информация
2 декабря 2023 г. 9:46:14
00:46:49
Похожие видео