Next: Introduction, Previous: (dir), Up: (dir) [Index]
This manual describes how to install and use Chart, version 271.
Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2014, 2015, 2016, 2017, 2019, 2023 Kevin Ryde
Chart is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version (see Copying).
Chart is a stock and commodity price charting program, featuring various display options, data downloading, and user extensibility.
Chart is written in Perl and uses Gtk through the Gtk2-Perl interface. Extensions can be written using Perl. The home page is
Once you’ve installed Chart (see Installing), getting started is easy.
Run chart
, and choose File/Open from the menu bar. Enter a symbol,
like ‘GM’ (for General Motors USA) and click “New”. The download
dialog pops up and gets an initial 5 years data, then the chart is displayed.
The Watchlist is easy too (see Watchlist). Choose Tools/Watchlist from the menu bar, go to the Symbol box, enter a symbol like ‘NAB.AX’ (for National Australia Bank) and press Return. The symbol is added to the list and a latest quote downloaded. Click on “Refresh” to update.
Stock symbols broadly follow Yahoo Finance conventions, which is the exchange symbol plus a suffix, like ‘.L’ for the London Stock Exchange (see Yahoo Finance). But Chart is not Yahoo specific, other data sources have other suffixes.
Next: Installing, Previous: Introduction, Up: Top [Index]
Chart is Free Software, published under the terms of the GNU General Public License (version 3 or later). The file COPYING contains the full license terms (view it under Help/About within the program).
Chart is not in the public domain. It’s copyrighted and there are restrictions on its distribution and redistribution, but these restrictions are designed to permit everything a cooperating person would want to do.
Essentially you can give or sell copies to anyone, with or without modifications, but you must allow everyone else to do the same and you must clearly identify any modifications.
Be aware there is no warranty whatsoever for Chart. This is described in full in the license terms. No warranty whatsoever includes no warranty against any losses or any missed gains as a result of anything Chart does or doesn’t do or show.
Note that Chart is only a program for displaying data. The program and this manual do not give financial advice.
The data that Chart may download or display will be copyright to the creator of that data and will be provided under terms decided by the creator. You must check each data source used to see that you and your intended use are within the terms (see Data Sources). The minimum for a source in Chart is that personal non-commercial use is permitted. Usually no re-distribution is permitted.
The author believes that the manipulations Chart performs on downloaded data are purely mechanical and do not cause the program’s terms to be added to any results. Derived forms like the database files, watchlist quotes, screenshots of graphs, etc, will be subject only to the conditions of the data originators (cumulatively if data from more than one source is shown).
Next: Invocation, Previous: Copying, Up: Top [Index]
The following programs and libraries are required, see their respective documentation for installation instructions.
Chart uses an ExtUtils::MakeMaker
build system. A basic build and
install can be made as follows. This will install under ‘/usr/local’.
perl Makefile.PL make make install
The usual ExtUtils::MakeMaker
options and build targets are available.
Here are some other notes,
Various optional features and their required Perl modules are set out in the
optional_features
section of META.yml. Some of the smart Perl
install tools might offer them in an automated way, otherwise look at
META.yml or Makefile.PL and install desired things manually.
The most interesting options include Finance::Quote
(see Finance Quote), Genius Trader and TA-Lib (see Other Indicator Packages).
If suitable modules are available then LWP is set to request compression in
HTTP downloads. Various servers will do this and it saves download size when
the server does. Gzip is the most common and its decompression uses
IO::Uncompress::Gunzip
which comes with Perl so should be available
always.
For https
protocol the LWP::Protocol::https
module is required.
In libwww 6 and up it comes separately and expresses its required supporting
modules. In libwww 5 see its README.SSL on the recommended
Crypt::SSLeay
module (using OpenSSL). Many data sources need
https
, including Yahoo Finance.
The source for the manual you’re now reading is doc/chart.texi, in Texinfo format (see Texinfo in Texinfo).
HTML format chart.html is installed as
lib/App/Chart/doc/chart.html with the source code. It can be viewed
with the Help commands within Chart, or with any browser. The following
make
targets can build other formats,
make info # Info make dvi # TeX DVI make ps # PostScript make pdf # PDF
producing files doc/chart.info, doc/chart.dvi, etc. They need
enough of Chart’s Perl dependencies installed to run the doc/weights.pl
script, then Info requires makeinfo
(see Creating an Info File in Texinfo) and DVI, PS and PDF require various TeX and Texinfo
tools. PDF also requires either epstopdf
from Texlive or TeTeX, or
ps2pdf
from Ghostscript.
makeinfo
can produce other formats, including DocBook and XML
(see Options for makeinfo
in Texinfo).
A Scrollkeeper entry
(http://scrollkeeper.sourceforge.net) doc/chart.omf is included
for the manual (HTML form). It can be used by Gnome help (Yelp) and similar
programs. Currently it’s not automatically installed but you can copy to
/usr/share/omf/chart/chart.omf and run scrollkeeper-update
.
The default directory for Chart downloaded data and configurations is
~/Chart, ie. a Chart subdirectory of the user’s home
directory. The CHART_DIRECTORY
environment variable can be set to a
different directory if something else is preferred, or perhaps to experiment
or keep some things separate.
Next: Symbol Lists, Previous: Installing, Up: Top [Index]
The Chart command line is
chart [--options] [symbol…]
The default is to run the Gtk graphical interface. The optional symbol is an initial symbol to display.
symbol can be a partial name and is matched against the database the
same way as in the Open dialog (see Open). So if TSCO.L
is the
only thing in the database starting with “TS” then just ‘chart ts’ is
enough, or similarly for ^GSPC
just ‘chart gsp’ may be enough.
The graphical options are
Start on the given display dpy. The default is the usual DISPLAY
environment variable, which should be set as part of X startup, and shouldn’t
need to be overridden. See man X
for more.
Start with just the Watchlist dialog (see Watchlist). The initial list displayed is selected by the symbol options like ‘--all’ below.
chart --watchlist --all
A full main chart window can be opened from a symbol by double-clicking or choosing “Chart” from the Button-3 menu in the usual way.
Instead of running the full GUI, show just the stock ticker (see Ticker). The symbol options below select the symbols displayed. The default is the favourites list. For example,
chart --ticker --alerts
--display is a standard Gtk option, other standard Gtk options are
accepted too, but there’s none that do much for Chart. See man 7
gtk-options
for a full list.
The following options select one or more symbol lists or symbols for --watchlist and --ticker above, and for the command line --download below. The options are cumulative, so you can have a combination like
chart --alerts --favourites '*.AX'
For the symbols in those lists plus all ‘.AX’ symbols. (In the ticker a combination like that updates if the list contents or available ‘.AX’ symbols changes.)
The “All” list of all current symbols in the database, meaning everything except the historical list.
The “Alerts” list of all symbols currently outside their alert levels.
The “Favourites” list. downloaded.
The given explicit symbols.
Shell style wildcards ‘*’ and ‘?’ can be used to match existing database symbols. ‘*’ matches any sequence of characters, ‘?’ matches any single character. For example to update all Australian shares
chart --download '*.AX'
The quotes ‘' '’ are only to stop the ‘*’ being interpreted by the shell (see Quoting in Bash Features).
Chart can do its data downloading from the command line. Error messages are
printed to the standard output and a progress status line is shown if it’s a
terminal. This is good for a cron
job or other automated update.
The usual way to update everything is
chart --download --all
The symbol options above select what to display. Explicitly named symbols are added to the database if not already present, and are raised out of “historical” status if there’s some new data.
For --favourites only symbols from it already in the database are downloaded. Other symbols there are assumed to wanted for the watchlist, but not downloaded.
Other options are
Print the program version, and exit.
Print a summary of the command line options, and exit.
Chart has some support for the GNU Bash command line completion feature (see Letting Readline Type For You in Bash Features).
The chart.bash script lets you hit Tab etc to complete symbols
entered on the command line. For example type ‘chart --download bh’
Tab could complete to ‘BHP.AX’. It uses the sqlite3
command-line program to access the Chart database. Command options are
completed too, so ‘chart --do’ Tab gives ‘--download’.
To load this, source the file from your .bashrc (see Bash Startup Files in Bash Features),
. chart.bash
See comments in chart.bash for more, including use with the
bash_completion
project
(http://www.caliban.org/bash/index.shtml#completion).
Next: Display, Previous: Invocation, Up: Top [Index]
There are four builtin symbol lists in Chart, and you can create user defined lists from the Watchlist dialog (see Watchlist).
The favourites list is the default shown in the watchlist and is intended for symbols which you’re interested in at the moment. Symbols don’t have to be in the database, they can be in the list just to see quotes in the watchlist.
Symbols can be added or removed using the watchlist dialog, and from the main window (see Main Window) when viewing a chart using the File menu entries (accelerators ! and Control-!). Entries can be moved around from the watchlist too.
The alerts list is symbols which have gone above or below alert level annotations which you set (see Annotations). This changes with the latest quotes or database prices available. If you change an alert level then the symbol is added or removed accordingly too.
When a stock has been delisted or a futures contract has expired, the symbol is put into the historical list. The current rule is to go when there’s no new data for 3 weeks, or 3 weeks after a known contract expiry date.
“No new data” doesn’t merely mean no trades, it means no new information at all from the data source for that time. Current data sources don’t give direct indications of stocks that have been delisted, the rule here is designed to pick them up but not catch stocks merely suspended for a period.
The historical list cannot be directly edited, but if a stock is re-listed you can lift it out of historical status by explicitly downloading. (Do a Ctrl-U update, or ask for that symbol in the download dialog, see Download.)
The all list is all symbols in the database, except those in the historical list described above.
Next: Annotations, Previous: Symbol Lists, Up: Top [Index]
• Open | ||
• Main Window | ||
• View Style | ||
• Dividends | ||
• Cross | ||
• Ticker |
Next: Main Window, Previous: Display, Up: Display [Index]
The File/Open dialog selects a symbol to display. Click on an entry in the tree, or type in a symbol. Upper or lower case can be entered, and just some of the symbol is enough. The tree selection jumps to show what’s matched. There’s no need to give a suffix, unless two symbols are the same apart from the suffix.
The tree shows the various symbol lists (see Symbol Lists), but for the favourites list only symbols actually in the database. Clicking on an entry makes that list current, so N and P then navigate within that. Initially the start of the tree is current, so N starts in the first list.
To add a new symbol, enter it and click “New” (Alt-N). In this case you must have upper/lower case and the suffix correct. There’s no validation for that, you just have to be careful. An initial download is done and the chart is displayed.
When adding a lot of new symbols the command line download (see Invocation) may be easier than entering them individually in the GUI. You can give a long list and let Chart go away and do all the initial downloads. (The command is the same as an “update”, because an update of a stock with no data means do an initial download.) For example,
chart --download TSCO.L RNO.PA FBU.NZ BMW.DE
The TreeView in the dialog has an irritating animated arrow when expanding or collapsing a symlist. You can fix that for Chart and other Gtk2 by adding to your ~/.gtkrc-2.0 file
gtk-enable-animations = 0
Next: View Style, Previous: Open, Up: Display [Index]
The default display is daily open/high/low/close candlesticks with volume below. Ctrl-W selects a weekly display, or Ctrl-M monthly. Ctrl-D goes back to daily.
The scroll bars move the visible portion. Arrow keys Up, Down, etc move by a step, or control-arrows and Page-Up/Page-Down move by a page. Mouse Button-1 drags the graph within the window. Ctrl-C centres it vertically in the window, if you lose track when paging around.
Z and Shift-Z zoom in and out vertically. W and Shift-W zoom in and out horizontally (‘W’ stands for “wider”). The initial vertical scaling is based on apparent price volatility, so active stocks take the full window (or more), and sedate stocks are shown fairly flat.
During trading, the current day’s open/high/low/last so far is shown in yellow (to emphasise it’s a latest quote). This is always in OHLC style, even on a candlestick chart. The figure drawn looks like
| | +-- | +----- | +-- | --+ | |
The left line is the open as usual. The long line on the right is the last trade, and the surrounding shorter lines are the current bid and offer. The last trade might be equal to the bid or offer, overlapping it, or they might surround the last, as shown here. In any case this figure gives the current day visually.
Next: Dividends, Previous: Main Window, Up: Display [Index]
The Edit/Viewstyle dialog has options for the line style (OHLC, candles, etc), whether to adjust for stock splits (default yes), dividends (default no), and futures rollovers (default yes), and selections to enable various indicators.
Candlestick figures are shown in green for close above the open, or red for close below the open. This is instead of traditional hollow and solid, because hollow is hard to see when zoomed out to fit maximum data on the screen. If there’s no opening prices, candlesticks fallback to OHLC figures (just high/low and close). If there’s no high/low either, then candlesticks, OHLC and HL styles all fall back to a plain line.
Various averages (see Averages) or channels (see Channels and Boxes) can be applied in the main window, and an indicator (see Indicators) and an average (on it) in the lower window. The indicators have various parameters, like smoothing periods. For some closely related indicators the parameters are shared (eg. ADX and DMI), but most are independent for ease of tuning. The “Info” button at the right opens this manual at the selected indicator’s description.
Shift-Button-3 (ie. mouse Button-3 while the Shift key is held down) pops up a quick menu to change the indicator. On a two-button mouse Button-3 is usually the right button. The menu has a tearoff to keep it open for quick selection too. But parameter values can only be set from the Edit/Viewstyle dialog.
There’s just one global view style, applied to all charts viewed.
Next: Cross, Previous: View Style, Up: Display [Index]
Dividends and stock splits are shown across the top of the chart at ex dates. Both are part of normal data downloading, but may not be available for all exchanges or all stocks, and might have only recent or upcoming dividends (not historical dividends).
The cross is an orange horizontal and vertical line drawn following the mouse. It’s designed to help show relative price levels, or to see down to the time scale. The date and price are shown in the status area at the bottom too.
The cross can be toggled with the C key, or from the Tools/Cross menu entry. It can also be enabled just temporarily by pressing and holding mouse Button-3. On a 2-button mouse Button-3 is usually the right button.
There’s a cross in the intraday graphs similarly (see Intraday).
The ticker scrolls prices along a line at the bottom of the screen, refreshed periodically. It’s selected in the main window from the Tools/Ticker menu, or can be run standalone with the --ticker command line option (see Invocation).
Mouse Button-1 drags the text back and forward if you miss something or want to hurry it up. Button-3 pops up a menu to pause, force a refresh, or close it. On a 2-button mouse Button-3 is usually the right button. Prices are automatically refreshed every 5 minutes while running and visible.
The default is to show the favourites list (see Symbol Lists), but that can be changed from the menu. When standalone a symbol list or specified symbols can be given on the command line. For example to see everything in the database
chart --ticker --all
Annotations can be added to a chart, in the form of notes for particular days, and lines drawn on the chart.
Text notes are added with the Edit/Annotations dialog. These are free-form and can be used as personal reminders about particular events. (Usually they should be just a couple of words, as currently the drawing doesn’t do a good job with long text.)
Lines can be drawn on a chart as personal reminders of apparent trends or support/resistance etc. Lines can be drawn anywhere desired, and are stored using date and price so they scale with the display.
To draw a line press and hold mouse Button-2 at the starting point, and drag to the end. On a two-button mouse Button-2 usually means pressing both buttons at the same time.
While drawing, press H to toggle between a sloping line (the default) and a horizontal line. Press the spacebar to swap to move the opposite end of the line. An existing line can be repositioned by pressing and dragging Button-2 near an endpoint. Press Escape to abort an edit. To delete a line press D while dragging it.
Alert levels can be set if you want to know when a stock trades (or has a bid/offer) above or below some price. Symbols which have gone past an alert level are put into the Alerts list.
Alert levels are edited like lines above. While editing, press A to switch to an alert, and then A again to toggle between an alert above (the default) or below the level. An above alert is drawn like
| | ----------+
and below like
----------+ | |
Basically the little up or down tag at the right hand end points the direction it will be interested in (ie. above or below).
Next: Channels and Boxes, Previous: Annotations, Up: Top [Index]
When an indicator or average is based on a some number of past days, only trading days are counted, so for instance 10 days is 2 weeks. Days with no trading (public holiday, trading halt, etc) are skipped too.
At the start of data, either the initial listing, or just the start of what’s been downloaded, generally a shortened period of averaging is applied, so there’s an average immediately shown, though it may not be based on less than the desired period until N dayes, etc.
Of the following averages, the simple moving average and exponential moving average are the best known.
Next: Exponential Moving Average, Previous: Averages, Up: Averages [Index]
An N-day simple moving average is the unweighted average (mean) of the past N days. So if p1 is today’s closing price, p2 yesterday’s, etc, then the SMA for today is
p1 + p2 + ... + pN SMA = ------------------ N
Because old prices have the same weighting in the average as recent prices, the SMA can be rising merely because old lower prices are dropping out of the window. The weighting of past days also makes it seem to lag behind recent action. The EMA (see Exponential Moving Average) and WMA (see Weighted Moving Average) approaches address that sort of lag.
See also Momentum and Rate of Change, which show the slope of the SMA.
Next: Weighted Moving Average, Previous: Simple Moving Average, Up: Averages [Index]
An N-day exponential moving average (EMA) is a weighted average of today’s close and the preceding EMA value. The weight for today’s close is a smoothing factor alpha, where alpha=2/(N+1).
EMA[today] = alpha * close + (1-alpha) * EMA[yesterday]
The formula can also be written as follows, showing how the average moves towards today’s close by an alpha fraction of the distance from the old EMA to the new close.
EMA[today] = EMA[yesterday] + alpha * (close + EMA[yesterday])
Expanding out gives a power series with successively decreasing weight for each day’s price. Writing f=1-alpha and with p1 today’s closing price, p2 yesterday’s, etc, then
p1 + p2*f + p3*(f^2) + p4*(f^3) + ... EMA = ------------------------------------- 1 + f + f^2 + f^3 + ...
This is an infinite sum, but f is less than 1 so each successive weight f^k is smaller and smaller, soon becoming negligible. The most recent N days make up about 86.5% of the total. The following graph shows how the weights decrease for N=10.
Because recent prices have a higher weighting that past prices, the EMA responds more quickly and tracks recent prices more closely than a simple moving average (see Simple Moving Average).
When working with N-day periods, it should be noted that J. Welles Wilder uses a different reckoning of the decrease factor for EMAs. For example for a 14-day EMA he writes
1 13 EMA[today] = -- * close + -- * EMA[yesterday] 14 14
This is the same as the formula above, just a different f factor. When Wilder gives “W” days, the equivalent “N” above is 2*W-1, so say 14 becomes 27. This is also sometimes called a “modified moving average”.
In the indicators designed by Wilder, Chart uses his reckoning, so that for instance a 14-day RSI is entered at 14. This applies to ATR, DMI (and ADX) and RSI (see Average True Range, Directional Movement Index, and Relative Strength Index).
Next: Double and Triple Exponential Moving Average, Previous: Exponential Moving Average, Up: Averages [Index]
An N-day weighted moving average is an average of today’s close and preceding closes, with weighting factor N for today, N-1 for yesterday, N-2 for the day before, etc. The influence of past data thereby decreases with its age, down to nothing beyond N days.
The formula is as follows, with p1 for today’s closing price, p2 yesterday’s, etc.
N * p1 + (N-1) * p2 + (N-2) * p3 + ... + 2 * p[N-1] + pN WMA = -------------------------------------------------------- N + N-1 + N-2 + ... + 2 + 1
Like the EMA (see Exponential Moving Average), the WMA gives a higher weighting to recent prices than past prices, so it tracks those recent prices more closely than a simple moving average (see Simple Moving Average). The following graph shows how the weights decrease for N=15.
Next: Endpoint Moving Average, Previous: Weighted Moving Average, Up: Averages [Index]
The double exponential moving average (DEMA) and triple exponential moving average (TEMA) are combination EMAs (see Exponential Moving Average) by Patrick Mulloy, designed to track recent prices even more closely than the plain EMA. The calculation for DEMA is
DEMA = 2*EMA[N] - EMAofEMA[N]
and for TEMA,
TEMA = 3*EMA[N] - 3*EMAofEMA[N] + EMAofEMAofEMA[N]
Both are “overweight” on recent points so the moving average can actually get ahead of recent prices in some unusual price patterns. The following graph shows the DEMA weights for N=15.
And the following is TEMA for the same N=15.
Next: Fractal Adaptive Moving Average, Previous: Double and Triple Exponential Moving Average, Up: Averages [Index]
The endpoint moving average (EPMA) establishes an average price by fitting a least squares straight line (see Linear Regression) through the past N days closing prices and taking the endpoint of the line (ie. the line as at the last day) as the average.
This calculation goes by a number of other names, including least squares moving average (LSQMA), moving linear regression, and time series forecast (TSF). Joe Sharp’s “modified moving average” is the same thing too.
The formula ends up being a straightforward weighted average of past N prices, with weights going from 2*N-1 down to -N+2. This is easily derived from the least squares formulas, but just looking at the weightings the connection to least squares is not at all obvious. If p1 is today’s close, p2 yesterdays, etc, then
(2*N-1)*p[1] + (2*N-4)*p[2] + ... + (-N+2)*p[N] EPMA = ----------------------------------------------- 2*N-1 + 2*N-4 + ... + -N+2
The weights decrease by 3 for each older day, and go negative for the oldest third of the N days. The following graph shows that for N=15.
The negatives mean the average is “overweight” on recent prices and can overshoot price action after a sudden jump. In general however because the fitted line deliberately goes through the middle of recent prices the EPMA tends to be in the middle of recent prices, or a projection of where they seemed to be trending.
It’s interesting to compare the EPMA with a plain SMA (see Simple Moving Average). An SMA effectively draws a horizontal line through the past N days prices (their mean), whereas the EPMA draws a sloping line.
The inertia indicator (see Inertia) uses the EPMA.
Next: Guppy Multiple Moving Average, Previous: Endpoint Moving Average, Up: Averages [Index]
http://www.mesasoftware.com/technicalpapers.htm
http://www.mesasoftware.com/Papers/FRAMA.pdf
The fractal adaptive moving average (FRAMA) by John Ehlers is an exponential style moving average (see Exponential Moving Average) with an alpha smoothing factor that varies according to a fractal dimension calculated over the past N day’s prices.
The dimension is calculated by looking at the N days in two halves, the immediately preceding N/2 days and the N/2 preceding that. The trading ranges in those halves are compared to the total range and an alpha factor for the EMA generated. The calculation is slightly tricky but in essence the amount of overlap between the ranges is measured. The alpha factor is small and the EMA slow when the halves overlap. The alpha is large and the EMA fast when the halves don’t overlap but add up to make the overall N day range.
The FRAMA alpha factor and the fractal dimension value are available in the lower indicator window, to see where they’re big or small, under “Low Priority” near the end of the indicators lists.
Next: Hull Moving Average, Previous: Fractal Adaptive Moving Average, Up: Averages [Index]
http://www.guppytraders.com/gup329.shtml (summary at Darryl Guppy’s web site)
The Guppy multiple moving average (GMMA) by Darryl Guppy is a set of six short term and six long term exponential moving averages (see Exponential Moving Average), all drawn on the one chart.
His standard periods are 3, 5, 8, 10, 12 and 15 days for the short averages, and 30, 35, 40, 45, 50 and 60 days for the long averages. These periods are parameters in Chart to allow experimentation. A value of 0 suppresses an entry if less than twelve lines are desired.
Guppy’s approach is look for compression of the averages (the lines coming together) in each group as signalling a likely trend change; and for steady parallel or expanding lines as a continuing trend. He emphasises that the idea is not a moving average crossover system.
Next: Kaufman Adaptive Moving Average, Previous: Guppy Multiple Moving Average, Up: Averages [Index]
http://www.alanhull.com/
http://www.justdata.com.au/Journals/AlanHull/hull_ma.htm
The Hull moving average (HMA) by Alan Hull is a combination of weighted moving averages (see Weighted Moving Average) with a momentum component, designed to have low lag.
HMA = WMA[floor(sqrt(N))] of (2 * WMA[floor(N/2)] - WMA[N])
The average is weighted towards recent prices, and in fact has negative weights for prices past about N/2 days ago. Those negatives can make the average overshoot actual price action after a big jump (the same as other lag-reduced averages do). The following graph shows the weights for N=15.
Next: Laguerre Filter, Previous: Hull Moving Average, Up: Averages [Index]
The Kaufman adaptive moving average (KAMA) by Perry J. Kaufman (http://www.perrykaufman.com) is an exponential style average (see Exponential Moving Average) but with a smoothing that varies according to recent data. In a steadily progressing move the latest prices are tracked closely, but when going back and forward with little direction the latest prices are given only small weights.
The smoothing factor is determined from a given past N days closes (default 10). The net change (up or down) over that time is expressed as a fraction of the total daily changes (up and down). This is called the “efficiency ratio”. If every day goes in the same direction then the two amounts are the same and the ratio is 1. But in the usual case where prices backtrack to some extent then the net will be smaller than the total. The ratio is 0 if no net change at all.
abs (close[today] - close[N days ago]) ER = -------------------------------------- Sum abs (close - close[prev]) past N days
The ER is rescaled to between 0.0645 and 0.666 and then squared to give an alpha factor for the EMA of between 0.444 and 0.00416. This corresponds to EMA periods from a fast 3.5 days to a very slow 479.5 days.
alpha = (ER * 0.6015 + 0.0645) ^ 2
An exponential moving average of prices is then taken, using each alpha value calculated.
KAMA = alpha * close + (1-alpha) * KAMA[prev]
These alpha values can be viewed directly with “KAMA alpha” in the lower indicator window (a low priority option, near the end of the lists). High values show where KAMA is tracking recent prices closely, low values show where it’s responding only slowly.
Next: Median-Average Adaptive Filter, Previous: Kaufman Adaptive Moving Average, Up: Averages [Index]
http://www.mesasoftware.com/technicalpapers.htm
http://www.mesasoftware.com/Papers/TIME%20WARP.pdf
The Laguerre Filter by John Elhers is a smoothing filter based on Laguerre polynomials. Its first term is an EMA (see Exponential Moving Average), followed by certain feedback terms. The smoothing is controlled by an alpha factor which is the alpha for the EMA and also damps the further terms. Alpha can range from 1 to follow prices almost exactly, down to 0 for a very slow response.
The result is still a weighted average of past prices. The weights for example for the default alpha=0.2 are as follows.
The adaptive laguerre filter is a variation on the laguerre filter using a variable alpha factor which is based on how well the filter is tracking a past N days prices. The effect is to follow sustained moves quite closely, but to change little when prices chop back and forwards in a range.
The raw alpha values can be viewed as “Adaptive Laguerre Alpha” in the lower indicator window, under “Low Priority” near the end of the indicator lists. High values mean closely tracking prices, low values mean only slow response.
Next: Moving Median, Previous: Laguerre Filter, Up: Averages [Index]
http://www.mesasoftware.com/technicalpapers.htm
http://web.archive.org/web/20070720222047/http://www.mesasoftware.com/Papers/What%27s+the+Difference.exe
(self-extracting zip file)
The median-average adaptive filter by John Elhers is an EMA (see Exponential Moving Average) with an alpha smoothing factor that varies according to how close it is to a median.
The raw alpha values can be viewed as “Median-Average Alpha” in the lower indicator window, under “Low Priority” in the indicator lists. High values are where the average is following recent prices closely. The maximum is 0.5, which corresponds to a 3-day EMA.
Next: Regularized Exponential Moving Average, Previous: Median-Average Adaptive Filter, Up: Averages [Index]
The moving median is simply the median of the past N days’ closing prices. This may be of limited interest and is thus under “Low Priority” in the indicator lists.
For reference, a median is calculated by considering the prices sorted from highest to lowest. The middle one is the median, or if there’s an even number then the mean of the middle two. So for example with 15 points the chosen median point will have 7 others above it and 7 below it. The effect when plotted is a line that stays roughly in the middle of the past N days price action.
Next: Sine Weighted Moving Average, Previous: Moving Median, Up: Averages [Index]
The regularized exponential moving average (REMA) by Chris Satchwell is a variation on the EMA (see Exponential Moving Average) designed to be smoother but not introduce too much extra lag. The formula can be given in a number of forms, such as
Rp + alpha*(close - Rp) + lambda*(Rp + (Rp-Rpp)) REMA = --------------------------------------------- 1 + lambda
alpha = N-day smoothing per EMA
Rp = yesterday’s REMA
Rpp = day before yesterday’s REMA
Lambda is a factor controlling the amount of “regularization”.
This form shows how there’s an Rp+alpha*(close-Rp) part like an EMA, and an Rp+(Rp-Rpp) part which projects from yesterday’s REMA according to whether it was rising or falling relative to the REMA of the day before. The two parts are averaged with a weighting 1 for the EMA part and lambda for the projection.
If lambda is zero then REMA is the same as a plain EMA. Satchwell suggests fairly small values for lambda, and the default in Chart is 0.5. John Ehlers noted that if lambda is large REMA becomes unstable.
In any case the result of the calculation is still an average of past prices with a certain set of weights that progressively decrease for older data. The following is the weights for N=15 and lambda=0.5,
A momentum indicator is formed from REMA as the slope of the line from yesterday’s REMA to today’s.
REMA - REMAprev RegMom = --------------- REMAprev
This is like a Rate of Change (see Momentum and Rate of Change), but on just one day and as a fraction instead of a percentage. A crossing through zero of the RegMom is a peak or trough (and possibly just a flat spot before a further rise or fall in the REMA line).
Next: T3 Moving Average, Previous: Regularized Exponential Moving Average, Up: Averages [Index]
A sine weighted moving average (Sine-MA) applies weights to each day in the shape of the bulge in a sine curve from 0 to pi. For an N-day average the weightings are
/ 1 \ / 2 \ / N \ sin | --- * pi |, sin | --- * pi |, ..., sin | --- * pi | \ N+1 / \ N+1 / \ N+1 /
The effect is that middle prices have the greatest weight (much like the TMA, Triangular Moving Average). The graph below shows the weights for N=10. In Chart SWMA is under “Low Priority” in the indicator lists.
Next: Triangular Moving Average, Previous: Sine Weighted Moving Average, Up: Averages [Index]
The T3 moving average by Tim Tillson is a triple smoothed combination of the DEMA (see Double and Triple Exponential Moving Average) and a plain EMA (see Exponential Moving Average).
A given “volume factor” V (default 0.7) controls how much of the DEMA is used. The factor ranges from 0 which gives a plain EMA, up to 1 which gives a full DEMA. Values in between are a combination. The formula for this “generalized DEMA” is
GD(N,v) = (1-v)*EMA[N] + v*DEMA[N]
or equivalently as follows, emphasising how a portion of the momentum term present in the DEMA is used,
GD(N,v) = EMA[N] + v * (EMA[N] - EMAofEMA[N])
T3 applies this three times,
T3(N,v) = GD(N,v) of GD(N,v) of GD(N,v)
The following graph shows the weightings that result from N=10 and v=0.7.
At the lower v=0 extreme T3 is simply a tripled EMA (see EMA of EMA of EMA). At the upper v=1 extreme T3 is a DEMA of DEMA of DEMA, and the following is the weights for that (again N=10),
Next: Variable Index Dynamic Average, Previous: T3 Moving Average, Up: Averages [Index]
A triangular moving average (TMA) applies weights to each day in a triangular shape. For example on a 7-day average the weights are 1, 2, 3, 4, 3, 2, 1, or the following graph shows a 15-day average. The middle prices in the period have the greatest weight, and the oldest or newest only a small weight.
It’s interesting to note TMA is equivalent to a twice-smoothed simple moving average of half period (see Simple Moving Average).
TMA[N] = SMA[floor(N/2)+1] of SMA[ceil(N/2)]
In Chart TMA is under “Low Priority” in the indicator lists.
Next: Volume Weighted Moving Average, Previous: Triangular Moving Average, Up: Averages [Index]
The variable index dynamic average (VIDYA) by Tushar Chande and Stanley Kroll (in their book The New Technical Trader, 1984) is an exponential style moving average (see Exponential Moving Average) with a smoothing that varies according to recent price volatility.
A volatility measure is obtained by taking the standard deviation (stddev, see Standard Deviation) of the past 9 days closing prices, expressed as a fraction of a longer stddev of 30 days. A scaling factor of 0.2 produces an alpha usually in the range of about 0.3 to 0.1, corresponding to EMA periods of about 5 to 20 days.
stddev[short] of closing prices alpha = 0.2 * ------------------------------- stddev[long] of closing prices
An exponential moving average of prices is then formed in the usual way, with each day’s alpha.
VIDYA = alpha * close + (1-alpha) * VIDYA[prev]
The alpha values can be viewed directly with “VIDYA alpha” in the lower indicator window, under “Low Priority” in the indicator lists. High values show where the VIDYA is tracking recent prices closely, low values show where it’s responding only slowly.
Next: Zero-Lag Exponential Moving Average, Previous: Variable Index Dynamic Average, Up: Averages [Index]
An N-day volume weighted moving average (VWMA) is the average of the past N days closing prices, each weighted in proportion to the volume on that day. So if p1 is today’s closing price, p2 yesterday’s, etc, and v1, v2, etc similarly the volumes, then the VWMA for today is
v1 * p1 + v2 * p2 + ... + vN * pN VWMA = --------------------------------- v1 + v2 + ... + vN
The effect is to give greater significance to days with greater volume, making the average tend towards those days’ closing prices more. If all volumes are about the same then the VWMA becomes a simple moving average (see Simple Moving Average).
A true VWMA, the kind frequently specified for dividend reinvestment plans and other things needing an average price around a particular period, takes every price level and the volume transacted at that level. Chart doesn’t have the data needed for that and the calculation above instead effectively attributes all volume to the closing price.
Previous: Volume Weighted Moving Average, Up: Averages [Index]
The zero-lag exponential moving average (ZLEMA) is a variation of the EMA (see Exponential Moving Average) which adds a momentum term aiming to reduce lag in the average so as to track current prices more closely. For a given N-day period the formula is
ZLEMA = EMA of (close + (close-close[lag]))
Where the “lag” period is (N-1)/2. A plain EMA applied to straight line points ends up always being the close at (N-1)/2 days ago. So the idea of adding in this difference “close - close[lag]” is to compensate for that lag, to make the ZLEMA track a straight line exactly. Of course real data is rarely a straight line, but the principle is to push the ZLEMA towards approximately the current close.
The calculation still ends up as various weights on each past price. The effect of the momentum term is to make recent prices “over weight” and thus tracked closely, and with negative weights on past terms. There’s a sudden jump in the weights at the momentum lag point. For example the following graph is the weights for N=15 (lag point 7).
The EMA lag on a straight line can be calculated easily using the power formula for the EMA (see Exponential Moving Average), applied to an infinite sequence of prices going downwards by 1 each day and reaching 0 at today. On non straight line sequences the lag is not a simple (N-1)/2, but will vary according to shape, period of cyclical components, etc.
Next: Indicators, Previous: Averages, Up: Top [Index]
• Bollinger Bands | ||
• Darvas Boxes | ||
• Donchian Channel | ||
• Ichimoku Kinko Hyo | ||
• Keltner Channel | ||
• Kirshenbaum Bands | ||
• Parabolic SAR |
Next: Darvas Boxes, Previous: Channels and Boxes, Up: Channels and Boxes [Index]
Bollinger bands by John Bollinger are an N-day simple moving average (see Simple Moving Average) with an upper and lower bands drawn at 1 standard deviation away from the average. The distance multiple is configurable.
Standard deviation (see Standard Deviation) is a statistical measure of how much the values in a data set (the N closing prices in this case) deviate from their average (the mean). When prices are not changing much the deviation is small and the band lines are close to the average. The bands are further away when closing prices are more volatile.
See also Kirshenbaum Bands, which are similar but with a channel width based on standard error from a linear regression.
Next: Donchian Channel, Previous: Bollinger Bands, Up: Channels and Boxes [Index]
Darvas boxes by Nicholas Darvas are a system of drawing boxes on certain trading ranges, with a view to trading breakouts up or down from them.
The top of a box is formed when the high of day 1 is not penetrated on the immediately following day 2 and day 3. The bottom of the box is established similarly when a low is not penetrated on two subsequent days. The first candidate low is the low of day 3, and the search for a low can extend indefinitely. If the box top is penetrated while looking for the low then the box is abandoned.
Boxes in Chart are drawn without sides, only top and bottom, so as not to obscure the price plot. The starting point for box finding is the start of all data in the database, which attempts to make the results consistent, though it’s still not deterministic in the worst case, since it’s never certain there can’t be a huge enclosing box back in past data.
Next: Ichimoku Kinko Hyo, Previous: Darvas Boxes, Up: Channels and Boxes [Index]
The Donchian Channel by Richard Donchian is a simple band system showing an N-day highest high, N-day lowest low, and a midpoint line between them.
The N days start from yesterday, so a day which is a new N-day high or N-day low will break out of the channel. This is taken as a bullish or bearish signal (respectively).
Next: Keltner Channel, Previous: Donchian Channel, Up: Channels and Boxes [Index]
Ichimoku kinko hyo by journalist Goichi Hosoda (writing under the pseudonym “Ichimoku Sanjin” the 1930s) is a set of indicator lines designed to show the overall state of the market. The name in Japanese means roughly “chart equilibrium at a glance”.
The tenkan line shown in orange is the midpoint of the past 9-day trading range, and the kijun line shown in red is a similar midpoint but of a slower 26 day period. A crossing of the tenkan up through the kijun is taken as a bullish signal, or conversely a downwards crossing is bearish. This is similar to fast/slow moving average crossing systems, but using range midpoints.
A senkou or “cloud” region is shown between green lines. One line is the average (the mean) of the tenkan and kijun, the other is the midpoint of the 52 day trading range. But these lines are drawn 26-days ahead, and thus extend out past the end of the latest data. The idea is that the present values of those are predicted to have a future influence.
The cloud adds to the bullishness or bearishness of the tenkan/kijun crossovers. A bullish cross while above the cloud is a strong buy signal, whereas within the cloud it’s only a normal buy, or below the cloud a weak buy. Conversely a bearish cross is a strong sell if below the cloud, normal within, or weak if above. The cloud region beyond current data is also interpreted as prospective future support/resistance.
The chikou line drawn in blue is closing prices shifted back 26 days. It’s interpreted relative to those past prices, with chikou above being bullish or below being bearish. This is similar to the kind of comparison momentum makes (see Momentum and Rate of Change).
The time periods of 9 days and 26 days are parameters in Chart (see View Style). When Hosoda designed the system Japanese markets traded 6 days a week, so 9 days was 1 1/2 trading weeks and 26 days was a month. The same calendar times in today’s 5 day weeks can be had with 7 and 22 days.
An N-day range midpoint like the tenkan, kijun and cloud lines is also available separately as “Range Midpoint” if you want to experiment. It’s under “Low Priority” in the averages list.
Next: Kirshenbaum Bands, Previous: Ichimoku Kinko Hyo, Up: Channels and Boxes [Index]
The Keltner channel is an N-day simple moving average (see Simple Moving Average) of “typical price” (which is (high+low+close)/3), and bands drawn above and below that at a distance which is the simple moving average of daily ranges (high to low) in the period.
This indicator was described by Chester W. Keltner in his 1960 book How To Make Money in Commodities, and those who learnt of it from him apparently gave it the name Keltner Channel. Keltner himself called it the “Ten-Day Moving Average Trading Rule” and never claimed any originality for the idea – it may have come from grain traders in the 1930s, or even earlier.
The idea is that closes outside the channel suggest strong bullish (or strong bearish) sentiment and can be bought (or sold). The 10-day period is a parameter in Chart.
The channel bands need daily high/low data, so when that’s not available (a few indexes for instance) they can’t be drawn. The centre line is still shown (it ends up as just a simple moving average of the closes).
Next: Parabolic SAR, Previous: Keltner Channel, Up: Channels and Boxes [Index]
Kirshenbaum bands are channel lines drawn around an exponential moving average (see Exponential Moving Average). The channel width is a multiple of the “standard error” from a linear regression of a past N days (see Linear Regression, and the EMA is smoothed using the same N days.
Kirshenbaum bands are similar to Bollinger bands (see Bollinger Bands), but with a linear regression standard error (stderr) instead of a standard deviation (stddev, see Standard Deviation). The difference is that stddev takes no account of a trend, so the Bollinger channel widens when a trend is in progress. But stderr is based on deviation from a fitted sloping line, so if prices are making steady progress up or down the channel width remains small.
The standard error values (ie. the channel width) can be viewed directly as an indicator too as “Linear Regression Stderr” (see Linear Regression).
Previous: Kirshenbaum Bands, Up: Channels and Boxes [Index]
Parabolic stop and reverse (SAR) by J. Welles Wilder is a trend following system which establishes a trailing stop that’s progressively advanced as a price move continues. If penetrated then one’s position short or long is reversed and a new stop established for the move in the opposite direction.
The stop is calculated as follows. For an upward move, the initial SAR is the lowest low made in the preceding down movement. From there an extreme high of the current move is maintained and the stop advances towards that by a fraction called the “acceleration factor”.
SAR = SAR[prev] + accel * (extreme - SAR[prev])
The initial acceleration factor is 0.02, and each time a new extreme is made, ie. a new high, it’s increased by adding 0.02, up to a maximum of 0.2. (Those values are parameters in Chart.) The effect is to move the stop up faster in a strong move making successive new highs.
If the SAR for a given day is penetrated by any part of that day’s trading range then it’s a signal to reverse one’s position and the SAR becomes a trailing stop for a short. The calculation for that is the same, using the previous extreme high as the initial stop and maintaining a low to step towards. Reversals can be seen in the graph when the stop mark switches from above to below the prices, or back.
This approach is only suited to trending markets. If prices are chopping back and forward in a ranging market then a lot of whipsaw reversals are generated. At each reversal the new stop point can be quite a distance from the current prices, ie. one’s entry point, making those whipsaws expensive. Wilder believed markets trend only about 30% of the time. His ADX (see Directional Movement Index) is one way to identify such conditions.
In Chart the default is not to adjust for dividend payments in the display or in indicator calculations. If price falls on ex-dividend dates are causing unwarranted SAR reversals you can turn on the adjustment option in the view style (see View Style). (Assuming the data source provides dividend information.)
Next: Common Calculations, Previous: Channels and Boxes, Up: Top [Index]
Next: Accumulative Swing Index, Previous: Indicators, Up: Indicators [Index]
The Accumulation/Distribution index by Marc Chaikin is a cumulative total volume, with volume each day added or subtracted in proportion to where the close is between that day’s high and low. For c, h, l, v and with ADprev as yesterday’s Acc/Dist the formula is
C - L AD = ADprev + V * (2 * ----- - 1) H - L
When the close is at the high the factor is +1 and the full volume is added in, when the close is at the low the factor is -1 and the full volume is subtracted. In between is in proportion, so for instance a close at 75% of the range would be a factor +0.5, or a close midway would be a factor 0 for no change to the Acc/Dist.
The starting point (ie. the zero point) for the running total is arbitrary. In Chart it’s merely the segment of data first displayed.
The name accumulation/distribution comes from the idea that during accumulation buyers are in control and the price will be bid up through the day, or will make a recovery after being sold down, in any case finishing near the high. Vice versa for distribution.
Acc/Dist is somewhat similar to On-Balance Volume (see On-Balance Volume). But Acc/Dist looks at close within that day’s range, whereas OBV looks just at close-to-close up or down. An Acc/Dist calculation within an N-day window can be made too, see Chaikin Money Flow.
Next: Aroon, Previous: Accumulation/Distribution, Up: Indicators [Index]
The accumulative swing index (ASI) by J. Welles Wilder forms a cumulative total of certain swing index values which are a tricky weighted combination of close-to-close, open-to-close, and high-to-low range amounts each day.
The close-to-close dominates the swing index, so the ASI broadly follows the shape of the price curve. Wilder recommended looking for trend lines and breakouts in the ASI to confirm price trend lines.
The starting point (ie. the zero point) for the running total is arbitrary. In Chart it’s merely the segment of data first displayed. Wilder’s calculation applied a scaling factor based on the daily limit move, but this is not done in Chart. The shape of the resulting curve is not changed by that.
The raw swing index values can be viewed with the “Swing Index” (which is under “Low Priority” in the indicator lists because it’s of little direct use).
Next: Average True Range, Previous: Accumulative Swing Index, Up: Indicators [Index]
The Aroon indicator by Tushar Chande shows the length of time since the highest or lowest close among the past N days’ closes. There are three lines: Aroon Up for the high, Aroon Down for the low, and the Aroon Oscillator.
Aroon Up and Down are both expressed as percentages 0 to 100. If today is a new N-day high then Aroon Up is 100, and for each day that passes (without a fresh N-day high) it drops by 100/N, down to 0 for no new highs in the past N days. Conversely for Aroon Down for new N-day lows.
The Aroon Oscillator is simply the difference between the Up and Down lines,
AroonOsc = AroonUp - AroonDown
In Chart the Up line is drawn in green, the down in red, and the oscillator in white.
Next: Centre of Gravity Oscillator, Previous: Aroon, Up: Indicators [Index]
Average true range (ATR) by J. Welles Wilder is the daily “true range” values (see True Range) smoothed by an N-period exponential moving average (see Exponential Moving Average).
ATR = EMA[N] of True Range
The default smoothing period is 14 days, as recommended by Wilder. The period is always by Wilder’s reckoning of EMA smoothing period (see Wilder EMA period).
The idea behind ATR is that when traders are enthusiastic, either in an uptrend or downtrend, the range will be higher as the stock or commodity is bid up or sold down through the day. A lesser range suggests waning interest.
When a data source doesn’t provide high/low values (some indexes for instance), then just close-to-close changes are used. This may be of limited use.
The normalized ATR by John Forman (http://www.theessentialsoftrading.com) expresses the ATR as a percentage of the current closing price. This makes it possible to compare ATR values over long periods where a share price level (and hence the typical daily ranges) have changed greatly.
ATR NATR = 100 * ----- close
Next: Chaikin Money Flow, Previous: Average True Range, Up: Indicators [Index]
http://www.mesasoftware.com/technicalpapers.htm
http://www.mesasoftware.com/Papers/The%20CG%20Oscillator.pdf
The Centre of Gravity (CG) oscillator by John Ehlers is a comparison of recent prices against older prices within a given past N days.
Prices from those N days are imagined as weights placed on a beam, equally spaced, and the CG oscillator is then the balance point or centre of gravity along that beam. If p1 is today’s price, p2 yesterday’s, etc, then the formula is
1*p[1] + 2*p[2] + ... + N*p[N] CG = - ------------------------------ p[1] + p[2] + ... + p[N]
The “-” sign puts the CG on a scale of -N at the oldest end, up to -1 at the newest prices end. But those extremes are not reached, instead CG hovers around the midpoint -(N-1)/2. The scale is not important, only the shape of the curve, which rises if recent prices are higher, and falls if recent prices are lower.
Ehlers suggests looking at a past 10 days, and that’s the default. He notes that if N is very small the CG becomes quite noisy, and that if N is large it tends to become very unresponsive.
Next: Chaikin Oscillator, Previous: Centre of Gravity Oscillator, Up: Indicators [Index]
The Chaikin money flow index by Marc Chaikin is based on the Accumulation/Distribution index calculations (see Accumulation/Distribution), but just within a past N-day window. The formula is
/ close - low \ total N-day volume * | 2 * ----------- - 1 | \ high - low / Chaikin MF = ------------------------------------------------ total N-day volume
The Acc/Dist style volume values in the numerator range between +volume and -volume according to “closing location value”. They’re summed and expressed as a fraction of the total volume in that period. This fraction therefore ranges from -1 to +1, but in practice the extremes are rarely reached (since it would require every day to be a close at the day’s high to get +1, or every day at the low to get -1).
The idea is that buying strength is indicated by a close near the top of the day’s range, suggesting buyers have bid it up through to course of the day or recovered from pullbacks. Conversely a close near the bottom of the range suggests sellers in control. The amount of volume this is done on is worked in, as a measure of the significance of the action. In any case positive values are bullish and negative values are bearish in this interpretation, though perhaps with large values representing extremes which are likely to reverse.
This Chaikin money flow is is similar to the plain money flow index (see Money Flow Index), but the latter uses close-to-close up or down, where Chaikin uses close within the day’s range as a fraction, not just an “all or nothing” up or down.
High/low and volume data are required before Chaikin money flow can be drawn, this may not be available for some data sources (some stock indexes in particular).
It should be noted that “money flow” here is a shorthand for the enthusiasm of buyers (or, when negative, sellers). It’s common to speak informally of money flowing into or out of a stock, but of course there’s never actually any net money in or out since for every buyer there’s a seller of the same amount.
Next: Chande Momentum Oscillator, Previous: Chaikin Money Flow, Up: Indicators [Index]
The Chaikin oscillator, or Chaikin A/D oscillator, by Marc Chaikin is simply the difference between a 3-day and 10-day exponential moving average (EMA, see Exponential Moving Average) of the Accumulation/Distribution index (see Accumulation/Distribution).
Chaikin Osc = EMA[3] of A/D - EMA[10] of A/D
The periods 3 and 10 are configurable.
Next: Commodity Channel Index, Previous: Chaikin Oscillator, Up: Indicators [Index]
The Chande Momentum Oscillator (CMO) by Tushar Chande is a variation on the RSI (see Relative Strength Index) using an SMA (see Simple Moving Average) and on a scale between -100 and +100.
SMA[N] of (close - prev close) CMO = 100 * --------------------------------- SMA[N] of abs(close - prev close)
The formula can also be written in the style of the RSI, with U=close-prev on an up day, and D=prev-close on a down day.
SMA[N] of U CMO = -100 + 200 * ------------------------- SMA[N] of U + SMA[N] of D
See also TSI (see True Strength Index), another different moving average for an RSI.
Next: Coppock Curve, Previous: Chande Momentum Oscillator, Up: Indicators [Index]
The Commodity Channel Index by Donald Lambert is an oscillator designed to identify overbought and oversold conditions in a ranging market. It expresses the difference between today’s typical price and recent average as a fraction of each day’s mean deviation from that average.
tp[today] - mean tp CCI = ------------------- 0.015 * meandev
The mean tp is over a given past N days. “Typical price” is the average of high, low and close. Chart uses just the close if there’s no high/low data from a particular data source.
high + low + close tp = ------------------ 3
The mean deviation meandev is the mean difference between each of the N days typical price and the mean tp. The differences are taken as absolute values (ie. ignoring negative signs),
abs(tp1 - mean tp) + abs(tp2 - mean tp) + ... abs(tpN - mean tp) meandev = ---------------------------------------------------------------- N
The scaling factor 0.015 above is designed to put the index between +100 and -100 roughly 70% to 80% of the time. Those levels are drawn as dashed lines. Lambert regarded index values outside that range as overbought or oversold, but with no actual buy or sell signal until crossed back, ie. rising above +100 then coming back below that, or conversely falling below -100 then rising back above it again.
The default N-day period in Chart is 20 days. Lambert recommended making it about 1/3 of the market cycle, so 20 days would correspond to a 60 day cycle.
The meandev calculated is similar to the standard deviation (see Standard Deviation) in that it’s an average difference from the mean, but meandev is a mean of the absolute differences, whereas stddev is a quadratic mean of those differences.
Next: Detrended Price Oscillator, Previous: Commodity Channel Index, Up: Indicators [Index]
The Coppock Curve, or Coppock Indicator, by Edwin Coppock, first published in Barrons magazine 1962, is a smoothed rate of change style indicator designed to identify long-term buy signals on a monthly chart.
The indicator is calculated as the sum of 14-period and 11-period ROC values (see Momentum and Rate of Change), smoothed with a 10-period WMA (see Weighted Moving Average). Adding the two ROCs has the effect of averaging their values.
Coppock = WMA[10] of (ROC[14] + ROC[11])
Coppock designed the indicator for use on a monthly time scale, which can be viewed in Chart with Ctrl-M (see Main Window). In other timebases (days or weeks) Chart uses the same 14, 11 and 10 periods, which may or may not be useful, since months were what Coppock intended.
The indicator generates a buy signal for long-term investors when it’s below zero and turns upwards from a trough. The nature of the calculation means this will be well after the low in prices, the signal is meant to indicate a good rally has been established.
Next: Directional Movement Index, Previous: Coppock Curve, Up: Indicators [Index]
The detrended price oscillator (DPO) aims to eliminate an intermediate or long term trend and show variations around that trend. It’s calculated on a given N days using today’s close and a past simple moving average (see Simple Moving Average),
DPO = close - SMA over N days, as at N/2+1 days ago
This is somewhat similar to momentum (see Momentum and Rate of Change), but instead of taking the close N days ago, an average (the SMA) of N days surrounding that point is used.
Next: Ease of Movement, Previous: Detrended Price Oscillator, Up: Indicators [Index]
The directional movement index by J. Welles Wilder expresses so-called directional movement, from high to high, or low to low, as a percentage of true range (see True Range).
When today’s high is above yesterday’s high, the increase is upwards directional movement, written DM+. If today’s high is not above yesterday’s then DM+ is zero. Conversely when today’s low is less than yesterday’s low the decrease is downward directional movement, written DM-. Again if today’s low is not below yesterday’s then DM- is zero. Both DM+ and DM- are positive numbers, the “+” and “-” signs just refer to the direction of the movement.
On an “inside day” where today’s trading range is entirely within yesterday’s both DM+ and DM- are zero. On an “outside day” where today’s trading goes both above and below yesterday’s range, only the larger of DM+ and DM- is used and the other is set to zero.
The two DM+ and DM- series are each smoothed with an N-day exponential moving average (see Exponential Moving Average) and expressed as a percentage of average true range (see Average True Range). The ATR uses the same N-day EMA smoothing. Two lines are formed, the upwards directional index DI+ and downwards directional index DI-.
EMA[N] of DM+ EMA[N] of DM+ DI+ = 100 * ------------- DI+ = 100 * ------------- ATR[N] ATR[N]
In Chart, DI+ is drawn in green (for upwards) and DI- is drawn in red (for downwards).
The smoothing N is by Wilder’s reckoning of EMA smoothing period (as discussed in Exponential Moving Average), the default is the 14 he recommended.
An extreme of 100 is approached on DI+ when each day trades entirely above yesterday’s range (eg. runaway gaps), and then closes at the high of the day. This is rather rare, usually there’s some pullbacks. Essentially DM+ counts just the advance, the true range in the denominator counts the backtracking too. For DI-, an extreme of 100 is approached similarly when each day trades entirely lower the previous, and closes at its low.
The average directional index (ADX) combines DI+ and DI-, expressing their difference (ignoring the sign) as a percentage of the total, forming a single line ranging 0 to 100,
abs(DI+ - DI-) ADX = 100 * -------------- DI+ + DI-
Next: Elder Bull/Bear Power, Previous: Directional Movement Index, Up: Indicators [Index]
The ease of movement indicator by Richard Arms shows a ratio of price movements over volume. Big moves on light volume mean easy movement through price levels, small moves and/or heavier volume means difficult movement.
midpoint[today] - midpoint[yesterday] Ease = ------------------------------------- box ratio
The midpoint is the middle of the day’s trading range, ie. (high+low)/2. The box ratio is volume over trading range, giving the amount of volume required to move by one price tick, on the day. Volume is taken in millions, to bring the scale up (with no effect on the shape).
volume[today] box ratio = ------------------------ high[today] - low[today]
Ease of movement is smoothed with an exponential moving average (see Exponential Moving Average), with default 14 periods. The raw daily values can be seen, if desired, by setting the average to 1 day.
Next: Fisher Transform, Previous: Ease of Movement, Up: Indicators [Index]
Bull power and bear power by Dr. Alexander Elder show where today’s high and low lie relative to the a 13-day EMA (see Exponential Moving Average) of the closing prices.
Bull power = High - EMA[13] of close Bear power = Low - EMA[13] of close
Bull power is drawn in green and the bear power in red. The 13-day period is an option (see View Style). A 13-day EMA can be selected in the top window to show the basis for the calculation. The indicator lines are like “detrended” variations around that average.
Elder takes the 13-day EMA to be a consensus of value, and the amount bulls can push the daily highs above that is their power, and conversely the amount the bears can push daily lows below it is theirs (sending the bear power line negative).
Next: Force Index, Previous: Elder Bull/Bear Power, Up: Indicators [Index]
http://www.mesasoftware.com/technicalpapers.htm http://www.mesasoftware.com/Papers/USING%20THE%20FISHER%20TRANSFORM.pdf
The fisher transform indicator by John Ehlers is a range oscillator showing where today’s price is within the past N-days highest and lowest. It has some smoothing, plus what’s known in mathematics as a fisher transform.
The range position is similar to Stochastics and to Williams %R (see Williams %R). The fisher transformation stretches out values near the N-day high and low to make large peaks so as to help highlight those extremes.
The calculation is as follows. The prices used are the midpoint between the day’s high and low (as in most of Ehlers’ indicators). Today’s price is located within the highest and lowest of those midpoints from the past N days, scaled to -1 for the low and 1 for the high.
price = (high + low) / 2 price - Ndaylow raw = 2 * ------------------ - 1 Ndayhigh - Ndaylow
This raw position is smoothed by a 5-day EMA (see Exponential Moving Average) then a log form which is the fisher transform, before a final further 3-day EMA smoothing.
smoothed = EMA[5] of raw 1 + smoothed fisher = EMA[3] of log ------------ 1 - smoothed
The effect of the logarithm is to make “smoothed” values near 0 remain near there, but values near 1 and -1 grow greatly, thus highlighting extremities. A “smoothed” value of exactly +/-1 would transform to +/-infinity, so a clamp of 0.999 is applied, effectively limiting the final result to about +/-7.5.
Next: Forecast Oscillator, Previous: Fisher Transform, Up: Indicators [Index]
The force index by Dr. Alexander Elder shows daily close-to-close changes multiplied by the volume traded, so that moves on greater volume are given more significance. The raw change*volume values are smoothed slightly with a 2-day EMA (see Exponential Moving Average), so the formula is simply
Force Index = EMA[2] of (volume * (close - prev close))
An increasing force index indicates strong interest in an upward move, when it falls back either price or volume or both have declined suggesting waning interest. Conversely for a negative and falling force index on the downside. The smoothing period for the EMA is configurable.
Next: Gopalakrishnan Range Index, Previous: Force Index, Up: Indicators [Index]
The %F forecast oscillator by Tushar Chande shows deviation between today’s closing price and an N-day linear regression forecast (see Linear Regression) of that close. The deviation is expressed as a percentage of the close, so the formula is
close - forecast %F = ---------------- * 100 close forecast = linear regression of previous N days, at today
The N days prices for the linear regression start from yesterday’s close, and the forecast value is the line extended out to today. This forecast line is like the EPMA (see Endpoint Moving Average), but going out one day further. Chande suggests using a 5 day regression for short term trading, and that’s the default in Chart.
Next: Intraday Momentum Index, Previous: Forecast Oscillator, Up: Indicators [Index]
The Gopalakrishnan Range Index (GAPO) by Jayanthi Gopalakrishnan quantifies the variability in a stock, based on the logarithm of the trading range over an N-day period (default 5 days).
log(high[Ndays] - low[Ndays]) GAPO = ----------------------------- log(N)
The idea is to identify markets which are more erratic than others. It will be noted though that there’s no scaling to the overall price level. In Chart GAPO is under “Low Priority” in the indicator lists.
Next: Klinger Volume Oscillator, Previous: Gopalakrishnan Range Index, Up: Indicators [Index]
The intraday momentum index (IMI) by Tushar Chande expresses upward open-to-close movement in the past N days as percentage of total open-to-close movement (up and down).
Sum[N] of max(close-open, 0) IMI = ---------------------------- Sum[N] of abs(close-open)
This is like an RSI (see Relative Strength Index) but on open-to-close movement and with a simple moving average.
The use of open-to-close is also similar to the way QStick (see QStick) shows proportions of black and white candlesticks, with IMI scaling according to the total real-body height in the past N days.
Next: MACD, Previous: Intraday Momentum Index, Up: Indicators [Index]
The Klinger volume oscillator (KVO) by Stephen J. Klinger is based on cumulative volume, with volume added or subtracted according to the direction of typical price and weighted by a certain daily range calculation.
A trend direction is determined from today and yesterday’s “typical prices” (which are (high+low+close)/3),
trend = / 1 if TP[today] > TP[yesterday] \ -1 if TP[today] <= TP[yesterday]
A daily measurement DM = high-low is calculated and then a cumulative measurement formed (cumulative while the trend direction is the same),
CM[today] = / CM[yesterday] + DM[today] if trend[today]==trend[yester] \ DM[yesterday] + DM[today] if trend[today]!=trend[yester]
A “volume force” is then formed by accumulating volume amounts, with the “trend” factor making them add or subtract according to the typical price direction, and with the values scaled by DM and CM.
VF = volume * trend * abs(2*DM/CM - 1)
The Klinger oscillator is then formed as the difference between fast (34-day) and slow (55-day) EMAs (see Exponential Moving Average) of the volume force.
KVO = EMA[34] of VF - EMA[55] of VF
This is drawn in green, and a trigger line is drawn in red, being a 13-period EMA of the KVO line. The view style (see View Style) has an option to draw the difference between the two lines as a histogram, in MACD style (see MACD).
The raw volume force can be viewed directly as “KVO volume force” under “Low Priority” near the end of the indicator lists.
Next: MASS Index, Previous: Klinger Volume Oscillator, Up: Indicators [Index]
The MACD (Moving Average Convergence/Divergence) indicator by Gerard Appel shows how two moving averages on closing prices come together or move apart (ie. converge or diverge). The main MACD line is the difference between a fast and slow EMA (see Exponential Moving Average), this is shown in green in Chart.
MACD = EMA[12] of price - EMA[26] of price
A signal or trigger line is then formed by smoothing this with a further EMA. This is shown in red in Chart.
signal = EMA[9] of MACD
A crossing of the MACD up through the signal line is taken as a buy signal, or downwards a sell signal. The difference between these lines is shown as a histogram (solid white block). This helps show whether the lines are coming together or going further apart.
histogram = MACD - signal
Crossings of the MACD line up or down through zero are also interpreted as bullish or bearish (respectively). This corresponds to crossings of the underlying EMA[12] up or down through the EMA[26].
Periods 12,26,9 are frequently used, but can be varied in Chart (see View Style).
Next: Momentum and Rate of Change, Previous: MACD, Up: Indicators [Index]
The MASS index by Donald Dorsey is based on daily trading range. Each day’s range high to low is calculated and those values are smoothed with a 9-day EMA (see Exponential Moving Average). A ratio of that value with a second EMA smoothing is then taken, and the past 25 days of those ratios added up.
EMA[9] of high-low MASS = Sum[25] of ----------------------- EMAofEMA[9] of high-low
The EMA and the EMA of EMA are normally quite close, making their ratio usually about 1 and hence the sum formed is usually close to 25. The most significant pattern Dorsey looked for was a “reversal bulge” where the index goes above 27 then falls back below 26.5, indicating a widening of daily trading range and suggesting a reversal in price is likely.
Applying an EMA a second time gives a quite different result from a plain EMA. It’s still a weighted average of recent prices, but whereas a plain EMA is dominated by the most recent prices, a double EMA spreads more broadly, and the latest few days’ influence is in fact smaller than the peak weights (at about N/2 days back). The following graph shows the weights for N=10.
The twice-smoothed EMA is also available directly as a moving average option, under “Low Priority” in the indicator lists, to see its effect on prices or on an oscillator.
Next: Money Flow Index, Previous: MASS Index, Up: Indicators [Index]
Momentum and rate of change show a difference between today’s close and the close N days ago. Momentum is the difference as a price amount (positive or negative), rate of change scales it to a percentage increase or decrease from that N-day ago close. This scaling is an advantage if comparing past times when prices levels were much higher or lower than now. If p1 is today, p2 yesterday, etc, then
Momentum = p[1] - p[N+1] p[1] - p[N+1] ROC = 100 * ------------- p[N+1]
It will be noticed that momentum is the difference between an N-day simple moving average (see Simple Moving Average) for today and yesterday, with a scale factor N, ie.
Momentum -------- = SMA[today] - SMA[yesterday] N
This is the slope of the SMA line (price change per day) at that point. Momentum crosses up through zero when SMA makes a peak, or down through zero when SMA makes a trough. The TRIX indicator (see TRIX) does a similar thing with a triple exponential moving average.
Next: On-Balance Volume, Previous: Momentum and Rate of Change, Up: Indicators [Index]
The Money Flow Index (MFI) ranges from 0 to 100 showing dollar volume (referred to as “money flow”) on up days as a percentage of total up and down days, in a given past N days.
The calculation is as follows. A “typical price” is formed from the average of high, low and close. If high/low figures are not available then Chart just uses the close,
high + low + close typical price = ------------------ 3
“Money flow” on a given day is typical price multiplied by volume. This is the money that flowed, ie. an approximation to the dollar volume traded.
money flow = typical price * volume
Across the N-day period two totals are formed. “Positive money flow” is the money flow on days where the typical price is higher the previous day’s typical price, and “negative money flow” when below. Days when typical price is unchanged are ignored. The MFI is then
positive money flow MFI = 100 * ----------------------------------------- positive money flow + negative money flow
Generally an MFI level of 80 is considered overbought, and 20 considered oversold. Those levels are shown as shown as dashed lines.
MFI is similar to RSI (see Relative Strength Index) in its construction and use. Both are looking at up days versus totalled up and down days, but the RSI scales by price change amounts where MFI scales on dollar volume (or an approximation to that).
It should be noted “money flow” refers to dollar volume, ie. the total value of shares traded. Sometimes finance commentators speak of money “flowing into” a stock, but that expression only means buyers are enthusiastic. Obviously there’s never any net money in or out, because for every buyer there’s a seller of the same amount.
For the purposes of the MFI, “money flow”, ie. dollar volume, on an up day is taken to represent the enthusiasm of buyers, and on a down day to represent the enthusiasm of sellers. An excessive proportion in one direction or the other is interpreted as an extreme, likely to result in a price reversal.
Next: Negative Volume Index, Previous: Money Flow Index, Up: Indicators [Index]
On-balance volume (OBV) is a running total of daily volume, with volume on an up day added and volume on a down day subtracted. An up day is a close higher than the previous day’s close, and vice versa a down day. So if p1 is today’s close and p2 is yesterday’s, the formula is simply
/ v1 if p1 > p2 | OBV = OBVprev + | 0 if p1 = p2 | \ - v1 if p1 > p2
The starting point (ie. the zero point) for the running total is arbitrary. In Chart it’s merely the segment of data first displayed.
See also Price and Volume Trend, and Accumulation/Distribution, which accumulate volume in similar ways.
Next: Polarized Fractal Efficiency, Previous: On-Balance Volume, Up: Indicators [Index]
The Negative Volume Index (NVI) and Positive Volume Index (PVI) by Norman Fosback (http://www.fosback.com) track price changes according to changes in volume. The NVI tracks closing price changes that occur on days with lower volume than yesterday, and the PVI conversely tracks those with higher volume than yesterday.
/ close | ----------- if vol < vol[prev] NVI = NVI[prev] * | close[prev] | \ 1 if vol >= vol[prev]
/ close | ----------- if vol > vol[prev] PVI = PVI[prev] * | close[prev] | \ 1 if vol <= vol[prev]
The fraction close/close[prev] means that the indexes follow percentage daily changes in the closing prices, but only changes on the selected lower or higher volume days are used. The starting point for the changes is arbitrary, only the shape of the resulting line matters. In Chart the start is 100 for the first data portion displayed.
The principle behind the NVI is that on high volume days an uninformed crowd is dominating, whereas on quieter days “smart money” is establishing positions. Fosback holds there’s a 95% probability of a bull market when the NVI rises above its one-year moving average.
Next: Pretty Good Oscillator, Previous: Negative Volume Index, Up: Indicators [Index]
The Polarized Fractal Efficiency indicator by Hans Hannula shows how efficient, meaning how much like a straight line, the price movement has been over the past N days.
The net distance travelled over the past N days is expressed as a percentage of the total of each day’s distance travelled. Distance is measured in two-dimensions, like a ruler on the plotted graph. Rise (or fall) is expressed as a percentage, and each day counts as 1 unit across. So the formula, on closing prices p1 (today) to pN is
Sign(p1-pN) * Hypot(N-1, Pchg(p1,pN)) PFE = 100 * ------------------------------------------------------- Hypot(1, Pchg(p1,p2)) + ... + Hypot(1, Pchg(p[N-1],pN)) Sign(X) = 1 if X>0, or -1 if X<0 new - old Pchg(new,old) = 100 * --------- old Hypot(x,y) = sqrt (x^2 + y^2)
Here “Pchg” is a percentage change up or down from “new” to “old” price, and “Hypot” is the distance (the hypotenuse) for a move of X horizontally and Y vertically. “Sign” means that PFE is positive or negative according to whether the change over the past N days is up or down.
At the extremes of 100 or -100, price movement is at maximum efficiency, with the past N days making a perfectly straight line. An almost straight line is generally very close to 100 too. A midpoint of 0 means there’s been no net change over the past N days.
Hannula looked at price changes over 10 day period (horizontal distance of 9), and this is the default in Chart. A smoothing parameter is provided too; it applies an exponential moving average (see Exponential Moving Average) to the PFE. The default is 5 days smoothing, a value of 0 means no smoothing (to see the raw values).
Next: Price and Volume Trend, Previous: Polarized Fractal Efficiency, Up: Indicators [Index]
The “Pretty Good Oscillator” (PGO) by Mark Johnson measures the distance of the current close from its N-day simple moving average (see Simple Moving Average), expressed in terms of an average true range (see Average True Range) over a similar period.
close - SMA[N] of closes PGO = ------------------------ EMA[N] of true range
So for instance a PGO value of +2.5 would mean the current close is 2.5 average days’ range above the SMA.
Johnson’s approach was to use it as a breakout system for longer term trades. If the PGO rises above 3.0 then go long, or below -3.0 then go short, and in both cases exit on returning to zero (which is a close back at the SMA).
Next: QStick, Previous: Pretty Good Oscillator, Up: Indicators [Index]
Price and Volume Trend (PVT) is a running total of daily volume, with each day’s volume added or subtracted according to the percentage change in the today’s closing price over yesterday’s.
close[today] - close[yesterday] PVT = PVTprev + volume * ------------------------------- close[yesterday]
The starting point (ie. the zero point) for the running total is arbitrary. In Chart it’s merely the segment of data first displayed.
PVT is similar to On-balance volume (see On-Balance Volume), but accumulating a portion of the volume. And see also Accumulation/Distribution, which also accumulates volume.
Next: R-Squared Index, Previous: Price and Volume Trend, Up: Indicators [Index]
The QStick indicator shows the dominance of black (down) or white (up) candlesticks, which are red and green in Chart, as represented by the average open to close change for each of past N days.
close[1]-open[1] + ... + close[N]-open[N] QStick = ----------------------------------------- N
Days which are up have positive amounts for close-open, days which are down have negative amounts. In adding them up they cancel out until the dominance of one over the other results.
Next: RAVI, Previous: QStick, Up: Indicators [Index]
The R-squared indicator by Tushar Chande and Stanley Kroll is a measure of how closely the past N days resemble a straight line, ie. a trend. It calculates what is called in statistics the coefficient of determination of the prices versus a straight line. This coefficient is written r^2, hence the name of the indicator.
For reference, the formulas are as follows, where X values are the closing prices and Y values are a straight line 1,2,…,N. Variance is the square of standard deviation (see Standard Deviation).
(Covariance X,Y)^2 r^2 = ----------------------- Variance X * Variance Y Covariance X,Y = Mean (X*Y) - (Mean X) * (Mean Y) Variance X = Mean(X^2) - (Mean X)^2
The R-squared indicator ranges from 0 meaning no apparent correlation to the straight line, up to 1 for perfect correlation. The slope of the closing prices line doesn’t matter, nor does the absolute price level, only how well they make a straight line.
Chande and Kroll suggested using a 14-day period, and that’s the default in Chart.
Next: Relative Strength Index, Previous: R-Squared Index, Up: Indicators [Index]
RAVI is a simple indicator showing whether a stock is trending. It calculates the percentage difference between current prices and older prices. Current prices are represented by a short SMA and the longer time frame by a long SMA (see Simple Moving Average). The defaults are 7 days and 65 days.
abs (SMA[short] - SMA[long]) RAVI = 100 * ---------------------------- SMA[long]
Next: Relative Volatility Index, Previous: RAVI, Up: Indicators [Index]
The Relative Strength Index (RSI) by J. Welles Wilder compares average upward close-to-close movement against all close-to-close movement, each smoothed by an EMA (see Exponential Moving Average).
For each day an upward or downward movement is calculated. On an up day
U = close[today] - close[yesterday] D = 0
or on a down day as follows (notice D is a positive amount),
U = 0 D = close[yesterday] - close[today]
The sequence of U values over time is averaged with an EMA (see Exponential Moving Average) and likewise the D values. The ratio is the “relative strength”,
EMA[N] of U RS = ----------- EMA[N] of D
This is turned into an index between 0 and 100,
1 RSI = 100 * ------ 1 + RS
This can also be written as follows, emphasising the way the RSI measures up movement as a proportion of the two up and down,
EMA[N] of U RSI = 100 * ----------------------------- (EMA[N] of U) + (EMA[N] of D)
Wilder recommended a smoothing period of N=14, and that’s the default in Chart. Note also that the period is interpreted by Wilder’s reckoning of EMA smoothing (see Wilder EMA period).
An index value of 70 is considered overbought and 30 oversold; those levels are shown as dashed lines. The principle is that after a large proportion of movement in one direction, a reaction the other way becomes likely. On the other hand it’s easy to see from the formula that a steady progressive trend (every day up, or every day down) can push the RSI to an extreme and hold it there.
The term “relative strength” also refers to a comparison between a stock and the overall market. This is sometimes called “relative strength comparative” to avoid confusion. This is unrelated to the relative strength and relative strength index described in this section.
See also CMO (see Chande Momentum Oscillator) which is an RSI with SMA smoothing, and TSI (see True Strength Index) which is an RSI with double-EMA smoothing.
The stochastic RSI is an N-day unsmoothed %K stochastic applied to the RSI line. The position of today’s RSI is expressed as a fraction 0 to 1 of its overall range (lowest to highest) in the past N days, the same N as used for the RSI calculation,
RSI[today] - RSI[Nday low] Stoch RSI = ------------------------------ RSI[Nday high] - RSI[Nday low]
Next: Random Walk Index, Previous: Relative Strength Index, Up: Indicators [Index]
The Relative Volatility Index (RVI) by Donald Dorsey is similar to the RSI (see Relative Strength Index) but where the RSI adds up price change amounts based on price direction, the RVI instead adds standard deviations (stddev, see Standard Deviation) based on price direction.
The standard deviation is over a past 10 days, then an EMA (see Exponential Moving Average) of deviations on up days is compared to all deviations, giving Dorsey’s original 1993 definition of RVI on closing prices.
S = Stddev[10 days] U = / S if price > prev price \ 0 otherwise EMA[W14] of U RVIorig = 100 * ------------- EMA[W14] of S
In 1995 Dorsey revised his idea, to apply RVI to the daily highs and daily lows and average the result, thus the following, which is the RVI used in Chart.
RVIorig of highs + RVIorig of lows RVI = ---------------------------------- 2
When a data source doesn’t provide high/low values just the closes are used, which ends up as Dorsey’s original. The stddev period of 10 days and the default EMA of 14 days are parameters (see View Style). The EMA period follows J. Welles Wilder’s reckoning (see Wilder EMA period), the same as an RSI.
Dorsey also smoothed the RVI with a 20-day least squares moving average (LSQMA, see Endpoint Moving Average) and called the result the inertia indicator. The 20-day smoothing period is a parameter.
An LSQMA can of course also be applied to an RVI directly, this can be good to see how it smooths. But inertia is offered as a separate selection since the smoothed line tends to follow the raw RVI quite closely, making it hard to see which is which.
Next: Stochastics, Previous: Relative Volatility Index, Up: Indicators [Index]
The random walk index (RWI) by E. Michael Poulos is a measure of how much price ranges over N days differ from what would be expected by a random walk (randomly going up and down). A bigger than expected range suggests a trend.
The index is in two parts, an RWI high which looks at upward movement and an RWI low for downward movement. In Chart RWI high is shown in green, and RWI low in red. The RWI high looks at terms like
High[today] - Low[K] 1 -------------------- * ------ Average TR [K] sqrt(K)
which is the move from the low K days ago up to today’s high, scaled by an average of the true range (TR, see True Range). Such terms are calculated for each number of days 2, 3, etc, up to the given RWI parameter N, and the maximum is the RWI. The first term for instance is today’s high less yesterday’s low, compared to a two-day average of the true range (yesterday’s true range and the day before’s). RWI low is similar, but using High[K] - Low[today] for the movement down from past high to today’s low.
The factor sqrt(K) compares the movement to a random walk. If a random walk has a 50% chance of going up by one, or a 50% chance of going down by one, then it can be shown that on average the distance travelled after K steps is sqrt(K). So the formula compares observed distance in average day’s steps compared to the sqrt(K) steps which would be the expected move if it were random. Thus 1 is when movement is apparently random, and higher or lower if some apparently non-random trend or lack of trend (respectively) appears to be present.
Next: TD Range Expansion Index, Previous: Random Walk Index, Up: Indicators [Index]
Stochastics are an oscillator and signal line described by George Lane based on each day’s close within the total trading range of past N days. This should not be confused with stochastic processes etc in mathematics, the two are unrelated.
The %K line is the close position within the past N-days trading range (highest high to lowest low) expressed as a percentage 0 to 100.
close - Nday low %K = 100 * -------------------- Nday high - Nday low
An extreme of 0 is reached for a close at the day’s low which is also a new N-day low. Likewise 100 for a close at the day’s high and a new N-day high. A signal line %D is added by smoothing %K with a simple moving average (see Simple Moving Average).
%D = SMA[D] of %K
The default periods in chart are 14 days for %K, and 3 days smoothing for %D. The %K line is drawn in red and the %D line in green.
%K and %D just described are called the “fast” stochastics. Corresponding “slow” stochastics are formed by smoothing %K with a simple moving average, and calculating %D from that smoothed series. The extra smoothing is the “slow days” parameter in Chart. The default is 0 for no slowing, a value of 3 is often used.
Incidentally, a value of 1 for the slowing is the same as no slowing, because a 1-period SMA of course doesn’t change the data.
Next: Trend Intensity Index, Previous: Stochastics, Up: Indicators [Index]
The range expansion index by Tom DeMark is designed to identify price exhaustion which may be the end of a move up or down.
The calculation is somewhat similar to an RSI (see Relative Strength Index) but looks at 2-day changes in the daily high and daily low values and smooths with a 5-day SMA (see Simple Moving Average). Changes are ignored if the current day in not either within or covering price action from 5 or 6 days ago. That test effectively holds the indicator around zero while prices are making breakaway runs.
DeMark regarded values above +45 or below -45 as overbought or oversold. Such a reading maintained for up to five days suggests a reversal, except that if it remains there for 6 or more days then the signal may be unreliable and trading should be avoided.
Next: Trendscore, Previous: TD Range Expansion Index, Up: Indicators [Index]
The trend intensity index (TII) by M. H. Pee measures the strength of a trend, by looking at what proportion of the past 30 days prices have been above or below the level of today’s 60-day simple moving average (see Simple Moving Average).
The 60-day average is as of today, not its past values at each of those past 30 days. For each day the deviation close-avg is taken. Positive amounts are up deviations, and negative amounts have the sign discarded and are down deviations.
up = / close - average if close > average \ 0 otherwise down = / average - close if average < close \ 0 otherwise
The percentage of the total up amounts out of total up and down amounts is then the trend intensity index,
total up TDI = 100 * --------------------- total up + total down
The extreme of 100 occurs when all closes in the past 30 days have been above today’s 60-day moving average level, and conversely the extreme of 0 when all below that level.
Visually the index is like looking at the area under the graph of prices. The area above a horizontal line at today’s 60-day moving average is the up amounts, the area below it is the down amounts, and the index is the fraction of the up out of the total.
Pee recommended entering trades when levels of 80 on the upside or 20 on the downside are reached. Lines are shown in Chart at those levels, as is 50 which is a neutral level.
The 60 and 30 days are configurable (see View Style). Any values are accepted, but it probably doesn’t make much sense to have the MA period (60) shorter than the deviations period (30). Certainly it makes no sense to have the two equal, because the up deviations are then always exactly 50% of the total.
Next: True Strength Index, Previous: Trend Intensity Index, Up: Indicators [Index]
Trendscore by Tushare Chande1 rates the strength of a trend. The calculation is quite simple, today’s close is compared to each close at 11 through 20 days ago and scored +1 for each it’s above and -1 if below.
Trendscore = if close >= close[11] then +1 else -1 + if close >= close[12] then +1 else -1 ... + if close >= close[12] then +1 else -1
The result is a rating between +10 or -10 for how many of those past days the current close is above. The high of +10 is when above all those past prices, or -10 when below them all. In a good trend up or down those extremes are often reached.
Next: TRIX, Previous: Trendscore, Up: Indicators [Index]
The true strength index (TSI) by William Blau2 is variation of the RSI (see Relative Strength Index) using two EMAs to smooth (see Exponential Moving Average), and a scale -100 to +100.
EMA[13] of EMA[25] of (close - prevclose) TSI = 100 * -------------------------------------------- EMA[13] of EMA[25] of abs(close - prevclose)
The TSI ranges from -100 up to +100 with positive values representing upward momentum and negative values downward momentum. Extreme values can be interpreted as overbought and oversold, as per the ordinary RSI.
The two EMA periods are parameters in Chart. If you set one of them to 1 then you get a plain RSI, though with a period by the usual reckoning whereas the RSI is in Wilder’s style (see Wilder EMA period), so for instance a TSI 27,1 is equivalent to an RSI 14.
See EMA of EMA for the effect of two EMAs. In general it leads to less weighting on the most recent data (the close-to-close differences in this case) than a single EMA.
See also CMO (see Chande Momentum Oscillator) using another different moving average for an RSI.
Next: Twiggs Money Flow, Previous: True Strength Index, Up: Indicators [Index]
TRIX by Jack Hutson shows the slope of a triple-smoothed N-day exponential moving average of closing prices. The slope is calculated as a percentage change between today and yesterday’s triple smoothed EMA values.
EMAofEMAofEMA[today] - EMAofEMAofEMA[yesterday] TRIX = 100 * --------------------------------------- EMAofEMAofEMA[yesterday]
A positive TRIX means the triple EMA is rising, suggesting a steady uptrend, in the same way any rising moving average does. Conversely a negative value means the triple EMA is falling, suggesting a downtrend. A cross through zero is a peak or trough in the triple EMA and may suggest a trend change. Chart draws a line at the zero level.
A triple smoothed EMA is prices smoothed with an EMA then those values smoothed again with another EMA and finally a third time with a further EMA (all of the same given period).
The result is quite different from a plain EMA. It’s still a weighted average of recent prices, but whereas a plain EMA is dominated by the most recent prices, a triple EMA spreads much more broadly, and the latest few days’ influence is in fact smaller than the peak weights (at about N-days back). The following graph shows the weights for N=10.
An EMA of EMA of EMA can also be viewed directly, in the upper prices window. This can be used to see the effect its smoothing has, and may help for adjusting the period N to get a desired smoothness versus responsiveness. Note the N-day period is set separately for the two windows.
Next: Ulcer Index, Previous: TRIX, Up: Indicators [Index]
http://www.incrediblecharts.com/technical/twiggs_money_flow.htm
The Twiggs money flow index by Colin Twiggs is a variation of the Chaikin money flow index (see Chaikin Money Flow) using true range so as to include gap moves, and using EMA smoothing (see Exponential Moving Average) to avoid jumps when a high volume day drops out of the calculation. The formula is
/ close - truelow \ EMA[N] of volume * | 2 * ------------------ - 1 | \ truehigh - truelow / Twiggs MF = -------------------------------------------------- EMA[N] of volume truehigh = max (high, prevclose) truelow = min (low, prevclose)
The default EMA period is 21 days, and the period is reckoned by J. Welles Wilder’s method (see Exponential Moving Average).
Next: Ultimate Oscillator, Previous: Twiggs Money Flow, Up: Indicators [Index]
http://www.tangotools.com/ui/ui.htm
The Ulcer Index by Peter Martin is a measure of downside volatility. For a given N-day period the closing prices are considered from oldest to newest and for each close a retracement percentage is calculated, relative to the highest close so far.
price[i] - maxprice so far R[i] = -------------------------- maxprice so far
So for instance a price $5.00 falling back to $4.50 is a -10% retracement. These are averaged with a quadratic mean, which has the effect of emphasising large drawdowns, but incorporating all into the result.
/ R[1]^2 + R[2]^2 + ... + R[N]^2 \ Ulcer = sqrt | ------------------------------ | \ N /
The index can be calculated over the kind of period one might hold an investment to calculate a measure of the ulcer-producing drawdowns suffered during that period.
Next: Vertical Horizontal Filter, Previous: Ulcer Index, Up: Indicators [Index]
The Ultimate Oscillator by Larry Williams is based on buying pressure as a proportion of true range over recent periods, with the past 7 days, 14 days and 28 days combined together.
The calculation starts with “buying pressure”, which is the amount by which the close is above the “true low” on a given day. The true low is the lesser of the given day’s trading low, and the previous close.
bp = close - min (low, prev close)
The true range (the same as in True Range) is the difference between the “true high” and the true low above. The true high is the greater of the given day’s trading high, and the previous close.
tr = max (high, prev close) - min (low, prev close)
The total buying pressure over the past 7 days is expressed as a fraction of the total true range over that period. If bp1 is today, bp2 yesterday, etc then
bp1 + bp2 + ... + bp7 avg7 = --------------------- tr1 + tr2 + ... + tr7
The same is done for the past 14 days and past 28 days and the resulting three values combined in proportions 4:2:1, and expressed as a percentage.
4 * avg7 + 2 * avg14 + avg28 UltOsc = 100 * ---------------------------- 4 + 2 + 1
The oscillator ranges from 0 to 100 and is interpreted in similar ways to other oscillators, with extremes indicating overbought or oversold conditions, and bullish or bearish divergence when new lows or highs fail to be made. Williams recommended levels of 70 and 30 for overbought or oversold and those are drawn by Chart.
Next: Volatility Ratio, Previous: Ultimate Oscillator, Up: Indicators [Index]
The vertical horizontal filter (VHF) by Adam White expresses the range of closing prices as a fraction of total close-to-close movement over a given N-day period.
highest close - lowest close VHF = ------------------------------------- total of each abs(close - prev close)
This ratio ranges from 0 to 1. The extreme of 1 means all close-to-close movement was in one direction, so they added up to the full range. A usual value is somewhere in the middle, reflecting a mixture of advances and retreats that occur even in a strong market.
Next: Williams %R, Previous: Vertical Horizontal Filter, Up: Indicators [Index]
The volatility ratio by Jack Schwager expresses the latest day’s trading range as a ratio of the overall range for a past N days. “True range” is used for both (see True Range), so gaps are included in the calculation.
For an N-day true range the close immediately preceding those N days is incorporated. Thus
TR Ndays = max(high[1], high[2], ... high[N], close[N+1]) - min(low[1], low[2], ... low[N], close[N+1])
The volatility ratio is then simply
TR VOLR = -------- TR Ndays
When a strong breakout from a tight range occurs the day’s range can be a sizeable fraction of the recent range. A level of 0.5 is considered significant and that’s drawn as a line in Chart.
Next: Williams Accumulation/Distribution, Previous: Volatility Ratio, Up: Indicators [Index]
Williams %R by Larry Williams is an oscillator showing the day’s close relative to the trading range of the last N days (the highest high to the lowest low). The scale is 0 for a close at the high, down to -100 for a close at the low.
Williams used a 10 day period, which is the default in Chart, and held that a close above -20 suggested an overbought condition, and below -80 suggests oversold. Those levels are shown as lines in Chart. Extremes are reached almost any time new N-day highs or lows are being made, so Williams’ conditions for trading were to buy an oversold when
or conversely to sell an overbought
Next: Zig Zag Indicator, Previous: Williams %R, Up: Indicators [Index]
The Williams Accumulation/Distribution index by Larry Williams forms a running total of “buying pressure” on up days, or “selling pressure” on down days.
/ (close - true low) if close > prev close WAD = WAD[prev] + | 0 if close = prev close \ (close - true high) if close > prev close
Buying pressure is represented by how far the close is above the true low (which is the lesser of today’s low or yesterday’s close). Selling pressure is represented by how far the close is below the true high (which is the greater of today’s high or yesterday’s close). Notice the difference “close - true high” is negative, so on down days WAD decreases.
The starting point (ie. the zero point) for the running total is arbitrary. In Chart it’s merely the segment of data first displayed.
Previous: Williams Accumulation/Distribution, Up: Indicators [Index]
The zig zag indicator is a simple way to ignore retracements less than a given X percentage.
When prices are rising, a line is drawn up from the previous low to the latest high. Pullbacks smaller than the given X% are ignored. The trend is only considered to have turned down when a point X% below that latest high is penetrated. Then a down line is drawn, it in turn continuing until a reversal of more than X% above the last lowe occurs. The result is a kind of zig zag, ignoring small moves, small according to the X%.
For the last line segment, at the right of the chart, the line is drawn to the high (or low) then horizontally to the edge of the screen. The horizontal part means there hasn’t yet been a retracement of X% from that level shown.
Next: Other Indicator Packages, Previous: Indicators, Up: Top [Index]
The following are algorithms and calculations shared among various indicators and averages.
• Linear Regression | ||
• Standard Deviation | ||
• True Range |
Next: Standard Deviation, Previous: Common Calculations, Up: Common Calculations [Index]
The “least squares” or “linear regression” algorithm produces a best fitting straight line through the middle of a set of N data points x1,y1, ..., xN,yN. In Chart this means a set of prices Y, and dates X (with non-trading days collapsed out).
For a possible fitted line L(X)= a + b*X, the vertical distance from the line to each point is squared, and a total deviation formed.
SumSquares = (y1 - L(x1))^2 + ... + (yN - L(xN))^2
The line parameters a and b are then chosen to make SumSquares as small as possible (hence the name “least squares”), and there’s just one line with that smallest SumSquares. The calculation is made easier if the X coordinates are shifted so that Mean(X)=0. With that the formulas for a and b are
y1 + ... + yN a = Mean Y = ------------- N x1*y1 + ... + xN*yN b = ------------------- x1^2 + ... xN^2
A least squares fit is “best” under certain mathematical assumptions: basically that the data points were a straight line to which normally distributed random amounts (positive or negative) have been added. Of course an underlying straight line is unlikely in market price data, or in economics generally, and in particular any cyclical component invalidates the assumptions. Even so the algorithm is quite widely used because it offers an objective basis for fitting a line.
The slope of the linear regression line, the b above, is sometimes called the regression coefficient. This is available as an indicator (Linear Regression Slope), to show how steep the fitted trend line is. The units are price change per day, which is negative for a downward sloping line. This may or may not be particularly useful so it’s under “Low Priority” in the indicator lists.
Standard error (stderr) is a statistical measure of how much values differ from an assumed underlying curve. It’s calculated as the quadratic mean of the vertical distances from each point to the curve.
Standard error from a linear regression line y=a+bx is
/ (y1 - (a+b*x1))^2 + ... + (yN - (a+b*xN))^2 \ Stderr = sqrt | ------------------------------------------- | \ N /
Notice the numerator is the same SumSquares which was minimized above. Standard error is similar to standard deviation (see Standard Deviation); but where stddev takes differences from a horizontal line (the Y mean), stderr here goes from the sloping linear regression line.
For reference, there’s no need to actually calculate the linear regression a and b, the stderr can be formed directly as
/ Covariance(X,Y)^2 \ Stderr = sqrt | Variance(Y) - ----------------- | \ Variance(X) /
where variance and covariance are as follows (and notice they simplify if X values are chosen to make Mean(X) zero),
Covariance X,Y = Mean (X*Y) - (Mean X) * (Mean Y) Variance X = Mean(X^2) - (Mean X)^2
Standard error from a linear regression like this is used as a channel width in Kirshenbaum Bands (see Kirshenbaum Bands). It can also be viewed directly as an indicator, but this is probably of limited use and for that reason is under “Low Priority” in the indicator lists.
Next: True Range, Previous: Linear Regression, Up: Common Calculations [Index]
Standard deviation (stddev) is a statistical measure of how much the values in a data set deviate from their average (mean). The stddev of a past N days is used in the calculation of Bollinger bands (see Bollinger Bands) and VIDYA and Variable Index Dynamic Average).
The raw stddev values can be shown in Chart as an indicator, to see what goes into those calculations. The values have little direct use though, and for that reason stddev is under “Low Priority” in the indicator lists.
For reference, the formula on prices p1 to pN is as follows. Each p[i]-m is the distance from the mean m, and those distances are averaged with a quadratic mean.
/ (p1-m)^2 + (p2-m)^2 + ... + (pN-m)^2 \ Stddev = sqrt ( ------------------------------------ ) \ N /
where m is the arithmetic mean
p1 + p2 + ... + pN m = ------------------ N
Also, for reference, the formula can be rearranged to the following form, “sum of the squares minus square of the sums”. This is what Chart uses, because a new term can be shifted into the sums without recalculating all N terms.
/ p1^2 + p2^2 + ... + pN^2 (p1 + p2 + ... + pN)^2 \ Stddev = sqrt ( ------------------------ - ---------------------- ) \ N N^2 /
Previous: Standard Deviation, Up: Common Calculations [Index]
True range is simply the day’s trading range (high to low) extended to include the previous day’s close, should that close be above the high or below the low.
true range = max(high, prev close) - min(low, prev close)
The effect is to include any “gap” left between yesterday’s close and today’s range. Quite often there’s no gap, but when overnight news makes prices jump it can be desirable in some algorithms to include that distance.
When a stock doesn’t have high/low values (some indexes for instance), then just close-to-close changes are used for true range, which may or may not be particularly useful.
Raw true range values are generally uninteresting, they’re merely used in other indicators. Wilder’s average true range (see Average True Range) uses smoothed true range values. Setting N=0 for the smoothing period can show the raw true range values if desired.
Next: Watchlist, Previous: Common Calculations, Up: Top [Index]
The indicators and averages from the following packages can be selected in Chart under the View Style dialog (see View Style).
Genius Trader is written in Perl and to install you only need to have its code
somewhere in your Perl module path (PERL5LIB
etc).
TA-Lib has a Perl interface generated by Swig. As of version 0.5 the interface is statically linked, so once compiled you only need to ensure the generated .pm and .so files are in your Perl module path.
Various indicators and averages are available both natively in Chart and in GT and/or TA-Lib too. Sometimes there’s subtle differences in the calculations near the start of data, but generally it’s just “more than one way to do it”.
Next: Intraday, Previous: Other Indicator Packages, Up: Top [Index]
The watchlist window shows latest quotes for stocks and commodities in the favourites list or other list. For example,
Symbol Bid/Offer Last Change High Low Volume When Notes ^GSPC / 1237.81 8.68 1228.33 1237.81 19m Thu GM / 34.91 -0.10 34.57 35.38 3.74m Thu BHP.AX 21.03/21.05 21.05 0.31 20.75 21.05 16m 10:45
The favourites list and other user lists can be edited. New symbols are added by entering a symbol in the text box and pressing Return or clicking “Insert”. If already present then the list scrolls to it. Move entries by dragging. Delete an entry by selecting it (click or space) and clicking the “Delete” button.
Clicking in the symbol column edits the symbol there. Double clicking in the other columns opens the main Chart display on that symbol. Mouse button-3 (usually the right-hand button) pops up a menu of other actions, including opening an intraday window (see Intraday).
The Refresh button downloads new quotes for the whole list, or the Refresh menu item for just that symbol. For some data sources Chart knows the trading times, and if there won’t be after hours changes then the quote locks to the end-of-day and is not re-downloaded until the next day.
The displayed list can be selected from a menu with Button-3 in the upper left notebook tab, where the current list name is displayed.
The “Symlists” tab shows the available lists. New lists can be created from there, or the names of existing user lists changed. Double clicking displays the list. Use the “Edit Name” button in the action area to change a name. The order of the lists controls how they appear in the Open dialog (see Open) and the sequence for Next and Prev in the main display. You can drag rows to re-order.
Each line is shown in green for a last trade higher than yesterday’s close, red for lower, or black unchanged. Blue means a refresh download is in progress.
The bid/offer column is normally shown as say ‘2.10/2.12’, but when the market is crossed (ie. bid higher than offer) an “x” is used to highlight this, for example ‘2.20x1.99’. What that means depends on the exchange, it might be a pre-open auction, or merely transient.
Volume is abbreviated ‘k’ for thousands, ‘m’ for millions, ‘b’ for billions. This is number of shares (or number of contracts), the same as shown in the main chart.
The “When” column shows just a time for today, just the day for the past week, or a full date prior to that. The timezone of the exchange is used. If the exchange is in your local zone then there’s no difference, but if you’re elsewhere then the exchange zone has the advantage that you can see where it is in the trading session, eg. early on, the close, etc. It’s easier to remember opening and closing times at the exchange than local equivalents (especially when daylight savings affects them).
Moving the mouse over an entry (and keeping it still) opens a tooltip box showing the stock name (if available), full date/times for the quote and last trade, and the exchange timezone location.
The View/Intraday menu entry (Ctrl-I) or the Intraday button in the watchlist (see Watchlist) opens an intraday image window for the current symbol, showing trading today, or so-far today.
Alas there are no longer any data sources with intraday images.
Next: Data Sources, Previous: Intraday, Up: Top [Index]
The Tools/Download menu entry opens the download dialog. Choose “What” to download, either all symbols, the favourites list, or a particular symbol.
The default is an update of all symbols. This is usually what’s wanted, to get all latest data.
Click on the “Start” button to begin. The top box is the subprocesses running, the middle box is the jobs running or queued, and errors are shown in the lower text window. If you’re offline the errors will usually be “host name lookup failure” or “network unreachable”. To abort select the job in the middle box and click on “Stop”.
The main chart display can be used while downloading, for instance to look immediately at the first few symbols updated while the rest are still going. Sometimes a database update can make the GUI block for a moment.
In the main Chart window, Ctrl-U starts an update download for the currently viewed chart. This is a good shortcut to grab new data for just one symbol. Download progress is shown in the main window statusbar (as well as the download dialog).
You can run ‘chart --download’ to do a command-line (non-GUI) download (see Invocation), for instance in a script perhaps when first going online, or at selected times. Progress messages are shown if the output is a terminal.
Care should be taken not to hammer the various data sources when automating downloads. Keep update attempts to times when there should be new data, and don’t retry endlessly.
Chart tries to know when to expect new data, and will do nothing in an update until then, but this is often imperfect. Public holidays (with no data) are not tracked, and it’s easy for a data source to be delayed unexpectedly.
Next: Internationalization, Previous: Download, Up: Top [Index]
Note that data from each of these sources is subject to various disclaimers and conditions for its use. A summary of the restrictions is noted in each section and links to the relevant parts of the web sites which should be consulted for full information.
The minimum terms for a source in Chart are that personal non-commercial use is permitted. In fact that’s usually all that’s permitted, and in particular further copying or distribution is generally not allowed (and this will include derived forms like the graphs drawn by Chart).
• Finance Quote | ||
• MLC Funds | ||
• New Zealand Stock Exchange | ||
• Reserve Bank of Australia | ||
• Thrift Savings Plan | ||
• Yahoo Finance |
Next: MLC Funds, Previous: Data Sources, Up: Data Sources [Index]
http://finance-quote.sourceforge.net
If you have the Finance::Quote
package installed then Chart can use it
for
In Chart, symbols are of the form ‘CODE.method.FQ’, for example common
stock fund “C” from the tsp method (Finance::Quote::TSP
)
C.tsp.FQ
Some of the FQ methods are covered by Chart natively (like US shares and indexes from Yahoo).
An FQ method not in the default builtin packages must be added to the
FQ_LOAD_QUOTELET
environment variable in the usual way. Chart also
tries a module of the same name as the method (case insensitive), so for
simple add-ons you might not need to configure anything.
Next: New Zealand Stock Exchange, Previous: Finance Quote, Up: Data Sources [Index]
MLC provides the following for its managed investment funds and superannuation funds,
The web site is for general information only, and only provided for residents of Australia, see the disclaimer at
http://www.mlc.com.au/mlc/im_considering_mlc/personal/footer_tools/advice_warning_and_disclaimer
Downloads use https
so Chart needs the secure sockets modules for LWP
(see Installing).
There are no apparent fund symbols so Chart uses the full fund and product name, with a ‘.MLC’ suffix. For example,
MLC Property Securities Fund,MasterKey Superannuation (Gold Star).MLC
This is a lot to type, but it can normally be cut and pasted from the full list at the following unit prices page (the page source has the fund and product names together),
https://www.mlc.com.au/masterkeyWeb/execute/FramesetUnitPrices?null
Next: Reserve Bank of Australia, Previous: MLC Funds, Up: Data Sources [Index]
NZX provides
Quotes, historical data and other information is obtained from Yahoo (see Yahoo Finance).
The NZX web site is for non-commercial or personal use only, see the terms at
In Chart NZX symbols follow the Yahoo convention, which is the exchange symbol and a ‘.NZ’ suffix, for example ‘FBU.NZ’. The NZX home page above has a search to lookup symbols (as does Yahoo).
Next: Thrift Savings Plan, Previous: New Zealand Stock Exchange, Up: Data Sources [Index]
The RBA provides
The RBA web site is for personal non-commercial use, with proper attribution. See the full terms at the following link. (Material is to be used in “unaltered form”, but the bank advised a long time ago that import into a charting program is permitted.)
Available currencies can be found on the exchange rates page
http://www.rba.gov.au/statistics/frequency/exchange-rates.html
In Chart symbols are ‘AUDXXX.RBA’ for the value of one Australian dollar in the currency ‘XXX’. Currently these are as follows
Symbol Currency AUDUSD.RBA US dollar AUDCNY.RBA Chinese renminbi AUDJPY.RBA Japanese yen AUDEUR.RBA Euro AUDKRW.RBA South Korean won AUDSGD.RBA Singapore dollar AUDNZD.RBA New Zealand dollar AUDGBP.RBA UK pound sterling AUDMYR.RBA Malaysian ringgit AUDTHB.RBA Thai baht AUDIDR.RBA Indonesian rupiah AUDINR.RBA Indian rupee AUDTWD.RBA Taiwanese dollar AUDVND.RBA Vietnamese dong AUDPNK.RBA Papua New Guinea kina AUDCHF.RBA Swiss franc AUDAED.RBA UAE dirham AUDCAD.RBA Canadian dollar
Plus the following for the RBA’s Trade Weighted Index for the Australian dollar, and the Australian dollar valued in the IMF’s Special Drawing Right basket of currencies.
Symbol Value AUDTWI.RBA Trade Weighted Index AUDSDR.RBA Special Drawing Right
The historical data page http://www.rba.gov.au/statistics/historical-data.html has XLS files going back to 1983 (and monthly to 1969) but the code for that in Chart has bit-rotted and the CSV is about half the size. The server offers compressed downloads (see Installing).
Next: Yahoo Finance, Previous: Reserve Bank of Australia, Up: Data Sources [Index]
The US government Thrift Savings Plan (TSP) provides
In Chart symbols are the fund code and a ‘.TSP’ suffix, for example ‘C.TSP’ for the common stock fund. The lifecycle funds are like ‘L2050.TSP’, and the lifecycle income fund is ‘LINCOME.TSP’.
Chart uses Finance::Quote::TSP
for the latest prices, so you must have
that module installed (it comes with the main Finance::Quote
).
Previous: Thrift Savings Plan, Up: Data Sources [Index]
Yahoo provides the following for many stock exchanges around the world (see Yahoo Exchanges),
Yahoo does not allow commercial use, see the terms of service at
Chart uses the Yahoo stock symbol conventions. For US stocks (AMEX, Nasdaq, NYSE) this is just the exchange symbol like ‘AAPL’ for Apple Computer. Stocks from elsewhere are the exchange symbol and a suffix, like ‘BMW.DE’ for BMW on Xetra. See Yahoo Exchanges, below, for those supported in Chart. Yahoo has a symbol lookup on most pages (and at the country-specific sites),
Some currency cross-rates are available, they take a form like ‘AUDUSD=X’ for the value of one Australian dollar in US dollars. Some spot metals prices are available similarly, for example ‘XAUUSD=X’ for Gold in US dollars (but perhaps only quotes, not historical).
Yahoo gives some information on market closing times, but Chart doesn’t make use of that. A day’s trading is written as daily data at 6pm (in the exchange’s timezone). Before that the current day is a latest quote. Downloads are slightly overlapped so that if 6pm was too soon then its prices are replaced on a subsequent download.
Currently quotes are only the current day’s open/high/low/last in the manner of the historical data, so without bid/offer.
Currently splits are not handled properly. Yahoo supplies historical prices adjusted for subsequent splits, but the intention in Chart is to have original prices and adjust on display if desired. The effect in the database is to make a bit of a mess with new downloads having new splits and past downloads not.
• Yahoo Exchanges |
Previous: Yahoo Finance, Up: Yahoo Finance [Index]
See also New Zealand Stock Exchange, which uses Yahoo and is described in its own section.
Suffix Country Exchange none USA American Stock Exchange (AMEX)
http://www.amex.comnone New York Stock Exchange (NYSE)
http://www.nyse.comnone NASDAQ
http://www.nasdaq.com‘.OB’ Over the Counter (OTC)
http://www.otcbb.com‘.BA’ Argentina Buenos Aires Stock Exchange (BCBA)
http://www.bcba.sba.com.ar‘.AX’ Australia Australian Stock Exchange
http://www.asx.com.au‘.VI’ Austria Wiener Borse
http://en.wienerborse.at‘.SA’ Brazil Sao Paolo Stock Exchange
http://www.bovespa.com.br‘.TO’ Canada Toronto Stock Exchange
http://www.tsx.com‘.V’ Toronto Stock Exchange Venture division
http://www.tsx.com‘.CO’ Denmark Copenhagen Stock Exchange
http://www.cse.dk‘.PA’ France Paris Stock Exchange (now part of Euronext)
http://www.euronext.com‘.BE’ Germany Berlin
http://www.berlinerboerse.de‘.BM’ Bremen
http://www.berlinerboerse.de‘.D’ Duesseldorf
http://www.boerse-duesseldorf.de‘.F’ Frankfurt ‘.H’ Hamburger Boerse
http://www.hamburger-boerse.de‘.HA’ Hanover ‘.MU’ Boerse Muenchen
http://www.boerse-muenchen.de‘.SG’ Stuttgart
http://www.boerse-stuttgart.de‘.DE’ XETRA ‘.HK’ Hong Kong Hong Kong Stock Exchange
http://www.hkex.com.hk‘.BO’ India Bombay Stock Exchange (BSE)
http://www.bseindia.com‘.CL’ Calcutta Stock Exchange (CSE)
http://www.cse-india.com‘.NS’ National Stock Exchange of India (NSE)
http://www.nseindia.com‘.JK’ Indonesia Jakarta Stock Exchange
http://www.idx.co.id/‘.MI’ Italy Italian Stock Exchange (Borsa Italiana)
http://www.borsaitaliana.it/homepage/homepage.en.htm‘.KS’ Korea Korean Stock Exchange
http://eng.krx.co.kr‘.KQ’ KOSDAQ
http://eng.krx.co.kr/abk/abk_d_025.jsp‘.KL’ Malaysia Kuala Lumpur Stock Exchange (KLSE)
http://www.klse.com.my‘.MX’ Mexico Mexico Stock Exchange (Bolsa Mexicana de Valores)
http://www.bmv.com.mx‘.AS’ Netherlands Amsterdam Stock Exchange (now part of Euronext) http://www.euronext.com ‘.NZ’ New Zealand New Zealand Stock Exchange
http://www.nzx.com
and see New Zealand Stock Exchange‘.OL’ Norway Oslo Stock Exchange
http://www.oslobors.no/ob_eng/‘.SI’ Singapore Singapore Stock Exchange (SGX)
http://www.sgx.com‘.BC’ Spain Barcelona Stock Exchange (Bolsa de Barcelona) http://www.borsabcn.es ‘.BI’ Bilbao Stock Exchange (Bolsa de Bilbao) http://www.bolsabilbao.es ‘.MA’ Madrid ‘.MC’ Madrid CATS ‘.MF’ Madrid fixed income ‘.ST’ Sweden Stockholm ‘.SW’ Switzerland Swiss Exchange (SWX)
http://www.swx.com‘.VX’ Virt-X (part of the SWX Group)
http://www.virt-x.com‘.TW’ Taiwan Taiwan Stock Exchange
http://www.tse.com.tw/docs/eng_home.htm‘.TWO’ Taiwan OTC ‘.L’ UK London Stock Exchange (LSE)
http://www.londonstockexchange.com‘.IL’ London Stock Exchange International Order Book (IOB)
http://www.londonstockexchange.com/iob
Next: Emacs, Previous: Data Sources, Up: Top [Index]
Chart is written in English, but has support for various localizations, selected by the usual system mechanisms.
Numbers are shown with the locale decimal point and thousands separator. You can also customize these in your init.pl.
Dates are shown in the locale format, or the usual C language default is ‘mm/dd/yy’. You can also customize this in your init.pl to set a personal preference, like the month as a name instead of a number.
Message strings are translated into the selected language, when a translation is available. Gtk has a good set of translations for the standard menus and dialogs, but for Chart specifics there’s almost nothing yet.
Names are downloaded in the selected or highest preference language, when there’s a choice. Weblinks to company information or the exchange home page likewise.
Annotation notes (see Annotations) can be entered with unicode characters.
On a typical Unix/POSIX-style system the locale is selected with the
LANG
environment variable, set to a language code and optional territory
and charset. For example US English,
LANG=en_US export LANG
This is often set by the system administrator, but you can do it yourself in your ~/.profile (see Bash Startup Files in Bash Features).
Language and country codes can be found in Language Codes in GNU
gettext
utilities, and Country Codes in GNU
gettext
utilities. Usually there’s only a few combinations
available on a system, run ‘locale -a’ to see them.
Additionally, on a GNU system the LANGUAGE
environment variable gives a
list of language preferences for message translations (see User influence on gettext
in GNU C Library
Reference Manual). For example to have Italian preferred, otherwise Spanish,
otherwise English,
LANGUAGE=it_IT:es:en export LANGUAGE
Chart looks at LANGUAGE
too (on all systems) for the preferred language
for stock and commodity names.
Next: Concept Index, Previous: Internationalization, Up: Top [Index]
http://www.gnu.org/software/emacs/
chartprog.el shows the Chart watchlist and gets quotes within Emacs (see The Emacs Editor in The Emacs Editor). It’s designed for Emacs 21 and higher, and also works with XEmacs 21 if you have the UTF-8 coding system (see below).
The Debian package has the following setups already. Otherwise, the best way to use chartprog.el is with autoloads for the commands. chartprog-loaddefs.el is a small file which sets this up. Add the following to your .emacs file (see The Init File ~/.emacs in The Emacs Editor),
(require 'chartprog-loaddefs)
The build system currently doesn’t install chartprog.el into
site-lisp, so you should copy it and chartprog-loaddefs.el to
somewhere in your load-path
(see Libraries of Lisp
Code for Emacs in The Emacs Editor).
M-x chart-watchlist displays the Favourites list in a buffer. Key a adds a symbol. C-k and C-y kill and yank symbols. g refreshes the quotes. L selects a different list (like the Alerts list). The usual C-h m mode help shows other key bindings.
Chart communicates changes to the lists between the Emacs display and a running Chart GUI. So if you have both open then changes in one are reflected in the other a moment later.
M-x chart-quote displays a quote for a given symbol in the message area. It prompts for the symbol with default a symbol at point. Tab completion is available (see Completion in The Emacs Editor) using the database symbols, favourites list, and previously requested symbols.
M-x chart-quote-at-point displays a quote for the symbol at point, without prompting.
The language, date formats, etc, follow the Chart locale selection described in Internationalization. Emacs M-x set-language-environment and other Emacs setups don’t influence the display.
UTF-8 is used in Emacs, the same as in the Gtk GUI display. This is easiest to implement, and should mean whatever is seen in the GUI can be seen in Emacs.
If you use an Asian locale then you probably know Emacs 21 has limited support for Asian parts of UTF-8. The typical symptom is ‘\207’, ‘\221’ etc in the display. Install the MULE-UCS package to add to the builtin characters: http://www.m17n.org
If you use XEmacs 21 you probably know it has no builtin UTF-8. To run
chartprog.el
you must get one of the add-ons providing that. MULE-UCS
is recommended (http://www.m17n.org), and chartprog.el
will
attempt to load it automatically.
Return the latest price for symbol (a string) from Chart. If there’s no
information available (an unknown stock, not online, nothing cached, etc) the
return is nil
.
(chart-latest "F") ⇒ 19.55
field is a lisp symbol for what data to return. The default is
last
which is the last traded price. The fields are
name string or nil bid offer \ prices or nil open high low last change / quote-date last-date string like "2012-12-31", or nil quote-time last-time string like "16:59:59", or nil volume number or nil note string or nil
Which fields actually have data depends on the data source. name
is
the stock or commodity name as a string, or nil
if not available.
Dates and times are in the timezone of the symbol. note
is a string
with extra notes, such as ex-dividend or limit up, or nil
if no other
notes.
(chart-latest "F" 'volume) ⇒ 10492900
scale (an integer) is how many places to move the decimal point down. For example if SCALE is 2 then price 1.23 is returned as 123. This is good for working in cents when quotes are in dollars, etc.
chart-latest
doesn’t download new quotes but just returns existing
data.
A call (thing-at-point 'chart-symbol)
gives the Chart symbol at point
(see Examining Buffer Contents in GNU Emacs Lisp Reference Manual). Note that you must (require
'chartprog)
before using this, it’s not autoloaded.
chart-latest
above can be used in SES (see Simple Emacs
Spreadsheet in Simple Emacs
Spreadsheet) expressions to include prices in a portfolio etc. See
emacs/example.ses in the Chart sources for a sample spreadsheet doing
this.
Since chart-latest
doesn’t download new data an
M-x ses-recalculate-all just shows existing downloaded quotes
(see Cell formulas in SES: Simple
Emacs Spreadsheet).
M-x chart-ses-refresh does a combination ses-recalculate-all
and
download of Chart prices used. A first recalculate records calls to
chart-latest
for which prices are used in the spreadsheet, they’re
downloaded, then a second recalculate applies the new data. (Further rounds
of download and recalculate are done as necessary if conditionals in
expressions use yet more symbols.)
Next: Function Index, Previous: Emacs, Up: Top [Index]
Jump to: | !
%
-
.
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |
---|
Jump to: | !
%
-
.
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |
---|
Previous: Concept Index, Up: Top [Index]
Jump to: | C |
---|
Index Entry | Section | ||
---|---|---|---|
| |||
C | |||
chart-latest : | Emacs | ||
: | Emacs | ||
: | Emacs | ||
: | Emacs | ||
: | Emacs | ||
|
Jump to: | C |
---|
Rating Trend Strength, Technical Analysis of Stocks and Commodities magazine, 11:9 (382-386)
The True Strength Index, Technical Analysis of Stocks and Commodities magazine, November 1991, and Trading With the True Strength Index, May 1992.
Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2014, 2015, 2016, 2017, 2019, 2023 Kevin Ryde
Chart is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.