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.


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).



// 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[15]; strcpy(OldAsset,Asset); // store original asset
if(!asset(Rate)) return;
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.

See also:

Stop, Spread, Lots, price, Commission, Broker Data


► latest version online