NAME - scan the market looking for signals


./ [ options ] <market file> <date> <system file> [ <system file> ... ]

DESCRIPTION will scan all stocks listed in <market file> looking for the signals indicated in each <system file> performing the analysis on the specified <date>. A system file must contain one or more description of GT::Signals or description of GT::Systems. You may list multiple system files on the command line. In the absence of a file standard input will be read instead.

NOTE -- if you omit a system file name will happily wait forever attempting to read from stdin.

The list of securities (code and name) that meet the specified signals is output at the end and grouped by signal.

Output can be either text (default) or html.

<market file> format:

stock or index symbols one per line


the date to perform the analysis on. the date string can be in any format that Date::Manip (if installed) can parse or the defacto gt standard date format (YYYY-MM-DD HH:MM:SS) where time is optional

<system file> format:

One or more GT::Signals or GT::Systems descriptions each on a separate line. The descriptions have the form of a signal or system name, followed by its arguments.

Example: S:Generic:And {S:Generic:CrossOverUp {I:SMA 5} {I:SMA 20}} {S:Generic:Increase {I:ADX}}

Description files can be formatted using the symbol '\' as the line continuation symbol. This symbol must appear as the last character on the line before the trailing line terminator (in unix that's a '\n' character). No whitespace must appear between the \ and the newline.

Example: S:Generic:And \ {S:Generic:CrossOverUp {I:SMA 5} {I:SMA 20}} \ {S:Generic:Increase {I:ADX}}

Blank lines and lines that start with # are comments and ignored. Note if you comment out the first line of multi-line description, the entire is effectively commented out.

Example: # the following signal description is commented out #S:Generic:And {S:Generic:Above {I:Prices} {I:EMA 30}} \ {S:Generic:Above {I:Prices} {I:EMA 150}}


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

Determines the time interval over which the scan is run. In detail:

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

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


The number of periods to use in the scan.


Runs the scan with the full history.

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.


Makes and invoked methods talkative (default - false)


If you want to start two (or more) scans in parallel (useful for machines with several CPUs for example).


Output is generated in html (default - false)


If html output enabled then embed this url as href (default -


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.

EXAMPLES (culled from devel archive)

To scan for all stocks that are trading above both their 30 day and 150 day EMAs create a system file containing this GT::Signals description (as a single line)

S:Generic:And {S:Generic:Above {I:Prices} {I:EMA 30}} {S:Generic:Above {I:Prices} {I:EMA 150}}

To scan for all stocks that are trading below both their 30 day and 150 day EMAs create a system file containing this GT::Signals description (as a single line)

S:Generic:And {S:Generic:Below {I:Prices} {I:EMA 30}} {S:Generic:Below {I:Prices} {I:EMA 150}}


 If the user has Date::Manip installed it allows the use of date strings
 that can be parsed by Date::Manip in addition the to defacto standard
 date-time format accepted by GT (YYYY-MM-DD HH:MM:SS) time part is optional
 Date::Manip is not required, without it users cannot use short-cuts to
 specify date strings. such short cuts include
 --start '6 months ago'
 --end 'today'
 Date string checking includes verifying the date string format
 is valid and the date is a valid date (and time if provided)
 Errors will be displayed and the script will terminate.
 The script also validates that the dates specified are consistent
 with respect to their purpose (--start is earlier than --end etc)
 Finally, appropriate timeframe conversion is performed so the user
 need not convert command line date strings from the day time to
 say week or month as it will be done automagically.
 Usage examples:
 with market_file (a file) containing the next 2 lines:
 with system_file (a file) containing the next 6 lines:
 # example system_file
 # todays price close was above open
 S:Generic:Above { I:Prices CLOSE } { I:Prices OPEN }
 # end of system_file
 with Date::Manip installed
 % --timeframe day --start '6 months ago' --end 'today' market_file \
  'today' system_file
 Signal: S:Generic:Above {I:Prices CLOSE} {I:Prices OPEN}
 replace day with week and you will (should) get:
 Signal: S:Generic:Above {I:Prices CLOSE} {I:Prices OPEN}
 without Date::Manip you will need to use:
 % --timeframe day --start 2007-04-24 --end 2007-10-24 market_file \
  2007-10-24 system_file
 % --timeframe week --start 2007-04-24 --end 2007-10-24 market_file \
  2007-10-24 system_file
 and should get the same results respectively

"Bad system call" failure on cygwin

If you are using cygwin on Windows to run GT, and you encounter a "Bad system call" error when running, you need to enable cygserver. cygserver is a utility that provides cygwin applications with persistent services. See for more detail. The first time you use cygserver, execute /usr/bin/cygserver-config to configure the service (there are many options but the above should suffice, see the manual for more). You can then invoke the service automatically through windows, or use net start cygserver to do so. You must also set the CYGWIN environment variable to 'server': CYGWIN=server export CYGWIN