Loads an array of values according to the specified types.
await Bar.load(modes:array, priceType:int, timeFrame:string, symbol:string)
Parameters
Name |
Type |
Действие |
Значение по умолчанию |
modes |
array |
Array of Bar.Mode enumeration values |
— |
priceType |
int |
Price type of of the bar |
— |
timeFrame |
string |
TimeFrame. It can be any of TimeFrame enumeration values. 0 means the current chart TimeFrame. |
— |
symbol |
string |
Symbol name. null means the current symbol. |
— |
Return value
Returns an object with the requested data arrays
Description
Used in the method
onUpdate. Arrays are obtained by destructuring - the name of the variable must be identical to the name of the type.
It is desirable that they be constants to avoid changing them.
If you need to load data by several types, then the best way to get them is to specify in the method all loaded types separated by commas.
The list of available types can be found in
Bar.Mode
Example
// Load an array of values with closing prices of all bars
const {Close} = await Bar.load([Bar.Mode.Close], PriceType.Bid);
// Loading an array of values for several types at once
const {High, Low, Close, Volume} = await Bar.load([Bar.Mode.High, Bar.Mode.Low, Bar.Mode.Close, Bar.Mode.Volume], PriceType.Bid);
// Load an array of values with closing prices and open prices of all bars and assign them to the variables CloseOtherName and OpenName, respectively
const {Close:CloseOtherName, Open:OpenOtherName} = await Bar.load([Bar.Mode.Close, Bar.Mode.Open], PriceType.Bid);