Change default settings
Default settings are managed by the static SettingsManager
class. A few common settings you may need to change include:
Setting | Default value |
---|---|
BaseCurrency | USD |
FXDirectory | C:\Data\Forex |
MoneyManagementTemplate | Templates\MoneyManagementTemplate.xltx |
To override a default, set the appropriate property in SettingsManager
before running any of your code. For example, to inform the backtester of where to find exchange rates for FX conversions when testing non-base currency denominated contracts, or to use a different money management template, you could set these properties like so:
SettingsManager.FXDirectory = @"C:\FX";
SettingsManager.MoneyManagementTemplate = @"Templates\ComparisonTemplate.xltx";
To make these changes the permanent default, call SettingsManager.Save()
. This will save an xml file called settings.xml to your output directory that looks like this:
<?xml version="1.0" encoding="utf-8"?>
<Settings>
<FXDirectory>C:\FX</FXDirectory>
<MoneyManagementTemplate>Templates\ComparisonTemplate.xltx</MoneyManagementTemplate>
</Settings>
Next, add this file to your Visual Studio project and set the 'Copy to Output Directory' property to 'Copy always' or 'Copy if newer'. When settings are first accessed, the settings.xml file will be loaded, overwriting the built-in defaults.