./graphic.pl [ options | additional graphical elements ] <code>


./graphic.pl [ --timeframe=timeframe ] [ --nb-item=100 ] \ [ --start=2005-06-01 ] [ --end=2006-01-01 ] \ [ --type=candle|candlevol|candlevolplace|barchart|line|none ] \ [ --volume ] \ [ --volume-height=150 ] [ --title="Daily Chart" ] \ [ --width=200 ] [ --height=230 ] [ --logarithmic ] \ [ additional graphical elements ] \ [ --file=conf ] [ --driver={GD|ImageMagick} ] \ [ --out=imagefile ] \ <code>

Use "graphic.pl --man" to list all available options


graphic.pl can generate charts in png format, including indicators and system signals, either as overlays of the original price data, or in different regions of the chart.

Various options are available to control color, size and other graphic properties.

Additional Graphical Elements

By default, only the price will be plotted, however, you can add other indicators, either as overlays or in different zones of the chart.

To plot overlays, simply add them to the graphic. For instance:

--add="Curve(Indicators::EMA 50, blue)" --add="Curve(Indicators::EMA 200, red)"

To plot indicators in a different zone, first create a new-zone, then add the indicators:

  --add="Histogram(I:MACD/3, brown)"
  --add="Curve(I:MACD/1, red)"
  --add="Curve(I:MACD/2, green)"
  --add="Set-Scale(0,100)" --add="set-title(RSI,tiny)" \

Full details about the available methods you can use with the --add option follow.

Note that all objects that might affect the scale (such as, e.g., an indicator) must be added to a zone before the scale is changed.

New-Zone(height, [left, right, top, bottom])

This creates a new zone for displaying more indicators. It's created with the given height and the given border sizes.


This changes the current display zone. 0 is the main zone, 1 is the volume zone if it exists. 2 is the first indicator zone and so on. Usually you just need to it switch to the "Volume" zone because you start on the main zone and you automatically switch to any newly created zone.

Set-Scale(min,max,[logarithmic]) or Set-scale(auto,[logarithmic])

This defines the scale for the currently selected zone (by default the last zone created or the main zone if no zone has been created). If auto scale is used, the scale must be set after all objects that can affect the min or max values have been added.

Set-Special-Scale(min,max,[log]) or Set-Special-Scale(auto,[log])

The last created object will be displayed with its own scale (and not the default one of the zone). The scale may be given or it may be calculated to fit the full zone. If auto scale is used, the scale must be set after all objects that can affect the min or max values have been added.


Define the ticks for the main axis of the current zone.


This adds a title to the currently selected zone. The title will be displayed in the given size (size can be tiny, small, medium, large and giant). If the title contains a %c, this is replaced by the <code>, if it contains %n, this is replaced by the long name of the <code>. See also ~/.gt/sharenames, which contains lines of the form <code>\t<long name> mapping a market to its long name.

Histogram(<datasource>, [color])
Curve(<datasource>, [color])
Marks(<datasource>, [color])
Mountain(<datasource>, [color])
MountainBand(<datasource1>, <datasource2>, [color])

This adds a new graphical object in the current zone. The datasource explains what data has to be displayed.

Text(text, x, y, [halign, valign, font_size, color, font_face])

This adds a block of text at the given coordinate (expressed in percent of the width/height of the zone).

halign can be one of "left", "center" or "right". valign can be one of "top", "bottom" or "center". font_size can be one of "tiny", "small", "medium", "large" or "giant". font_face can be one of "arial", "times" or "fixed".


This adds buy and sell arrows in the main chart, based on systems signals.

VotingLine(Systems::..., [y])

Show buy and sell arrows in a Voting Line la OmniTrader, based on a System Manager. You can indicate the y at which the line should be displayed.


Sometimes you need to pass datasources to the graphical objects. The following are currently available.


An indicator.


This datasources returns the evaluation of any portfolio.

Other Objects

Some datasources may be parameterized by objects. The following are currently available.

BackTestPortfolio(<systemname>, [directory])

This returns a portfolio that has been saved for a backtest of the system "systemname". The given directory must be a spool of backtests.


--full, --start=<date>, --end=<date>, --nb-item=<nr>

Determines the time interval used to plot the graphics. In detail:

--start=2001-1-10, --end=2002-11-17

The start and end dates considered for the plot. The date needs to be in the format configured in ~/.gt/options and must match the timeframe selected.


The number of periods to use to plot the graphics. Default is 120.


Consider all available periods.

The periods considered are relative to the selected time frame (i.e., if timeframe is "day", these indicate a date; if timeframe is "week", these indicate a week; etc.). In GT format, use "YYYY-MM-DD" or "YYYY-MM-DD hh:mm:ss" for days (the latter giving intraday data), "YYYY-WW" for weeks, "YYYY/MM" for months, and "YYYY" for years.

The interval of periods examined is determined as follows:

  1. if present, use --start and --end (otherwise default to last price)
  2. use --nb-item (from first or last, whichever has been determined), if present
  3. if --full is present, use first or last price, whichever has not yet been determined
  4. otherwise, consider a two year interval.

The first period determined following this procedure is chosen. If additional options are given, these are ignored (e.g., if --start, --end, --full are given, --full is ignored).


The timeframe can be any of the available modules in GT/DateTime.


Determines the number of periods (back from the last period) that are loaded for a given market from the data base. Care should be taken to ensure that these are consistent with the performed analysis. If not enough data is loaded to satisfy dependencies, for example, correct results cannot be obtained. This option is effective only for certain data base modules and ignored otherwise.


The type of graphic to plot. none causes the price not to be displayed, however, overlays can still be sketched in the graphic.


Should the volume be plotted (it is by default)? Use --no-volume if you want to omit it.

--title="Daily Chart"

A configuration option (typically given in the options file) in the form of a key=value pair. For example, --option=DB::Text::format=0 sets the format used to parse markets via the DB::Text module to 0.

Configuration-File ( --file=conf )

With this option, additional parameters are read from the configurationfile conf. Each line in this file corresponds to a command line parameter. Lines starting with # are ignored.


Send image output to specified file. If not specified, output goes to stdout.


./graphic.pl --add="Switch-Zone(0)" \ --add="Curve(Indicators::SMA 38, [0,0,255])" \ --add="Curve(Indicators::SMA 100, [0,255,0])" \ --add="Curve(Indicators::SMA 200, [255,0,0])" \ --title="Daily history of %c" \ 13000 > test.png

./graphic.pl --add="Curve(Indicators::EMA 5,[255,0,0])" \ --add="Curve(Indicators::EMA 20,[0,0,255])" \ --add="BuySellArrows(SY::Generic {S::Generic::CrossOverUp {I:EMA 5} {I:EMA 20}} {S::Generic::CrossOverDown {I:EMA 5} {I:EMA 20}} )" \ 13000 > test.png