Parameter Scans

Moonshot parameter scans provide a great way to test variations of your trading strategy. This notebook uses a parameter scan to gauge the impact of the quality filter on the QVAL strategy.

Impact of Quality Filter (Piotroski F-Score)

As a reminder, QVAL selects the top 50% of value stocks as ranked by Piotroski F-Score. How important is the quality filter? Does it improve the basic underlying value strategy? If so, would it help to be even more selective and and choose only, say, the top 25% by quality?

The following scan compares setting the quality filter at 25% (more selective), 50% (the current value), and 100% (= no quality filter).

As with the backtest, we use segment="A" to run the scan in 1-year segments.

In [1]:
from quantrocket.moonshot import scan_parameters
scan_parameters("qval", 
                param1="QUALITY_TOP_N_PCT", 
                vals1=[25, 50, 100], 
                start_date="2010-01-01", 
                end_date="2018-01-01", 
                segment="A", 
                filepath_or_buffer="qval_scan_QUALITY_TOP_N_PCT.csv")

Use moonchart to view a tear sheet of the scan results. The scan reveals that the quality filter does indeed have a positive impact in the latter part of this testing period:

In [2]:
from moonchart import ParamscanTearsheet
ParamscanTearsheet.from_moonshot_csv("qval_scan_QUALITY_TOP_N_PCT.csv")