Weighteds

View as Markdown

Definition

Holds an array of ISeries<double> objects holding historical bar weighted prices. An ISeries<double> object is added to this array when calling the AddDataSeries() method. Its purpose is to provide access to the weighted prices of all Bars objects in a multi-instrument or multi-time frame script.

Property Value

An array of ISeries<double> objects.

Syntax

Weighteds[int barSeriesIndex][int barsAgo]

Examples

1protected override void OnStateChange()
2{
3 if (State == State.Configure)
4 {
5 // Adds a 5-minute Bars object to the strategy and is automatically assigned
6 // a Bars object index of 1 since the primary data the strategy is run against
7 // set by the UI takes the index of 0.
8 AddDataSeries("AAPL", BarsPeriodType.Minute, 5);
9 }
10}
11
12protected override void OnBarUpdate()
13{
14 // Compares the primary bar's weighted price to the 5-minute bar's weighted price
15 if (Weighteds[0][0] > Weighteds[1][0])
16 Print("The primary bar's weighted price is greater");
17}