> For the complete documentation index, see [llms.txt](https://quantinfra.gitbook.io/quantinfra-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://quantinfra.gitbook.io/quantinfra-docs/strategies/strategy-configuration.md).

# Strategy configuration

A single strategy class may produce multiple instances of strategies that trade different contracts or use different parameters.

```json
{
  "Name": "MoMacd ETHUSDT",
  "ClassName": "QuantInfra.Strategies.Examples.MoMacdExample",
  "RequiredBarStorages": {
    "main": {
      "IdType": "Contract",
      "Id": 20614,
      "AggregationType": "Time",
      "TradingSessionIds": null,
      "Timeframe": "PT15M",
      "Offset": "P0D",
      "Timezone": "UTC",
      "LastValueOnly": false
    }
  },
  "Symbols": {
    "main": 20614
  },
  "Params": "{ \u0022coefficient\u0022: \u00221\u0022, \u0022downFractalPeriod\u0022: \u00222\u0022, \u0022maxDivide\u0022: \u00221\u0022, \u0022tp\u0022: \u00220.01\u0022, \u0022upFractalPeriod\u0022: \u00222\u0022, \u0022mmType\u0022: \u0022FixMoneyManagement\u0022 }",
  "Account": {
        "Name": "MoMacd ETHUSDT VA",
        "AccountType": "VirtualAccount",
        "CurrencyId": 840,
        "PositionAccounting": "Hedged",
        "EnableSharePriceTracking": true
    },
    "StartImmediately": true
}
```

## Parameters

| Field                 | Type                                  | Description                                                                                                       |
| --------------------- | ------------------------------------- | ----------------------------------------------------------------------------------------------------------------- |
| Name                  | string                                | Arbitrary name of the strategy                                                                                    |
| Class name            | string                                | Full name (including namespace) of the class the implements the strategy                                          |
| Symbols               | Dictionary\<string, int>              | IDs of the contracts traded by the strategy.                                                                      |
| Required bar storages | Dictionary\<string, BarStorageConfig> | Candles used by the strategy                                                                                      |
| Params                | string                                | A JSON string containing the set of strategy parameters. \u0022 or \” can be used as escape for the quote symbol. |
| Account               | Account configuration                 |                                                                                                                   |

For Symbols and Required Bar Storages, keys of the dictionary serve as internal names for the contracts. If you run a strategy on different contracts, its internal logic won’t change:

```
// Strategy code
OpenPosition(”main”, 10, Side.Buy)

// Strategy 1 config: 
Symbols: 
{ 
    “main”: 12345 // BTCUSD 
} 

// Strategy 2 config: 
Symbols: 
{ 
    “main”: 54321 // AAPL 
} 
```

### Bar storage (candles) configuration

<table><thead><tr><th width="195.22265625">Field</th><th>Description</th></tr></thead><tbody><tr><td>IdType</td><td>Denotes whether the ID refers to a contract or to a stream</td></tr><tr><td>Id</td><td>ID of the used contract or stream.</td></tr><tr><td>Aggregation type</td><td>Currently, only time aggregation is supported</td></tr><tr><td>Trading session IDs</td><td>If provided, will denote that candles or ticks only from these trading sessions will be aggregated</td></tr><tr><td>Timeframe</td><td>Timeframe of the aggregation. The only limitations are:<br>- Timeframes longer than 24 hours are currently not supported<br>- 24 hours must be divisible by the timeframe<br><br>NodaTime.Period is used to define the timeframe. When populating the string value in the config, the <a href="https://nodatime.org/3.1.x/userguide/period-patterns">Roundtrip</a> pattern is used, e.g.:<br>- PT5M for 5 minutes<br>- PT3H for 3 hours<br>- PT1D for 24 hours</td></tr><tr><td>Offset</td><td>Offset for closing the aggregation. For instance, you may want to close hourly bars at the 15th minute of each hour.</td></tr><tr><td>Timezone</td><td>Required for daily bars or when using multiple contracts traded in different time zones. Defines the time zone for closing the aggregation. Defaults to the time zone of the contract's exchange, or to UTC for streams.<br><br>Uses <a href="https://nodatime.org/2.0.x/api/NodaTime.DateTimeZoneProviders.html">NodaTime TZDB provider</a></td></tr></tbody></table>

### Account configuration

<table><thead><tr><th width="201.26953125">Field</th><th width="185.19140625">Type</th><th>Description</th></tr></thead><tbody><tr><td>Name</td><td>string</td><td>Optional, defaults to $”{Strategy Name} {Account Type}”</td></tr><tr><td>Account type</td><td>VirtualAccount<br>StrategySubaccount</td><td>For backtesting, always use VirtualAccount.<br>For live execution, the choice depends on the <a href="/pages/stP8XGozZ2OhfsKye72g#execution-modes">execution mode</a>.</td></tr><tr><td>Currency ID</td><td>int</td><td>The ID of the account’s base currency</td></tr><tr><td>Position Accounting</td><td>Netted<br>Hedged</td><td>Hedged accounting allows to track several positions for the same contract independently.</td></tr><tr><td>Enable share price tracking</td><td>bool</td><td>Denotes if you want to track percentage returns for the account (normally, must be enabled for strategy accounts)</td></tr></tbody></table>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://quantinfra.gitbook.io/quantinfra-docs/strategies/strategy-configuration.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
