Difference between revisions of "Above"
Jump to navigation
Jump to search
m (Reverted edits by 176.8.90.7 (talk) to last revision by Admin) |
|||
Line 1: | Line 1: | ||
− | Used in combination with [[Cross]] to specify the direction of the cross. Above specifies an upward (lesser to a greater value) direction. | + | Used in combination with [[Cross]] to specify the direction of the cross. '''Above''' specifies an upward (lesser to a greater value) direction. |
+ | |||
+ | == Usage == | ||
+ | <syntaxhighlight>Plot1 Cross Above Plot2</syntaxhighlight> | ||
+ | |||
+ | or: | ||
+ | |||
+ | <syntaxhighlight>E1 Cross Above E2</syntaxhighlight> | ||
− | + | Where: | |
− | a | + | :'''E''' - a numerical expression. |
+ | == Notes == | ||
+ | The plot of A is defined as having crossed Above the plot of B if the value of A is greater than the value of B and one of the following is true: | ||
+ | *The value of A was less than the value of B on the bar immediately preceding the current bar | ||
or | 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. | |
− | |||
For more information see [[Cross]]. | For more information see [[Cross]]. | ||
− | == | + | == Examples == |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
Trigger an alert on the bar where the Close price crosses above 1350.00: | Trigger an alert on the bar where the Close price crosses above 1350.00: | ||
<syntaxhighlight>Plot1(Close); | <syntaxhighlight>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> |
+ | |||
+ | To open a long position if a 5-period moving average crosses above a 10-period moving average: | ||
+ | <syntaxhighlight> | ||
+ | if (Average(Close, 5) cross above Average(Close, 10)) then | ||
+ | Buy ("EL") 1 contracts next bar at market; | ||
+ | </syntaxhighlight> | ||
[[Category:Comparisons and Loops]] | [[Category:Comparisons and Loops]] |
Latest revision as of 09:54, 19 February 2012
Used in combination with Cross to specify the direction of the cross. Above specifies an upward (lesser to a greater value) direction.
Usage
Plot1 Cross Above Plot2
or:
E1 Cross Above E2
Where:
- E - a numerical expression.
Notes
The plot of A is defined as having crossed Above the plot of B if the value of A is greater than the value of B and one of the 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.
For more information see Cross.
Examples
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");
To open a long position if a 5-period moving average crosses above a 10-period moving average:
if (Average(Close, 5) cross above Average(Close, 10)) then
Buy ("EL") 1 contracts next bar at market;