Difference between revisions of "Variable"

From MultiCharts
Jump to navigation Jump to search
m (Reverted edits by 176.8.90.7 (talk) to last revision by 194.84.116.138)
m
Line 1: Line 1:
 
Declares one or more names as variables; specifies the initial value, variable type, update basis, and data number for each variable.  
 
Declares one or more names as variables; specifies the initial value, variable type, update basis, and data number for each variable.  
 +
 
Variables can be numerical, string, or true/false.  
 
Variables can be numerical, string, or true/false.  
 
   
 
   
==== Usage ====
+
== Usage ==
<syntaxhighlight>Variable:[IntraBarPersist]VariableName1(InitialValue1[,DataN]), [IntraBarPersist]  
+
<syntaxhighlight>Variable: [IntraBarPersist]VariableName1(InitialValue1[,DataN]), [IntraBarPersist]  
 
VariableName2(InitialValue2[,DataN]),etc.</syntaxhighlight>  
 
VariableName2(InitialValue2[,DataN]),etc.</syntaxhighlight>  
  
 
Parameters inside the square brackets are optional
 
Parameters inside the square brackets are optional
  
==== Parameters ====  
+
== Parameters ==
[[IntraBarPersist]] - an optional parameter; specifies that the value of the variable is to be updated on every tick  
+
:'''IntraBarPersist''' - an optional parameter; specifies that the value of the variable is to be updated on every tick. If this parameter is not specified, the value will be updated at the close of each bar. See for more information the [[IntraBarPersist]] Wiki article.
If this parameter is not specified, the value will be updated at the close of each bar.  
+
:'''VariableName''' - an expression, specifying the variable 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.  
 
+
:'''InitialValue''' - an expression, specifying the initial value and defining the variable type. The value can be a numerical, string, or true/false expression; the type of the expression defines the variable type.  
[[VariableName]] - an expression, specifying the variable name  
+
:'''DataN''' - an optional parameter; specifies the Data Number of the data series the variable is to be tied to. If this parameter is not specified, the variable will be tied to the default data series.  
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.  
 
 
 
[[InitialValue]] - an expression, specifying the initial value and defining the variable type  
 
The value can be a numerical, string, or true/false expression; the type of the expression defines the variable type.  
 
 
 
[[DataN]] - an optional parameter; specifies the Data Number of the data series the variable is to be tied to  
 
If this parameter is not specified, the variable will be tied to the default data series.  
 
 
   
 
   
==== Example ====
+
== Example ==
Declare Avg. as a numerical variable with the initial value of 20:  
+
Declare ''Avg.'' as a numerical variable with the initial value of 20:  
 
 
<syntaxhighlight>Variable:Avg.(20);</syntaxhighlight>
 
  
Declare Max as a numerical variable, updated on every tick, with the initial value of 100:  
+
<syntaxhighlight>Variable: Avg.(20);</syntaxhighlight>
  
<syntaxhighlight>Variable:IntraBarPersist Max(100);</syntaxhighlight>
+
Declare ''Max'' as a numerical variable, updated on every tick, with the initial value of 100:
  
Declare Min_Price as a numerical variable, tied to the series with Data #2, and the initial value equal to the value of Close function:  
+
<syntaxhighlight>Variable: IntraBarPersist Max(100);</syntaxhighlight>
  
<syntaxhighlight>Variable:Min_Price(Close,Data2);</syntaxhighlight>
+
Declare ''Min_Price'' as a numerical variable, tied to the series with Data #2, and the initial value equal to the value of Close function:
  
Declare Overnight as a true/false variable with the initial value of False, and Name as a string variable with the initial value of "Intra-Day":
+
<syntaxhighlight>Variable: Min_Price(Close,Data2);</syntaxhighlight>
  
<syntaxhighlight>Variable:Overnight(False),Name("Intra-Day");</syntaxhighlight>
+
Declare ''Overnight'' as a true/false variable with the initial value of False, and Name as a string variable with the initial value of "Intra-Day":
  
 +
<syntaxhighlight>Variable: Overnight(False),Name("Intra-Day");</syntaxhighlight>
  
 
[[Category:Declaration]]
 
[[Category:Declaration]]

Revision as of 06:13, 8 April 2013

Declares one or more names as variables; specifies the initial value, variable type, update basis, and data number for each variable.

Variables can be numerical, string, or true/false.

Usage

Variable: [IntraBarPersist]VariableName1(InitialValue1[,DataN]), [IntraBarPersist] 
VariableName2(InitialValue2[,DataN]),etc.

Parameters inside the square brackets are optional

Parameters

IntraBarPersist - an optional parameter; specifies that the value of the variable is to be updated on every tick. If this parameter is not specified, the value will be updated at the close of each bar. See for more information the IntraBarPersist Wiki article.
VariableName - an expression, specifying the variable 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.
InitialValue - an expression, specifying the initial value and defining the variable type. The value can be a numerical, string, or true/false expression; the type of the expression defines the variable type.
DataN - an optional parameter; specifies the Data Number of the data series the variable is to be tied to. If this parameter is not specified, the variable will be tied to the default data series.

Example

Declare Avg. as a numerical variable with the initial value of 20:

Variable: Avg.(20);

Declare Max as a numerical variable, updated on every tick, with the initial value of 100:

Variable: IntraBarPersist Max(100);

Declare Min_Price as a numerical variable, tied to the series with Data #2, and the initial value equal to the value of Close function:

Variable: Min_Price(Close,Data2);

Declare Overnight as a true/false variable with the initial value of False, and Name as a string variable with the initial value of "Intra-Day":

Variable: Overnight(False),Name("Intra-Day");