Weighted

Description

Weighted is a DataSeries of the type DataSeries, in which the historical weighted values are saved.

The weighted price of a bar is calculated using the formula (high + low + 2*close) / 4 and then weighted on the closing price.

See also Median and Typical.

Parameter

barsAgo Index value (see Bars)

Usage

Weighted

Weighted[int barsAgo]

More Information

The returned value is dependent upon the property CalculateOnClosedBar.

Example

// Weighted price for the current period
Print(Time[0] + " " + Weighted[0]);
// Weighted price of the bar from 5 periods ago
Print(Time[5] + " " + Weighted[5]);
// Current value for the SMA 14 using the weighted price
Print("SMA(14) calculated using the weighted price: " + Instrument.Round2TickSize(SMA(Weighted, 14)[0]));

Last updated