April 2019
Intermediate to advanced
426 pages
11h 13m
English
Using fixed strategy parameters, we were able to have the backtest engine run a single time and visualize its performance. Since the goal of backtesting is to find the optimal strategy parameters for considering in a trading system, we would like our backtest engine to run multiple times on different strategy parameters.
For example, define the list of threshold values that we would like to test in a constant variable named THRESHOLDS:
THRESHOLDS = [ (-0.5, 0.5), (-1.5, 1.5), (-2.5, 2.0), (-1.5, 2.5),]
Each item in the list constant is a tuple of buy and sell threshold values. We can iterate these values with a for loop, calling the engine.start() command and plotting on a graph on every iteration with ...
Read now
Unlock full access