OptionForge grid search helps you optimize options backtests by sweeping strategy parameters and comparing outcomes across all tested combinations.
Grid search runs the same strategy across a range of parameter values and returns a report so you can compare performance across combinations.
Add grid parameters using a standard Lua assignment followed by a comment in the format [min:max:step] This means the grid search code is also value for a single back-test. It's strongly recommended to make sure that the single back-test is running without issue before using a grid-search.
dte = 45 -- [30:90:15]
width = 10 -- [5:20:5]
short_delta = -25 -- [-40:-10:5]
qty = 1 -- [1:4:1]
local profit_target = 150 -- [50:300:50]
stop_loss = -400 -- [-800:-200:100]
dte = 21 -- [7:63:7]
entry_hour = 10 -- [9:15:1]
entry_minute = 30 -- [0:45:15]
This lets you sweep non-integers and mixed types by mapping a simple integer index.
local idx = 1 -- [1:5:1]
local val = ({23.5, 99.4, 123.6, 298.1, 333})[idx]
local str = ({"Mon", "Tue", "Wed", "Thu", "Fri"})[idx]
It is highly recommended to debug with a normal backtest first, then run grid search once the script behaves as expected.
After adding grid parameters, click Run Grid Search in the UI. A grid report will open when the runs finish.