×

Sign up and get MultiCharts free

Use its powerful simulation mode with data included out of the box. Just fill out the form and start honing your trading skills with a few clicks.

Changes - MultiCharts

Changes

Jump to navigation Jump to search

Cross

156 bytes removed, 10:02, 19 February 2012
no edit summary
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.
== Usage ==<syntaxhighlight>Above, Over, Below,Plot1 Cross Direction Plot2</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.
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:
a) The value of A was less than the value of B on the bar immediately preceding the current bar <syntaxhighlight>E1 Cross Direction E2</syntaxhighlight>
orWhere:
b) The values of A and B were equal for :'''E''' - 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 barsnumerical expression.
The plot :'''Direction''' - a required parameter which specifies the direction of A is defined as having crossed <syntaxhighlight>the cross.::[[Above]], [[Over]], [[Below</syntaxhighlight> ]] or <syntaxhighlight>[[Under</syntaxhighlight> ]] parameters are used to specify the plot direction of B if the value of A is less than the value of B and one of the following is true: cross.
== Notes ==* [[Above]] and [[Over]] are transposable and specify an upward (lesser to agreater 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 was more is greater than the value of B on and one of the bar immediately preceding the current bar, following is true:
::The value of A was less than the value of B on the bar immediately preceding the current bar, ::'''or'''::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 plot of A and B were equal for a consecutive sequence of one is defined as having crossed [[Below]] or more bars immediately preceding [[Under]] the current bar and plot of B if the value of A was more is less than the value of B on and one of the bar immediately preceding this sequence of bars. ==== Usage ====<syntaxhighlight>E1 Cross Direction E2</syntaxhighlight> orfollowing is true: <syntaxhighlight>Plot1 Cross Direction Plot2</syntaxhighlight>
Where: <syntaxhighlight>E</syntaxhighlight> - a numerical expression:The value of A was more than the value of B on the bar immediately preceding the current bar, ::'''or''' <syntaxhighlight>Direction</syntaxhighlight> - ::The values of A and B were equal for a required parameter; specifies consecutive sequence of one or more bars immediately preceding the direction current bar and the value of A was more than the value of B on the cross bar immediately preceding this sequence of bars.
==== Example ==Examples ==
Trigger an alert on the bar where the Close price crosses above 1350.00:
<syntaxhighlight>Plot1(Close);
 
If Plot1 Cross Above 1350.50 Then
Alert("Price has crossed above 1350.00");</syntaxhighlight>
To open a long position if the close crosses above the 20-period moving average:
<syntaxhighlight>
if Close cross above Average(Close, 20) then
Buy 2 contracts next bar at market;
</syntaxhighlight>
[[Category:Comparisons and Loops]]

Navigation menu