|
|
Several of the Script Sections in RealTest serve to define items which are both calculated and displayed.
These sections include: Charts, Graphs, Results, Trades and Scan.
In each of these sections, the format in which to display the value of the calculated formula can be optionally specified by including a special kind of comment within the formula definition.
A format specification comment must use the squiggly-brace comment style.
If no format specification is provided, the "general" format will be used (as in Excel).
As one quick example, the NetProfit formula in Results.rts is defined as {$0} S.Equity - S.StartEquity. The $0 tells RealTest to display this stat as a whole dollar value.
You can see other examples of these codes in the section links above.
Two forms are supported within the { } block: the short-glyph form (e.g. {$0}) documented in the first table below, and the newer named-attribute form (e.g. {format: dollar, places: 0}) documented in the second. The two forms cannot be mixed in the same comment block, but the same formula may contain multiple comment blocks.
Short-Glyph Form
|
Code
|
Used In
|
Shows This
|
Digits (if present) Specify
|
|
#
|
scans, trades, charts, graphs, results
|
general-purpose numeric value
|
number of decimal places
|
|
#x
|
scans, trades, charts, graphs, results
|
integer in hexadecimal format
|
n/a
|
|
##
|
scans, trades, charts, graphs, results
|
general-purpose number without commas
|
number of decimal places
|
|
$
|
scans, trades, charts, graphs, results
|
value as currency
|
number of decimal places
|
|
%
|
scans, trades, charts, graphs, results
|
value * 100 as a percent
|
number of decimal places
|
|
-
|
with any of the above codes
|
value as above, use red if negative
|
the ABS is the number of decimal places
|
|
//
|
scans, trades, charts, graphs, results
|
value as a date string
|
n/a
|
|
`
|
scans, trades, charts, graphs, results
|
value in 32nds, as futures prices are quoted (e.g. 110'16)
|
n/a
|
|
~
|
scans, trades, charts, graphs, results
|
value as True or False
|
n/a
|
|
^
|
charts
|
show this indicator in an upper indicator pane (^ = ^1 = pane closest to price; ^2 and ^3 select additional panes stacked above)
|
optional pane number 1, 2 or 3
|
|
^
|
graphs
|
include this graph in Test Summary Reports
|
n/a
|
|
|
|
charts
|
show this indicator as a line in the volume pane (use line: Bars to draw actual bars)
|
n/a
|
|
|
|
graphs
|
draw bars rather than a line
|
base value (x-axis) for bar chart
|
|
|
|
results
|
show this item in the status bar
|
n/a
|
|
"name"
|
any
|
override the default item name
|
n/a
|
An output format specification comment can be inserted anywhere within the item's formula.
Any unrecognized character in the comment cancels its interpretation as an output format.
Named-Attribute Form
An output format comment may alternatively contain a comma-separated list of name: value attributes, e.g. {format: dollar, places: 0, color: orange}. The script editor pops a context-aware autocomplete list when the cursor is inside the { } block, showing only the attributes that apply in the current script section.
|
Attribute
|
Alias
|
Used In
|
Value
|
|
format
|
unit
|
scans, trades, charts, graphs, results
|
one of: number, plain, dollar, percent, fraction, date, bool, hex
|
|
places
|
decimals
|
scans, trades, charts, graphs, results
|
integer number of decimal places
|
|
negred
|
–
|
scans, trades, charts, graphs, results
|
1 or 0 – show negative values in red
|
|
name
|
label
|
scans, trades, charts, graphs, results
|
quoted display label that overrides the item name
|
|
color
|
–
|
charts (per indicator); strategy / template / benchmark / statsgroup / combined section headers
|
named color, #RRGGBB, RGB(r,g,b), #RRGGBBAA, or ARGB(a,r,g,b) – overrides the default palette color; the alpha forms make bar fills partially transparent (see below)
|
|
pane
|
–
|
charts
|
one of: price, ind1, ind2, ind3, volume – selects which chart pane to draw the indicator in
|
|
line
|
linetype
|
charts, graphs
|
one of: Line, Bars, Dashed, Dotted (graphs treat Dashed/Dotted as Line)
|
|
width
|
–
|
charts
|
integer 1 to 20 – pen width in pixels for this line, overriding the Line Width chart option (with line: Bars, sets each bar’s half-width)
|
|
base
|
–
|
charts, graphs (with line: Bars)
|
baseline (x-axis) value for histogram-style rendering
|
|
hat
|
–
|
charts, graphs
|
1 or 0 – equivalent to the legacy ^ glyph (route to indicator pane in charts; include in Test Summary Reports in graphs)
|
|
factor
|
–
|
trades
|
1 or 0 – marks the item as a Factor Scan factor and evaluates it as of the trade’s setup bar rather than its exit bar
|
The 1/0 attributes (negred, hat, factor) may also be given as a bare word meaning 1: {factor} is the same as {factor: 1}, and {factor, format: percent, places: 2} combines it with other attributes.
Color Values
The color: attribute accepts five value forms:
1.a named color: black, white, red, darkred, green, darkgreen, blue, darkblue, cyan, magenta, yellow, orange, purple, brown, gray, darkgray, lightgray
2.an HTML-style hex code: #RRGGBB (e.g. #FF8800)
3.an RGB triple: RGB(r, g, b) with each component 0–255
4.a hex code with an alpha (opacity) byte: #RRGGBBAA (e.g. #FF880080 for half-transparent orange)
5.an ARGB quad: ARGB(a, r, g, b) with the alpha (opacity) component first
The alpha component is an opacity from 1 (nearly invisible) to 255 (fully opaque); omitting it, or giving 0 or 255, draws the color fully opaque. Alpha affects only fills: chart indicators drawn with line: bars and the bars of bar-style graphs. Lines and text always draw opaque. Partially transparent fills let overlapping bars and the chart grid show through, which is especially useful for multi-strategy drawdown graphs. Bar graphs can also be given a default transparency without editing any color specs – see the Bar Graph Opacity setting in the graph options dialog.
On the Strategy, Template, Benchmark, StatsGroup, and Combined section header lines, a {color: ...} comment overrides the color used for that strategy in graphs, result columns, trade overlays on charts, and combined-strategy reports.
|
|