RealTest User Guide
RealTest User Guide

 

 

Navigation: RealTest Script Language > Syntax Element Details >

SaveScanChartsTo / SaveTradeChartsTo

 

 

 

 

Category

Settings or Scan Settings or Order Settings

Description

Paths of folders in which to automatically save a chart image for every row of a scan or TestScan list (SaveScanChartsTo) or for every trade of a test or orders run (SaveTradeChartsTo)

Notes

If SaveScanChartsTo is present, then every time a scan is run, a chart image (PNG file) is saved for every item (row) of the scan. In a test or orders run it applies instead to the TestScan list, when the script has one and the Scan checkbox is on. If SaveTradeChartsTo is present, then every time a test or orders run completes, a chart is saved for every trade in its trade list. A script can use either or both; each names its own folder. Specify them in the general Settings section or in a ScanSettings or TestSettings or OrderSettings section. Optimize runs ignore them.

Before 2.0.32.8 a single SaveChartsTo setting (with SaveChartsMax) served both purposes, which meant a test or orders run with a TestScan section saved both lists’ charts whenever either was wanted. The old names are no longer recognized; scripts that use them must be changed to the new names.

In an orders run (any OrdersMode, including OrderClerkStats playback of live trades) the trade list is the backtest's, so with EndOfTestExits: False the trade 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.

When the charts have been saved, a brief popup shows how many were written. A message box appears only if one or more chart images could not be written (an invalid or unwritable folder, for example).

SaveScanChartsMax / SaveTradeChartsMax

The companion settings SaveScanChartsMax: N and SaveTradeChartsMax: N cap the number of charts saved from the corresponding list (default is no limit). The cap is applied after the list’s filter and sort, so sorting the trade list by profit ascending combined with SaveTradeChartsMax: 50 saves charts of the 50 worst trades.

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 the current chart options — visible bar count, bar style, entry-to-exit lines, and the other chart window display settings. The recommended way to control these from a script is the Chart Settings keywords (ChartVisibleBars, ChartEntryExitLine, ChartShowOtherTrades, ChartTradeLabels, etc.), which also include ChartImageWidth and ChartImageHeight for the saved image’s pixel size. A script that sets them renders the same charts on any machine, in any run mode.

Options a script does not set fall back to their last-used values as persisted in realtest.ini from the most recently viewed chart window. [WindowPositions] iChartW and iChartH are the saved image’s default width and height in pixels; 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, ShowOtherTrades, and ChartTradeLabels.

A few options (colors, fonts, pane height percentages, cursor bar visibility) have no script keyword yet and can only be pinned via the ini. 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.

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 trade-chart variant also supports automated workflows such as AI-assisted trade review and daily monitoring reports built from batch runs.

 

 

 

Copyright © 2020-2026 Systematic Solutions, LLC