App-Chart
view release on metacpan or search on metacpan
doc/chart.texi view on Meta::CPAN
@c document, not a particular section.
@c
@c Doesn't come out looking great in html, but mung-html.scm takes care of
@c that.
@c
@macro CHARTreftop{info,title}
@ref{Top,\title\,\title\,\info\,\title\}
@end macro
@macro CHARTpxreftop{info,title}
@pxref{Top,\title\,\title\,\info\,\title\}
@end macro
@c
@iftex
@unmacro CHARTreftop
@macro CHARTreftop{info,title}
@i{\title\}
@end macro
@unmacro CHARTpxreftop
@macro CHARTpxreftop{info,title}
see @i{\title\}
@end macro
@end iftex
@c Usage: @CHARTureflong{url, urlsplit}
@c
@c Give an @uref{} for a long url. The url is the raw url, and the urlsplit
@c part is with some line breaks at judicious places. The split format is
@c used in formats which don't handle long lines well.
@c
@c Actually, this doesn't work very well. If you use a split form for tex
@c then there's no link in the pdf. Hmm.
@c
@ifinfo
@macro CHARTureflong{url,urlsplit}
@uref{\url\}
@end macro
@set CHARTureflongdefined
@end ifinfo
@c
@ifhtml
@macro CHARTureflong{url,urlsplit}
@uref{\url\}
@end macro
@set CHARTureflongdefined
@end ifhtml
@c
@iftex
@macro CHARTureflong{url,urlsplit}
@indicateurl{\urlsplit\}
@end macro
@set CHARTureflongdefined
@end iftex
@c
@ifclear CHARTureflongdefined
@alias CHARTureflong=uref
@end ifclear
@c @cross{} is a \times symbol in tex, or an "x" in info.
@c In tex it works inside or outside $ $.
@tex
\gdef\cross{\ifmmode\times\else$\times$\fi}
@end tex
@ifnottex
@macro cross
x
@end macro
@end ifnottex
@c @alph{} is \alpha symbol in tex, or an "alpha" in info.
@c In tex it works inside or outside $ $.
@tex
\gdef\alph{\ifmmode\alpha\else$\alpha$\fi}
@end tex
@ifnottex
@macro alph
alpha
@end macro
@end ifnottex
@c @m{T,N} is $T$ in tex or @math{N} otherwise.
@iftex
@macro m {T,N}
@tex$\T\$@end tex
@end macro
@end iftex
@ifnottex
@macro m {T,N}
@math{\N\}
@end macro
@end ifnottex
@c @ms{V,N} is a subscript $V_N$ in tex or just vn otherwise.
@iftex
@macro ms {V,N}
@tex$\V\_{\N\}$@end tex
@end macro
@end iftex
@ifnottex
@macro ms {V,N}
\V\\N\
@end macro
@end ifnottex
@c @nicode{S} is plain S in info, or @code{S} elsewhere. This can be used
@c when the quotes that @code{} gives in info aren't wanted, but the
@c fontification in tex or html is wanted. @alias is used rather than @macro
@c because backslashes don't work properly in an @macro.
@ifinfo
@alias nicode=asis
@end ifinfo
@ifnotinfo
@alias nicode=code
@end ifnotinfo
@c @nisamp{S} is plain S in info, or @samp{S} elsewhere. This can be used
@c when the quotes that @samp{} gives in info aren't wanted, but the
@c fontification in tex or html is wanted. @alias is used rather than @macro
@c because backslashes don't work properly in an @macro.
@ifinfo
@alias nisamp=asis
@end ifinfo
@ifnotinfo
@alias nisamp=samp
@end ifnotinfo
@c @iquot{S} is italics in TeX, HTML, etc, or quotes in info. This is meant
@c for the names of books etc.
@ifinfo
@macro iquot {S}
``\S\''
@end macro
@end ifinfo
doc/chart.texi view on Meta::CPAN
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.
@c ---------------------------------------------------------------------------
@node On-Balance Volume, Negative Volume Index, Money Flow Index, Indicators
@section On-Balance Volume
@cindex On-balance volume
@cindex OBV
@cindex Volume, on-balance
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 @ms{p,1} is
today's close and @ms{p,2} is yesterday's, the formula is simply
@tex
$$ OBV = OBV_{prev} + \left\{ \matrix{ v_1 & \mathop{\rm if} \; p_1 > p_2 \cr
0 & \mathop{\rm if} \; p_1 = p_2 \cr
-v_1 & \mathop{\rm if} \; p_1 < p_2 \cr
} \right. $$
@end tex
@ifnottex
@example
/ v1 if p1 > p2
|
OBV = OBVprev + | 0 if p1 = p2
|
\ - v1 if p1 > p2
@end example
@end ifnottex
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 @ref{Price and Volume Trend}, and @ref{Accumulation/Distribution},
which accumulate volume in similar ways.
@c ---------------------------------------------------------------------------
@node Negative Volume Index, Polarized Fractal Efficiency, On-Balance Volume, Indicators
@section Negative Volume Index
@cindex Negative volume index
@cindex NVI
@cindex Index, negative volume
@cindex Fosback, Norman
The Negative Volume Index (NVI) and Positive Volume Index (PVI) by Norman
Fosback (@uref{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.
@tex
$$ NVI = NVI_{prev} \times \left\{ \matrix{
close \over close_{prev} & \mathop{\rm if} \; vol < vol_{prev} \cr
1 & \mathop{\rm if} \; vol \ge vol_{prev} \cr
} \right. $$
@end tex
@ifnottex
@example
/ close
| ----------- if vol < vol[prev]
NVI = NVI[prev] * | close[prev]
|
\ 1 if vol >= vol[prev]
@end example
@end ifnottex
@tex
$$ PVI = PVI_{prev} \times \left\{ \matrix{
close \over close_{prev} & \mathop{\rm if} \; vol > vol_{prev} \cr
1 & \mathop{\rm if} \; vol \le vol_{prev} \cr
} \right. $$
@end tex
@ifnottex
@example
/ close
| ----------- if vol > vol[prev]
PVI = PVI[prev] * | close[prev]
|
\ 1 if vol <= vol[prev]
@end example
@end ifnottex
The fraction @m{close/close_{prev}, close/close[prev]} means that the indices
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.
@c FIXME Such an average can be viewed in
@c Chart by selecting an SMA (@pxref{Simple Moving Average}) of 260 days (one
@c year's worth of weekdays).
@c ---------------------------------------------------------------------------
@node Polarized Fractal Efficiency, Pretty Good Oscillator, Negative Volume Index, Indicators
@section Polarized Fractal Efficiency
@cindex Polarized fractal efficiency
@cindex PFE
@cindex Fractal, polarized efficiency indicator
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
doc/chart.texi view on Meta::CPAN
@ifnottex
@example
up = / close - average if close > average
\ 0 otherwise
down = / average - close if average < close
\ 0 otherwise
@end example
@end ifnottex
The percentage of the total up amounts out of total up and down amounts is
then the trend intensity index,
@tex
$$ RVIorig = 100 \times { total \; up
\over total \; up + total \; down } $$
@end tex
@ifnottex
@example
total up
TDI = 100 * ---------------------
total up + total down
@end example
@end ifnottex
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 (@pxref{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.
@c ---------------------------------------------------------------------------
@node Trendscore, True Strength Index, Trend Intensity Index, Indicators
@section Trendscore
@cindex Trendscore
@cindex Chande, Tushar
Trendscore by Tushare Chande@footnote{@iquot{Rating Trend Strength}, Technical
Analysis of Stocks and Commodities magazine, 11:9 (382-386)} 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 @math{+1} for each
it's above and @math{-1} if below.
@tex
$$ Trendscore = \left\{
\matrix{
if\,close \ge close[11]\; then\; +1\; else \;-1 \cr
+\, if\,close \ge close[12]\; then\; +1\; else \;-1 \cr
\cdots \cr
+\, if\,close \ge close[20]\; then\; +1\; else \;-1 \cr
} \right. $$
$$ Trendscore = 100 \times { TripleEMA[today] - TripleEMA[yesterday]
\over TripleEMA[yesterday] } $$
@end tex
@ifnottex
@example
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
@end example
@end ifnottex
The result is a rating between @math{+10} or @math{-10} for how many of those
past days the current close is above. The high of @math{+10} is when above
all those past prices, or @math{-10} when below them all. In a good trend up
or down those extremes are often reached.
@c ---------------------------------------------------------------------------
@node True Strength Index, TRIX, Trendscore, Indicators
@section True Strength Index
@cindex True strength index
@cindex Index, True strength
@cindex TSI
@cindex Blau, William
The true strength index (TSI) by William Blau@footnote{@iquot{The True
Strength Index}, Technical Analysis of Stocks and Commodities magazine,
November 1991, and @iquot{Trading With the True Strength Index}, May 1992.} is
variation of the RSI (@pxref{Relative Strength Index}) using two EMAs to
smooth (@pxref{Exponential Moving Average}), and a scale @math{-100} to
@math{+100}.
@tex
$$ TSI = 100 \times { EMA[13]\; of\; EMA[25]\; of\; (close - prevclose )
\over EMA[13]\; of\; EMA[25]\; of\; \left| close - prevclose \right| } $$
@end tex
@ifnottex
@example
EMA[13] of EMA[25] of (close - prevclose)
TSI = 100 * --------------------------------------------
EMA[13] of EMA[25] of abs(close - prevclose)
@end example
@end ifnottex
The TSI ranges from @math{-100} up to @math{+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 (@pxref{Wilder EMA period}), so for instance a TSI
27,1 is equivalent to an RSI 14.
See @ref{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.
( run in 1.875 second using v1.01-cache-2.11-cpan-75ffa21a3d4 )