App-Chart

 view release on metacpan or  search on metacpan

lib/App/Chart/doc/chart.html  view on Meta::CPAN

<li><a href="#Moving-Median">Moving Median</a></li>
<li><a href="#Regularized-Exponential-Moving-Average">Regularized Exponential Moving Average</a></li>
<li><a href="#Sine-Weighted-Moving-Average">Sine Weighted Moving Average</a></li>
<li><a href="#T3-Moving-Average">T3 Moving Average</a></li>
<li><a href="#Triangular-Moving-Average">Triangular Moving Average</a></li>
<li><a href="#Variable-Index-Dynamic-Average">Variable Index Dynamic Average</a></li>
<li><a href="#Volume-Weighted-Moving-Average">Volume Weighted Moving Average</a></li>
<li><a href="#Zero_002dLag-Exponential-Moving-Average">Zero-Lag Exponential Moving Average</a></li>
</ul>
<hr>
<div class="section-level-extent" id="Simple-Moving-Average">
<div class="nav-panel">
<p>
Next: <a href="#Exponential-Moving-Average" accesskey="n" rel="next">Exponential Moving Average</a>, Previous: <a href="#Averages" accesskey="p" rel="prev">Averages</a>, Up: <a href="#Averages" accesskey="u" rel="up">Averages</a> &nbsp; [<a href="#Co...
</div>
<h3 class="section" id="Simple-Moving-Average-1"><span>8.1 Simple Moving Average<a class="copiable-link" href="#Simple-Moving-Average-1"> &para;</a></span></h3>
<a class="index-entry-id" id="index-Simple-moving-average"></a>
<a class="index-entry-id" id="index-SMA"></a>
<a class="index-entry-id" id="index-Average_002c-simple"></a>
<a class="index-entry-id" id="index-Moving-average_002c-simple"></a>

<p>An N-day simple moving average is the unweighted average (mean) of the past N
days.  So if p1 is today&rsquo;s closing price, p2 yesterday&rsquo;s, etc,
then the SMA for today is
</p>
<div class="example">
<pre class="example-preformatted">      p1 + p2 + ... + pN
SMA = ------------------
              N
</pre></div>

<p>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 <a class="pxref" href="#Exponential-Moving-Average">Exponential Moving Average</a>) and WMA (see <a class="pxref" href="#Weighted-Moving-Average">Weighted Moving Average</a>) approaches address that sort of lag.
</p>
<p>See also <a class="ref" href="#Momentum-and-Rate-of-Change">Momentum</a>, which show the slope of the SMA.
</p>

<hr>
</div>
<div class="section-level-extent" id="Exponential-Moving-Average">
<div class="nav-panel">
<p>
Next: <a href="#Weighted-Moving-Average" accesskey="n" rel="next">Weighted Moving Average</a>, Previous: <a href="#Simple-Moving-Average" accesskey="p" rel="prev">Simple Moving Average</a>, Up: <a href="#Averages" accesskey="u" rel="up">Averages</a> ...
</div>
<h3 class="section" id="Exponential-Moving-Average-1"><span>8.2 Exponential Moving Average<a class="copiable-link" href="#Exponential-Moving-Average-1"> &para;</a></span></h3>
<a class="index-entry-id" id="index-Exponential-moving-average"></a>
<a class="index-entry-id" id="index-EMA"></a>
<a class="index-entry-id" id="index-Average_002c-exponential"></a>
<a class="index-entry-id" id="index-Moving-average_002c-exponential"></a>

<p>An N-day exponential moving average (EMA) is a weighted average of today&rsquo;s
close and the preceding EMA value.  The weight for today&rsquo;s close is a
smoothing factor alpha, where <em class="math">alpha=2/(N+1)</em>.
</p>
<div class="example">
<pre class="example-preformatted">EMA[today] = alpha * close + (1-alpha) * EMA[yesterday]
</pre></div>

<p>The formula can also be written as follows, showing how the average moves
towards today&rsquo;s close by an alpha fraction of the distance from the old EMA
to the new close.
</p>
<div class="example">
<pre class="example-preformatted">EMA[today] = EMA[yesterday] + alpha * (close + EMA[yesterday])
</pre></div>

<p>Expanding out gives a power series with successively decreasing weight for
each day&rsquo;s price.  Writing <em class="math">f=1-alpha</em> and with p1 today&rsquo;s
closing price, p2 yesterday&rsquo;s, etc, then
</p>
<div class="example">
<pre class="example-preformatted">      p1 + p2*f + p3*(f^2) + p4*(f^3) + ...
EMA = -------------------------------------
       1 +   f  +    f^2   +    f^3   + ...
</pre></div>

<p>This is an infinite sum, but <em class="math">f</em> is less than 1 so each successive weight
<em class="math">f^k</em> is smaller and smaller, soon becoming negligible.  The most recent
<em class="math">N</em> days make up about 86.5% of the total.  The following graph shows how
the weights decrease for <em class="math">N=10</em>.
</p>
<br>
<div class="center"><img class="image" src="chart-ema-weights.png" alt="EMA weights graph">
</div>
<p>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 <a class="pxref" href="#Simple-Moving-Average">Simple Moving Average</a>).
</p>
<a class="index-entry-id" id="index-EMA-period-by-Wilder"></a>
<a class="index-entry-id" id="index-Wilder-EMA-period"></a>
<a class="index-entry-id" id="index-Wilder_002c-J_002e-Welles"></a>
<a class="anchor" id="Wilder-EMA-period"></a><ul class="mini-toc">
<li><a href="#J_002e-Welles-Wilder" accesskey="1">J. Welles Wilder</a></li>
</ul>
<div class="subsection-level-extent" id="J_002e-Welles-Wilder">
<h4 class="subsection"><span>8.2.1 J. Welles Wilder<a class="copiable-link" href="#J_002e-Welles-Wilder"> &para;</a></span></h4>

<p>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
</p>
<div class="example">
<pre class="example-preformatted">              1           13
EMA[today] = -- * close + -- * EMA[yesterday]
             14           14
</pre></div>

<p>This is the same as the formula above, just a different <em class="math">f</em> factor.  When
Wilder gives &ldquo;W&rdquo; days, the equivalent &ldquo;N&rdquo; above is <em class="math">2*W-1</em>, so say
14 becomes 27.  This is also sometimes called a &ldquo;modified moving average&rdquo;.
</p>
<p>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 <a class="pxref" href="#Average-True-Range">Average True Range</a>, <a class="ref" href="#Directional-Movement-Index">Directional Movement Index</a>, and
<a class="ref" href="#Relative-Strength-Index">Relative Strength Index</a>).
</p>

<hr>
</div>
</div>
<div class="section-level-extent" id="Weighted-Moving-Average">
<div class="nav-panel">
<p>
Next: <a href="#Double-and-Triple-Exponential-Moving-Average" accesskey="n" rel="next">Double and Triple Exponential Moving Average</a>, Previous: <a href="#Exponential-Moving-Average" accesskey="p" rel="prev">Exponential Moving Average</a>, Up: <a h...
</div>
<h3 class="section" id="Weighted-Moving-Average-1"><span>8.3 Weighted Moving Average<a class="copiable-link" href="#Weighted-Moving-Average-1"> &para;</a></span></h3>
<a class="index-entry-id" id="index-Weighted-moving-average"></a>
<a class="index-entry-id" id="index-WMA"></a>
<a class="index-entry-id" id="index-Average_002c-weighted"></a>
<a class="index-entry-id" id="index-Moving-average_002c-weighted"></a>

<p>An N-day weighted moving average is an average of today&rsquo;s close and preceding
closes, with weighting factor N for today, <em class="math">N-1</em> for yesterday,
<em class="math">N-2</em> for the day before, etc.  The influence of past data thereby
decreases with its age, down to nothing beyond N days.
</p>
<p>The formula is as follows, with p1 for today&rsquo;s closing price, p2
yesterday&rsquo;s, etc.
</p>
<div class="example">
<pre class="example-preformatted">      N * p1 + (N-1) * p2 + (N-2) * p3 + ... + 2 * p[N-1] + pN
WMA = --------------------------------------------------------
        N    +    N-1     +     N-2    + ... +    2       + 1
</pre></div>

<p>Like the EMA (see <a class="pxref" href="#Exponential-Moving-Average">Exponential Moving Average</a>), 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 <a class="pxref" href="#Simple-Moving-Average">Simple Moving Average</a>).
The following graph shows how the weights decrease for <em class="math">N=15</em>.
</p>
<br>
<div class="center"><img class="image" src="chart-wma-weights.png" alt="WMA weights graph">
</div>

<hr>
</div>
<div class="section-level-extent" id="Double-and-Triple-Exponential-Moving-Average">
<div class="nav-panel">
<p>
Next: <a href="#Endpoint-Moving-Average" accesskey="n" rel="next">Endpoint Moving Average</a>, Previous: <a href="#Weighted-Moving-Average" accesskey="p" rel="prev">Weighted Moving Average</a>, Up: <a href="#Averages" accesskey="u" rel="up">Averages<...
</div>
<h3 class="section" id="Double-and-Triple-Exponential-Moving-Average-1"><span>8.4 Double and Triple Exponential Moving Average<a class="copiable-link" href="#Double-and-Triple-Exponential-Moving-Average-1"> &para;</a></span></h3>
<a class="index-entry-id" id="index-Double-exponential-moving-average"></a>
<a class="index-entry-id" id="index-Average_002c-double-exponential"></a>
<a class="index-entry-id" id="index-Moving-average_002c-double-exponential"></a>
<a class="index-entry-id" id="index-DEMA"></a>
<a class="index-entry-id" id="index-Triple-exponential-moving-average"></a>
<a class="index-entry-id" id="index-Average_002c-triple-exponential"></a>
<a class="index-entry-id" id="index-Moving-average_002c-triple-exponential"></a>
<a class="index-entry-id" id="index-TEMA"></a>

<p>The double exponential moving average (DEMA) and triple exponential moving
average (TEMA) are combination EMAs (see <a class="pxref" href="#Exponential-Moving-Average">Exponential Moving Average</a>) by
Patrick Mulloy, designed to track recent prices even more closely than the
plain EMA.  The calculation for DEMA is
</p>
<div class="example">
<pre class="example-preformatted">DEMA = 2*EMA[N] - EMAofEMA[N]
</pre></div>

<p>and for TEMA,
</p>
<div class="example">
<pre class="example-preformatted">TEMA = 3*EMA[N] - 3*EMAofEMA[N] + EMAofEMAofEMA[N]
</pre></div>

<p>Both are &ldquo;overweight&rdquo; 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 <em class="math">N=15</em>.
</p>
<br>
<div class="center"><img class="image" src="chart-dema-weights.png" alt="DEMA weights graph">
</div>
<p>And the following is TEMA for the same <em class="math">N=15</em>.
</p>
<br>
<div class="center"><img class="image" src="chart-tema-weights.png" alt="TEMA weights graph">
</div>

<hr>
</div>
<div class="section-level-extent" id="Endpoint-Moving-Average">
<div class="nav-panel">
<p>
Next: <a href="#Fractal-Adaptive-Moving-Average" accesskey="n" rel="next">Fractal Adaptive Moving Average</a>, Previous: <a href="#Double-and-Triple-Exponential-Moving-Average" accesskey="p" rel="prev">Double and Triple Exponential Moving Average</a>...
</div>
<h3 class="section" id="Endpoint-Moving-Average-1"><span>8.5 Endpoint Moving Average<a class="copiable-link" href="#Endpoint-Moving-Average-1"> &para;</a></span></h3>
<a class="index-entry-id" id="index-Endpoint-moving-average"></a>
<a class="index-entry-id" id="index-EPMA"></a>
<a class="index-entry-id" id="index-Least-squares-moving-average"></a>
<a class="index-entry-id" id="index-LSQMA"></a>
<a class="index-entry-id" id="index-Average_002c-endpoint"></a>
<a class="index-entry-id" id="index-Average_002c-least-squares"></a>
<a class="index-entry-id" id="index-Moving-average_002c-endpoint"></a>
<a class="index-entry-id" id="index-Moving-average_002c-least-squares"></a>
<a class="index-entry-id" id="index-Time-series-forecast"></a>
<a class="index-entry-id" id="index-TSF"></a>
<a class="index-entry-id" id="index-Sharp_002c-Joe"></a>
<a class="index-entry-id" id="index-Average_002c-modified"></a>
<a class="index-entry-id" id="index-Moving-average_002c-modified"></a>
<a class="index-entry-id" id="index-Modified-moving-average"></a>

<p>The endpoint moving average (EPMA) establishes an average price by fitting a
least squares straight line (see <a class="pxref" href="#Linear-Regression">Linear Regression</a>) 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.
</p>
<p>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&rsquo;s &ldquo;modified moving average&rdquo; is the same thing too.
</p>
<p>The formula ends up being a straightforward weighted average of past N prices,
with weights going from <em class="math">2*N-1</em> down to <em class="math">-N+2</em>.  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&rsquo;s
close, p2 yesterdays, etc, then
</p>
<div class="example">
<pre class="example-preformatted">       (2*N-1)*p[1] + (2*N-4)*p[2] + ... + (-N+2)*p[N]
EPMA = -----------------------------------------------
        2*N-1       +  2*N-4       + ... +  -N+2
</pre></div>

<p>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 <em class="math">N=15</em>.
</p>
<br>
<div class="center"><img class="image" src="chart-epma-weights.png" alt="Endpoint MA weights graph">
</div>
<p>The negatives mean the average is &ldquo;overweight&rdquo; 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.
</p>
<p>It&rsquo;s interesting to compare the EPMA with a plain SMA (see <a class="pxref" href="#Simple-Moving-Average">Simple Moving Average</a>).  An SMA effectively draws a horizontal line through the past N days
prices (their mean), whereas the EPMA draws a sloping line.
</p>
<p>The inertia indicator (see <a class="pxref" href="#Inertia">Inertia</a>) uses the EPMA.
</p>


<hr>
</div>
<div class="section-level-extent" id="Fractal-Adaptive-Moving-Average">
<div class="nav-panel">
<p>
Next: <a href="#Guppy-Multiple-Moving-Average" accesskey="n" rel="next">Guppy Multiple Moving Average</a>, Previous: <a href="#Endpoint-Moving-Average" accesskey="p" rel="prev">Endpoint Moving Average</a>, Up: <a href="#Averages" accesskey="u" rel="u...
</div>
<h3 class="section" id="Fractal-Adaptive-Moving-Average-1"><span>8.6 Fractal Adaptive Moving Average<a class="copiable-link" href="#Fractal-Adaptive-Moving-Average-1"> &para;</a></span></h3>
<a class="index-entry-id" id="index-Fractal-adaptive-moving-average"></a>
<a class="index-entry-id" id="index-FRAMA"></a>
<a class="index-entry-id" id="index-Average_002c-fractal-adaptive"></a>
<a class="index-entry-id" id="index-Moving-average_002c-fractal-adaptive"></a>

