Plotting
graph
Creates a new plotting canvas: graph() for defaults, graph(w, h) for a size in pixels with the range fitted to what is plotted, graph(xmin, xmax, ymin, ymax) sized automatically from the data range, or graph(w, h, xmin, xmax, ymin, ymax) with explicit pixel dimensions.
xmin (number) -- optional
xmax (number) -- optional
ymin (number) -- optional
ymax (number) -- optional
title
Sets a graph's title.
g (graph) --
text (string) --
xticks
Sets a graph's x-axis tick spacing (the grid follows it). With "pi" as a third argument the axis's numbers are written as multiples of pi: xticks(g, pi/2, "pi") marks π/2, π, 3π/2, ... (a tick that is no such multiple keeps its number).
g (graph) --
spacing (number) -- positive
unit (string) -- optional "pi": the numbers as multiples of pi
yticks
Sets a graph's y-axis tick spacing (the grid follows it). With "pi" as a third argument the axis's numbers are written as multiples of pi: yticks(g, pi/2, "pi") marks π/2, π, 3π/2, ... (a tick that is no such multiple keeps its number).
g (graph) --
spacing (number) -- positive
unit (string) -- optional "pi": the numbers as multiples of pi
plot
Adds a line series to a graph: plot(g, ys) auto-indexes x = 1..n, plot(g, xs, ys) uses an explicit x array, or plot(g, "expr", min, max) samples an expression in x over a range. When xs is a list of names, plot(g, ["Jan", "Feb", "Mar"], ys), the points stand at 1, 2, ... and the names are written on the x axis in place of numbers, as bar() does. Optional trailing color/linetype/label style args.
g (graph) --
data (number[] | string) -- an array, two arrays (the first may be a list of names), or a quoted expression in x
style (string) -- optional color, linetype, label
axes
Shows or hides a graph's axes.
g (graph) --
show (boolean) -- true or false
grid
Shows or hides a graph's grid lines.
g (graph) --
show (boolean) -- true or false
aspect
Forces a graph's x and y axes to use equal pixels-per-unit scaling, so geometric shapes aren't visually distorted.
g (graph) --
equal (boolean) -- true or false
tracePlot Apas Cloud
Makes the curves of a graph draw themselves in: each line traces from the start of its range to the end (x for plot, t for plotParametric, theta for plotPolar) over the given number of seconds, with a dot at the moving end. Leave the seconds out for 4; at most 60; 0 turns it off. On a page the reader can click the picture to play it again. SVG, PNG and PDF output show the finished curves. One-line form: tracePlot(g, "expr", min, max, seconds, color, linetype, label) plots the function and traces it in one call; tracePolar and traceParametric do the same for the other two kinds of curve. All curves of one graph draw together, over the time given last.
g (graph) --
seconds (number) -- how long the drawing takes; optional, 4 if left out
tracePolar Apas Cloud
plotPolar and tracePlot in one line: adds the polar curve r(theta) to the graph and makes the graph's curves draw themselves in over the given number of seconds (4 if left out, at most 60). The optional color, line type and label follow the seconds, as in plotPolar.
g (graph) --
rExpr (string) -- r as an expression in theta
thetaMin (number) --
thetaMax (number) --
seconds (number) -- how long the drawing takes; optional
traceParametric Apas Cloud
plotParametric and tracePlot in one line: adds the curve (x(t), y(t)) to the graph and makes the graph's curves draw themselves in over the given number of seconds (4 if left out, at most 60). The optional color, line type and label follow the seconds, as in plotParametric.
g (graph) --
xExpr (string) -- x as an expression in t
yExpr (string) -- y as an expression in t
tmin (number) --
tmax (number) --
seconds (number) -- how long the drawing takes; optional
plotParametric
Adds a parametric curve series (x(t), y(t)) to a graph, sampled over an explicit t range.
g (graph) --
xExpr (string) -- expression in t
yExpr (string) -- expression in t
tmin (number) --
tmax (number) --
plotPolar
Adds a polar curve series r(theta) to a graph, sampled over an explicit theta range.
g (graph) --
rExpr (string) -- expression in theta
thetaMin (number) --
thetaMax (number) --
scatter
Adds a scatter (points only, no line) series to a graph: scatter(g, ys) auto-indexes x, scatter(g, xs, ys) uses an explicit x array; then a colour and a name for the legend. The name may be a list, one for each point, scatter(g, [2, 3], [4, 9], "navy", ["P", "Q"]): each is written beside its point, above and to the right, and none goes in the legend (R98). pointSize(g, px) makes the points bigger.
g (graph) --
xs (number[]) -- optional explicit x array
ys (number[]) --
color (string) -- optional colour
name (string or text[]) -- optional: a name for the legend, or a list of names, one beside each point
bar
Adds a bar series to a graph: bar(g, ys) auto-indexes x, bar(g, xs, ys) uses an explicit x array. When xs is a list of names, bar(g, ["Mon", "Tue"], ys), each bar is named on the x axis and drawn as a thin bar with a rounded end. Several bar series on one graph are told apart by colour and label; stacked(g) stands them on one another and grouped(g) side by side.
g (graph) --
xs (number[] or text[]) -- optional: the x of each bar, or a name for each bar
ys (number[]) --
stacked
Stands the bar series of a graph on one another instead of one in front of the other: at each x the first series is at the bottom and each later one starts where the one before it ends. Values above zero stack upwards and values below zero downwards. stacked(g, false) turns it off again.
g (graph) --
on (boolean) -- optional, true when left out
grouped
Stands the bar series of a graph side by side instead of one in front of the other: at each x the series share its slot, the first on the left, each told apart by colour and label (a double bar chart). grouped(g, false) turns it off again; grouped(g) and stacked(g) exclude each other.
g (graph) --
on (boolean) -- optional, true when left out
legend
Moves a graph's legend box to another corner of the plot, so that it does not sit on the data: legend(g, "top-left"), "top-right" (where it stands unless moved), "bottom-left", "bottom-right" or "bottom" (the middle of the bottom edge); legend(g, "outside") writes it in one row under the plot, clear of the last candles; legend(g, "none") leaves it out.
g (graph) --
place (string) -- "top-left", "top-right", "bottom-left", "bottom-right", "bottom", "outside" or "none"
hline
A level line across the whole width of a graph: hline(g, y[, colour[, label]]), dashed, its name written at the right end (a pivot, a support, RSI's 30 and 70). The y range widens to show it. It goes to the current pane (see pane()).
g (graph) --
y (number) -- the level
colour (text) -- a CSS colour name or #rrggbb; the axis colour when left out
label (text) -- the name at the right end
drawLine
A trendline drawn on a chart: drawLine(g, name, x1, y1, x2, y2[, colour]), the segment through two price-time points, its name at its end. A drawn object, not a plotted series: in the browser the reader can select it, drag it by its ends or its body and delete it, and the page reads the whole set back as this spec (GraphPlotter.getDrawings). The same name again replaces the earlier object. x is in the axis's unit, the day number the bars' xs carry (dateTimeDays). The SVG draws the same line. It goes to the current pane (see pane()).
g (graph) --
name (text) -- the object's name, the page's handle for it
x1 (number) -- the first point's time (a day number)
y1 (number) -- the first point's price
x2 (number) -- the second point's time
y2 (number) -- the second point's price
colour (text) -- a CSS colour name or #rrggbb; the ink colour when left out
drawLevel
A horizontal level drawn on a chart: drawLevel(g, name, y[, colour]), solid across the whole width with its name at the right end. A drawn object as drawLine()'s: the reader can select it, drag it up and down and delete it in the browser, and getDrawings returns it with the rest; hline() is the script's own fixed level, which the reader cannot move. The same name again replaces the earlier object. It goes to the current pane (see pane()).
g (graph) --
name (text) -- the object's name
y (number) -- the level
colour (text) -- a CSS colour name or #rrggbb; the ink colour when left out
drawRect
A rectangle drawn on a chart: drawRect(g, name, x1, y1, x2, y2[, colour]), the box with those two corners (a range, a consolidation), lightly filled, its name inside the top left corner. A drawn object as drawLine()'s: movable by its corners or its body and deletable in the browser, returned by getDrawings, the same in the SVG. The same name again replaces the earlier object.
g (graph) --
name (text) -- the object's name
x1 (number) -- the first corner's time (a day number)
y1 (number) -- the first corner's price
x2 (number) -- the opposite corner's time
y2 (number) -- the opposite corner's price
colour (text) -- a CSS colour name or #rrggbb; the ink colour when left out
drawRay
A ray drawn on a chart: drawRay(g, name, x1, y1, x2, y2[, colour]), the line from the first point through the second and onward to the edge of the plot (a trendline that goes on). A drawn object as drawLine()'s: movable by its points or its body and deletable in the browser, returned by getDrawings, the same in the SVG.
g (graph) --
name (text) -- the object's name
x1 (number) -- the first point's time (a day number)
y1 (number) -- the first point's price
x2 (number) -- the second point's time
y2 (number) -- the second point's price
colour (text) -- a CSS colour name or #rrggbb; the ink colour when left out
drawFib
A Fibonacci retracement drawn on a chart: drawFib(g, name, x1, y1, x2, y2[, colour]), the move from the first point to the second (dashed) with the levels at 0, 23.6, 38.2, 50, 61.8 and 100 percent of the way back from its end, each a line between the two times labelled with its share and its price. A drawn object as drawLine()'s: movable by its points or its body and deletable in the browser, returned by getDrawings, the same in the SVG.
g (graph) --
name (text) -- the object's name
x1 (number) -- the swing's start time (a day number)
y1 (number) -- the swing's start price
x2 (number) -- the swing's end time
y2 (number) -- the swing's end price
colour (text) -- a CSS colour name or #rrggbb; the ink colour when left out
drawText
Words at a point of a chart: drawText(g, name, x, y, "words"[, colour]), the words written to the right of the point with a small mark at it (a label on a level, a note on a bar). A drawn object as drawLine()'s: movable and deletable in the browser, returned by getDrawings with its text, the same in the SVG. The same name again replaces the earlier object. In the browser the measure tool's reading (the price change, the percent and the bar count of a drag) can be pinned as a rectangle carrying that text.
g (graph) --
name (text) -- the object's name
x (number) -- the point's time (a day number)
y (number) -- the point's price
words (text) -- the words written
colour (text) -- a CSS colour name or #rrggbb; the ink colour when left out
hideDrawing
Keeps a drawing but leaves it out of the picture: hideDrawing(g, name), the name one given to drawLine(), drawLevel(), drawRect(), drawRay(), drawFib() or drawText(). The browser's object list shows it with its eye closed and can show it again; the SVG leaves it out. The kept format of getDrawings and setDrawings carries the state, so a page's set comes back as it was.
g (graph) --
name (text) -- a drawing's name
lockDrawing
Keeps a drawing from being moved or deleted by the pointer in the browser: lockDrawing(g, name). It is drawn as before; the object list shows it locked and can unlock it. The kept format of getDrawings and setDrawings carries the state.
g (graph) --
name (text) -- a drawing's name
hide
Leaves a series out of the picture by the name its legend shows: hide(g, "EMA 20"); its legend entry stays, dimmed, and in the browser a click on any legend entry hides or shows its series. Series are named by the label argument of plot(), candlestick(), bar() and area().
g (graph) --
name (text) -- the series' label
show
Draws a hidden series again: show(g, "EMA 20").
g (graph) --
name (text) -- the series' label
remove
Takes a series off the graph for good: remove(g, "EMA 20"); its legend entry goes too.
g (graph) --
name (text) -- the series' label
pane
Opens an indicator's own panel under the price chart, sharing the x axis: pane(g, "rsi", 0.3) and every plot(), bar(), candlestick() or hline() that follows goes there; the height is its share of the main pane's (0.3 unless said); pane(g, "main") returns to the main pane. In the browser the panes share the crosshair (the bar under the pointer, its time and each pane's values), the wheel zoom, the drag and the legend's clicks.
g (graph) --
name (text) -- the pane's name, written in its corner; "main" is the main pane
height (number) -- its share of the main pane's height, 0.3 unless said
axisTitles
Writes what each axis measures: the x axis's title under the plot, the y axis's up the left side, each with its unit. "" leaves that axis without one. The plot is made smaller to give them room; a pie has no axes and shows neither. xlabel(g, x) and ylabel(g, y) set one at a time.
g (graph) --
x (string) -- the x axis's title, "" for none
y (string) -- the y axis's title, "" for none
xlabel
Names the x axis, under the plot: what it measures, with its unit (R95). The same as axisTitles(g, x, "") for the x title alone; ylabel(g, y) names the y axis.
g (graph) --
x (string) -- the x axis's title
ylabel
Names the y axis, written upwards at the left edge (R95). The same as axisTitles(g, "", y) for the y title alone; xlabel(g, x) names the x axis.
g (graph) --
y (string) -- the y axis's title
pointSize
Sets the radius in pixels, 1 to 30, of a graph's markers: scatter()'s points and plot()'s markers (R98). Unset they are 3 px, too small to read on the board of a film; bubble()'s own sizes are not changed. In the browser, in --svg and in LaTeX output.
g (graph) --
px (number) -- the radius in pixels, 1 to 30
pointLabel
Writes a name beside the point (x, y) of a graph: pointLabel(g, 2, 4, "P (2, 4)") stands it above and to the right; a fifth argument says where, "above-right", "above-left", "below-right", "below-left", "above", "below", "left" or "right" (R98). The name is a marker's radius and 4 px away from the point. It draws no marker: scatter() the point too, or give scatter() a list of names.
g (graph) --
x (number) --
y (number) --
text (string) -- the name
place (string) -- optional: where the name stands from the point, "above-right" if not said
pie
Draws values as parts of a whole: pie(g, names, values) gives one slice for each value, starting at twelve o'clock and going clockwise, with each name, value and share listed beside it. A fourth argument between 0 and 1 leaves a hole of that part of the radius, which makes a ring. A list of colours, one for each slice, may be given last. The values must be zero or more, with at least one above zero.
g (graph) --
names (text[]) -- a name for each slice
values (number[]) -- the size of each slice
hole (number) -- optional, 0 up to but not 1
colors (text[]) -- optional, a colour for each slice
area
Adds a filled-area line series to a graph, filled to y = 0; with "above", "below", "left" or "right" as the last argument it is filled to that edge of the graph's frame instead (see shade() for a half-plane).
g (graph) --
xs (number[]) --
ys (number[]) --
style (string) -- optional color, line type, label
to (string) -- optional "above", "below", "left" or "right": fill to that edge of the frame
shade
Shades a half-plane, as an inequality is graphed: the boundary y = rule drawn across the graph's x range and the side above or below it filled to the frame. shade(g, "x = 3", "left" or "right") is a vertical boundary. Give the line type "dashed" for a strict inequality (< or >). The graph needs its range: graph(xmin, xmax, ymin, ymax) or graph(w, h, xmin, xmax, ymin, ymax).
g (graph) --
rule (string) -- the boundary in x ("2*x + 1" or "y = 2*x + 1"), or "x = c"
side (string) -- "above" or "below" ("left" or "right" for x = c)
style (string) -- optional color, line type, label
riemann
Draws the rectangles (or trapezoids) of a Riemann sum on a graph, with the points whose heights are used marked: riemann(g, "f", a, b, n, method) for n equal parts of [a, b], or riemann(g, xs, ys, method) for a table (parts of any width; a midpoint sum of a table takes [x0, x2], [x2, x4], ... at heights y1, y3, ..., so an odd number of points). The method is "left" (the default), "right", "midpoint" or "trapezoid". riemannSum gives the value.
g (graph) --
f (string) -- the function of x in quotes, e.g. "x^2" (or a list xs for a table)
a (number) -- left end (or the list ys for a table)
b (number) -- right end (not for a table)
n (number) -- the number of equal parts, 1 to 500 (not for a table)
method (string) -- optional: "left", "right", "midpoint" or "trapezoid"
color (string) -- optional: the colour
bubble
Adds a bubble series to a graph -- a scatter plot where a third array sets each point's marker size.
g (graph) --
xs (number[]) --
ys (number[]) --
sizes (number[]) --
histogram
Bins raw data into equal-width buckets and adds it to a graph as a bar series. With a list of interval ends instead of a count, histogram(g, data, [0, 10, 20, 30]), the intervals are [0, 10), [10, 20) and [20, 30] (the last takes its right end): the bars touch, each as wide as its interval, and the y axis starts at 0. A colour and a label may follow either form.
g (graph) --
data (number[]) -- raw values to bin
numBins (number) -- optional, defaults to 10; or a list of interval ends, rising
dotPlot
Draws a dot plot of a list of values: one dot for each value, stacked over it, so the height of a column is how many times the value comes. The y axis counts in ones from 0 unless the graph set its own range.
g (graph) --
data (number[]) -- the values
color (string) -- optional
label (string) -- optional, for the legend
candlestick
Adds a candlestick (OHLC) series to a graph, typically indexed by date(). Given times of a day (dateTimeDays values) over a span under three days, the axis is labelled HH:MM and the closed hours and nights take no room; whole days (date values) keep the date axis. After the five arrays come the label and the style, in either order: the style is "candle" (filled bodies, as without), "hollow" (an up bar's body an outline), "ohlc" (bars with the open ticked to the left and the close to the right), "line" (the closes joined) "area" (the closes joined and filled under) or "heikin-ashi" (each bar's close the mean of its open, high, low and close, its open the mean of the bar before's averaged open and close, drawn as candles; the bars kept are the ones given), "renko" or "point-figure" (bricks or columns from the closes on a bar-count axis, with the box and reversal of chartStyle() or the defaults, one percent and three boxes); see chartStyle().
g (graph) --
xs (number[]) -- typically date() values
opens (number[]) --
highs (number[]) --
lows (number[]) --
closes (number[]) --
label (text) -- the name in the legend; optional
style (text) -- "candle", "hollow", "ohlc", "line", "area", "heikin-ashi", "renko" or "point-figure"; optional
chartStyle
How every candle series of a graph is drawn, those added after too: chartStyle(g, "candle") filled bodies on wicks (as without), "hollow" an up bar's body an outline and a down bar's filled, "ohlc" bars with the open ticked to the left and the close to the right, "line" the closes joined, "area" the closes joined and filled under, "heikin-ashi" the averaged bars as candles (each close the mean of the bar's open, high, low and close, each open the mean of the bar before's averaged open and close; the high and low take them in). chartStyle(g, "renko"[, box]) draws bricks from the closes: a brick is laid up when the close reaches the top of the last brick plus the box, down when it reaches the bottom less the box (a reversal takes two boxes). chartStyle(g, "point-figure"[, box[, reversal]]) draws columns of X boxes (rising) and O boxes (falling): a close a box further extends the column, a close `reversal` boxes against it starts a new column. The box is a size in points, or a share of the first close when under one (0.01 is one percent, the default); the reversal is a count of boxes (3 the default). Both stand on a bar-count axis; the overlays and the panes, which live on the time axis, are left out of that drawing, the levels kept. The bars kept in the graph stay as given, so the crosshair reads the true open, high, low and close. In the browser a page control switches the drawing the same way (GraphPlotter.setChartStyle(canvas, style)).
g (graph) --
style (text) -- "candle", "hollow", "ohlc", "line", "area", "heikin-ashi", "renko" or "point-figure"
box (number) -- renko and point-figure: the box in points, or a share of the first close when under one; 0.01 when left out
reversal (number) -- point-figure: the boxes a close must move against the column to start a new one; 3 when left out
dateAxis
Says that a graph's x values are dates (date() values, days since 1970-01-01): the axis is ticked by the calendar, the first of a year over more than three years, the first of a month over more than 90 days, else days, and the browser's crosshair reads the date. For a NAV history, rolling returns or any series over dates; candlestick() sets it by itself.
logScale
Switches a graph's x, y, or both axes to a logarithmic scale; bar charts included. A log axis cannot start at 0: a range given from 0 (or below) starts under the smallest positive value plotted. On a graph(xmin, xmax, ymin, ymax) the log side takes the default length (600 px across, 400 up) instead of the unit-based size.
g (graph) --
axis (string) -- "x", "y", or "both"
chartGroup
The chart joins a link group of the browser page: every chart of the name on the page shares the crosshair (the bar under the pointer in one is marked in the others at the same time), the visible range (a zoom or a pan in one moves the others) and the symbol (a symbol the page sets on one it is told to set on the others); an unlinked chart is left alone, and each chart keeps its own panes and drawings. chartGroup(g, "") leaves the group. The engine's own picture (SVG, TikZ) shows the chart alone.
g (graph) --
name (text) -- the group's name, the same on every chart to link
layoutOf
The chart's setup as a record, no data: kind (candle, hollow, ohlc, line, area, heikin-ashi, renko, point-figure), scale (regular, log, percent), inverted, legend, group, title, panes (the pane names), series and candles (the labels), drawings (the names), and text, the whole layout as JSON, which is how the record shows too. The JSON ({"layout": 1, ...}) carries each series with its colour, line type, pane, axis, hidden and fill and with the indicator and params its label names ("EMA 20" gives EMA and [20], "BB 20 2" gives BB and [20, 2]; a plain label such as "Volume" has no params; a label starting with a number gives null), the levels and the drawings, never the bars or the values. A page keeps the text (a script shows it with {{L.text}} in an .apc, or the page reads it from the browser plotter's getLayout) and gives it back with applyLayout; getLayout and setLayout in the browser keep the same text, so one kept layout serves the canvas and the engine's SVG alike.
applyLayout
Reads a layout (the text layoutOf(g).text or the browser's getLayout gave, or layoutOf's record) onto the graph: the kind, the scale, the legend, the group and the title; the heights of the panes it names that the graph has; the look of each series and candle series found by its label (colour, line type, pane, axis, hidden, fill; a label the graph has not is passed over, since the page re-runs its script with that indicator); and the levels and the drawings, which replace the graph's. The data is the graph's own: a layout carries none. An empty text changes nothing, so applyLayout(g, param("layout", "")) is safe before the page has kept anything; a text that is not a layout is refused with the words: a layout is the text layoutOf(g).text or the browser's getLayout gave (JSON with "layout":1), or layoutOf's record. This is how a page's kept chart reaches the engine: the page passes the text under the name layout (the browser plotter's exportSvg does so by itself) and the engine's SVG shows the chart as it stands in the browser.
g (graph) --
layout (text) -- the layout text, or layoutOf's record
yScale
The y axis's scale: yScale(g, "log") as logScale(g, "y"); "percent" rebases every series of the main pane on its own first value and labels the axis in percent (a long index history, or two symbols compared on one scale); "inverted" turns the scale in use upside down (the axis runs down, as a yield or a rank is read); "regular" puts everything back. The browser's crosshair reads in the scale in use. The values kept in the graph stay as given; a level (hline) and a drawing are rebased on the first series' base. Indicator panes keep their own plain scale.
g (graph) --
scale (text) -- "log", "percent", "regular" or "inverted"
yAxis
A second y scale: yAxis(g, name, "left") puts the series of that name (a candle series too) on a left-hand axis with its own range, its numbers at the left and the main scale's at the right edge, so an index and India VIX, or a price and its open interest, share one chart; "right" puts it back on the main scale. The browser's crosshair reads both scales. The name is the label plot() or candlestick() was given.
g (graph) --
name (text) -- the series' label
side (text) -- "left" or "right"
showVolumeProfile
The volume profile of the chart's candles drawn as bars at the right of the main pane: the volume traded at each price row between the lowest low and the highest high, the value area (70 percent of the volume around the point of control) darker, the point of control a line with its price; the browser recomputes it for the visible bars on a zoom. showVolumeProfile(g, volumes[, rows[, width]]): the volumes go with the bars by index (a candlestick carries none), 24 rows and a fifth of the plot's width unless said; [] takes it off.
g (graph) --
volumes (number[]) -- one a bar, as long as the candlestick's lists
rows (number) -- price rows, 24
width (number) -- the longest row's share of the plot's width, 0.2
hlines
The price levels a finance record carries, each drawn as an hline in the current pane with its name: hlines(g, oiWalls(strikes, callOi, putOi, spot)) the call and put walls with their open interest (red and green), hlines(g, pivotPoints(h, l, c)) P, R1 to R3 and S1 to S3, hlines(g, gex(...)) the gamma flip, hlines(g, volumeProfile(...)) the point of control and the value area, hlines(g, fibLevels(low, high)) the retracements; any other record its number fields by name, and a map {"VWAP": 24080, "Open": 24050} its named numbers. A colour given is every level's.
g (graph) --
record (record) -- the finance record, any record of numbers, or a map of named numbers
colour (text) -- one colour for all; each kind's own when left out
alertOn
A condition the chart carries, for the browser (GraphPlotter.checkAlerts) or checkAlerts(g) to say on which bars it fired: alertOn(g, name, subject, condition[, value]). The subject is "price" (the first candle series' closes), a plot() or candlestick() label (compared with the value), or a drawing's name from drawLevel(), drawLine(), drawRay() or drawRect() (the price against the drawing's level at each bar, so no value). The condition is "crosses-above", "crosses-below", "greater" or "less". The same name again restates the alert. A value alert shows as a dotted line with its name; nothing watches live prices or sends word, that is the page's and the server's.
g (graph) --
name (text) -- the alert's handle for the page
subject (text) -- "price", a series or candle label, or a drawing's name
condition (text) -- "crosses-above", "crosses-below", "greater" or "less"
value (number) -- the level compared with; left out for a drawing
checkAlerts
The alerts that fired on the chart's own bars, as a record of lists: name, index (the bar's, from 0), time (the bar's x), value (the subject's there), level (the value, or the drawing's level at that bar), condition, and count. A crossing fires at the bar it happens on; "greater" and "less" at the bar the state is entered on, the first bar counting. The browser's GraphPlotter.checkAlerts gives the same on the same bars.
eventMark
A flag on the time axis for a day or a time the page knows of (expiry, an RBI day, a result, a corporate action): eventMark(g, time, "label"[, colour]) or, for several, eventMark(g, times, labels[, colour]). The time is in the axis's unit, a day number from dateTimeDays(...) as the bars' xs are. In the browser the label shows in the crosshair reading at that bar; the SVG writes it beside the flag.
g (graph) --
time (number) -- the time in the axis's unit, or a list of times
label (text) -- the event's words, or a list as long as the times
colour (text) -- the flag's colour; orange when left out
showPayoff
The option strategy payoff of strategyPayoff drawn on a graph: the profit at expiry as a line with its profit side filled green and its loss side red (the fills end exactly where the line crosses zero), today's Black-Scholes curve dashed when the payoff has one, the break-evens as markers on the zero line with their prices in the legend, the spot (the payoff's, or the one given) as a dotted vertical line, a zero level, and the axes fitted to the spots and the profits with room above and below; the axis titles "Spot at expiry" and "Profit" unless the script set its own.
g (graph) --
payoff (record) -- the record strategyPayoff returns
spot (number) -- the spot to mark; the payoff's own when left out