Changes

Jump to navigation Jump to search

Array

5 bytes added, 05:32, 3 April 2013
m
Removed dead links
Each element in an array is referenced by one or more index numbers, one for each of the dimensions. Indexing starts at 0 for each of the dimensions.
Dynamic arrays (arrays with an unlimited number of elements) are one-dimensional, and are initialized at declaration as having only one element. Declared dynamic arrays can be resized using [[Array_SetMaxIndex.]] .
Elements can be manipulated individually or as a group, in all or part of an array.
==== Usage ====
<syntaxhighlight>Array:<IntraBarPersist>ArrayName1
[D1,D2,D3,etc.]
Parameters inside the angled brackets are optional
==== Parameters ==== [[:'''IntraBarPersist]] ''' - an optional parameter; specifies that the value of the array elements is to be updated on every tick . If this parameter is not specified, the value will be updated at the close of each bar.
[[:'''ArrayName]] ''' - an expression specifying the array name. The name can consist of letters, underscore characters, numbers, and periods. The name cannot begin with a number or a period and is not case-sensitive.
[[:'''D]] ''' - a numerical expression specifying the array size in elements, starting at 0, for each of the dimensions; a single expression specifies a one-dimensional array, two expressions specify a two-dimensional ([[''D1]] '' by [[''D2]]'') array, three expressions specify a three-dimensional ([[''D1]] '' by [[''D2]] '' by [[''D3]]'') array, etc. A dynamic array, with an unlimited number of elements, is specified by the empty square brackets: [& ] and will be a one-dimensional array.
[[:'''InitialValue]] ''' - an expression, specifying the initial value and defining the data type for all of the elements in the array. The value can be a numerical, string, or true/false expression; the type of the expression defines the data type.
[[:'''DataN]] ''' - an optional parameter; specifies the Data Number of the data series the array is to be tied to . If this parameter is not specified, the array will be tied to the default data series.
==== Example ====
Declare Length and SFactor as 9-element one-dimensional numerical arrays with data elements' initial values of 0:
<syntaxhighlight>Array:Length[8](0),SFactor[8](0);</syntaxhighlight>  
Declare Max_Price as a 24-element by 60-element two-dimensional numerical array, updated on every tick, tied to the series with Data #2, and with data elements' initial values equal to the value of Close function:
<syntaxhighlight>Array:IntraBarPersist Max_Price[23,59](Close,Data2);</syntaxhighlight>  
Declare Highs2 as a dynamic numerical array with data elements' initial values of 0:
<syntaxhighlight>Array:Highs2[](0);</syntaxhighlight>    
[[Category:Declaration]]

Navigation menu