<p><a class="uref" href="http://www.mesasoftware.com/technicalpapers.htm">http://www.mesasoftware.com/technicalpapers.htm</a> <br>
<a class="uref" href="http://www.mesasoftware.com/Papers/FRAMA.pdf">http://www.mesasoftware.com/Papers/FRAMA.pdf</a>
</p>
<a class="index-entry-id" id="index-Ehlers_002c-John"></a>
<p>The fractal adaptive moving average (FRAMA) by John Ehlers is an exponential
style moving average (see <a class="pxref" href="#Exponential-Moving-Average">Exponential Moving Average</a>) with an alpha
smoothing factor that varies according to a fractal dimension calculated over
the past N day&rsquo;s prices.
</p>
<p>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&rsquo;t overlap but add up to make the overall N day range.
</p>
<p>The FRAMA alpha factor and the fractal dimension value are available in the
lower indicator window, to see where they&rsquo;re big or small, under &ldquo;Low
Priority&rdquo; near the end of the indicators lists.
</p>
<ul class="mini-toc">
<li><a href="#Additional-Resources" accesskey="1">Additional Resources</a></li>
</ul>
<div class="subsection-level-extent" id="Additional-Resources">
<h4 class="subsection"><span>8.6.1 Additional Resources<a class="copiable-link" href="#Additional-Resources"> &para;</a></span></h4>
<ul class="itemize mark-bullet">
<li><a class="uref" href="http://www.traders.com/Documentation/FEEDbk_docs/Archive/102005/TradersTips/TradersTips.html">http://www.traders.com/Documentation/FEEDbk_docs/Archive/102005/TradersTips/TradersTips.html</a>
&ndash; TASC Oct 2005 Traders&rsquo; Tips various formulas [possibly gone].
</li></ul>


<hr>
</div>
</div>
<div class="section-level-extent" id="Guppy-Multiple-Moving-Average">
<div class="nav-panel">
<p>
Next: <a href="#Hull-Moving-Average" accesskey="n" rel="next">Hull Moving Average</a>, Previous: <a href="#Fractal-Adaptive-Moving-Average" accesskey="p" rel="prev">Fractal Adaptive Moving Average</a>, Up: <a href="#Averages" accesskey="u" rel="up">A...
</div>
<h3 class="section" id="Guppy-Multiple-Moving-Average-1"><span>8.7 Guppy Multiple Moving Average<a class="copiable-link" href="#Guppy-Multiple-Moving-Average-1"> &para;</a></span></h3>
<a class="index-entry-id" id="index-Guppy-multiple-moving-average"></a>
<a class="index-entry-id" id="index-GMMA"></a>
<a class="index-entry-id" id="index-Average_002c-Guppy-multiple"></a>
<a class="index-entry-id" id="index-Moving-average_002c-Guppy-multiple"></a>

<p><a class="uref" href="http://www.guppytraders.com/gup329.shtml">http://www.guppytraders.com/gup329.shtml</a> (summary at Darryl Guppy&rsquo;s web
site)
</p>
<a class="index-entry-id" id="index-Darryl-Guppy"></a>
<p>The Guppy multiple moving average (GMMA) by Darryl Guppy is a set of six short
term and six long term exponential moving averages (see <a class="pxref" href="#Exponential-Moving-Average">Exponential Moving Average</a>), all drawn on the one chart.
</p>
<p>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.
</p>
<p>Guppy&rsquo;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.
</p>
<ul class="mini-toc">
<li><a href="#Additional-Resources-1" accesskey="1">Additional Resources</a></li>
</ul>
<div class="subsection-level-extent" id="Additional-Resources-1">
<h4 class="subsection"><span>8.7.1 Additional Resources<a class="copiable-link" href="#Additional-Resources-1"> &para;</a></span></h4>

<ul class="itemize mark-bullet">
<li><a class="uref" href="http://www.incrediblecharts.com/technical/multiple_moving_averages.htm">http://www.incrediblecharts.com/technical/multiple_moving_averages.htm</a>
&ndash; sample graph of &lsquo;<samp class="samp">ASX.AX</samp>&rsquo; from 1999.
</li></ul>


<hr>
</div>
</div>
<div class="section-level-extent" id="Hull-Moving-Average">
<div class="nav-panel">
<p>
Next: <a href="#Kaufman-Adaptive-Moving-Average" accesskey="n" rel="next">Kaufman Adaptive Moving Average</a>, Previous: <a href="#Guppy-Multiple-Moving-Average" accesskey="p" rel="prev">Guppy Multiple Moving Average</a>, Up: <a href="#Averages" acce...
</div>
<h3 class="section" id="Hull-Moving-Average-1"><span>8.8 Hull Moving Average<a class="copiable-link" href="#Hull-Moving-Average-1"> &para;</a></span></h3>
<a class="index-entry-id" id="index-Hull-moving-average"></a>
<a class="index-entry-id" id="index-HMA"></a>

<p><a class="uref" href="http://www.alanhull.com/">http://www.alanhull.com/</a> <br>
<a class="uref" href="http://www.justdata.com.au/Journals/AlanHull/hull_ma.htm">http://www.justdata.com.au/Journals/AlanHull/hull_ma.htm</a>

lib/App/Chart/doc/chart.html  view on Meta::CPAN

Next: <a href="#Moving-Median" accesskey="n" rel="next">Moving Median</a>, Previous: <a href="#Laguerre-Filter" accesskey="p" rel="prev">Laguerre Filter</a>, Up: <a href="#Averages" accesskey="u" rel="up">Averages</a> &nbsp; [<a href="#Concept-Index"...
</div>
<h3 class="section" id="Median_002dAverage-Adaptive-Filter-1"><span>8.12 Median-Average Adaptive Filter<a class="copiable-link" href="#Median_002dAverage-Adaptive-Filter-1"> &para;</a></span></h3>
<a class="index-entry-id" id="index-Median_002daverage-adaptive-filter"></a>
<a class="index-entry-id" id="index-Filter_002c-Median_002daverage"></a>

<p><a class="uref" href="http://www.mesasoftware.com/technicalpapers.htm">http://www.mesasoftware.com/technicalpapers.htm</a> <br>
<a class="uref" href="http://web.archive.org/web/20070720222047/http://www.mesasoftware.com/Papers/What%27s+the+Difference.exe">http://web.archive.org/web/20070720222047/http://www.mesasoftware.com/Papers/What%27s+the+Difference.exe</a>
(self-extracting zip file)
</p>
<a class="index-entry-id" id="index-Ehlers_002c-John-2"></a>
<p>The median-average adaptive filter by John Elhers is an EMA (see <a class="pxref" href="#Exponential-Moving-Average">Exponential Moving Average</a>) with an alpha smoothing factor that varies according to how
close it is to a median.
</p>
<p>The raw alpha values can be viewed as &ldquo;Median-Average Alpha&rdquo; in the lower
indicator window, under &ldquo;Low Priority&rdquo; 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.
</p>

<hr>
</div>
<div class="section-level-extent" id="Moving-Median">
<div class="nav-panel">
<p>
Next: <a href="#Regularized-Exponential-Moving-Average" accesskey="n" rel="next">Regularized Exponential Moving Average</a>, Previous: <a href="#Median_002dAverage-Adaptive-Filter" accesskey="p" rel="prev">Median-Average Adaptive Filter</a>, Up: <a h...
</div>
<h3 class="section" id="Moving-Median-1"><span>8.13 Moving Median<a class="copiable-link" href="#Moving-Median-1"> &para;</a></span></h3>
<a class="index-entry-id" id="index-Moving-median"></a>
<a class="index-entry-id" id="index-Median_002c-moving"></a>

<p>The moving median is simply the median of the past N days&rsquo; closing prices.
This may be of limited interest and is thus under &ldquo;Low Priority&rdquo; in the
indicator lists.
</p>
<p>For reference, a median is calculated by considering the prices sorted from
highest to lowest.  The middle one is the median, or if there&rsquo;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.
</p>

<hr>
</div>
<div class="section-level-extent" id="Regularized-Exponential-Moving-Average">
<div class="nav-panel">
<p>
Next: <a href="#Sine-Weighted-Moving-Average" accesskey="n" rel="next">Sine Weighted Moving Average</a>, Previous: <a href="#Moving-Median" accesskey="p" rel="prev">Moving Median</a>, Up: <a href="#Averages" accesskey="u" rel="up">Averages</a> &nbsp;...
</div>
<h3 class="section" id="Regularized-Exponential-Moving-Average-1"><span>8.14 Regularized Exponential Moving Average<a class="copiable-link" href="#Regularized-Exponential-Moving-Average-1"> &para;</a></span></h3>
<a class="index-entry-id" id="index-Regularized-exponential-moving-average"></a>
<a class="index-entry-id" id="index-REMA"></a>
<a class="index-entry-id" id="index-Average_002c-regularized-exponential"></a>
<a class="index-entry-id" id="index-Moving-average_002c-regularized-exponential"></a>
<a class="index-entry-id" id="index-Exponential-moving-average_002c-regularized"></a>

<a class="index-entry-id" id="index-Satchwell_002c-Chris"></a>
<p>The regularized exponential moving average (REMA) by Chris Satchwell is a
variation on the EMA (see <a class="pxref" href="#Exponential-Moving-Average">Exponential Moving Average</a>) designed to be
smoother but not introduce too much extra lag.  The formula can be given in a
number of forms, such as
</p>
<div class="example">
<pre class="example-preformatted">       Rp + alpha*(close - Rp) + lambda*(Rp + (Rp-Rpp))
REMA = ---------------------------------------------
                 1             +      lambda
</pre></div>
<p>alpha = N-day smoothing per EMA <br>
Rp = yesterday&rsquo;s REMA <br>
Rpp = day before yesterday&rsquo;s REMA <br>
<em class="math">Lambda</em> is a factor controlling the amount of &ldquo;regularization&rdquo;.
</p>
<p>This form shows how there&rsquo;s an <em class="math">Rp+alpha*(close-Rp)</em> part like an EMA, and an <em class="math">Rp+(Rp-Rpp)</em> part
which projects from yesterday&rsquo;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 <em class="math">lambda</em> for the projection.
</p>
<p>If <em class="math">lambda</em> is zero then REMA is the same as a plain EMA.
Satchwell suggests fairly small values for <em class="math">lambda</em>, and the default
in Chart is 0.5.  John Ehlers noted that if <em class="math">lambda</em> is large REMA
becomes unstable.
</p>
<p>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 <em class="math">N=15</em> and <em class="math">lambda=0.5</em>,
</p>
<br>
<div class="center"><img class="image" src="chart-rema-weights.png" alt="Regularized EMA weights graph">
</div>
<ul class="mini-toc">
<li><a href="#REMA-Momentum-1" accesskey="1">REMA Momentum</a></li>
<li><a href="#Additional-Resources-3" accesskey="2">Additional Resources</a></li>
</ul>
<div class="subsection-level-extent" id="REMA-Momentum-1">
<h4 class="subsection"><span>8.14.1 REMA Momentum<a class="copiable-link" href="#REMA-Momentum-1"> &para;</a></span></h4>
<a class="anchor" id="REMA-Momentum"></a><a class="index-entry-id" id="index-REMA-Momentum"></a>
<a class="index-entry-id" id="index-Regularized-Momentum"></a>

<p>A momentum indicator is formed from REMA as the slope of the line from
yesterday&rsquo;s REMA to today&rsquo;s.
</p>
<div class="example">
<pre class="example-preformatted">         REMA - REMAprev
RegMom = ---------------
             REMAprev
</pre></div>

<p>This is like a Rate of Change (see <a class="pxref" href="#Momentum-and-Rate-of-Change">Momentum</a>), 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).
</p>
</div>
<div class="subsection-level-extent" id="Additional-Resources-3">
<h4 class="subsection"><span>8.14.2 Additional Resources<a class="copiable-link" href="#Additional-Resources-3"> &para;</a></span></h4>
<ul class="itemize mark-bullet">
<li><a class="uref" href="http://www.traders.com/Documentation/FEEDbk_docs/Archive/072003/TradersTips/TradersTips.html">http://www.traders.com/Documentation/FEEDbk_docs/Archive/072003/TradersTips/TradersTips.html</a>
&ndash; TASC Traders&rsquo; Tips, August 2003, REMA and REMA momentum formulas.
</li></ul>


<hr>
</div>
</div>
<div class="section-level-extent" id="Sine-Weighted-Moving-Average">
<div class="nav-panel">
<p>
Next: <a href="#T3-Moving-Average" accesskey="n" rel="next">T3 Moving Average</a>, Previous: <a href="#Regularized-Exponential-Moving-Average" accesskey="p" rel="prev">Regularized Exponential Moving Average</a>, Up: <a href="#Averages" accesskey="u" ...
</div>
<h3 class="section" id="Sine-Weighted-Moving-Average-1"><span>8.15 Sine Weighted Moving Average<a class="copiable-link" href="#Sine-Weighted-Moving-Average-1"> &para;</a></span></h3>
<a class="index-entry-id" id="index-Sine-weighted-moving-average"></a>
<a class="index-entry-id" id="index-Sine_002dMA"></a>
<a class="index-entry-id" id="index-Average_002c-sine-weighted"></a>
<a class="index-entry-id" id="index-Moving-average_002c-sine-weighted"></a>

<p>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 <em class="math">pi</em>.  For an N-day average
the weightings are
</p>
<div class="example">
<pre class="example-preformatted">     /  1      \         /  2      \             /  N      \
sin |  --- * pi |,  sin |  --- * pi |, ..., sin |  --- * pi |
     \ N+1     /         \ N+1     /             \ N+1     /
</pre></div>

<p>The effect is that middle prices have the greatest weight (much like the TMA,
<a class="ref" href="#Triangular-Moving-Average">Triangular Moving Average</a>).  The graph below shows the weights for
<em class="math">N=10</em>.  In Chart SWMA is under &ldquo;Low Priority&rdquo; in the indicator lists.
</p>
<br>
<div class="center"><img class="image" src="chart-sine-weights.png" alt="Sine weights graph">
</div>

<hr>
</div>
<div class="section-level-extent" id="T3-Moving-Average">
<div class="nav-panel">
<p>
Next: <a href="#Triangular-Moving-Average" accesskey="n" rel="next">Triangular Moving Average</a>, Previous: <a href="#Sine-Weighted-Moving-Average" accesskey="p" rel="prev">Sine Weighted Moving Average</a>, Up: <a href="#Averages" accesskey="u" rel=...
</div>
<h3 class="section" id="T3-Moving-Average-1"><span>8.16 T3 Moving Average<a class="copiable-link" href="#T3-Moving-Average-1"> &para;</a></span></h3>
<a class="index-entry-id" id="index-T3-moving-average"></a>

