Asset parameters 2
Size of 1 price point (pip) of the current asset in units of the counter currency, f.i. 0.0001 for EUR/USD. Can be used to set a price in pips, f.i. Stop = 10*PIP. For converting a price difference to pips, divide it by PIP.
Value of 1 pip profit or loss per lot in units of the account currency; determined by the lot size (LotAmount) and the exchange rate of account currency and counter currency. This value should normally remain constant during the simulation for not adding artifacts to the result. If desired for special purposes, it can be calculated by script to fluctuate with the exchange rate (see example below). When the asset price rises or falls by x, the equivalent profit or loss in account currency is x * Lots * PIPCost/PIP. The value of the counter currency in account curreny units is normally CCValue = PIPCost / (PIP * LotAmount). This is only different In special cases when a CFD corresponds to only a fraction of the underlying asset.
Required margin for puchasing and holding 1 lot of the current asset in units of the account currency; depends on leverage,
currency, and lot size.
The number of lots at a given margin is Margin / MarginCost.
For options and futures, MarginCost is calculated per
underlying unit. The variable is updated in real time when the broker uses the Leverage method for calculating margin cost. For special margin requirements, f.i. for covered options or
option combos, set this variable in the script to the
maximum of initial, maintenance, and end-of-day margin per underlying unit before entering a trade.
Asset value divided by margin cost. Determined by the account's buying power, i.e. the asset amount that can be purchased with account currency. MarginCost and Leverage can be converted into each other: MarginCost = LotAmount * Asset price * CCValue / Leverage = Asset price / Leverage * PIPCost / PIP.
The number of contracts per Lot with the current asset. Determines the minimum order size and depends on the lot size of the account. For currencies, the lot size of a micro lot account is normally 1000 contracts; of a mini lot account 10000 contracts; and of a a standard lot account 100000 contracts. Some brokers offer also lot sizes that are a fraction of a contract, f.i. 0.1 contracts per lot for certain CFDs.
Maximum number of Lots with the current asset
(default: 1000000000/LotAmount). Can be set to a smaller number
for safety reasons. If the number of lots exceeds this limit, a software bug is
suspected, the order is not executed, and an error message is issued.
Multiplies prices, ask-bid spread, trade size, and PIP size of the current asset with the given factor. Can be used for generating an artificial asset for arbitrage purposes.
The initial asset price taken from the asset list. Can be used - when desired - to adapt MarginCost to the changes of the asset price in the backtest (current MarginCost = Initial MarginCost * Asset Price / InitialPrice). Many brokers do not adapt their MarginCost continously, but in monthly intervals or at special events.
The last ask price of the current asset in live trading mode or by calling priceQuote. The last bid price is AskPrice - Spread.
var, read/only if not mentioned otherwise (edit the Asset List for permanently changing asset parameters).
- When Zorro is connected to a broker, it loads the current asset parameters from the broker's server
if available. When not connected, or when the boker API does not provide the parameters, they are loaded from the asset list (normally History\AssetsFix.csv). The asset list can be edited with a spreadsheet program or a text editor for simulating different brokers, accounts, and assets in backtests; or it can be automatically updated to the parameters of the current broker account. For details see Data Import.
// set stop / profit target at a fixed pip distance
Stop = 10*PIP;
TakeProfit = 40*PIP;
// let profits fluctuate with the account currency exchange rate
function convertProfits(string Rate)
char OldAsset; strcpy(OldAsset,Asset); // store original asset
var Price = price();
if(Price > 0.)
PIPCost = PIP*LotAmount/Price;
// call this function from run(), f.i.
convertProfits("EUR/USD"); // when account currency = EUR and counter currency = USD.
Stop, Spread, Lots, price, Commission, Broker Data
► latest version online