Difference between revisions of "Cross"

From MultiCharts
Jump to navigation Jump to search
(Created page with "Returns a value of <syntaxhighlight>True</syntaxhighlight> if, on the current bar, the plot of a numerical expression A crossed the plot of a numerical expression B in the spe...")
 
Line 1: Line 1:
Returns a value of <syntaxhighlight>True</syntaxhighlight> if, on the current bar, the plot of a numerical expression A crossed the plot of a numerical expression B in the specified direction.  
+
Returns a value of [[True]] if, on the current bar, the plot of a numerical expression A crossed the plot of a numerical expression B in the specified direction.  
  
<syntaxhighlight>Above, Over, Below,</syntaxhighlight> or <syntaxhighlight>Under</syntaxhighlight> parameters specify the direction of the cross; <syntaxhighlight>Above</syntaxhighlight> and <syntaxhighlight>Over</syntaxhighlight> are transposable and specify an upward (lesser to a greater value) direction, and <syntaxhighlight>Below</syntaxhighlight> and <syntaxhighlight>Under</syntaxhighlight> are transposable and specify a downward (greater to a lesser value) direction.  
+
[[Above, Over, Below,]] or [[Under]] parameters specify the direction of the cross; [[Above]] and [[Over]] are transposable and specify an upward (lesser to a greater value) direction, and [[Below]] and [[Under]] are transposable and specify a downward (greater to a lesser value) direction.  
  
The plot of A is defined as having crossed <syntaxhighlight>Above</syntaxhighlight> or <syntaxhighlight>Over</syntaxhighlight> the plot of B if the value of A is greater than the value of B and one of the following is true:  
+
The plot of A is defined as having crossed [[Above]] or [[Over]] the plot of B if the value of A is greater than the value of B and one of the following is true:  
  
 
a) The value of A was less than the value of B on the bar immediately preceding the current bar  
 
a) The value of A was less than the value of B on the bar immediately preceding the current bar  
Line 11: Line 11:
 
b) The values of A and B were equal for a consecutive sequence of one or more bars immediately preceding the current bar and the value of A was less than the value of B on the bar immediately preceding this sequence of bars.  
 
b) The values of A and B were equal for a consecutive sequence of one or more bars immediately preceding the current bar and the value of A was less than the value of B on the bar immediately preceding this sequence of bars.  
  
The plot of A is defined as having crossed <syntaxhighlight>Below</syntaxhighlight> or <syntaxhighlight>Under</syntaxhighlight> the plot of B if the value of A is less than the value of B and one of the following is true:  
+
The plot of A is defined as having crossed [[Below]] or [[Under]] the plot of B if the value of A is less than the value of B and one of the following is true:  
  
 
a) The value of A was more than the value of B on the bar immediately preceding the current bar,  
 
a) The value of A was more than the value of B on the bar immediately preceding the current bar,  
Line 24: Line 24:
 
<syntaxhighlight>Plot1 Cross Direction Plot2</syntaxhighlight>  
 
<syntaxhighlight>Plot1 Cross Direction Plot2</syntaxhighlight>  
  
Where: <syntaxhighlight>E</syntaxhighlight> - a numerical expression
+
Where: [[E]] - a numerical expression
            <syntaxhighlight>Direction</syntaxhighlight> - a required parameter; specifies the direction of the cross  
+
 
 +
[[Direction]] - a required parameter; specifies the direction of the cross  
 
   
 
   
 
==== Example ====
 
==== Example ====
Trigger an alert on the bar where the Close price crosses above 1350.00:
+
<syntaxhighlight>Trigger an alert on the bar where the Close price crosses above 1350.00:
  
<syntaxhighlight>Plot1(Close);
+
Plot1(Close);
 
If Plot1 Cross Above 1350.50 Then
 
If Plot1 Cross Above 1350.50 Then
 
Alert("Price has crossed above 1350.00");</syntaxhighlight>
 
Alert("Price has crossed above 1350.00");</syntaxhighlight>

Revision as of 12:36, 20 January 2012

Returns a value of True if, on the current bar, the plot of a numerical expression A crossed the plot of a numerical expression B in the specified direction.

Above, Over, Below, or Under parameters specify the direction of the cross; Above and Over are transposable and specify an upward (lesser to a greater value) direction, and Below and Under are transposable and specify a downward (greater to a lesser value) direction.

The plot of A is defined as having crossed Above or Over the plot of B if the value of A is greater than the value of B and one of the following is true:

a) The value of A was less than the value of B on the bar immediately preceding the current bar

or

b) The values of A and B were equal for a consecutive sequence of one or more bars immediately preceding the current bar and the value of A was less than the value of B on the bar immediately preceding this sequence of bars.

The plot of A is defined as having crossed Below or Under the plot of B if the value of A is less than the value of B and one of the following is true:

a) The value of A was more than the value of B on the bar immediately preceding the current bar,

or

b) The values of A and B were equal for a consecutive sequence of one or more bars immediately preceding the current bar and the value of A was more than the value of B on the bar immediately preceding this sequence of bars.

Usage

E1 Cross Direction E2

or:

Plot1 Cross Direction Plot2

Where: E - a numerical expression

Direction - a required parameter; specifies the direction of the cross

Example

Trigger an alert on the bar where the Close price crosses above 1350.00:

Plot1(Close);
If Plot1 Cross Above 1350.50 Then
Alert("Price has crossed above 1350.00");