Technical analysis library
Backtesting in qi uses theqi-ta library, which is a thin q wrapper around the widely used ta-lib. Functions like bbands and atr are drawn from here.
QSharpe
For backtesting, qi has its own Domain Specific Language (DSL) called qsharpe. Below is a sample qsharpe (.qs) file:
Parameters
Paramaters are stored in.params files, and have the same structure as .conf files, e.g.
Folder structure
In any given qi project, qi expects strategies to be stored in astrategies folder, under which are folders named after each strategy:
Running a strategy
To run a strategy do:q qi.q -strat mr1 -params v1
The -params argument is not required if there is only one .params file.
Shared logic
The folderstrategies/common is reserved for functionality that can be used by all strategies.
Under common, there can be two folders:
lib- for.qsfiles with common logicparams- common parameters
Example using shared logic
If we imagine that we have created the following shared folder:q qi.q -strat mr2
which will use defaults.params from common, or we can do:
q qi.q -strat mr2 -params passive
Note: in this second case, defaults will still be used, but will be overriden by passive.
If we now create a local params file so that we have:
q qi.q -strat mr2
The order of params files being loaded is:
common/params/defaults.paramsmr2/custom.qs