Plot
- plot indicator graph

Exploration / Indicators
(AmiBroker 3.80)


SYNTAX Plot( array, name, color/barcolor, style = styleLine, minvalue = {empty}, maxvalue = {empty}, XShift = 0, Zorder = 0, width = 1 )
RETURNS NUMBER
FUNCTION Plots the graph using array data. Parameters:
  • array - data array to be plotted
  • name - defines graph name used for displaying values in a title bar.
  • color - defines plot color that could be static (if third argument is a number) or dynamic (when third argument is an array). Color indexes are related to the current palette (see Preferences/Color)
  • style is a combination of one or more of following values:

    styleLine = 1 - normal (line) chart (default)
    styleHistogram = 2 - histogram chart
    styleThick =4 - fat (thick)
    styleDots = 8 - include dots
    styleNoLine = 16 - no line
    styleDashed = 32 - dashed line style
    styleCandle = 64 - candlestick chart
    styleBar = 128 - traditional bar chart
    styleNoDraw = 256 - no draw (perform axis scaling only)
    styleStaircase = 512 - staircase (square) chart
    styleSwingDots = 1024 - middle dots for staircase chart
    styleNoRescale = 2048 - no rescale
    styleNoLabel = 4096 - no value label
    stylePointAndFigure = 8192 - point and figure
    (new in 4.20):
    styleArea = 16384 - area chart (extra wide histogram)
    styleOwnScale = 32768 - plot is using independent scaling
    styleLeftAxisScale = 65536 - plot is using left axis scale (independent from right axis)
    styleNoTitle - do not display values of this plot in the chart title
    styleCloud - cloud style (area between high and low arrays) - to be used with PlotOHLC function
    styleClipMinMax - clip (do not paint) area between min and max levels - note this style is incompatible with printers and WMF (metafiles).
    styleGradient - (new in 5.60) - gradient area chart. Upper gradient color is specified by color parameter in Plot() function, bottom gradient color is either background color or can be defined using SetGradientFill function. styleGradient can be combined with styleLine
  • minvalue and maxvalue - (used by styleOwnScale plots ONLY) define plot minimum and maximum values (lower and upper boundary for Y axis)
  • XShift - allows to visually shift the chart past the last bar.
  • ZOrder - defines the Z-axis position of given plot. The default is zero. Zorder = 0 means also where the "grid" is located. So if you want to plot BEHIND the grid you need to specify negative zorder parameter.Plots are drawn in the following order:
    • zorder parameter takes precedence over the order of calling Plot() functions, so if z-order is set, it determines plotting order. See http://www.amibroker.com/gifs/zorder.gif
    • If multiple plots use the same z-order parameter they are plotted in reverse call order (ones that appear last in the code are plotted first). This rule can be changed by already existing switch graphzorder = 1 which, when specified, reverses this behaviour (so plots are drawn in call order).
      Please note the above applies to each zorder "layer" separately (so within same zorder "layer" reverse call rule applies) This may sound complicated but is required for backward compatibility.
  • width - defines pixel or percent width of given plot. The default is 1 pixel. Positive values specify PIXEL width, negative values specify width in percent of current bar width. So for example -20 will give you dynamic width that is 20% of bar width. Example: Plot( C, "Close", colorBlack, styleBar, Null, Null, 0, 1, -20 /* line width as percent of bar */ );
EXAMPLE // Example 20-bar Moving average shifted 10 bars into the future past the last bar:
Plot(Close,"Close",colorBlack,styleCandle);
Plot(MA(Close,20), "Shifted MA", colorRed, styleLine, Null, Null, 10 );
// Note that shift occurs during plotting AND does NOT affect source array
SEE ALSO PLOTFOREIGN() function , PLOTGRID() function , PlotText() function , PLOTSHAPES() function , PLOTOHLC() function

References:

The Plot function is used in the following formulas in AFL on-line library:

More information:

See updated/extended version on-line.