<p>The T3 moving average by Tim Tillson is a triple smoothed combination of the
DEMA (see <a class="pxref" href="#Double-and-Triple-Exponential-Moving-Average">Double and Triple Exponential Moving Average</a>) and a plain EMA
(see <a class="pxref" href="#Exponential-Moving-Average">Exponential Moving Average</a>).
</p>
<p>A given &ldquo;volume factor&rdquo; 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
&ldquo;generalized DEMA&rdquo; is
</p>
<div class="example">
<pre class="example-preformatted">GD(N,v) = (1-v)*EMA[N] + v*DEMA[N]
</pre></div>

<p>or equivalently as follows, emphasising how a portion of the momentum term
present in the DEMA is used,
</p>
<div class="example">
<pre class="example-preformatted">GD(N,v) = EMA[N] + v * (EMA[N] - EMAofEMA[N])
</pre></div>

<p>T3 applies this three times,
</p>
<div class="example">
<pre class="example-preformatted">T3(N,v) = GD(N,v) of GD(N,v) of GD(N,v)
</pre></div>

<p>The following graph shows the weightings that result from <em class="math">N=10</em> and
<em class="math">v=0.7</em>.
</p>
<br>
<div class="center"><img class="image" src="chart-t3-weights.png" alt="T3 weights graph">
</div>
<p>At the lower <em class="math">v=0</em> extreme T3 is simply a tripled EMA (see <a class="pxref" href="#EMA-of-EMA-of-EMA">EMA of EMA of EMA</a>).  At the upper <em class="math">v=1</em> extreme T3 is a DEMA of DEMA of DEMA, and
the following is the weights for that (again <em class="math">N=10</em>),
</p>
<br>
<div class="center"><img class="image" src="chart-dema-3-weights.png" alt="DEMA of DEMA of DEMA weights graph">
</div>

<hr>
</div>
<div class="section-level-extent" id="Triangular-Moving-Average">
<div class="nav-panel">
<p>
Next: <a href="#Variable-Index-Dynamic-Average" accesskey="n" rel="next">Variable Index Dynamic Average</a>, Previous: <a href="#T3-Moving-Average" accesskey="p" rel="prev">T3 Moving Average</a>, Up: <a href="#Averages" accesskey="u" rel="up">Average...
</div>
<h3 class="section" id="Triangular-Moving-Average-1"><span>8.17 Triangular Moving Average<a class="copiable-link" href="#Triangular-Moving-Average-1"> &para;</a></span></h3>
<a class="index-entry-id" id="index-Triangular-moving-average"></a>
<a class="index-entry-id" id="index-TMA"></a>
<a class="index-entry-id" id="index-Average_002c-triangular"></a>
<a class="index-entry-id" id="index-Moving-average_002c-triangular"></a>

<p>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.
</p>
<br>
<div class="center"><img class="image" src="chart-tma-weights.png" alt="Triangular weights graph">
</div>
<p>It&rsquo;s interesting to note TMA is equivalent to a twice-smoothed simple moving
average of half period (see <a class="pxref" href="#Simple-Moving-Average">Simple Moving Average</a>).
</p>
<div class="example">
<pre class="example-preformatted">TMA[N] = SMA[floor(N/2)+1] of SMA[ceil(N/2)]
</pre></div>

lib/App/Chart/doc/chart.html  view on Meta::CPAN

<pre class="example-preformatted">VIDYA = alpha * close + (1-alpha) * VIDYA[prev]
</pre></div>

<p>The alpha values can be viewed directly with &ldquo;VIDYA alpha&rdquo; in the lower
indicator window, under &ldquo;Low Priority&rdquo; in the indicator lists.  High values
show where the VIDYA is tracking recent prices closely, low values show where
it&rsquo;s responding only slowly.
</p>

<hr>
</div>
<div class="section-level-extent" id="Volume-Weighted-Moving-Average">
<div class="nav-panel">
<p>
Next: <a href="#Zero_002dLag-Exponential-Moving-Average" accesskey="n" rel="next">Zero-Lag Exponential Moving Average</a>, Previous: <a href="#Variable-Index-Dynamic-Average" accesskey="p" rel="prev">Variable Index Dynamic Average</a>, Up: <a href="#...
</div>
<h3 class="section" id="Volume-Weighted-Moving-Average-1"><span>8.19 Volume Weighted Moving Average<a class="copiable-link" href="#Volume-Weighted-Moving-Average-1"> &para;</a></span></h3>
<a class="index-entry-id" id="index-Volume-weighted-moving-average"></a>
<a class="index-entry-id" id="index-VWMA"></a>
<a class="index-entry-id" id="index-Average_002c-volume-weighted"></a>
<a class="index-entry-id" id="index-Moving-average_002c-volume-weighted"></a>

<p>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&rsquo;s closing price, p2 yesterday&rsquo;s, etc, and
v1, v2, etc similarly the volumes, then the VWMA for today is
</p>
<div class="example">
<pre class="example-preformatted">       v1 * p1 + v2 * p2 + ... + vN * pN
VWMA = ---------------------------------
          v1   +    v2   + ... +    vN
</pre></div>

<p>The effect is to give greater significance to days with greater volume, making
the average tend towards those days&rsquo; closing prices more.  If all volumes are
about the same then the VWMA becomes a simple moving average (see <a class="pxref" href="#Simple-Moving-Average">Simple Moving Average</a>).
</p>
<p>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&rsquo;t have the
data needed for that and the calculation above instead effectively attributes
all volume to the closing price.
</p>

