price (int offset) : var

Returns the mean ask price of the currently selected asset - the average of all price ticks inside the bar period resp. time frame. This is normally the preferred price for indicators because it is less susceptible to random fluctuations and makes systems more robust and independent on the data feed.

priceOpen (int offset) : var

priceClose (int offset) : var

priceHigh (int offset) : var

priceLow (int offset) : var

Returns the open, close, maximum and minimum ask price of a bar period resp. time frame with the current asset.

marketVal (int offset) : var

marketVol (int offset) : var

Returns additional market data, such as spread, unadjusted close, trade volume per minute, quote frequency, or similar price accompanying data dependent on the implementation in the Broker API (Zorro S only). Only when T6 price history is used for historical data and the LEAN flag is not set.

Parameters:

offset Optional bar number for which the prices are returned, in time frames before the current time frame. If omitted, the price of the current bar is returned. Negative offsets return future prices when the PEEK flag is set; otherwise they give an error message.

Returns:

Price or additional market data.
 

priceSet (int offset, var Open, var High, var Low, var Close)

Modifies the open, high, low, close, and mean price of the current asset for test purposes, artificial price curves, or for prices from different sources. Use offset = -1 for modifying the prices of the next bar, which is necessary for entering trades at the modified prices.

priceQuote (var Timestamp, var Quote) : int

Enters a new price quote of the current asset in the system; for HFT simulation or when prices are not available from the broker connection. Updates LastPrice and Spread. Increases Bar after every BarPeriod when no run function is used.

Parameters:

offset Optional bar number for which the prices are returned, in time frames before the current time frame. If omitted, the price of the current bar is returned. Negative offsets return future prices when the PEEK flag is set; otherwise they give an error message.
Timestamp The exchange timestamp of the quote in DATE format. Only quotes newer than the previous quote of the same asset and type have an effect.
Quote The price. Quote > 0 indicates an ask price, Quote < 0 a bid price.

Returns:

1 when the price was changed due to a new timestamp, 0 otherwise.
 

Usage:

priceOpen(10) returns the opening price of 10 bars ago. priceClose() returns the close price of the current bar, i.e. the most recent price.

Remarks:

Example:

BarPeriod = 60; // set up 1 hour bars (60 minutes)

TimeFrame = 4;
asset("EUR/USD");
vars EUR4 = series(price());	// create a series of 4 hour EUR mean prices
...
TimeFrame = frameSync(24);
asset("SPX500");
vars SPXDay = series(priceClose());	// create a series of daily S&P 500 close prices
TimeFrame = 1;
...

See also:

enterLong/Short, series, asset, Spread, PIP, Detrend, dayHigh/Low

► latest version online