|
Category
Settings or Scan Settings or Order Settings
Description
Path of a folder in which to automatically save a chart image for every row of a scan or every trade of a test or orders run
Notes
If this setting is present, then every time a scan is run, a chart image (PNG file) is saved for every item (row) of the scan, and every time a test or orders run completes, a chart is saved for every trade in its trade list. Specify it in the general Settings section or in a ScanSettings or TestSettings or OrderSettings section. Optimize runs ignore it. In an orders run (any OrdersMode, including OrderClerkStats playback of live trades) the trade list is the backtest's, so with EndOfTestExits: False the charts include one for each still-open position, showing its entry marker only.
Scan charts are named symbol_date.PNG (e.g. MSFT_20210518.PNG). Trade charts are named symbol_entrydate_tradenumber.PNG (e.g. MSFT_20210518_37.PNG); the trade number suffix keeps two trades that entered the same symbol on the same date from overwriting each other. Note the extension is written in upper case, which matters to anything that collects the files case-sensitively.
Existing folder contents are not deleted before new charts are added, but existing chart files with the same names will be overwritten without asking.
For a test, charts are saved for the trade list as displayed: a Filter: item in the Trades Section limits which trades get charts (e.g. Filter: T.Profit < 0 for losing trades only), and its Sort: item controls the order in which they are saved. A full backtest can produce thousands of trades, so filtering (or the cap below) is recommended.
SaveChartsMax
The companion setting SaveChartsMax: N caps the number of charts saved (default is no limit). The cap is applied after the trade list’s filter and sort, so sorting by profit ascending combined with SaveChartsMax: 50 saves charts of the 50 worst trades. The cap applies to scan chart saving as well.
Remember that Sort: names a column of the Trades Section, so that column has to be defined in the same script. Interactively the default Trades.rts supplies one named Profit, but a script run from the command line inherits nothing, so it must declare its own:
Trades:
Profit: {$-2} T.Profit
Sort: Profit
Without the column definition the script fails to parse with "unrecognized item name in Sort definition".
Chart Appearance
Saved charts employ all last-used chart options — image size, visible bar count, bar style, cursor bar visibility, and the other chart window display settings — as persisted in realtest.ini from the most recently viewed chart window. Nothing in the script controls chart appearance, so fully deterministic chart rendering in an automated pipeline requires running with a controlled realtest.ini.
Two ini sections matter for that. [WindowPositions] iChartW and iChartH are the saved image’s width and height in pixels — a saved chart comes out at exactly those dimensions. If they are absent (or hold the placeholder -2147483648 that RealTest writes before any chart window has been sized), saved charts are 1600 x 1000. [ChartWindows] holds everything else: ChartVisibleBars, ChartExtraBars, ChartCandlestick, ChartLogScale, ChartSplitAdjust, ChartAfterExit, ChartShowIndPane / ChartIndPanePct, ChartShowVolPane / ChartVolPanePct, ChartShowCursor / ChartCursorBar, ChartBG, ChartUpBar / ChartDownBar, Indicator0Color through Indicator9Color, ChartFont / ChartFontHeight, ChartLineWidth, EntryExitLine, and ShowOtherTrades.
An ini written by hand for automated runs need contain only the keys it wants to pin; the rest fall back to their defaults. RealTest does not rewrite the ini during a command line run, so the same ini gives the same images every time, in every process.
Charts for a scan or trade list that has already been run can also be saved on demand via the Scan Menu or Trades Menu.
This feature was originally added to aid discretionary traders in creating a "chart book" for study purposes; the test-trades variant also supports automated workflows such as AI-assisted trade review and daily monitoring reports built from batch runs.
|