<hr>
</div>
<div class="section-level-extent" id="Zero_002dLag-Exponential-Moving-Average">
<div class="nav-panel">
<p>
Previous: <a href="#Volume-Weighted-Moving-Average" accesskey="p" rel="prev">Volume Weighted Moving Average</a>, Up: <a href="#Averages" accesskey="u" rel="up">Averages</a> &nbsp; [<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h3 class="section" id="Zero_002dLag-Exponential-Moving-Average-1"><span>8.20 Zero-Lag Exponential Moving Average<a class="copiable-link" href="#Zero_002dLag-Exponential-Moving-Average-1"> &para;</a></span></h3>
<a class="index-entry-id" id="index-zero_002dlag-exponential-moving-average"></a>
<a class="index-entry-id" id="index-Average_002c-zero_002dlag-exponential"></a>
<a class="index-entry-id" id="index-Moving-average_002c-zero_002dlag-exponential"></a>
<a class="index-entry-id" id="index-ZLEMA"></a>

<p>The zero-lag exponential moving average (ZLEMA) is a variation of the EMA
(see <a class="pxref" href="#Exponential-Moving-Average">Exponential Moving Average</a>) 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
</p>
<div class="example">
<pre class="example-preformatted">ZLEMA = EMA of (close + (close-close[lag]))
</pre></div>

<p>Where the &ldquo;lag&rdquo; period is <em class="math">(N-1)/2</em>.  A plain EMA applied to straight
line points ends up always being the close at <em class="math">(N-1)/2</em> days ago.  So the
idea of adding in this difference &ldquo;close - close[lag]&rdquo; 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.
</p>
<p>The calculation still ends up as various weights on each past price.  The
effect of the momentum term is to make recent prices &ldquo;over weight&rdquo; and thus
tracked closely, and with negative weights on past terms.  There&rsquo;s a sudden
jump in the weights at the momentum lag point.  For example the following
graph is the weights for <em class="math">N=15</em> (lag point 7).
</p>
<br>
<div class="center"><img class="image" src="chart-zlema-weights.png" alt="Zero-lag EMA weights graph">
</div>
<p>The EMA lag on a straight line can be calculated easily using the power
formula for the EMA (see <a class="pxref" href="#Exponential-Moving-Average">Exponential Moving Average</a>), 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 <em class="math">(N-1)/2</em>,
but will vary according to shape, period of cyclical components, etc.
</p>

<hr>
</div>
</div>
<div class="chapter-level-extent" id="Channels-and-Boxes">
<div class="nav-panel">
<p>
Next: <a href="#Indicators" accesskey="n" rel="next">Indicators</a>, Previous: <a href="#Averages" accesskey="p" rel="prev">Averages</a>, Up: <a href="#Top" accesskey="u" rel="up">Chart</a> &nbsp; [<a href="#Concept-Index" title="Index" rel="index">I...
</div>
<h2 class="chapter" id="Channels-and-Boxes-1"><span>9 Channels and Boxes<a class="copiable-link" href="#Channels-and-Boxes-1"> &para;</a></span></h2>
<a class="index-entry-id" id="index-Channels"></a>
<a class="index-entry-id" id="index-Boxes"></a>



<ul class="mini-toc">
<li><a href="#Bollinger-Bands" accesskey="1">Bollinger Bands</a></li>
<li><a href="#Darvas-Boxes" accesskey="2">Darvas Boxes</a></li>
<li><a href="#Donchian-Channel" accesskey="3">Donchian Channel</a></li>
<li><a href="#Ichimoku-Kinko-Hyo" accesskey="4">Ichimoku Kinko Hyo</a></li>
<li><a href="#Keltner-Channel" accesskey="5">Keltner Channel</a></li>
<li><a href="#Kirshenbaum-Bands" accesskey="6">Kirshenbaum Bands</a></li>
<li><a href="#Parabolic-SAR" accesskey="7">Parabolic SAR</a></li>
</ul>
<hr>
<div class="section-level-extent" id="Bollinger-Bands">
<div class="nav-panel">
<p>
Next: <a href="#Darvas-Boxes" accesskey="n" rel="next">Darvas Boxes</a>, Previous: <a href="#Channels-and-Boxes" accesskey="p" rel="prev">Channels and Boxes</a>, Up: <a href="#Channels-and-Boxes" accesskey="u" rel="up">Channels and Boxes</a> &nbsp; [...
</div>
<h3 class="section" id="Bollinger-Bands-1"><span>9.1 Bollinger Bands<a class="copiable-link" href="#Bollinger-Bands-1"> &para;</a></span></h3>
<a class="index-entry-id" id="index-Bollinger-bands"></a>
<a class="index-entry-id" id="index-Average-1"></a>
<a class="index-entry-id" id="index-Moving-average"></a>
<a class="index-entry-id" id="index-Variance"></a>
<a class="index-entry-id" id="index-Deviation"></a>
<a class="index-entry-id" id="index-Standard-deviation"></a>

<p><a class="uref" href="http://www.bollingerbands.com">http://www.bollingerbands.com</a>
</p>
<a class="index-entry-id" id="index-Bollinger_002c-John"></a>
<p>Bollinger bands by John Bollinger are an N-day simple moving average
(see <a class="pxref" href="#Simple-Moving-Average">Simple Moving Average</a>) with an upper and lower bands drawn at 1
standard deviation away from the average.  The distance multiple is
configurable.
</p>
<p>Standard deviation (see <a class="pxref" href="#Standard-Deviation">Standard Deviation</a>) 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.
</p>
<p>See also <a class="ref" href="#Kirshenbaum-Bands">Kirshenbaum Bands</a>, which are similar but with a channel width
based on standard error from a linear regression.
</p>

lib/App/Chart/doc/chart.html  view on Meta::CPAN

<li><a href="#Chande-Momentum-Oscillator" accesskey="8">Chande Momentum Oscillator</a></li>
<li><a href="#Commodity-Channel-Index" accesskey="9">Commodity Channel Index</a></li>
<li><a href="#Coppock-Curve">Coppock Curve</a></li>
<li><a href="#Detrended-Price-Oscillator">Detrended Price Oscillator</a></li>
<li><a href="#Directional-Movement-Index">Directional Movement Index</a></li>
<li><a href="#Ease-of-Movement">Ease of Movement</a></li>
<li><a href="#Elder-Bull_002fBear-Power">Elder Bull/Bear Power</a></li>
<li><a href="#Fisher-Transform">Fisher Transform</a></li>
<li><a href="#Force-Index">Force Index</a></li>
<li><a href="#Forecast-Oscillator">Forecast Oscillator</a></li>
<li><a href="#Gopalakrishnan-Range-Index">Gopalakrishnan Range Index</a></li>
<li><a href="#Intraday-Momentum-Index">Intraday Momentum Index</a></li>
<li><a href="#Klinger-Volume-Oscillator">Klinger Volume Oscillator</a></li>
<li><a href="#MACD">MACD</a></li>
<li><a href="#MASS-Index">MASS Index</a></li>
<li><a href="#EMA-of-EMA-1">EMA of EMA</a></li>
<li><a href="#Momentum-and-Rate-of-Change">Momentum</a></li>
<li><a href="#Money-Flow-Index">Money Flow Index</a></li>
<li><a href="#On_002dBalance-Volume">On-Balance Volume</a></li>
<li><a href="#Negative-Volume-Index">Negative Volume Index</a></li>
<li><a href="#Polarized-Fractal-Efficiency">Polarized Fractal Efficiency</a></li>
<li><a href="#Pretty-Good-Oscillator">Pretty Good Oscillator</a></li>
<li><a href="#Price-and-Volume-Trend">Price and Volume Trend</a></li>
<li><a href="#QStick">QStick</a></li>
<li><a href="#R_002dSquared-Index">R-Squared Index</a></li>
<li><a href="#RAVI">RAVI</a></li>
<li><a href="#Relative-Strength-Index">Relative Strength Index</a></li>
<li><a href="#Relative-Volatility-Index">Relative Volatility Index</a></li>
<li><a href="#Inertia-1">Inertia</a></li>
<li><a href="#Random-Walk-Index">Random Walk Index</a></li>
<li><a href="#Stochastics">Stochastics</a></li>
<li><a href="#TD-Range-Expansion-Index">TD Range Expansion Index</a></li>
<li><a href="#Trend-Intensity-Index">Trend Intensity Index</a></li>
<li><a href="#Trendscore">Trendscore</a></li>
<li><a href="#True-Strength-Index">True Strength Index</a></li>
<li><a href="#TRIX">TRIX</a></li>
<li><a href="#EMA-of-EMA-of-EMA-1">EMA of EMA of EMA</a></li>
<li><a href="#Twiggs-Money-Flow">Twiggs Money Flow</a></li>
<li><a href="#Ulcer-Index">Ulcer Index</a></li>
<li><a href="#Ultimate-Oscillator">Ultimate Oscillator</a></li>
<li><a href="#Vertical-Horizontal-Filter">Vertical Horizontal Filter</a></li>
<li><a href="#Volatility-Ratio">Volatility Ratio</a></li>
<li><a href="#Williams-_0025R">Williams %R</a></li>
<li><a href="#Williams-Accumulation_002fDistribution">Williams Accumulation/Distribution</a></li>
<li><a href="#Zig-Zag-Indicator">Zig Zag Indicator</a></li>
</ul>
<hr>
<div class="section-level-extent" id="Accumulation_002fDistribution">
<div class="nav-panel">
<p>
Next: <a href="#Accumulative-Swing-Index" accesskey="n" rel="next">Accumulative Swing Index</a>, Previous: <a href="#Indicators" accesskey="p" rel="prev">Indicators</a>, Up: <a href="#Indicators" accesskey="u" rel="up">Indicators</a> &nbsp; [<a href=...
</div>
<h3 class="section" id="Accumulation_002fDistribution-1"><span>10.1 Accumulation/Distribution<a class="copiable-link" href="#Accumulation_002fDistribution-1"> &para;</a></span></h3>
<a class="index-entry-id" id="index-Accumulation_002fdistribution"></a>
<a class="index-entry-id" id="index-Index_002c-accumulation_002fdistribution"></a>

<a class="index-entry-id" id="index-Chaikin_002c-Marc"></a>
<p>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&rsquo;s high and low.  For <var class="var">c</var>, <var class="var">h</var>, <var class="var">l</var>,
<var class="var">v</var> and with ADprev as yesterday&rsquo;s Acc/Dist the formula is
</p>
<div class="example">
<pre class="example-preformatted">                       C - L
AD = ADprev + V * (2 * ----- - 1)
                       H - L
</pre></div>

<p>When the close is at the high the factor is <em class="math">+1</em> and the full volume is
added in, when the close is at the low the factor is <em class="math">-1</em> 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 <em class="math">+0.5</em>, or a close midway would be a
factor 0 for no change to the Acc/Dist.
</p>
<p>The starting point (ie. the zero point) for the running total is arbitrary.
In Chart it&rsquo;s merely the segment of data first displayed.
</p>
<p>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.
</p>
<p>Acc/Dist is somewhat similar to On-Balance Volume (see <a class="pxref" href="#On_002dBalance-Volume">On-Balance Volume</a>).
But Acc/Dist looks at close within that day&rsquo;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 <a class="ref" href="#Chaikin-Money-Flow">Chaikin Money Flow</a>.
</p>

<hr>
</div>
<div class="section-level-extent" id="Accumulative-Swing-Index">
<div class="nav-panel">
<p>
Next: <a href="#Aroon" accesskey="n" rel="next">Aroon</a>, Previous: <a href="#Accumulation_002fDistribution" accesskey="p" rel="prev">Accumulation/Distribution</a>, Up: <a href="#Indicators" accesskey="u" rel="up">Indicators</a> &nbsp; [<a href="#Co...
</div>
<h3 class="section" id="Accumulative-Swing-Index-1"><span>10.2 Accumulative Swing Index<a class="copiable-link" href="#Accumulative-Swing-Index-1"> &para;</a></span></h3>
<a class="index-entry-id" id="index-Accumulative-swing-index"></a>
<a class="index-entry-id" id="index-ASI"></a>
<a class="index-entry-id" id="index-Index_002c-accumulative-swing"></a>

<a class="index-entry-id" id="index-Wilder_002c-J_002e-Welles-2"></a>
<p>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.
</p>
<p>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.
</p>
<p>The starting point (ie. the zero point) for the running total is arbitrary.
In Chart it&rsquo;s merely the segment of data first displayed.  Wilder&rsquo;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.
</p>
<a class="anchor" id="Swing-Index"></a><p>The raw swing index values can be viewed with the &ldquo;Swing
Index&rdquo; (which is under &ldquo;Low Priority&rdquo; in the indicator lists because it&rsquo;s
of little direct use).
</p>

<hr>

lib/App/Chart/doc/chart.html  view on Meta::CPAN

</p>
<div class="example">
<pre class="example-preformatted">ATR = EMA[N] of True Range
</pre></div>

<p>The default smoothing period is 14 days, as recommended by Wilder.  The period
is always by Wilder&rsquo;s reckoning of EMA smoothing period (see <a class="pxref" href="#Wilder-EMA-period">Wilder EMA period</a>).
</p>
<p>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.
</p>
<p>When a data source doesn&rsquo;t provide high/low values (some indices for
instance), then just close-to-close changes are used.  This may be of limited
use.
</p>
<a class="index-entry-id" id="index-Normalized-ATR"></a>
<a class="anchor" id="Normalized-ATR"></a><ul class="mini-toc">
<li><a href="#Normalized-ATR-1" accesskey="1">Normalized ATR</a></li>
</ul>
<div class="subsection-level-extent" id="Normalized-ATR-1">
<h4 class="subsection"><span>10.4.1 Normalized ATR<a class="copiable-link" href="#Normalized-ATR-1"> &para;</a></span></h4>

<a class="index-entry-id" id="index-Forman_002c-John"></a>
<p>The normalized ATR by John Forman
(<a class="uref" href="http://www.theessentialsoftrading.com">http://www.theessentialsoftrading.com</a>) 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.
</p>
<div class="example">
<pre class="example-preformatted">              ATR
NATR = 100 * -----
             close
</pre></div>


<hr>
</div>
</div>
<div class="section-level-extent" id="Centre-of-Gravity-Oscillator">
<div class="nav-panel">
<p>
Next: <a href="#Chaikin-Money-Flow" accesskey="n" rel="next">Chaikin Money Flow</a>, Previous: <a href="#Average-True-Range" accesskey="p" rel="prev">Average True Range</a>, Up: <a href="#Indicators" accesskey="u" rel="up">Indicators</a> &nbsp; [<a h...
</div>
<h3 class="section" id="Centre-of-Gravity-Oscillator-1"><span>10.5 Centre of Gravity Oscillator<a class="copiable-link" href="#Centre-of-Gravity-Oscillator-1"> &para;</a></span></h3>
<a class="index-entry-id" id="index-Centre-of-gravity-oscillator"></a>
<a class="index-entry-id" id="index-CG"></a>
<a class="index-entry-id" id="index-COG"></a>

<p><a class="uref" href="http://www.mesasoftware.com/technicalpapers.htm">http://www.mesasoftware.com/technicalpapers.htm</a> <br>
<a class="uref" href="http://www.mesasoftware.com/Papers/The%20CG%20Oscillator.pdf">http://www.mesasoftware.com/Papers/The%20CG%20Oscillator.pdf</a>
</p>
<a class="index-entry-id" id="index-Ehlers_002c-John-3"></a>
<p>The Centre of Gravity (CG) oscillator by John Ehlers is a comparison of recent
prices against older prices within a given past N days.
</p>
<p>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&rsquo;s price, p2 yesterday&rsquo;s, etc, then the formula is
</p>
<div class="example">
<pre class="example-preformatted">       1*p[1] + 2*p[2] + ... + N*p[N]
CG = - ------------------------------
        p[1] +   p[2] + ... +   p[N]
</pre></div>

<p>The &ldquo;<em class="math">-</em>&rdquo; sign puts the CG on a scale of <em class="math">-N</em> at the oldest end,
up to <em class="math">-1</em> at the newest prices end.  But those extremes are not reached,
instead CG hovers around the midpoint <em class="math">-(N-1)/2</em>.  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.
</p>
<p>Ehlers suggests looking at a past 10 days, and that&rsquo;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.
</p>
<ul class="mini-toc">
<li><a href="#Additional-Resources-5" accesskey="1">Additional Resources</a></li>
</ul>
<div class="subsection-level-extent" id="Additional-Resources-5">
<h4 class="subsection"><span>10.5.1 Additional Resources<a class="copiable-link" href="#Additional-Resources-5"> &para;</a></span></h4>

<ul class="itemize mark-bullet">
<li><a class="uref" href="http://www.linnsoft.com/tour/techind/cog.htm">http://www.linnsoft.com/tour/techind/cog.htm</a> &ndash; sample graph of Intel
(symbol &lsquo;<samp class="samp">INTC</samp>&rsquo;) from 2001/2.
</li><li><a class="uref" href="http://www.working-money.com/Documentation/FEEDbk_docs/Archive/082002/TradersTips/TradersTips.html">http://www.working-money.com/Documentation/FEEDbk_docs/Archive/082002/TradersTips/TradersTips.html</a>
&ndash; formulas in TASC Trader&rsquo;s tips August 2002 (for article from May 2002).
</li></ul>


<hr>
</div>
</div>
<div class="section-level-extent" id="Chaikin-Money-Flow">
<div class="nav-panel">
<p>
Next: <a href="#Chaikin-Oscillator" accesskey="n" rel="next">Chaikin Oscillator</a>, Previous: <a href="#Centre-of-Gravity-Oscillator" accesskey="p" rel="prev">Centre of Gravity Oscillator</a>, Up: <a href="#Indicators" accesskey="u" rel="up">Indicat...
</div>
<h3 class="section" id="Chaikin-Money-Flow-1"><span>10.6 Chaikin Money Flow<a class="copiable-link" href="#Chaikin-Money-Flow-1"> &para;</a></span></h3>
<a class="index-entry-id" id="index-Chaikin-money-flow"></a>
<a class="index-entry-id" id="index-Money-flow_002c-Chaikin"></a>
<a class="index-entry-id" id="index-Index_002c-Chaikin-money-flow"></a>

<a class="index-entry-id" id="index-Chaikin_002c-Marc-1"></a>
<p>The Chaikin money flow index by Marc Chaikin is based on the
Accumulation/Distribution index calculations
(see <a class="pxref" href="#Accumulation_002fDistribution">Accumulation/Distribution</a>), but just within a past N-day window.  The
formula is
</p>
<div class="example">
<pre class="example-preformatted">                                     /      close - low     \
              total N-day  volume * |  2 *  ----------- - 1  |
                                     \      high - low      /
Chaikin MF = ------------------------------------------------
                         total N-day  volume
</pre></div>

<p>The Acc/Dist style volume values in the numerator range between <em class="math">+volume</em>
and <em class="math">-volume</em> according to &ldquo;closing location value&rdquo;.  They&rsquo;re summed
and expressed as a fraction of the total volume in that period.  This fraction
therefore ranges from <em class="math">-1</em> to <em class="math">+1</em>, but in practice the extremes are
rarely reached (since it would require every day to be a close at the day&rsquo;s
high to get <em class="math">+1</em>, or every day at the low to get <em class="math">-1</em>).
</p>
<p>The idea is that buying strength is indicated by a close near the top of the
day&rsquo;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.
</p>
<p>This Chaikin money flow is is similar to the plain money flow index
(see <a class="pxref" href="#Money-Flow-Index">Money Flow Index</a>), but the latter uses close-to-close up or down,
where Chaikin uses close within the day&rsquo;s range as a fraction, not just an
&ldquo;all or nothing&rdquo; up or down.
</p>
<p>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 indices in
particular).
</p>
<p>It should be noted that &ldquo;money flow&rdquo; here is a shorthand for the enthusiasm
of buyers (or, when negative, sellers).  It&rsquo;s common to speak informally of
money flowing into or out of a stock, but of course there&rsquo;s never actually any
net money in or out since for every buyer there&rsquo;s a seller of the same amount.
</p>

<hr>
</div>
<div class="section-level-extent" id="Chaikin-Oscillator">
<div class="nav-panel">
<p>
Next: <a href="#Chande-Momentum-Oscillator" accesskey="n" rel="next">Chande Momentum Oscillator</a>, Previous: <a href="#Chaikin-Money-Flow" accesskey="p" rel="prev">Chaikin Money Flow</a>, Up: <a href="#Indicators" accesskey="u" rel="up">Indicators<...
</div>
<h3 class="section" id="Chaikin-Oscillator-1"><span>10.7 Chaikin Oscillator<a class="copiable-link" href="#Chaikin-Oscillator-1"> &para;</a></span></h3>
<a class="index-entry-id" id="index-Chaikin-oscillator"></a>
<a class="index-entry-id" id="index-Chaikin-A_002fD-oscillator"></a>
<a class="index-entry-id" id="index-Oscillator_002c-Chaikin"></a>

<a class="index-entry-id" id="index-Chaikin_002c-Marc-2"></a>
<p>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 <a class="pxref" href="#Exponential-Moving-Average">Exponential Moving Average</a>) of the Accumulation/Distribution index
(see <a class="pxref" href="#Accumulation_002fDistribution">Accumulation/Distribution</a>).
</p>
<div class="example">
<pre class="example-preformatted">Chaikin Osc = EMA[3] of A/D - EMA[10] of A/D
</pre></div>

<p>The periods 3 and 10 are configurable.
</p>

<hr>
</div>
<div class="section-level-extent" id="Chande-Momentum-Oscillator">
<div class="nav-panel">
<p>
Next: <a href="#Commodity-Channel-Index" accesskey="n" rel="next">Commodity Channel Index</a>, Previous: <a href="#Chaikin-Oscillator" accesskey="p" rel="prev">Chaikin Oscillator</a>, Up: <a href="#Indicators" accesskey="u" rel="up">Indicators</a> &n...
</div>
<h3 class="section" id="Chande-Momentum-Oscillator-1"><span>10.8 Chande Momentum Oscillator<a class="copiable-link" href="#Chande-Momentum-Oscillator-1"> &para;</a></span></h3>
<a class="index-entry-id" id="index-Chande-Momentum-Oscillator"></a>
<a class="index-entry-id" id="index-CMO"></a>

<a class="index-entry-id" id="index-Chande_002c-Tushar-2"></a>
<p>The Chande Momentum Oscillator (CMO) by Tushar Chande is a variation on the
RSI (see <a class="pxref" href="#Relative-Strength-Index">Relative Strength Index</a>) using an SMA (see <a class="pxref" href="#Simple-Moving-Average">Simple Moving Average</a>) and on a scale between <em class="math">-100</em> and <em class="math">...
</p>
<div class="example">
<pre class="example-preformatted">            SMA[N] of   (close - prev close)
CMO = 100 * ---------------------------------
            SMA[N] of  abs(close - prev close)
</pre></div>

<p>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.
</p>
<div class="example">
<pre class="example-preformatted">                          SMA[N] of U
CMO = -100 + 200 * -------------------------
                   SMA[N] of U + SMA[N] of D
</pre></div>

<p>See also TSI (see <a class="pxref" href="#True-Strength-Index">True Strength Index</a>), another different moving average
for an RSI.
</p>

<hr>
</div>
<div class="section-level-extent" id="Commodity-Channel-Index">
<div class="nav-panel">
<p>
Next: <a href="#Coppock-Curve" accesskey="n" rel="next">Coppock Curve</a>, Previous: <a href="#Chande-Momentum-Oscillator" accesskey="p" rel="prev">Chande Momentum Oscillator</a>, Up: <a href="#Indicators" accesskey="u" rel="up">Indicators</a> &nbsp;...
</div>
<h3 class="section" id="Commodity-Channel-Index-1"><span>10.9 Commodity Channel Index<a class="copiable-link" href="#Commodity-Channel-Index-1"> &para;</a></span></h3>
<a class="index-entry-id" id="index-Commodity-channel-index"></a>
<a class="index-entry-id" id="index-CCI"></a>
<a class="index-entry-id" id="index-Index_002c-commodity-channel"></a>
<a class="index-entry-id" id="index-Channel_002c-commodity-index"></a>

<a class="index-entry-id" id="index-Lambert_002c-Donald"></a>
<p>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&rsquo;s typical price and recent average as a fraction
of each day&rsquo;s mean deviation from that average.
</p>
<div class="example">
<pre class="example-preformatted">      tp[today] - mean tp
CCI = -------------------
        0.015 * meandev
</pre></div>

<p>The <em class="math">mean tp</em> is over a given past N days.  &ldquo;Typical price&rdquo; is the
average of high, low and close.  Chart uses just the close if there&rsquo;s no
high/low data from a particular data source.
</p>
<div class="example">
<pre class="example-preformatted">     high + low + close
tp = ------------------
             3
</pre></div>

<p>The mean deviation <em class="math">meandev</em> 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),
</p>
<div class="example">
<pre class="example-preformatted">          abs(tp1 - mean tp) + abs(tp2 - mean tp) + ... abs(tpN - mean tp)
meandev = ----------------------------------------------------------------
                                       N
</pre></div>

<p>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,

lib/App/Chart/doc/chart.html  view on Meta::CPAN

scaled to <em class="math">-1</em> for the low and <em class="math">1</em> for the high.
</p>
<div class="example">
<pre class="example-preformatted">price = (high + low) / 2

            price - Ndaylow
raw = 2 * ------------------ - 1
          Ndayhigh - Ndaylow
</pre></div>

<p>This raw position is smoothed by a 5-day EMA (see <a class="pxref" href="#Exponential-Moving-Average">Exponential Moving Average</a>) then a log form which is the fisher transform, before a final
further 3-day EMA smoothing.
</p>
<div class="example">
<pre class="example-preformatted">smoothed = EMA[5] of raw

                       1 + smoothed
fisher = EMA[3] of log ------------
                       1 - smoothed
</pre></div>

<p>The effect of the logarithm is to make &ldquo;smoothed&rdquo; values near 0 remain near
there, but values near 1 and <em class="math">-1</em> grow greatly, thus highlighting
extremities.  A &ldquo;smoothed&rdquo; value of exactly <em class="math">+/-1</em> would transform
to <em class="math">+/-infinity</em>, so a clamp of 0.999 is applied, effectively
limiting the final result to about <em class="math">+/-7.5</em>.
</p>
<ul class="mini-toc">
<li><a href="#Additional-Resources-6" accesskey="1">Additional Resources</a></li>
</ul>
<div class="subsection-level-extent" id="Additional-Resources-6">
<h4 class="subsection"><span>10.15.1 Additional Resources<a class="copiable-link" href="#Additional-Resources-6"> &para;</a></span></h4>

<ul class="itemize mark-bullet">
<li><a class="uref" href="http://www.linnsoft.com/tour/techind/fish.htm">http://www.linnsoft.com/tour/techind/fish.htm</a> &ndash; sample Nasdaq 100
symbol &lsquo;<samp class="samp">QQQ</samp>&rsquo; from August 2002.  (For Chart use Yahoo symbol &lsquo;<samp class="samp">^IXIC</samp>&rsquo;
to get that data).
</li></ul>


<hr>
</div>
</div>
<div class="section-level-extent" id="Force-Index">
<div class="nav-panel">
<p>
Next: <a href="#Forecast-Oscillator" accesskey="n" rel="next">Forecast Oscillator</a>, Previous: <a href="#Fisher-Transform" accesskey="p" rel="prev">Fisher Transform</a>, Up: <a href="#Indicators" accesskey="u" rel="up">Indicators</a> &nbsp; [<a hre...
</div>
<h3 class="section" id="Force-Index-1"><span>10.16 Force Index<a class="copiable-link" href="#Force-Index-1"> &para;</a></span></h3>
<a class="index-entry-id" id="index-Elder-force-index"></a>
<a class="index-entry-id" id="index-Force-index"></a>
<a class="index-entry-id" id="index-Index_002c-force"></a>
<a class="index-entry-id" id="index-EFI"></a>
<a class="index-entry-id" id="index-_0025F"></a>

<a class="index-entry-id" id="index-Elder_002c-Alexander-1"></a>
<p>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 <em class="math">change*volume</em> values are
smoothed slightly with a 2-day EMA (see <a class="pxref" href="#Exponential-Moving-Average">Exponential Moving Average</a>), so
the formula is simply
</p>
<div class="example">
<pre class="example-preformatted">Force Index = EMA[2] of (volume * (close - prev close))
</pre></div>

<p>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.
</p>

<hr>
</div>
<div class="section-level-extent" id="Forecast-Oscillator">
<div class="nav-panel">
<p>
Next: <a href="#Gopalakrishnan-Range-Index" accesskey="n" rel="next">Gopalakrishnan Range Index</a>, Previous: <a href="#Force-Index" accesskey="p" rel="prev">Force Index</a>, Up: <a href="#Indicators" accesskey="u" rel="up">Indicators</a> &nbsp; [<a...
</div>
<h3 class="section" id="Forecast-Oscillator-1"><span>10.17 Forecast Oscillator<a class="copiable-link" href="#Forecast-Oscillator-1"> &para;</a></span></h3>
<a class="index-entry-id" id="index-Forecast-oscillator"></a>
<a class="index-entry-id" id="index-Oscillator_002c-forecast"></a>
<a class="index-entry-id" id="index-FOSC"></a>
<a class="index-entry-id" id="index-_0025F-1"></a>

<a class="index-entry-id" id="index-Chande_002c-Tushar-3"></a>
<p>The %F forecast oscillator by Tushar Chande shows deviation between today&rsquo;s
closing price and an N-day linear regression forecast (see <a class="pxref" href="#Linear-Regression">Linear Regression</a>) of that close.  The deviation is expressed as a percentage of the
close, so the formula is
</p>
<div class="example">
<pre class="example-preformatted">     close - forecast
%F = ---------------- * 100
          close

forecast = linear regression of previous N days, at today
</pre></div>

<p>The N days prices for the linear regression start from yesterday&rsquo;s close, and
the forecast value is the line extended out to today.  This forecast line is
like the EPMA (see <a class="pxref" href="#Endpoint-Moving-Average">Endpoint Moving Average</a>), but going out one day
further.  Chande suggests using a 5 day regression for short term trading, and
that&rsquo;s the default in Chart.
</p>

<hr>
</div>
<div class="section-level-extent" id="Gopalakrishnan-Range-Index">
<div class="nav-panel">
<p>
Next: <a href="#Intraday-Momentum-Index" accesskey="n" rel="next">Intraday Momentum Index</a>, Previous: <a href="#Forecast-Oscillator" accesskey="p" rel="prev">Forecast Oscillator</a>, Up: <a href="#Indicators" accesskey="u" rel="up">Indicators</a> ...
</div>
<h3 class="section" id="Gopalakrishnan-Range-Index-1"><span>10.18 Gopalakrishnan Range Index<a class="copiable-link" href="#Gopalakrishnan-Range-Index-1"> &para;</a></span></h3>
<a class="index-entry-id" id="index-Gopalakrishnan-range-index"></a>
<a class="index-entry-id" id="index-Index_002c-Gopalakrishnan-range"></a>
<a class="index-entry-id" id="index-GAPO"></a>

<a class="index-entry-id" id="index-Gopalakrishnan_002c-Jayanthi"></a>
<p>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).
</p>
<div class="example">
<pre class="example-preformatted">       log(high[Ndays] - low[Ndays])
GAPO = -----------------------------
                  log(N)
</pre></div>

<p>The idea is to identify markets which are more erratic than others.  It will
be noted though that there&rsquo;s no scaling to the overall price level.  In Chart
GAPO is  under &ldquo;Low Priority&rdquo; in the indicator lists.
</p>

<hr>
</div>
<div class="section-level-extent" id="Intraday-Momentum-Index">
<div class="nav-panel">
<p>
Next: <a href="#Klinger-Volume-Oscillator" accesskey="n" rel="next">Klinger Volume Oscillator</a>, Previous: <a href="#Gopalakrishnan-Range-Index" accesskey="p" rel="prev">Gopalakrishnan Range Index</a>, Up: <a href="#Indicators" accesskey="u" rel="u...
</div>
<h3 class="section" id="Intraday-Momentum-Index-1"><span>10.19 Intraday Momentum Index<a class="copiable-link" href="#Intraday-Momentum-Index-1"> &para;</a></span></h3>
<a class="index-entry-id" id="index-Intraday-momentum-index"></a>
<a class="index-entry-id" id="index-Index_002c-Intraday-momentum"></a>
<a class="index-entry-id" id="index-IMI"></a>

<a class="index-entry-id" id="index-Chande_002c-Tushar-4"></a>
<p>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).

lib/App/Chart/doc/chart.html  view on Meta::CPAN

<div class="example">
<pre class="example-preformatted">                high + low + close
typical price = ------------------
                        3
</pre></div>

<p>&ldquo;Money flow&rdquo; on a given day is typical price multiplied by volume.  This is
the money that flowed, ie. an approximation to the dollar volume traded.
</p>
<div class="example">
<pre class="example-preformatted">money flow = typical price * volume
</pre></div>

<p>Across the N-day period two totals are formed.  &ldquo;Positive money flow&rdquo; is the
money flow on days where the typical price is higher the previous day&rsquo;s
typical price, and &ldquo;negative money flow&rdquo; when below.  Days when typical
price is unchanged are ignored.  The MFI is then
</p>
<div class="example">
<pre class="example-preformatted">                      positive money flow
MFI = 100 * -----------------------------------------
            positive money flow + negative money flow
</pre></div>

<p>Generally an MFI level of 80 is considered overbought, and 20 considered
oversold.  Those levels are shown as shown as dashed lines.
</p>
<p>MFI is similar to RSI (see <a class="pxref" href="#Relative-Strength-Index">Relative Strength Index</a>) 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).
</p>
<p>It should be noted &ldquo;money flow&rdquo; refers to dollar volume, ie. the total value
of shares traded.  Sometimes finance commentators speak of money &ldquo;flowing
into&rdquo; a stock, but that expression only means buyers are enthusiastic.
Obviously there&rsquo;s never any net money in or out, because for every buyer
there&rsquo;s a seller of the same amount.
</p>
<p>For the purposes of the MFI, &ldquo;money flow&rdquo;, 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.
</p>

<hr>
</div>
<div class="section-level-extent" id="On_002dBalance-Volume">
<div class="nav-panel">
<p>
Next: <a href="#Negative-Volume-Index" accesskey="n" rel="next">Negative Volume Index</a>, Previous: <a href="#Money-Flow-Index" accesskey="p" rel="prev">Money Flow Index</a>, Up: <a href="#Indicators" accesskey="u" rel="up">Indicators</a> &nbsp; [<a...
</div>
<h3 class="section" id="On_002dBalance-Volume-1"><span>10.26 On-Balance Volume<a class="copiable-link" href="#On_002dBalance-Volume-1"> &para;</a></span></h3>
<a class="index-entry-id" id="index-On_002dbalance-volume"></a>
<a class="index-entry-id" id="index-OBV"></a>
<a class="index-entry-id" id="index-Volume_002c-on_002dbalance"></a>

<p>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&rsquo;s close, and vice versa a down day.  So if p1 is
today&rsquo;s close and p2 is yesterday&rsquo;s, the formula is simply
</p>
<div class="example">
<pre class="example-preformatted">                 /  v1     if p1 &gt; p2
                |
OBV = OBVprev + |   0      if p1 = p2
                |
                 \  - v1   if p1 &gt; p2
</pre></div>

<p>The starting point (ie. the zero point) for the running total is arbitrary.
In Chart it&rsquo;s merely the segment of data first displayed.
</p>
<p>See also <a class="ref" href="#Price-and-Volume-Trend">Price and Volume Trend</a>, and <a class="ref" href="#Accumulation_002fDistribution">Accumulation/Distribution</a>,
which accumulate volume in similar ways.
</p>

<hr>
</div>
<div class="section-level-extent" id="Negative-Volume-Index">
<div class="nav-panel">
<p>
Next: <a href="#Polarized-Fractal-Efficiency" accesskey="n" rel="next">Polarized Fractal Efficiency</a>, Previous: <a href="#On_002dBalance-Volume" accesskey="p" rel="prev">On-Balance Volume</a>, Up: <a href="#Indicators" accesskey="u" rel="up">Indic...
</div>
<h3 class="section" id="Negative-Volume-Index-1"><span>10.27 Negative Volume Index<a class="copiable-link" href="#Negative-Volume-Index-1"> &para;</a></span></h3>
<a class="index-entry-id" id="index-Negative-volume-index"></a>
<a class="index-entry-id" id="index-NVI"></a>
<a class="index-entry-id" id="index-Index_002c-negative-volume"></a>

<a class="index-entry-id" id="index-Fosback_002c-Norman"></a>
<p>The Negative Volume Index (NVI) and Positive Volume Index (PVI) by Norman
Fosback (<a class="uref" href="http://www.fosback.com">http://www.fosback.com</a>) 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.
</p>
<div class="example">
<pre class="example-preformatted">                   /   close
                  |  -----------    if vol &lt; vol[prev]
NVI = NVI[prev] * |  close[prev]
                  |
                   \     1          if vol &gt;= vol[prev]

</pre></div>

<div class="example">
<pre class="example-preformatted">                   /   close
                  |  -----------    if vol &gt; vol[prev]
PVI = PVI[prev] * |  close[prev]
                  |
                   \     1          if vol &lt;= vol[prev]

</pre></div>

<p>The fraction <em class="math">close/close[prev]</em> 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.
</p>
<p>The principle behind the NVI is that on high volume days an uninformed crowd
is dominating, whereas on quieter days &ldquo;smart money&rdquo; is establishing
positions.  Fosback holds there&rsquo;s a 95% probability of a bull market when the
NVI rises above its one-year moving average.
</p>

<hr>
</div>
<div class="section-level-extent" id="Polarized-Fractal-Efficiency">
<div class="nav-panel">
<p>
Next: <a href="#Pretty-Good-Oscillator" accesskey="n" rel="next">Pretty Good Oscillator</a>, Previous: <a href="#Negative-Volume-Index" accesskey="p" rel="prev">Negative Volume Index</a>, Up: <a href="#Indicators" accesskey="u" rel="up">Indicators</a...
</div>
<h3 class="section" id="Polarized-Fractal-Efficiency-1"><span>10.28 Polarized Fractal Efficiency<a class="copiable-link" href="#Polarized-Fractal-Efficiency-1"> &para;</a></span></h3>
<a class="index-entry-id" id="index-Polarized-fractal-efficiency"></a>
<a class="index-entry-id" id="index-PFE"></a>
<a class="index-entry-id" id="index-Fractal_002c-polarized-efficiency-indicator"></a>

<p>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.
</p>
<p>The net distance travelled over the past N days is expressed as a percentage
of the total of each day&rsquo;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
</p>
<div class="example">
<pre class="example-preformatted">                   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&gt;0, or -1 if X&lt;0

                      new - old
Pchg(new,old) = 100 * ---------
                         old

Hypot(x,y) = sqrt (x^2 + y^2)
</pre></div>

<p>Here &ldquo;Pchg&rdquo; is a percentage change up or down from &ldquo;new&rdquo; to &ldquo;old&rdquo; price,
and &ldquo;Hypot&rdquo; is the distance (the hypotenuse) for a move of X horizontally
and Y vertically.  &ldquo;Sign&rdquo; means that PFE is positive or negative according
to whether the change over the past N days is up or down.
</p>
<p>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&rsquo;s been no net
change over the past N days.
</p>
<p>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 <a class="pxref" href="#Exponential-Moving-Average">Exponential Moving Average</a>) to
the PFE.  The default is 5 days smoothing, a value of 0 means no smoothing
(to see the raw values).
</p>
<ul class="mini-toc">
<li><a href="#Additional-Resources-8" accesskey="1">Additional Resources</a></li>
</ul>
<div class="subsection-level-extent" id="Additional-Resources-8">
<h4 class="subsection"><span>10.28.1 Additional Resources<a class="copiable-link" href="#Additional-Resources-8"> &para;</a></span></h4>
<ul class="itemize mark-bullet">
<li><a class="uref" href="http://www.traderslog.com/polarized-fractal-efficiency.htm">http://www.traderslog.com/polarized-fractal-efficiency.htm</a> &ndash; sample
chart of IBM, year not shown but data is 2002.
</li><li><a class="uref" href="http://transcripts.fxstreet.com/2005/09/polarized_fract.html">http://transcripts.fxstreet.com/2005/09/polarized_fract.html</a> &ndash;
presentation on PFE by Erik Long.
</li></ul>


<hr>
</div>
</div>
<div class="section-level-extent" id="Pretty-Good-Oscillator">
<div class="nav-panel">
<p>
Next: <a href="#Price-and-Volume-Trend" accesskey="n" rel="next">Price and Volume Trend</a>, Previous: <a href="#Polarized-Fractal-Efficiency" accesskey="p" rel="prev">Polarized Fractal Efficiency</a>, Up: <a href="#Indicators" accesskey="u" rel="up"...
</div>
<h3 class="section" id="Pretty-Good-Oscillator-1"><span>10.29 Pretty Good Oscillator<a class="copiable-link" href="#Pretty-Good-Oscillator-1"> &para;</a></span></h3>
<a class="index-entry-id" id="index-Pretty-good-oscillator"></a>
<a class="index-entry-id" id="index-PGO"></a>
<a class="index-entry-id" id="index-Oscillator_002c-pretty-good"></a>

<p>The &ldquo;Pretty Good Oscillator&rdquo; (PGO) by Mark Johnson measures the distance of
the current close from its N-day simple moving average (see <a class="pxref" href="#Simple-Moving-Average">Simple Moving Average</a>), expressed in terms of an average true range (see <a class="pxref" href="#Average-True-Range">Average True Range</a>...
</p>
<div class="example">
<pre class="example-preformatted">      close - SMA[N] of closes
PGO = ------------------------
        EMA[N] of true range
</pre></div>

<p>So for instance a PGO value of +2.5 would mean the current close is 2.5
average days&rsquo; range above the SMA.
</p>
<p>Johnson&rsquo;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).
</p>
<ul class="mini-toc">
<li><a href="#Additional-Resources-9" accesskey="1">Additional Resources</a></li>
</ul>
<div class="subsection-level-extent" id="Additional-Resources-9">
<h4 class="subsection"><span>10.29.1 Additional Resources<a class="copiable-link" href="#Additional-Resources-9"> &para;</a></span></h4>
<ul class="itemize mark-bullet">
<li><a class="uref" href="http://trader.online.pl/MSZ/e-w-Pretty_Good_Oscillator.html">http://trader.online.pl/MSZ/e-w-Pretty_Good_Oscillator.html</a> &ndash; formula,
and sample chart of Cisco (&lsquo;<samp class="samp">CSCO</samp>&rsquo;) from 2003.
</li></ul>


<hr>
</div>
</div>
<div class="section-level-extent" id="Price-and-Volume-Trend">
<div class="nav-panel">
<p>
Next: <a href="#QStick" accesskey="n" rel="next">QStick</a>, Previous: <a href="#Pretty-Good-Oscillator" accesskey="p" rel="prev">Pretty Good Oscillator</a>, Up: <a href="#Indicators" accesskey="u" rel="up">Indicators</a> &nbsp; [<a href="#Concept-In...
</div>
<h3 class="section" id="Price-and-Volume-Trend-1"><span>10.30 Price and Volume Trend<a class="copiable-link" href="#Price-and-Volume-Trend-1"> &para;</a></span></h3>
<a class="index-entry-id" id="index-Price-and-volume-trend"></a>
<a class="index-entry-id" id="index-PVT"></a>
<a class="index-entry-id" id="index-Volume_002c-price-trend"></a>

<p>Price and Volume Trend (PVT) is a running total of daily volume, with each
day&rsquo;s volume added or subtracted according to the percentage change in the
today&rsquo;s closing price over yesterday&rsquo;s.
</p>
<div class="example">
<pre class="example-preformatted">                         close[today] - close[yesterday]
PVT = PVTprev + volume * -------------------------------
                                 close[yesterday]
</pre></div>

<p>The starting point (ie. the zero point) for the running total is arbitrary.
In Chart it&rsquo;s merely the segment of data first displayed.
</p>
<p>PVT is similar to On-balance volume (see <a class="pxref" href="#On_002dBalance-Volume">On-Balance Volume</a>), but
accumulating a portion of the volume.  And see also
<a class="ref" href="#Accumulation_002fDistribution">Accumulation/Distribution</a>, which also accumulates volume.
</p>

<hr>
</div>
<div class="section-level-extent" id="QStick">
<div class="nav-panel">
<p>
Next: <a href="#R_002dSquared-Index" accesskey="n" rel="next">R-Squared Index</a>, Previous: <a href="#Price-and-Volume-Trend" accesskey="p" rel="prev">Price and Volume Trend</a>, Up: <a href="#Indicators" accesskey="u" rel="up">Indicators</a> &nbsp;...
</div>
<h3 class="section" id="QStick-1"><span>10.31 QStick<a class="copiable-link" href="#QStick-1"> &para;</a></span></h3>
<a class="index-entry-id" id="index-QStick"></a>

<p>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.
</p>
<div class="example">
<pre class="example-preformatted">         close[1]-open[1] + ... + close[N]-open[N]
QStick = -----------------------------------------
                             N
</pre></div>

<p>Days which are up have positive amounts for <em class="math">close-open</em>, days which are
down have negative amounts.  In adding them up they cancel out until the
dominance of one over the other results.
</p>

<hr>
</div>
<div class="section-level-extent" id="R_002dSquared-Index">
<div class="nav-panel">
<p>
Next: <a href="#RAVI" accesskey="n" rel="next">RAVI</a>, Previous: <a href="#QStick" accesskey="p" rel="prev">QStick</a>, Up: <a href="#Indicators" accesskey="u" rel="up">Indicators</a> &nbsp; [<a href="#Concept-Index" title="Index" rel="index">Index...
</div>
<h3 class="section" id="R_002dSquared-Index-1"><span>10.32 R-Squared Index<a class="copiable-link" href="#R_002dSquared-Index-1"> &para;</a></span></h3>
<a class="index-entry-id" id="index-R_002dsquared-index"></a>
<a class="index-entry-id" id="index-Index_002c-R_002dSquared"></a>

<a class="index-entry-id" id="index-Chande_002c-Tushar-5"></a>
<a class="index-entry-id" id="index-Kroll_002c-Stanley-1"></a>
<a class="index-entry-id" id="index-Correlation-coefficient"></a>
<a class="index-entry-id" id="index-Coefficient_002c-correlation"></a>
<a class="index-entry-id" id="index-Coefficient-of-determination"></a>
<p>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 <em class="dfn">coefficient of determination</em>
of the prices versus a straight line.  This coefficient is written <em class="math">r^2</em>,
hence the name of the indicator.
</p>
<p>For reference, the formulas are as follows, where X values are the closing
prices and Y values are a straight line 1,2,&hellip;,N.  Variance is the
square of standard deviation (see <a class="pxref" href="#Standard-Deviation">Standard Deviation</a>).
</p>
<div class="example">
<pre class="example-preformatted">         (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
</pre></div>

<p>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&rsquo;t matter, nor does the absolute price level, only how well
they make a straight line.
</p>
<p>Chande and Kroll suggested using a 14-day period, and that&rsquo;s the default in
Chart.
</p>

<hr>
</div>
<div class="section-level-extent" id="RAVI">
<div class="nav-panel">
<p>
Next: <a href="#Relative-Strength-Index" accesskey="n" rel="next">Relative Strength Index</a>, Previous: <a href="#R_002dSquared-Index" accesskey="p" rel="prev">R-Squared Index</a>, Up: <a href="#Indicators" accesskey="u" rel="up">Indicators</a> &nbs...
</div>
<h3 class="section" id="RAVI-1"><span>10.33 RAVI<a class="copiable-link" href="#RAVI-1"> &para;</a></span></h3>
<a class="index-entry-id" id="index-RAVI"></a>

<p>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 <a class="pxref" href="#Simple-Moving-Average">Simple Moving Average</a>).  The defaults are 7 days and 65 days.
</p>
<div class="example">
<pre class="example-preformatted">             abs (SMA[short] - SMA[long])
RAVI = 100 * ----------------------------
                      SMA[long]
</pre></div>


<hr>
</div>
<div class="section-level-extent" id="Relative-Strength-Index">
<div class="nav-panel">
<p>
Next: <a href="#Relative-Volatility-Index" accesskey="n" rel="next">Relative Volatility Index</a>, Previous: <a href="#RAVI" accesskey="p" rel="prev">RAVI</a>, Up: <a href="#Indicators" accesskey="u" rel="up">Indicators</a> &nbsp; [<a href="#Concept-...
</div>
<h3 class="section" id="Relative-Strength-Index-1"><span>10.34 Relative Strength Index<a class="copiable-link" href="#Relative-Strength-Index-1"> &para;</a></span></h3>
<a class="index-entry-id" id="index-Relative-strength-index"></a>
<a class="index-entry-id" id="index-RSI"></a>
<a class="index-entry-id" id="index-Index_002c-relative-strength"></a>

<a class="index-entry-id" id="index-Wilder_002c-J_002e-Welles-5"></a>
<p>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 <a class="pxref" href="#Exponential-Moving-Average">Exponential Moving Average</a>).
</p>
<p>For each day an upward or downward movement is calculated.  On an up day
</p>
<div class="example">
<pre class="example-preformatted">U = close[today] - close[yesterday]
D = 0
</pre></div>

<p>or on a down day as follows (notice D is a positive amount),
</p>
<div class="example">
<pre class="example-preformatted">U = 0
D = close[yesterday] - close[today]
</pre></div>

<p>The sequence of U values over time is averaged with an EMA
(see <a class="pxref" href="#Exponential-Moving-Average">Exponential Moving Average</a>) and likewise the D values.  The
ratio is the &ldquo;relative strength&rdquo;,
</p>
<div class="example">
<pre class="example-preformatted">     EMA[N] of U
RS = -----------
     EMA[N] of D
</pre></div>

<p>This is turned into an index between 0 and 100,
</p>
<div class="example">
<pre class="example-preformatted">              1
RSI = 100 * ------
            1 + RS
</pre></div>

<p>This can also be written as follows, emphasising the way the RSI measures up
movement as a proportion of the two up and down,
</p>
<div class="example">
<pre class="example-preformatted">                    EMA[N] of U
RSI = 100 * -----------------------------
            (EMA[N] of U) + (EMA[N] of D)
</pre></div>

<p>Wilder recommended a smoothing period of N=14, and that&rsquo;s the default in
Chart.  Note also that the period is interpreted by Wilder&rsquo;s reckoning of EMA
smoothing (see <a class="ref" href="#Wilder-EMA-period">Wilder EMA period</a>).
</p>
<p>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&rsquo;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.
</p>
<p>The term &ldquo;relative strength&rdquo; also refers to a comparison between a stock and
the overall market.  This is sometimes called &ldquo;relative strength
comparative&rdquo; to avoid confusion.  This is unrelated to the relative strength
and relative strength index described in this section.
</p>
<p>See also CMO (see <a class="pxref" href="#Chande-Momentum-Oscillator">Chande Momentum Oscillator</a>) which is an RSI with SMA
smoothing, and TSI (see <a class="pxref" href="#True-Strength-Index">True Strength Index</a>) which is an RSI with
double-EMA smoothing.
</p>

<a class="anchor" id="Stochastic-RSI"></a><ul class="mini-toc">
<li><a href="#Stochastic-RSI-1" accesskey="1">Stochastic RSI</a></li>
</ul>
<div class="subsection-level-extent" id="Stochastic-RSI-1">
<h4 class="subsection"><span>10.34.1 Stochastic RSI<a class="copiable-link" href="#Stochastic-RSI-1"> &para;</a></span></h4>
<a class="index-entry-id" id="index-Stochastic-RSI"></a>

<p>The stochastic RSI is an N-day unsmoothed %K stochastic
applied to the RSI line.  The position of today&rsquo;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,
</p>
<div class="example">
<pre class="example-preformatted">               RSI[today] - RSI[Nday low]
Stoch RSI =  ------------------------------
             RSI[Nday high] - RSI[Nday low]
</pre></div>


<hr>
</div>
</div>
<div class="section-level-extent" id="Relative-Volatility-Index">
<div class="nav-panel">
<p>
Next: <a href="#Random-Walk-Index" accesskey="n" rel="next">Random Walk Index</a>, Previous: <a href="#Relative-Strength-Index" accesskey="p" rel="prev">Relative Strength Index</a>, Up: <a href="#Indicators" accesskey="u" rel="up">Indicators</a> &nbs...
</div>
<h3 class="section" id="Relative-Volatility-Index-1"><span>10.35 Relative Volatility Index<a class="copiable-link" href="#Relative-Volatility-Index-1"> &para;</a></span></h3>
<a class="index-entry-id" id="index-Relative-volatility-index"></a>
<a class="index-entry-id" id="index-RVI"></a>
<a class="index-entry-id" id="index-Index_002c-relative-volatility"></a>

<a class="index-entry-id" id="index-Dorsey_002c-Donald-1"></a>
<p>The Relative Volatility Index (RVI) by Donald Dorsey is similar to the RSI
(see <a class="pxref" href="#Relative-Strength-Index">Relative Strength Index</a>) but where the RSI adds up price change
amounts based on price direction, the RVI instead adds standard deviations
(stddev, see <a class="pxref" href="#Standard-Deviation">Standard Deviation</a>) based on price direction.
</p>
<p>The standard deviation is over a past 10 days, then an EMA (see <a class="pxref" href="#Exponential-Moving-Average">Exponential Moving Average</a>) of deviations on up days is compared to all deviations,
giving Dorsey&rsquo;s original 1993 definition of RVI on closing prices.
</p>
<div class="example">
<pre class="example-preformatted">S = Stddev[10 days]

U = /  S   if price &gt; prev price
    \  0   otherwise

lib/App/Chart/doc/chart.html  view on Meta::CPAN

</pre></div>

<p>When a data source doesn&rsquo;t provide high/low values just the closes are used,
which ends up as Dorsey&rsquo;s original.  The stddev period of 10 days and the
default EMA of 14 days are parameters (see <a class="pxref" href="#View-Style">View Style</a>).  The EMA period
follows J. Welles Wilder&rsquo;s reckoning (see <a class="pxref" href="#Wilder-EMA-period">Wilder EMA period</a>), the same
as an RSI.
</p>
<a class="anchor" id="Inertia"></a></div>
<div class="section-level-extent" id="Inertia-1">
<h3 class="section"><span>10.36 Inertia<a class="copiable-link" href="#Inertia-1"> &para;</a></span></h3>
<a class="index-entry-id" id="index-Inertia"></a>

<p>Dorsey also smoothed the RVI with a 20-day least squares moving average
(LSQMA, see <a class="pxref" href="#Endpoint-Moving-Average">Endpoint Moving Average</a>) and called the result the inertia
indicator.  The 20-day smoothing period is a parameter.
</p>
<p>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.
</p>

<hr>
</div>
<div class="section-level-extent" id="Random-Walk-Index">
<div class="nav-panel">
<p>
Next: <a href="#Stochastics" accesskey="n" rel="next">Stochastics</a>, Previous: <a href="#Relative-Volatility-Index" accesskey="p" rel="prev">Relative Volatility Index</a>, Up: <a href="#Indicators" accesskey="u" rel="up">Indicators</a> &nbsp; [<a h...
</div>
<h3 class="section" id="Random-Walk-Index-1"><span>10.37 Random Walk Index<a class="copiable-link" href="#Random-Walk-Index-1"> &para;</a></span></h3>
<a class="index-entry-id" id="index-Random-walk-index"></a>
<a class="index-entry-id" id="index-Index_002c-random-walk"></a>
<a class="index-entry-id" id="index-RWI"></a>

<p>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.
</p>
<p>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
</p>
<div class="example">
<pre class="example-preformatted">High[today] - Low[K]     1
-------------------- * ------
   Average TR [K]      sqrt(K)
</pre></div>

<p>which is the move from the low K days ago up to today&rsquo;s high, scaled by an
average of the true range (TR, see <a class="pxref" href="#True-Range">True Range</a>).  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&rsquo;s high less
yesterday&rsquo;s low, compared to a two-day average of the true range (yesterday&rsquo;s
true range and the day before&rsquo;s).  RWI low is similar, but using <em class="math">High[K]
- Low[today]</em> for the movement down from past high to today&rsquo;s low.
</p>
<p>The factor <em class="math">sqrt(K)</em> 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 <em class="math">sqrt(K)</em>.  So the formula compares observed distance in
average day&rsquo;s steps compared to the <em class="math">sqrt(K)</em> 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.
</p>

<hr>
</div>
<div class="section-level-extent" id="Stochastics">
<div class="nav-panel">
<p>
Next: <a href="#TD-Range-Expansion-Index" accesskey="n" rel="next">TD Range Expansion Index</a>, Previous: <a href="#Random-Walk-Index" accesskey="p" rel="prev">Random Walk Index</a>, Up: <a href="#Indicators" accesskey="u" rel="up">Indicators</a> &n...
</div>
<h3 class="section" id="Stochastics-1"><span>10.38 Stochastics<a class="copiable-link" href="#Stochastics-1"> &para;</a></span></h3>
<a class="index-entry-id" id="index-Stochastics"></a>

<a class="index-entry-id" id="index-Lane_002c-George"></a>
<p>Stochastics are an oscillator and signal line described by George Lane based
on each day&rsquo;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.
</p>
<a class="index-entry-id" id="index-_0025K-stochastic"></a>
<p>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.
</p>
<div class="example">
<pre class="example-preformatted">             close - Nday low
%K = 100 * --------------------
           Nday high - Nday low
</pre></div>

<a class="index-entry-id" id="index-_0025D-stochastic"></a>
<p>An extreme of 0 is reached for a close at the day&rsquo;s low which is also a new
N-day low.  Likewise 100 for a close at the day&rsquo;s high and a new N-day high.
A signal line %D is added by smoothing %K with a simple moving average
(see <a class="pxref" href="#Simple-Moving-Average">Simple Moving Average</a>).
</p>
<div class="example">
<pre class="example-preformatted">%D = SMA[D] of %K
</pre></div>

<p>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.
</p>
<a class="index-entry-id" id="index-Fast-stochastics"></a>
<a class="index-entry-id" id="index-Slow-stochastics"></a>
<p>%K and %D just described are called the &ldquo;fast&rdquo; stochastics.  Corresponding
&ldquo;slow&rdquo; stochastics are formed by smoothing %K with a simple moving average,
and calculating %D from that smoothed series.  The extra smoothing is the
&ldquo;slow days&rdquo; parameter in Chart.  The default is 0 for no slowing, a value of
3 is often used.
</p>
<p>Incidentally, a value of 1 for the slowing is the same as no slowing, because
a 1-period SMA of course doesn&rsquo;t change the data.
</p>

<hr>
</div>
<div class="section-level-extent" id="TD-Range-Expansion-Index">

lib/App/Chart/doc/chart.html  view on Meta::CPAN

moving average of closing prices.  The slope is calculated as a percentage
change between today and yesterday&rsquo;s triple smoothed EMA values.
</p>
<div class="example">
<pre class="example-preformatted">             EMAofEMAofEMA[today] - EMAofEMAofEMA[yesterday]
TRIX = 100 * ---------------------------------------
                    EMAofEMAofEMA[yesterday]
</pre></div>

<p>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.
</p>
<a class="index-entry-id" id="index-EMA-of-EMA-of-EMA"></a>
<a class="index-entry-id" id="index-Triple-exponential-moving-average-1"></a>
<a class="index-entry-id" id="index-Average_002c-triple-exponential-1"></a>
<a class="index-entry-id" id="index-Moving-average_002c-triple-exponential-1"></a>
<a class="anchor" id="EMA-of-EMA-of-EMA"></a></div>
<div class="section-level-extent" id="EMA-of-EMA-of-EMA-1">
<h3 class="section"><span>10.44 EMA of EMA of EMA<a class="copiable-link" href="#EMA-of-EMA-of-EMA-1"> &para;</a></span></h3>

<p>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).
</p>
<p>The result is quite different from a plain EMA.  It&rsquo;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&rsquo; influence is in fact smaller than the peak weights (at about N-days
back).  The following graph shows the weights for <em class="math">N=10</em>.
</p>
<br>
<div class="center"><img class="image" src="chart-ema-3-weights.png" alt="EMA of EMA of EMA weights graph">
</div>
<p>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.
</p>

<hr>
</div>
<div class="section-level-extent" id="Twiggs-Money-Flow">
<div class="nav-panel">
<p>
Next: <a href="#Ulcer-Index" accesskey="n" rel="next">Ulcer Index</a>, Previous: <a href="#TRIX" accesskey="p" rel="prev">TRIX</a>, Up: <a href="#Indicators" accesskey="u" rel="up">Indicators</a> &nbsp; [<a href="#Concept-Index" title="Index" rel="in...
</div>
<h3 class="section" id="Twiggs-Money-Flow-1"><span>10.45 Twiggs Money Flow<a class="copiable-link" href="#Twiggs-Money-Flow-1"> &para;</a></span></h3>
<a class="index-entry-id" id="index-Twiggs-money-flow"></a>
<a class="index-entry-id" id="index-Money-flow_002c-Twiggs"></a>
<a class="index-entry-id" id="index-Index_002c-Twiggs-money-flow"></a>

<p><a class="uref" href="http://www.incrediblecharts.com/technical/twiggs_money_flow.htm">http://www.incrediblecharts.com/technical/twiggs_money_flow.htm</a>
</p>
<a class="index-entry-id" id="index-Twiggs_002c-Colin"></a>
<p>The Twiggs money flow index by Colin Twiggs is a variation of the Chaikin
money flow index (see <a class="pxref" href="#Chaikin-Money-Flow">Chaikin Money Flow</a>) using true range so as to
include gap moves, and using EMA smoothing (see <a class="pxref" href="#Exponential-Moving-Average">Exponential Moving Average</a>) to avoid jumps when a high volume day drops out of the calculation.
The formula is
</p>
<div class="example">
<pre class="example-preformatted">                                /      close - truelow       \
            EMA[N] of  volume * | 2 * ------------------ - 1 |
                                \     truehigh - truelow     /
Twiggs MF = --------------------------------------------------
                  EMA[N] of  volume

truehigh = max (high, prevclose)
truelow  = min (low,  prevclose)
</pre></div>

<p>The default EMA period is 21 days, and the period is reckoned by J. Welles
Wilder&rsquo;s method (see <a class="pxref" href="#Exponential-Moving-Average">Exponential Moving Average</a>).
</p>

<hr>
</div>
<div class="section-level-extent" id="Ulcer-Index">
<div class="nav-panel">
<p>
Next: <a href="#Ultimate-Oscillator" accesskey="n" rel="next">Ultimate Oscillator</a>, Previous: <a href="#Twiggs-Money-Flow" accesskey="p" rel="prev">Twiggs Money Flow</a>, Up: <a href="#Indicators" accesskey="u" rel="up">Indicators</a> &nbsp; [<a h...
</div>
<h3 class="section" id="Ulcer-Index-1"><span>10.46 Ulcer Index<a class="copiable-link" href="#Ulcer-Index-1"> &para;</a></span></h3>
<a class="index-entry-id" id="index-Ulcer-index"></a>
<a class="index-entry-id" id="index-Index_002c-Ulcer"></a>

<p><a class="uref" href="http://www.tangotools.com/ui/ui.htm">http://www.tangotools.com/ui/ui.htm</a>
</p>
<a class="index-entry-id" id="index-Martin_002c-Peter"></a>
<p>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.
</p>
<div class="example">
<pre class="example-preformatted">       price[i] - maxprice so far
R[i] = --------------------------
           maxprice so far
</pre></div>

<a class="index-entry-id" id="index-Quadratic-mean"></a>
<a class="index-entry-id" id="index-Mean_002c-quadratic"></a>
<p>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.
</p>
<div class="example">
<pre class="example-preformatted">              / R[1]^2 + R[2]^2 + ... + R[N]^2 \
Ulcer = sqrt |  ------------------------------  |
              \              N                 /
</pre></div>

<p>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.
</p>

<hr>
</div>

lib/App/Chart/doc/chart.html  view on Meta::CPAN

</p>
<ul class="mini-toc">
<li><a href="#Additional-Resources-10" accesskey="1">Additional Resources</a></li>
</ul>
<div class="subsection-level-extent" id="Additional-Resources-10">
<h4 class="subsection"><span>10.52.1 Additional Resources<a class="copiable-link" href="#Additional-Resources-10"> &para;</a></span></h4>
<ul class="itemize mark-bullet">
<li><a class="uref" href="http://stockcharts.com/education/IndicatorAnalysis/indic_ZigZag.html">http://stockcharts.com/education/IndicatorAnalysis/indic_ZigZag.html</a> &ndash;
sample chart of &lsquo;<samp class="samp">HPQ</samp>&rsquo; from 1999/2000.
</li></ul>


<hr>
</div>
</div>
</div>
<div class="chapter-level-extent" id="Common-Calculations">
<div class="nav-panel">
<p>
Next: <a href="#Other-Indicator-Packages" accesskey="n" rel="next">Other Indicator Packages</a>, Previous: <a href="#Indicators" accesskey="p" rel="prev">Indicators</a>, Up: <a href="#Top" accesskey="u" rel="up">Chart</a> &nbsp; [<a href="#Concept-In...
</div>
<h2 class="chapter" id="Common-Calculations-1"><span>11 Common Calculations<a class="copiable-link" href="#Common-Calculations-1"> &para;</a></span></h2>
<a class="index-entry-id" id="index-Common-calculations"></a>

<p>The following are algorithms and calculations shared among various indicators
and averages.
</p>


<ul class="mini-toc">
<li><a href="#Linear-Regression" accesskey="1">Linear Regression</a></li>
<li><a href="#Standard-Deviation" accesskey="2">Standard Deviation</a></li>
<li><a href="#True-Range" accesskey="3">True Range</a></li>
</ul>
<hr>
<div class="section-level-extent" id="Linear-Regression">
<div class="nav-panel">
<p>
Next: <a href="#Standard-Deviation" accesskey="n" rel="next">Standard Deviation</a>, Previous: <a href="#Common-Calculations" accesskey="p" rel="prev">Common Calculations</a>, Up: <a href="#Common-Calculations" accesskey="u" rel="up">Common Calculati...
</div>
<h3 class="section" id="Linear-Regression-1"><span>11.1 Linear Regression<a class="copiable-link" href="#Linear-Regression-1"> &para;</a></span></h3>
<a class="index-entry-id" id="index-Linear-regression"></a>
<a class="index-entry-id" id="index-Least-squares_002c-line"></a>

<p>The &ldquo;least squares&rdquo; or &ldquo;linear regression&rdquo; algorithm produces a best
fitting straight line through the middle of a set of N data points
<em class="math">x1,y1,
..., xN,yN</em>.  In Chart this means a set of prices Y, and dates X
(with non-trading days collapsed out).
</p>
<p>For a possible fitted line <em class="math">L(X)= a + b*X</em>, the vertical distance
from the line to each point is squared, and a total deviation formed.
</p>
<div class="example">
<pre class="example-preformatted">SumSquares = (y1 - L(x1))^2 + ... + (yN - L(xN))^2
</pre></div>

<p>The line parameters <em class="math">a</em> and <em class="math">b</em> are then chosen to make SumSquares
as small as possible (hence the name &ldquo;least squares&rdquo;), and there&rsquo;s just one
line with that smallest SumSquares.  The calculation is made easier if the X
coordinates are shifted so that <em class="math">Mean(X)=0</em>.  With that the formulas for
<em class="math">a</em> and <em class="math">b</em> are
</p>
<div class="example">
<pre class="example-preformatted">             y1 + ... + yN
a = Mean Y = -------------
                   N

    x1*y1 + ... + xN*yN
b = -------------------
      x1^2 + ... xN^2
</pre></div>

<p>A least squares fit is &ldquo;best&rdquo; 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.
</p>
<a class="index-entry-id" id="index-Linear-regression-slope-indicator"></a>
<a class="index-entry-id" id="index-Regression-coefficient"></a>
<a class="index-entry-id" id="index-Coefficient_002c-regression"></a>
<a class="anchor" id="Linear-Regression-Slope"></a><ul class="mini-toc">
<li><a href="#Slope" accesskey="1">Slope</a></li>
<li><a href="#Standard-Error" accesskey="2">Standard Error</a></li>
<li><a href="#Additional-Resources-11" accesskey="3">Additional Resources</a></li>
</ul>
<div class="subsection-level-extent" id="Slope">
<h4 class="subsection"><span>11.1.1 Slope<a class="copiable-link" href="#Slope"> &para;</a></span></h4>

<p>The slope of the linear regression line, the <em class="math">b</em> above, is sometimes
called the <em class="dfn">regression coefficient</em>.  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&rsquo;s under &ldquo;Low Priority&rdquo; in
the indicator lists.
</p>
<a class="index-entry-id" id="index-Standard-error-1"></a>
<a class="anchor" id="Linear-Regression-Standard-Error"></a></div>
<div class="subsection-level-extent" id="Standard-Error">
<h4 class="subsection"><span>11.1.2 Standard Error<a class="copiable-link" href="#Standard-Error"> &para;</a></span></h4>

<p>Standard error (stderr) is a statistical measure of how much values differ
from an assumed underlying curve.  It&rsquo;s calculated as the quadratic mean of
the vertical distances from each point to the curve.
</p>
<p>Standard error from a linear regression line <em class="math">y=a+bx</em> is
</p>
<div class="example">
<pre class="example-preformatted">               / (y1 - (a+b*x1))^2 + ... + (yN - (a+b*xN))^2 \
Stderr = sqrt |  -------------------------------------------  |
               \                     N                       /
</pre></div>

<p>Notice the numerator is the same SumSquares which was minimized above.
Standard error is similar to standard deviation (see <a class="pxref" href="#Standard-Deviation">Standard Deviation</a>);
but where stddev takes differences from a horizontal line (the <em class="math">Y</em> mean),
stderr here goes from the sloping linear regression line.
</p>
<p>For reference, there&rsquo;s no need to actually calculate the linear regression
<em class="math">a</em> and <em class="math">b</em>, the stderr can be formed directly as
</p>
<div class="example">
<pre class="example-preformatted">               /               Covariance(X,Y)^2 \
Stderr = sqrt |  Variance(Y) - -----------------  |
               \                  Variance(X)    /
</pre></div>

<p>where variance and covariance are as follows (and notice they simplify if
<em class="math">X</em> values are chosen to make <em class="math">Mean(X)</em> zero),
</p>
<div class="example">
<pre class="example-preformatted">Covariance X,Y = Mean (X*Y) - (Mean X) * (Mean Y)
Variance X = Mean(X^2) - (Mean X)^2
</pre></div>

<p>Standard error from a linear regression like this is used as a channel width
in Kirshenbaum Bands (see <a class="pxref" href="#Kirshenbaum-Bands">Kirshenbaum Bands</a>).  It can also be viewed
directly as an indicator, but this is probably of limited use and for that
reason is under &ldquo;Low Priority&rdquo; in the indicator lists.
</p>
</div>
<div class="subsection-level-extent" id="Additional-Resources-11">
<h4 class="subsection"><span>11.1.3 Additional Resources<a class="copiable-link" href="#Additional-Resources-11"> &para;</a></span></h4>
<ul class="itemize mark-bullet">
<li><a class="uref" href="http://mathworld.wolfram.com/LeastSquaresFitting.html">http://mathworld.wolfram.com/LeastSquaresFitting.html</a> &ndash; on calculating
stderr without the a,b parameters
</li></ul>


<hr>
</div>
</div>
<div class="section-level-extent" id="Standard-Deviation">
<div class="nav-panel">
<p>
Next: <a href="#True-Range" accesskey="n" rel="next">True Range</a>, Previous: <a href="#Linear-Regression" accesskey="p" rel="prev">Linear Regression</a>, Up: <a href="#Common-Calculations" accesskey="u" rel="up">Common Calculations</a> &nbsp; [<a h...
</div>
<h3 class="section" id="Standard-Deviation-1"><span>11.2 Standard Deviation<a class="copiable-link" href="#Standard-Deviation-1"> &para;</a></span></h3>
<a class="index-entry-id" id="index-Standard-deviation-1"></a>
<a class="index-entry-id" id="index-Stddev"></a>

<p>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 <a class="pxref" href="#Bollinger-Bands">Bollinger Bands</a>) and VIDYA
and <a class="ref" href="#Variable-Index-Dynamic-Average">Variable Index Dynamic Average</a>).
</p>
<p>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 &ldquo;Low Priority&rdquo; in the indicator lists.
</p>
<a class="index-entry-id" id="index-Quadratic-mean-1"></a>
<a class="index-entry-id" id="index-Mean_002c-quadratic-1"></a>
<p>For reference, the formula on prices p1 to pN is as follows.  Each
<em class="math">p[i]-m</em> is the distance from the mean <em class="math">m</em>, and those distances
are averaged with a quadratic mean.
</p>
<div class="example">
<pre class="example-preformatted">               / (p1-m)^2 + (p2-m)^2 + ... + (pN-m)^2 \
Stddev = sqrt (  ------------------------------------  )
               \                   N                  /
</pre></div>

<p>where <em class="math">m</em> is the arithmetic mean
</p>
<div class="example">
<pre class="example-preformatted">    p1 + p2 + ... + pN
m = ------------------
            N
</pre></div>

<p>Also, for reference, the formula can be rearranged to the following form,
&ldquo;sum of the squares minus square of the sums&rdquo;.  This is what Chart uses,
because a new term can be shifted into the sums without recalculating all N
terms.
</p>
<div class="example">
<pre class="example-preformatted">               / p1^2 + p2^2 + ... + pN^2   (p1 + p2 + ... + pN)^2 \
Stddev = sqrt (  ------------------------ - ----------------------  )
               \            N                         N^2          /
</pre></div>


<hr>
</div>
<div class="section-level-extent" id="True-Range">
<div class="nav-panel">
<p>
Previous: <a href="#Standard-Deviation" accesskey="p" rel="prev">Standard Deviation</a>, Up: <a href="#Common-Calculations" accesskey="u" rel="up">Common Calculations</a> &nbsp; [<a href="#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h3 class="section" id="True-Range-1"><span>11.3 True Range<a class="copiable-link" href="#True-Range-1"> &para;</a></span></h3>
<a class="index-entry-id" id="index-True-range-1"></a>
<a class="index-entry-id" id="index-TR"></a>

<p>True range is simply the day&rsquo;s trading range (high to low) extended to include
the previous day&rsquo;s close, should that close be above the high or below the
low.
</p>
<div class="example">
<pre class="example-preformatted">true range = max(high, prev close) - min(low, prev close)
</pre></div>

<p>The effect is to include any &ldquo;gap&rdquo; left between yesterday&rsquo;s close and
today&rsquo;s range.  Quite often there&rsquo;s no gap, but when overnight news makes
prices jump it can be desirable in some algorithms to include that distance.
</p>
<p>When a stock doesn&rsquo;t have high/low values (some indices for instance), then
just close-to-close changes are used for true range, which may or may not be
particularly useful.
</p>
<p>Raw true range values are generally uninteresting, they&rsquo;re merely used in
other indicators.  Wilder&rsquo;s average true range (see <a class="pxref" href="#Average-True-Range">Average True Range</a>)
uses smoothed true range values.  Setting <em class="math">N=0</em> for the smoothing period
can show the raw true range values if desired.
</p>

<hr>
</div>
</div>
<div class="chapter-level-extent" id="Other-Indicator-Packages">
<div class="nav-panel">
<p>
Next: <a href="#Watchlist" accesskey="n" rel="next">Watchlist</a>, Previous: <a href="#Common-Calculations" accesskey="p" rel="prev">Common Calculations</a>, Up: <a href="#Top" accesskey="u" rel="up">Chart</a> &nbsp; [<a href="#Concept-Index" title="...
</div>
<h2 class="chapter" id="Other-Indicator-Packages-1"><span>12 Other Indicator Packages<a class="copiable-link" href="#Other-Indicator-Packages-1"> &para;</a></span></h2>
<a class="index-entry-id" id="index-Other-indicator-packages"></a>
<a class="index-entry-id" id="index-Indicator-packages"></a>
<a class="index-entry-id" id="index-Add_002don-indicators"></a>

<p>The indicators and averages from the following packages can be selected in
Chart under the View Style dialog (see <a class="pxref" href="#View-Style">View Style</a>).
</p>

lib/App/Chart/doc/chart.html  view on Meta::CPAN

<div class="example">
<pre class="example-preformatted">(chart-latest &quot;F&quot;) &rArr; 19.55
</pre></div>

<p><var class="var">field</var> is a lisp symbol for what data to return.  The default is
<code class="code">last</code> which is the last traded price.  The fields are
</p>
<div class="example">
<pre class="example-preformatted">name                        string or nil
bid offer                   \ prices or nil
open high low last change   /
quote-date last-date        string like &quot;2012-12-31&quot;, or nil
quote-time last-time        string like &quot;16:59:59&quot;, or nil
volume                      number or nil
note                        string or nil
</pre></div>

<p>Which fields actually have data depends on the data source.  <code class="code">name</code> is
the stock or commodity name as a string, or <code class="code">nil</code> if not available.
Dates and times are in the timezone of the symbol.  <code class="code">note</code> is a string
with extra notes, such as ex-dividend or limit up, or <code class="code">nil</code> if no other
notes.
</p>
<div class="example">
<pre class="example-preformatted">(chart-latest &quot;F&quot; 'volume) &rArr; 10492900
</pre></div>

<p><var class="var">scale</var> (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.
</p>
<p><code class="code">chart-latest</code> doesn&rsquo;t download new quotes but just returns existing
data.
</p></dd></dl>


<dl class="first-deftp">
<dt class="deftp" id="index-thing_002dat_002dpoint-1"><span class="category-def">Form: </span><span><strong class="def-name">thing-at-point</strong> <var class="def-var-arguments">&rsquo;chart-symbol</var><a class="copiable-link" href="#index-thing_0...
<dd><a class="index-entry-id" id="index-thing_002dat_002dpoint"></a>
<p>A call <code class="code">(thing-at-point 'chart-symbol)</code> gives the Chart symbol at point
(see <a data-manual="elisp" href="https://www.gnu.org/software/emacs/manual/html_mono/elisp.html#Buffer-Contents">Examining Buffer Contents</a> in <cite class="cite">GNU Emacs Lisp Reference Manual</cite>).  Note that you must <code class="code">(req...
'chartprog)</code> before using this, it&rsquo;s not autoloaded.
</p></dd></dl>


</div>
<div class="section-level-extent" id="Simple-Emacs-Spreadsheet">
<h3 class="section"><span>18.4 Simple Emacs Spreadsheet<a class="copiable-link" href="#Simple-Emacs-Spreadsheet"> &para;</a></span></h3>
<a class="index-entry-id" id="index-Simple-Emacs-Spreadsheet"></a>
<a class="index-entry-id" id="index-SES-spreadsheet"></a>

<a class="index-entry-id" id="index-example_002eses"></a>
<p><code class="code">chart-latest</code> above can be used in SES (see <a data-manual="ses" href="https://www.gnu.org/software/emacs/manual/html_mono/ses.html#Top">Simple Emacs
Spreadsheet</a> in <cite class="cite">Simple Emacs
Spreadsheet</cite>) expressions to include prices in a portfolio etc.  See
<samp class="file">emacs/example.ses</samp> in the Chart sources for a sample spreadsheet doing
this.
</p>
<p>Since <code class="code">chart-latest</code> doesn&rsquo;t download new data an
<kbd class="kbd">M-x ses-recalculate-all</kbd> just shows existing downloaded quotes
(see <a data-manual="ses" href="https://www.gnu.org/software/emacs/manual/html_mono/ses.html#Formulas">Cell formulas</a> in <cite class="cite">SES: Simple
Emacs Spreadsheet</cite>).
</p>
<a class="index-entry-id" id="index-chart_002dses_002drefresh"></a>
<p><kbd class="kbd">M-x chart-ses-refresh</kbd> does a combination <code class="code">ses-recalculate-all</code> and
download of Chart prices used.  A first recalculate records calls to
<code class="code">chart-latest</code> for which prices are used in the spreadsheet, they&rsquo;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.)
</p>


<hr>
</div>
</div>
<div class="unnumbered-level-extent" id="Concept-Index">
<div class="nav-panel">
<p>
Next: <a href="#Function-Index" accesskey="n" rel="next">Function and Variable Index</a>, Previous: <a href="#Emacs" accesskey="p" rel="prev">Emacs</a>, Up: <a href="#Top" accesskey="u" rel="up">Chart</a> &nbsp; [<a href="#Concept-Index" title="Index...
</div>
<h2 class="unnumbered" id="Concept-Index-1"><span>Concept Index<a class="copiable-link" href="#Concept-Index-1"> &para;</a></span></h2>
<div class="printindex cp-printindex">
<table class="cp-letters-header-printindex"><tr><th>Jump to: &nbsp; </th><td><a class="summary-letter-printindex" href="#Concept-Index_cp_symbol-1"><b>-</b></a>
 &nbsp; 
<a class="summary-letter-printindex" href="#Concept-Index_cp_symbol-2"><b>!</b></a>
 &nbsp; 
<a class="summary-letter-printindex" href="#Concept-Index_cp_symbol-3"><b>.</b></a>
 &nbsp; 
<a class="summary-letter-printindex" href="#Concept-Index_cp_symbol-4"><b>%</b></a>
 &nbsp; 
<br>
<a class="summary-letter-printindex" href="#Concept-Index_cp_letter-A"><b>A</b></a>
 &nbsp; 
<a class="summary-letter-printindex" href="#Concept-Index_cp_letter-B"><b>B</b></a>
 &nbsp; 
<a class="summary-letter-printindex" href="#Concept-Index_cp_letter-C"><b>C</b></a>
 &nbsp; 
<a class="summary-letter-printindex" href="#Concept-Index_cp_letter-D"><b>D</b></a>
 &nbsp; 
<a class="summary-letter-printindex" href="#Concept-Index_cp_letter-E"><b>E</b></a>
 &nbsp; 
<a class="summary-letter-printindex" href="#Concept-Index_cp_letter-F"><b>F</b></a>
 &nbsp; 
<a class="summary-letter-printindex" href="#Concept-Index_cp_letter-G"><b>G</b></a>
 &nbsp; 
<a class="summary-letter-printindex" href="#Concept-Index_cp_letter-H"><b>H</b></a>
 &nbsp; 
<a class="summary-letter-printindex" href="#Concept-Index_cp_letter-I"><b>I</b></a>
 &nbsp; 
<a class="summary-letter-printindex" href="#Concept-Index_cp_letter-J"><b>J</b></a>
 &nbsp; 
<a class="summary-letter-printindex" href="#Concept-Index_cp_letter-K"><b>K</b></a>
 &nbsp; 
<a class="summary-letter-printindex" href="#Concept-Index_cp_letter-L"><b>L</b></a>
 &nbsp; 
<a class="summary-letter-printindex" href="#Concept-Index_cp_letter-M"><b>M</b></a>
 &nbsp; 
<a class="summary-letter-printindex" href="#Concept-Index_cp_letter-N"><b>N</b></a>
 &nbsp; 
<a class="summary-letter-printindex" href="#Concept-Index_cp_letter-O"><b>O</b></a>



( run in 5.332 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )