Any asset used in a script should normally have an entry in an asset list in the History folder. The default asset list, AssetsFix.csv, also determines the assets that initially appear in the scroll box. The default asset list can be changed by an entry in the account list (see below). Since any broker has his individual asset parameters, different asset lists are used for simulating different brokers and accounts. If no particular asset list is given in a script, the default asset list is used. The parameters in the asset list affect training and testing. In live trading, asset parameters are normally not read from the list, but loaded from the broker API in real time. But when the broker API does not provide all parameters, their values from the asset list are used.
Different asset lists for backtesting and training can be selected either by script through the assetList command, or automatically with an account list (see below). Asset lists are simple comma separated spreadsheet files that can be edited with Excel or with a text editor for adding new assets, or for modifying parameters of the asset and the broker account. The parameters are stored in this format (example):
The first line must be the header line. Assets can be temporarily commented out: A line is ignored when it begins with "#". Names and symbols must contain no blanks, commas, or semicolons. Zorro also accepts semicolon separated csv files with commas instead of decimal points, but not a mix of both in the same file. Excel uses your local separation character, so make sure in your PC regional settings that it's a comma and the decimal is a point, otherwise Excel can not read standard csv files.
Every asset is represented by a line in the csv file. New assets can be added either manually - by editing the file and entering a new line - or automatically as described below. The asset parameters have the following meanings:
|Name||Name of the asset, f.i. "EUR/USD" (up to 15 characters, case sensitive, with no blanks and no special characters except for slash '/' and underline '_'). This name is used in the script and in the Asset scrollbox. The asset is ignored when it begins with "#".|
|Price||Ask price of one contract, in counter currency units. Accessible with the InitialPrice variable. For non-Forex assets the counter currency is usually the currency of the exchange place, such as USD for US stocks, or EUR for the DAX (GER30). For information only; not used in the backtest.|
|Spread||The difference of ask and bid price of the asset, in counter currency units. Accessible with the Spread variable.|
|Rollover fee ("swap") for long resp. short trades per calendar day and contract, resp. per 10000 contracts for currencies, in account currency units. Accessible with the RollLong/Short variables. This is normally the interest that is daily added to or subtracted from the account for holding positions and borrowing margin. On Wednesdays or Fridays it is often three times higher for compensating the weekend when the broker server is offline and no rollover fee can be deducted. When manually entering them, make sure to convert them to 10,000 contracts for currency pairs. If the Rollover is unknown, it can be estimated from the current annual interest rate divided by 365 and multiplied with asset price*(1-1/leverage).|
|PIP||Size of 1 pip in counter currency units; accessible with the PIP variable. Normally in the range of ~1/10000 of the asset price. The usual pip size is 0.0001 for assets (such as currency pairs) with a single digit price, 0.01 for assets with a price between 10 and 200 (such as USD/JPY and most stocks), and 1 for assets with a 4- or 5-digit price. Prices in the log are displayed with as many decimals as the pip size.|
|PipCost||Value of 1 pip profit or loss per lot, in units of the account currency. Accessible with the PipCost variable and internally used for calculating the trade profit. When the asset price rises or falls by x, the equivalent profit or loss of an unleveraged trade in account currency is x * Lots * PIPCost / PIP. For assets with pip size 1 and one contract per lot, the pip cost is just the conversion factor from counter currency to account currency. For calculating it manually, multiply LotAmount with PIP and divide by the price of the account currency in the asset's counter currency. Example 1: AUD/USD on a micro lot EUR account has PipCost of 1000 * 0.0001 / 1.11 (current EUR/USD price) = 0.09 EUR. Example 2: AAPL stock on a USD account has PipCost of 1 * 0.01 / 1.0 = 0.01 USD = 1 cent. Example 3: S&P500 E-Mini futures on a USD account have PipCost of 50 USD (1 point price change of the underlying is equivalent to $50 profit/loss of an S&P500 E-Mini contract).|
|MarginCost||Margin required for purchasing and holding 1 lot of the asset, in units of the account currency. Depends on account leverage, account currency, and counter currency; if the broker has different values for initial, maintenance, and end-of-day margin, enter the highest value. Accessible with the MarginCost variable. Internally used for the conversion from trade Margin to Lot amount: the number of lots that can be purchased with a given trade margin is Margin / MarginCost. Also affects the Required Capital and the Annual Return in the performance report. Can be left at 0 when Leverage (see below) is used for determining the margin.|
|Leverage||Account leverage for the asset, f.i. 100 for 100:1 leverage. Accessible with the Leverage variable. Equivalent to a margin given in percent, f.i. a 50% end-of-day margin is equivalent to 2:1 leverage. MarginCost and Leverage are different methods for determining a margin for a given volume. If the price is known, they can be converted into each other: MarginCost = Asset price / Leverage * PipCost / PIP. When the broker uses Leverage, the margin per purchased lot depends on the current price of the asset. When the broker uses MarginCost, the margin is independent of the asset price, therefore the broker will adapt MarginCost from time to time when the price has moved far enough. When only Leverage is entered in the asset list, the MarginCost variable is calculated from the Leverage value and the current price. When MarginCost is nonzero, Leverage is ignored and the Leverage variable is calculated from MarginCost and the initial price.|
|LotAmount||Number of contracts or units for 1 lot of the asset; accessible with the LotAmount variable. It's the smallest amount that you can buy or sell without getting the order rejected or a "odd lot size" warning. For currencies the lot size is normally 1000 on a micro lot account, 10000 on a mini lot account, and 100000 on standard lot accounts. Some index CFDs or crypto currencies can have a lot size less than one contract, such as 0.1 NASDAQ contracts, or 0.0001 Bitcoins. For most assets it's normally 1 contract per lot.|
|Commission||Roundturn commission for opening and closing one contract, resp. 10000 contracts for currencies. Accessible with the Commission variable. When manually entering the commission, double it if it's single turn. For currency pairs make sure to convert it to 10,000 contracts.|
|Symbol||Optional broker symbol of the asset (up to 39 characters, case
sensitive, no blanks, but special characters such as '.' or '-' are allowed). Additional information such as the asset type, exchange name,
or expiration date can be coded in the symbol, dependent on the Broker (f.i. AAPL-STK-NYSE-USD, see IB API). When asset prices
must be downloaded from an external source such as Quandl, give here the source (QUANDL, YAHOO, GOOGLE, AV, STOOQ),
a colon, and the asset code or symbol (f.i.
When assets are traded simultaneously with different brokers or accounts, give here as source the name from the account list, f.i. FXCM_Real:GER30 (see below; see also broker arbitrage). When the symbol begins with a colon ':', live prices are not updated. Asset prices are not retrieved at all when the symbol begins with '#'. When the field is empty, the asset name is used for the symbol.
|AssetVar||Optional numbers or text for the 8 asset specific variables or strings.|
Some broker APIs, such as IB or FIX, do not provide any asset parameters with exception of price and spread. The other parameters must be entered manually. The values can normally be taken from the broker's website. If the broker uses a very complex structure of fees, margin, and commission, enter estimated or average values. They need not be 100% accurate, but they should not be too far off in the interest of realistic backtests. An alternative way to get to the data is opening a minimum position of the asset in a demo account. The commission and margin is then often displayed in the broker's trade platform.
Since the price of the account currency is not constant, PipCost and MarginCost are only valid for the time at which the asset list was created or downloaded. In live trading they are automatically updated from the broker API. In the backtest they could be updated by script. But this is normally not required, since the deviations in trade profit and margin value are negligible in comparison to bias and randomness that affect strategy performance results.
Up to 8 additional asset-specific parameters - either numbers or strings - can be entered in the asset list behind the Symbol column. They can be accessed in the script through the AssetVar/AssetStr variables, and can be used for storing additional asset or strategy specific information, for instance the minimum and maximum portfolio weights, or the trading class for options. Asset-specific strings must not have more than 7 characters.
For backtesting or trading a certain asset, make sure that historical price data files for the tested period are available, and the asset it contained in the selected asset list. US citizens are restricted in trading, as high leverage and CFDs are usually not available to them. FXCM US accounts have often only 10:1 leverage and offer only currencies; the other assets should be removed from the list when simulating US accounts. For simulating many different accounts, place several Asset...csv files in the History folder and call assetList with the desired asset file name in the script for simulating the corresponding account.
There is a special asset list named Assets.csv in the Log folder. This list is updated on every [Trade] session with the current parameters of all assets contained in the script. It's a convenient way to simulate your current broker account: just connect to the broker with a script that selects all needed assets (f.i. the Download script), then copy Assets.csv to the History folder under the name of the asset list that you use for testing. It's preferable to do this a Monday, Tuesday, Thursday, or Friday, as on weekends most assets have an unrealistic spread and no rollover fee, and on Wednesdays often the rollover is three times as high for compensating the weekend. For permanently simulating a certain asset/account state, copy the corresponding asset line from Assets.csv into the History\AssetsFix.csv file. Zorro must be restarted when AssetsFix.csv was modified. Below you'll find examples for adding assets and downloading price data with the Download script.
The included asset list AssetsCur.csv contains about 35 currency pairs, including all pairs of the 7 major currencies EUR, USD, AUD, GBP, CHF, NZD, CAD. It can be used for trading with a multitude of currencies. For making this list permanent, copy AssetsCur.csv to AssetsFix.csv. The included asset lists AssetsIB.csv and AssetsOanda.csv contain selected assets for particular brokers.
For simulating direct market access (DMA) with no broker interference, set the parameters in the following way: Spread to a realistic bid/ask spread; Commission, RollLong, RollShort, and MarginCost to 0; Leverage to 1; LotAmount to 1; and PipCost to PIP multiplied with the price of the assets resp. the counter currency in account currency units.
Account lists are supported with Zorro S. By default, only a Demo and a Real account is available with the [Account] scrollbox. Individual accounts, with user-defined parameters and separate brokers and price sources, can be added with an account list. It is stored in a spreadsheet file named Accounts.csv in the History folder. This file is a convenient way to manage many broker accounts with different logins, passwords, asset parameters, and special modes. The Accounts.csv file can be edited with Excel or with the script editor. Zorro must be restarted when the file was modified. It contains the account parameters in comma separated spreadsheet format (example):
An example file AccountsExample.csv is contained in the History folder as a template for creating your own Accounts.csv file. Every account in the scrollbox corresponds to a line in the file with the following parameters, separated with commas:
|Name||Account name (no blanks) that appears in the account scrollbox.|
|Broker||Name of the broker (no blanks). Just for information, not yet used by the software.|
|Account||For future extension, not used yet and always 0.|
|User||User ID for the login, or 0 for manually entering the user name.|
|Pass||Password for the login, or 0 for manually entering the password.|
|Assets||Name of the default asset list (see above) for this account, with no blanks and without the .csv extension. This is the list used for live trading and backtesting when the account is selected and no assetList function is called in the script.|
|CCY||Name of the account currency, f.i. EUR or USD. Optionally, after a decimal point, the ANSI currency symbol and the number of digits to display for account values. By default, the currency symbol is '$' and account values are displayed with 2 decimals when less than 100, and without decimals from 100 on.|
|Real||Real account (1), real account with no trading (3) or demo account (0). When at 3, all trades are opened in Phantom Mode and not sent to the broker.|
|NFA||Compliance of the account. Affects default state of NFA flag and Hedge mode: 0 for no restrictions, 2 for Hedge = 0 (no hedging), 14 or 15 for NFA = on (full NFA compliance).|
|Plugin||File name of the broker plugin in the Plugin folder (without .dll extension).|
|Source||Optional source for live prices and price history. If no price source is given, prices are taken from the broker. The price source can be either an online data provider (GOOGLE, QUANDL, AV, STOOQ) or another account name. The account name must be defined prior on the same account list, and contain user ID and password. Broker and price source must not share the same plugin, but they can use copies of the same plugin. The symbols of the traded assets must be identical for broker and price source.|
The first line in the CSV file must be the header line. Names and strings must contain no blanks (check for blanks at the end that may be accidentally added!) and no special characters except for '-' and '_'. Zorro also accepts semicolon separated csv files with commas instead of decimal point, but not a mix of both in the same file. User names and passwords are stored in unencrypted text in the spreadsheet, so leave those parameters at 0 when other people have access to your PC.
In the above example, the account ABC_Both uses a separate
price source. It trades on an ABC real account, but
receives the prices and price history from ABC_Demo, which is a
demo account with the same broker. Since broker and price source must not share
the same plugin, the Zorro user with the above account list has made two copies
of the ZorroMT4.dll, and renamed them to ZorroMT41.dll
and ZorroMT42.dll. The connected MT4 client must also be
duplicated this way, since MT4 can not handle two different accounts
► latest version online