name |
The name for the chart legend; must be a string constant with less than 16 characters. Different curves must have different names. If the name begins with '#', it does not appear in the chart legend. |

pos |
The bar number in a histogram (-2000..2000), determines the bar's position on the horizontal axis. All plotBar commands within a +/-0.5 range of the same bar number plot to the same bar. |

x,y |
In a histogram, x is the bar number and y is the position on the vertical axis.In a price chart, x is the
bar offset (0 = current bar), and y is the position on the left or right vertical axis. |

label |
A number printed on the horizontal axis at the given bar position, or 0 for no label. For readability, label numbers should be in the ±0.1 .. ±1000 range. |

value |
The data value to be plotted or added to the bar. Use 1 in combination with SUM for counting events in a histogram. |

data |
The data series whose recent value is plotted. |

type |
The type of the data curve in the chart; must normally not change during the plot. Either plotBar.DOT - plot colored dots. Can also be used for plotBar and plotGraph.BAND1 - for plot, plot the upper line of a band, use the color for the lines.BAND2 - for plot, plot the lower line of a band, use the color for filling the band.LINE - for plot, use a thick line. Otherwise it's a thin line. MAIN - for plot, plot this and all following curves in the main price chart. NEW - for plot, plot this and all following curves in a new extra chart (see remark below about plot order).AXIS2 - use a second y axis on the right side of the chart. LOG - use a logarithmic y scale. LBL2 - for plotBar, label only every second x axis position. AVG - for plotBar, plot the average of all values of the current x position. For plot, use the average of all sample cycles. DEV - for plotBar, plot the standard deviation of all values of the current x position. SUM - for plotBar, plot the sum of all values at the current x position. MINV - for plotBar, plot the minimum of all values at the current x position. MAXV - for plotBar, plot the maximum of all values at the current x position. NRM - for plotBar, normalize the values of all x positions to 1.LINE - for plotGraph, draw a line from the last position to the current position.END -
for plotGraph, end point of a line or polygon started with LINE. DEL - for plotGraph, delete the previous plot and start over. DOT -
draw a colored dot. The size can be determined with PlotScale.SQUARE - draw a colored square.TRIANGLE - draw a upwards pointing colored triangle. TRIANGLE2,3,4 - draw a colored triangle pointing to the left, right, or down. CROSS - draw a colored cross.CROSS2 - draw a colored diagonal cross. |

color |
The color and transparency of the data curve in the chart, in the form as described under Colors. Symbols and lines on a histogram can have different colors; on a chart all elements belonging to a certain name must have the same color. If at 0, no curve is plotted (for merely collecting data for later analyzing by plotData). Use the color function for assigning different colors to numbers. |

- Either a histogram or a chart can be plotted, but not both at the same time.
**plotBar**overrides**plot**. - For zooming in a certain date, use either StartDate and EndDate for the whole simulation, or PlotDate and PlotBars for zooming the chart only. For more pixels per chart, set up PlotScale and PlotWidth. For not plotting a chart when [Result] is clicked, set PlotWidth at 0.
- When extra charts are opened with
**NEW**, the order of**plot**calls determines in which chart the curves are plotted. The order is determined by the first**plot**call in or after the FIRSTRUN. Subsequent calls can then be in arbitrary order. When plot order matters and plots depend on**if(...)**conditions, enforce the right order in the first run f.i. with**if(is(FIRSTRUN) or ...)**. - If
**plot**is called several times with the same**name**in the same run cycle, only the last data value is plotted. If a**plot**command is not called in a run, the plotted curve will have gaps at the skipped bars. - Every plot
**name**must have the same plot**type**and**color**; there can not be different plot types or colors per name. For plotting a curve in different colors, use alternating curves with the same value and different**name**. **plotGraph**has a limit to the number of elements (lines, symbols) per**name**. Exceeding the limit causes an Error 038 message. For adding more elements to the chart, use**plotGraph**with different element names.- Any
**plot**command is linked to the current asset. When multiple assets are traded, only prices, trades, and curves linked to the asset selected with the [Asset] scrollbox are plotted; curves linked to other assets are not plotted. For plotting parameters of different assets together, store them in different variables and then plot all together without calling**asset()**inbetween. For instance, inside an asset loop you can store them in a**var**array with one element per asset, then plot all elements of the array after the asset loop. The curves are then visible on the chart when you select the last asset of the loop and click [Result]. - Price charts are not plotted in a training run. Instead parameter charts are plotted that show the information ratio and the number of winning and losing trades for each parameter.
- For removing default chart elements such as price candles or equity curves, set their Color to 0.
- Use the color function for setting color ranges.
- Trade profiles, MAE graphs, seasonal profiles, correlograms or heat maps can be plotted with the functions from the profile library.
- More plot functions and options can be implemented if required. If you have a certain plot task that can not be realized with the current functions, please ask for it on the Zorro user forum.

// Compare price distribution (red) with random distribution (blue)function run() { vars Price = series(price(0)); int num = NumRiseFall(Price,20); plotBar("Price",2*num,num,1,SUM|BARS,RED); vars Random = series(0); Random[0] = Random[1] + random(); num = NumRiseFall(Random,20); plotBar("Random",2*num+1,0,1,SUM|BARS,BLUE); }

// plotGraph testfunction run() { set(PLOTNOW);// plot green dots above the price at every 20th barif(Bar%20 == 0)

plot("Dotted",1.01*price(),DOT,GREEN);

if(Bar == 500) {// plot a single blue rectangle in the price chartplotGraph("Rectangle",0,0.99*price(),LINE,BLUE);// start pointplotGraph("Rectangle",-500,0.99*price(),LINE,BLUE);// 1st cornerplotGraph("Rectangle",-500,1.01*price(),LINE,BLUE);// 2nd cornerplotGraph("Rectangle",0,1.01*price(),LINE,BLUE);// 3rd cornerplotGraph("Rectangle",0,0.99*price(),LINE|END,BLUE);// 4th corner and end point// plot a single red dotplotGraph("Single Dot",-250,price(),DOT,RED); } }

Examples of plotting symbols can be found in the Predict script and in the profile library.// Plotting a histogram barvoid plotHistogram(string Name,var Value,var Step,int Color) { var Bin = floor(Value/Step);

plotBar(Name,Bucket,Step*Bin,1,SUM+BARS+LBL2,Color); }