Plot1-99 (Reserved Word)
Used to plot values (numeric, boolean or string) in a price chart or in an grid-based analysis window. Plotted values can be standard bar values (such as Close or Volume), inputs, or variable values resulting from a calculation or an expression.
PlotN(Expression[,"<PlotName>"[,ForeColor[,Default[,Width]]]]);
N is a number between 1 and 99, representing one of the ninety-nine available plots. Expression is the value to be plotted and <PlotName> is the name of the plot. ForeColor is an Easy Language color used for the plot (also referred to as PlotColor), Default (this position in the plot statement is reserved for future use), and Width is a numeric value representing the width of the plot (see EasyLanguage Widths for more information). The parameters <PlotName>, ForeColor, Default, and Width are optional.
Notes
The parameter Default currently has no effect. However, a value for the parameter is required in order to specify a width, as discussed in the example.
The foreground color and width for a plot can also be set using the setplotcolor and SetPlotWidth reserved words.
Remarks
The reserved word Plot can also be used in an assignment or condition to refer to a plotted value. When used this way, the plot name must appear in parentheses immediately following the reserved word (i.e. Plot("PlotName"). Refer to Plot (Reserved Word) for more information.
Example 1
Any one or more of the optional parameters can be omitted, as long as there are no other parameters to the right. For example, the Default and Width parameters can be excluded from a statement as follow:
Plot1(Volume, "V", Red);
But the plot name cannot be omitted if you want to specify the plot color and width. For instance, the following example generates a syntax error because the name of the plot statement is expected:
Incorrect:
Plot1(Volume, Black, Default, 2);
Correct:
Plot1(Volume, "V", Black, Default, 2);
The only required parameter for a valid Plot statement is the value to be plotted. So the following statement is valid:
Plot1(Volume);
When no plot name is specified, EasyLanguage uses Plot1, Plot2.. Plot99 as the plot names for each plot. The first plot is named Plot1, the second Plot2, and so on.
Whenever referring to the plot color or width, you can use the word Default in place of the parameter(s) to have the Plot statement use the default color and/or width selected in the Properties tab of the Format indicator dialog box.
For example, the following statement will display the volume in the default color but indicates a specific width:
Plot1(Volume, "V", Default, Default, 3);
Again, you can use the word Default for the color parameters or the width parameter.
Also, the same plot (that is, Plot1, Plot2) can be used more than once in an analysis technique; the only requirement is that you use the same plot name in both instances of the Plot statement. If no name is assigned, then the default plot name is used (that is, Plot1, Plot2).
For example, if you want to plot the net change using red when it is negative and green when it is positive, you can use the same plot number (in this case Plot1) twice, as long as the name of the plot is the same:
Value1 = Close - Close[1];
If Value1 > 0 Then
Plot1(Value1, "NetChg", Green)
Else
Plot1(Value1, "NetChg", Red);
In this example, the plot name "NetChg" must be the same in both instances of the Plot statement.
Example 2
When applying the analysis technique to a chart, you can displace the plot to the right or left. For example:
Plot1[3](Value1);
The above example calculates the plot value using the current bar but draws it on the chart 3 bars ago. Use a negative number to draw the value 3 bars ahead of the current bar.
Example 3
You can plot a text string (enclosed in double quotes) or a boolean value (true/false) to a cell in a grid-based window or on the status line of a sub-graph in a chart. The second parameter label is optional and becomes the column heading when used with a gird-based application. For example:
Plot1("Up","Upward Value", Green);
In the above example the word 'Up' is displayed in green within a grid cell or on the sub-graph status line.
Example 4 - Getting Plot Value (Refer to Plot (Reserved Word) for more information)
Once you have defined a plot using the PlotN statement, you can reference the value of the plot simply by using the reserved word Plot in a calculation or condition. In the example below, the Plot1 statement is used to plot the accumulation distribution of the volume. The value of the plot is referenced in the next statement, in order to write the alert criteria:
Plot1(AccumDist(Volume), "AccumDist") ;
If Plot("AccumDist") > Highest(Plot("AccumDist"), 20) then Alert ;
Example 5
A little known feature of the Plot statement is the ability to reference the plot value in a conditional statement by simple using the PlotN word for a specific plot. For example:
If Plot1 > Plot2 Then
SetPlotColor(1, Cyan)
Else
SetPlotColor(1, Magenta);
In the above example, the color of plot 1 is changed to either Cyan or Magenta based on whether the value Plot1 is greater than Plot2 or not.