Any asset used in a script needs an entry in an asset list in the History folder (unless the asset is added by script). The default asset list, AssetsFix.csv, also determines the assets that initially appear in the scroll box. Since any broker has his individual asset parameters, different asset lists are used for simulating different brokers and accounts. The asset list can be selected either by script through the assetList command, or automatically with an account list (see below). If no particular asset list is given in a script, the default 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.
Asset lists are simple comma separated spreadsheet files (CSV files) that can be edited with Excel or with a text editor for adding new assets, or for modifying parameters. 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. For quickly adding a new currency pair to the asset scroll box, edit AssetsFix.csv with the script editor and copy the currency pair line over from the currency list AssetsCur.csv. For adding a stock, copy a line from AssetsSP250.csv.
Example of an asset list:
The first line is the header line. 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.
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 the name begins with "#"; this way assets can be temporarily 'commented out'.|
|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. Used in the backtest. If at 0, spread must be simulated in the script.|
|Rollover fee ("swap") for long or short trades per
calendar day and contract, or 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 10000 contracts for currency pairs.
If rollover is unknown, it can be estimated from the current annual interest rate divided by 365 and multiplied with asset price*(1-1/leverage). If the broker charges a flat interest fee on open margin, set RollLong/RollShort to 0, calculate the amount by script, and subtract it daily from the balance.
|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, or 1 for
unleveraged accounts. 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 alternative methods for determining the margin for a given trade 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 in account currency units for opening and closing one contract, or 10000 contracts for currency
pairs. Accessible with the Commission variable. When manually entering the commission, double it if
was single turn. For currency pairs make sure to convert it to 10000 contracts.
Whether an asset is a currency can be determined with the
If the commission is a percentage of the asset value, enter the negative percent value, f.i. -0.25 for 0.25% of the asset value. The commission is then automatically calculated from the percentage using the formula Commission = -Percent/100 * Price * PIPCost / PIP.
|Symbol||Optional symbols of the asset (up to 128 characters, case
sensitive, no blanks, but special characters such as '.' or '-' are allowed).
Because the same asset can have different symbol names dependent on broker
or price source, up to 3 symbols can be assigned: for trading, for live
prices, and for historical prices. The 3 symbols are separated by
exclamation marks '!'. They are accessible in the script
under the names SymbolTrade,
- A symbol can begin with the name of the source, followed by a colon and the symbol name (like STOOQ:AAPL). The source can be either an online source (QUANDL, AV, STOOQ, BITTREX, etc), or a broker/account name from the account list (like FXCM_Real:GER30; see below). This way, assets can be traded with broker A, based on prices from broker B, or vice versa (see also broker arbitrage).
- Additional information such as the asset type, exchange name, or expiration date can be coded in a symbol (f.i. AAPL-STK-NYSE-USD, see IB API).
- If the Symbol field is empty, the asset name is used for all symbols. If it contains a single symbol without price source, this symbol name is used for trading and price data with the selected broker. If it contains a single symbol with price source, the symbol is used for price data and the asset name is used for trading. If it contains 2 symbols, the first is used for trading and the second for price data. Of 3 symbols, the first is used for trading, the second for live prices, the third for historical prices. Example: TNOW-STK-SMART-USD!TNOW-STK-SMART-USD!YAHOO:TNOW.L.
- If a separate symbol for live and/or historical prices is blank or empty (f.i. AAPL! !), the prices of that asset are not downloaded or retrieved from the broker. This is for getting prices by script f.i. with the assetHistory or priceQuote functions.
- If the symbol is "DUMMY", a flat price curve is generated for test purposes.
|AssetVar||Up to 8 optional asset specific variables or strings, for evaluation in the script through AssetVar.. or AssetStr... Text strings must not exceed 7 characters.|
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.
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 or the counter currency in account currency units.
Any live trading session generates a special asset list named Assets.csv in the Log
folder. This list is updated with the actual parameters of all assets
that are selected in the trading script, as long as they are available through
the broker API. This is 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
are using for testing. It's preferable to do this a Monday, Tuesday, or Thursday, as on weekends most assets have an unrealistic spread and no rollover fee, and on Wednesdays
or Fridays often the rollover is three times as high for compensating the weekend.
!! Check the content of Assets.csv before copying it over. Dependent on broker API and market hours, some parameters, especially spread and rollover, might be wrong. If parameters are temporarily or permanently unavailable, they are replaced either by default values or by the content of the current asset list. They can be wrong by a large margin when the current list is from a different broker and/or different leverage. Some MTR4 brokers also return different values for rollover of commodity CFDs like XAG/USD; sometimes per lot, sometimes per 10,000 lots.
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.
Some asset lists - with no guarantee of completeness or correctness - have been included and can be used as templates for own asset lists:
AssetsFix.csv - The default asset list that determines the assets available with the scrollbox. Based on an Oanda™ 100:1 USD account with lot size 1000.
AssetsCur.csv - About 35 currency pairs, including all pairs of the 7 major currencies EUR, USD, AUD, GBP, CHF, NZD, CAD. For trading with a multitude of currencies. Based on an FXCM 100:1 EUR account.
AssetsOanda.csv - 15 Forex/CFD assets on an Oanda™ 100:1 USD account with lot size 1.
AssetsOandaEUR.csv - 15 Forex/CFD assets on an Oanda™ 30:1 EUR account.
AssetsFXCM.csv - 15 Forex/CFD assets on a FXCM™ 100:1 EUR account.
AssetsGP.csv - 15 Forex/CFD assets on a Global Prime™ 100:1 USD account.
AssetsIB.csv - Forex pairs, CFDs, and 40 major stocks on an Interactive Brokers™ USD account.
AssetsSP250.csv - Top 250 stocks from the S&P500 index.
AssetsCFD200.csv - 200 stock CFDs with 10:1 leverage for trading with IB™.
AssetsBittrex.csv - 100 cryptocurrencies on a Bittrex™ Bitcoin account.
AssetsZ8.csv - 20 stocks and ETFs for a Markowitz portfolio rotation strategy, prices from Stooq™, trading with IB™.
AssetsZ9.csv - 10 US sector ETFs and bonds for a momentum portfolio rotation strategy, prices from Stooq™, trading with IB™.
AssetsZ9E.csv - 10 European sector ETFs and bonds for a momentum portfolio rotation strategy, prices from Yahoo™, trading with IB™.
AssetsZ10.csv - 15 major cryptocurrencies, prices from Cryptocompare™, trading with Binance™.
Please note that asset parameters and trading costs change all the time. We do not observe brokers permanently for updating the asset lists. Many can be, and probably are, out of date. For an up-to-date simulation of your broker account, get the current parameters from the broker API or the broker's website and enter them in the asset list if necessary.
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||Account/subaccount identifier sent to the broker, or 0 when no subaccounts are used.|
|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 (.dll extension can be omitted). The same plugin can used for several price sources by copying the plugin to a different name (see below). In the example, ZorroMT41.dll and ZorroMT42.dll are both copies of the ZorroMT4.dll. If the field is empty, the broker plugin is selected with the scrollbox.|
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_Real is prepared for trading simultaneously with ABC_Demo, one used as price source, the other for entering trades by setting Asset List / Symbol accordingly (see above). Since two broker connections cannot use simultaneously 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 MTR4 client must also be duplicated this way, since MTR4 can also not handle two different accounts simultaneously.
► latest version online