(Revised January 10, 2014)

Robert Murray, Ph.D.

*Omicron Research Institute*

(Copyright Ó 2014
*Omicron Research Institute*. All rights reserved.)

**Introduction to***QuanTek***How to Use***QuanTek*for Trading**Stochastic Processes and Filtering****Graphs and Displays in***QuanTek***Main Graph – Overview****Main Graph – Scale 1****Main Graph – Scale 2****Main Graph – Scale 4****Main Graph – Scale 8****Harmonic Oscillator Splitter Window****Harmonic Oscillator Buy/Sell Signals****Other Stock Graph Features****Portfolio Optimization in***QuanTek***Trading and Portfolio Parameters Settings****Other Features****References**

** QuanTek**
is a trading program for stocks (and indexes, mutual funds, futures, etc.)
designed for short-term traders and long-term investors. The main feature of

It
is well known that it is extremely difficult to “beat the market” by active
trading. The **Random Walk** model is correct to a high degree of accuracy.
However, as in any kind of market, in the stock market inefficiencies exist
which enable the astute trader to make a profit. To make a profit in the stock
market requires an accurate *estimate* of the **future returns** over
some time interval. Unfortunately, these turn out to be extremely difficult to
estimate. In many cases the best overall results can be obtained just by
investing in an **index fund**. This is because, unless you are very
careful, active trading can result in unacceptable **risk** (standard
deviation of returns) without any corresponding gain in **returns**. ** QuanTek**
thus tries to combine the best of both worlds by using

At
this point we would like to warn you that ** QuanTek** is merely a

The
goal of ** QuanTek** is to use the best ideas from the fields of

However,
the assumption of a Random Walk with drift model is too simplistic and the
actual market dynamics are far more complex. Rather than trying to estimate
this (constant) long-term drift, we prefer to believe that it is possible to
estimate this **expected return** on a variety of time scales, at least
approximately. This is the purpose of the **Wavelet Linear Prediction**
filter, which attempts to measure past **correlation** in the returns, which
is usually **non-stationary** (time-dependent), and use this to attempt to
estimate the **expected return** out to 128 days in the future. The **average
volatility** or **risk** along with the **correlation** between
securities, or **covariance matrix**, is also measured, and together these
quantities are used to compute an **Optimal Portfolio** using the (slightly
modified) **Markowitz** method. It should be emphasized that estimating the
(time-varying) **expected future return** is a very difficult problem. In
fact, the Random Walk model says it is impossible, and the expected return
should be zero or, in the case of the Random Walk model with drift, the
constant drift “velocity”. However, it is essential to make this estimate in
order to construct any kind of **Optimal Portfolio**.

The
**Optimal Portfolio** is re-computed every day, after you have downloaded the
end-of-day data for the securities in your portfolio. Then, on the next trading
day, you can adjust or **rebalance** the positions in your chosen portfolio
to correspond to the computed positions in the **Optimal Portfolio**. It
does not matter exactly at what **buy/sell point** the adjustment is made,
although using information in the **Stock Graph** and **Short-Term Trades**
dialog, you can set **day limit orders** to try to get a better price. You
can also use the **buy/sell signals** from the **Harmonic Oscillator **indicator
and a feature from the **Short-Term Trades** dialog to help you set **N-day
limit orders**. However, the important point is to keep up with the changes
in the recommended positions (either daily or on an N-day time scale), at
whatever price. This is because the recommended positions in the **Optimal
Portfolio** are responding to perceived **trend changes** on an N-day time
scale, and it is these longer-term trends that are important. Another reason is
that, according to the **Random Walk** model, it does not even matter at
what price point trades are made, and this model is still approximately
correct. Also, if the portfolio is kept in balance at all times, this is the
best way to reduce **risk**, because no matter which way the market may
move, the **short** positions will balance the downside risk and the **long**
positions will take maximum advantage of the upside “risk”, in a way that
optimizes the **maximum return** with **minimum risk**.

The
results of the **Optimal Portfolio** are displayed in the **Short-Term
Trades** dialog, which can be displayed anywhere in the program by pressing
the **Alt** key. A more detailed display of various portfolio information,
including measured past and *estimated* future returns on four different
time scales, as well as the **Optimal Portfolio** calculation, can be found
in the **Portfolio Report**, which may be viewed anywhere in the program
from a button on the **Dialog Bar**. From the **Dialog Bar** are also
available three different **Help** dialogs, each of which link to the main **HTML
Help** file. Also from (almost) any window in the ** QuanTek** program,
you may view a

In
the usual approach to **Technical Analysis**, such as described in the
classic text by Edwards & Magee [EM] and the book by Pring [Pr], one looks
for certain patterns in the past stock prices, which indicate potential **buy/sell
points**. This is because these
patterns in past prices are thought to be *correlated* with future
up-trends or down-trends, either a change in trend from up to down or down to
up, or a continuation of the current trend.
These standard technical indicators are probably so well known by now
that they are largely ineffective, since everyone follows them, and in addition
they were more effective 50 to 80 years ago, when the markets were much smaller
and much less *efficient* than they are now. So now the question is, since
modern markets are very *efficient*, what is the best strategy for trading
and investing, beyond **Technical Analysis**?

Financial markets are very efficient, but
undoubtedly they are not *completely* efficient. It should still be
possible to estimate that securities prices are overvalued or undervalued, and
take advantage of this determination to make a profit in the market. In other
words, there should exist some **correlation** between **past price
patterns** and **future returns**. The prices are, of course, influenced
by *exogenous events* such as economic and political developments, as well
as earnings reports from each company, which are largely unpredictable, but
these may not affect the *long-term* *correlation*in the
data. The correlation, if it exists at
any given time, is due to the market dynamics not being perfectly *efficient*,
because investors are not perfectly rational and knowledgeable in their
behavior, and they also may have a short **time horizon**. The goal is to try to take advantage of this
(slight) inefficiency by searching for the correlation and then basing a set of
**trading rules** on it. In order to find this correlation, we make use of a
**Linear Prediction** filter to make a **Price Projection**.

Pundits
will say, of course, that there is no correlation in the stock data, and all
the LP filter is doing is “fitting to the noise”. It is indeed true that the market is very *efficient* and a
large part of the **Price Projection** is indeed just that – fitting to the
noise. Whatever correlation there is will be buried in stochastic noise and
hard to isolate. However, it is
necessary to try to make a prediction or estimate of *future returns*, no
matter what, for the sake of **portfolio optimization**. So we assume that there is a *signal*
buried within the *noise*, and try to make a prediction of the future *signal*
apart from the *noise*. Hopefully
the long-term estimate of future returns will “capture” the signal buried in
the noise, although the shorter-term fluctuations may indeed just be “fitting
to the noise”. Note that *any*
kind of estimate of future returns based on past data will run into this same
type of problem, including **Technical Analysis** or **Fundamental Analysis**. Basing this estimate on long-term trends or
moving averages, as in **Technical Analysis**, is equivalent to using a
particular kind of LP filter, but the LP filters used by ** QuanTek**
are more sophisticated than that. The
basic assumption being made here is that the

Financial
returns data constitute what is known as a **stochastic process**. The simplest type of stochastic process is
the familiar **Random Walk**. It was
first postulated over a century ago by Bachelier [B] that stock (actually,
futures) prices follow a **Random Walk**.
It is still hotly debated even now whether this is in fact the
case. Many people, when performing a
statistical analysis of stock data, are unable to discern any statistically
significant difference between stock price series and a **Random Walk**. My position is that the stock prices are *not
even* a **Random Walk**. A **Random
Walk** (with drift) is a **stationary stochastic process**, meaning that
the statistical properties do not change with time. In particular, if the price series were a **Random Walk**,
then it would have a constant *drift velocity* or *secular trend*. In that case, the only sensible investment
strategy would be **Buy & Hold**, to take advantage of this secular
trend, which would always be constant.
This is really quite a strong prediction of future price action! However, this is too good to be true, and
evidently the constancy of this secular trend is too much to ask. Instead, it appears that price returns data
constitute a **non-stationary stochastic process**. This means that the statistical properties
vary with time, including the drift velocity or trend, and the correlation
structure. So in this case, the optimal
strategy is one of *active trading*.
The purpose of the ** QuanTek** program is to try to determine
the optimum

** QuanTek**
has the capability to construct a variety of different technical indicators and
measure the correlation between these and the

It
should be mentioned that in the case of **stationary stochastic processes**,
the *law of large numbers* is used to prove theorems about the existence
and uncertainty of correlations. The
correlation is only defined in the limit as the size *N* of the data set
goes to infinity. For a **non-stationary
stochastic process** we do not have this luxury. In fact, one major problem with financial time series is that the
actual amount of data is rather sparse, so the statistical uncertainties are
always large. If the correlation
changes over an interval of *N* days, then the statistical uncertainty in
the correlation will be _{} (approximately) and
will never improve beyond that, no matter how long the data set is. So how can we ever prove the existence of
correlation and the effectiveness of **Trading Rules**? Instead of the limit _{}, which is usually used in the theory of **stationary
stochastic processes**, we can in the present case substitute an average over
a large portfolio of stocks. The **Linear
Prediction **filter is applied to the returns series of each individual
stock, and it yields **Trading Rules** for that stock which give a certain
return per year. This return per year
for an individual stock may be substantial, but the standard deviation of the
return will also be substantial and will be of the same order of magnitude. However, if we keep applying the **Linear
Prediction **filter to the stock over a long period of time, the returns
should be proportional to time *N*, while the standard deviation of
returns only increases like _{}. So eventually after
a period of time, the average returns should become much greater than the
uncertainty in returns. We can likewise
reduce the standard deviation, relative to the returns, still further by
computing the **Trading Rules** for an entire portfolio of stocks. The average **return** for the portfolio
should remain roughly the same when the number of stocks is increased (for a
given amount of equity), while the **standard deviation** of returns (**risk**)
for the portfolio should decrease like _{} for a portfolio of *M*
stocks (assuming the stocks are uncorrelated).
More generally, it is given in terms of the **covariance matrix** for
the portfolio. This is where the **Portfolio
Optimization** routine in ** QuanTek** comes in. The

The
** QuanTek** program uses a custom

Another
aspect of the custom **Linear Prediction **filter is that it incorporates
what we call a **Fractional Difference** filter. This is a filter for **fractionally integrated noise**
processes or so-called **long memory processes** [BD]. The **fractionally integrated noise**
process is characterized by a parameter, which we call the **fractal dimension**
or **fractional difference parameter** *d* which ranges from –0.5 to
+0.5. The fractal dimensions in the
range _{} characterize the *long
memory processes*, which exhibit long-term *trend* *persistence*. The fractal dimensions in the range _{} are sometimes called *intermediate
memory processes* and exhibit short-term *anti-persistence*. The long-memory processes are sometimes
attributed to *fractal statistics*.
It is thought that stock data exhibit this type of long memory
persistence [Pt1, Pt2]. (However, we
are finding that this is only true part of the time.)

To
take into account the **non-stationarity** of the returns series, we can use
a **Wavelet Linear Prediction** filter. This is done by making use of a **Wavelet**
series for the returns data instead of, say, a **Fourier** series. In this
case, the correlation is described by the properties of the **Wavelet variance**
instead of the **Periodogram**. Since the Wavelet series decomposes the
signal in both frequency and time (non-stationary), as opposed to the Fourier
series, which only decomposes the signal in the frequency domain (stationary),
this is a better method for describing financial time series. Using Wavelets,
the long-period fluctuations have an influence over a corresponding long period
of time, while the short-period fluctuations have an influence over a
corresponding short period of time, which is just what we want. So using the **Wavelet
Linear Prediction** filter, we have a better chance of capturing the real
correlation in the returns data, and avoiding the problem of “fitting to the
noise”.

** QuanTek**
has a variety of graphs and displays.
There is a

Associated
with the **Main Graph** are three other View windows. One is the **Harmonic
Oscillator** splitter window, with three panes, which displays a set of
custom **technical indicators** of the **oscillator** type based on **acausal
Savitzky-Golay **smoothing of the price data. Another is a **Stock Info **form
view, which displays **split**,** dividend**, and (not used at present) **earnings**
data, and also a variety of other **Fundamental **data. Finally is the **Stock
Data **text view, which displays the *actual* (unadjusted) prices, and
also the **Adjustment factor**, which is the factor multiplying the
unadjusted prices to get the adjusted prices (which are displayed on the **Main
Graph**). This **Adjustment factor** compensates for **splits** and **dividends**
in the price data.

The
**Main Graph** is designed to give a panoramic view of the entire data set,
and is easy to interpret and easily scrollable. The price axis moves automatically to keep the display centered,
when you scroll along the time axis, or you can scroll along the price axis
manually if necessary. The prices are
displayed on a logarithmic scale. There are four **scales** of the graph,
each of which displays different information. The **Main Graph** displays *adjusted*
price bars for each trading day (adjusted for stock splits and dividends),
showing **high**, **low**, **close**, and (on the highest scale) **open**
prices. It also displays **buy/sell points**, **buy/sell signals**, and a
**512-day smoothing curve**, **N-day smoothing curve**, **2048-day trend
line**, and the highest scale is a **Candlestick chart**. In connection with the 512-day smoothing
curves and 2048-day trend lines, a set of **Bollinger Bands** are displayed,
corresponding to one- and two-standard deviations of the average absolute
deviation of the prices from the curves.
The **Price Projection** is displayed in blue, after the most recent
past data on the graph. This display
shows the output of the **Linear Prediction **filter. At the top is an information bar which lists
the **N-day expected return** (annualized) from the **Price Projection**.
There is an error bar for each future projected price; to display an
approximate *estimated* one-standard-deviation range for the future
price. This range is approximately
proportional to _{}, where *n* is the number of days in the future for the
projected price. (This corresponds to
the standard deviation of the **Random Walk** process.) The **relative
(logarithmic) volume** is also displayed along the bottom of the graph.

When you open a stock data file, the **Main Graph
**appears. This graph can be switched
between four different magnification scales.
These scales are denoted **scale 1, 2, 4, **and** 8**, which
indicates their relative magnification value.
(Each scale is magnified by a factor of two relative to the preceding
one. Both the horizontal and vertical
axes are magnified by the same factor, so the slope of the price graph is
preserved. This is a **logarithmic** slope, indicating the *percentage*
change in prices per unit time.) When
you first open the **Main Graph**, it is on **scale 2**. Each scale contains some different technical
indicators, which are described here.
You can move back and forth between scales using the blue arrows on the
toolbar. You can also move back and
forth between blocks of the data using the magenta arrows. (The whole data set,
no matter how long, is displayed in one continuous graph.)

On **scale 2**
of the **Main Graph** are displayed the **buy/sell points**, denoted by
green and red vertical arrows, which are the beginning points of a range of **buy/sell
signals** that are displayed on **scales 4 **and** 8**. On **scale 4**
is displayed all the **buy/sell signals**, while on **scale 8** is
displayed all those, interpreted as **limit orders**, that actually went
through in the past data. The **buy/sell signals** in the future **Price
Projection** are set at prices offset from the expected price according to
some multiple of the size of the error bar for day *N* in the future. (The
multiple is set as one of the **Trading Parameters** in the **Trading &
Portfolio** dialog.) These **buy/sell points** and **buy/sell signals**,
derived from the **Harmonic Oscillator** indicator, may be used as *supplementary***
technical indicators** of the **oscillator** type to try to time trades
according to possible cycles in the prices on time scale **N**. We want to
emphasize that there is no real way to test these signals for reliability and
they may have no statistical significance. We advocate the **portfolio
rebalancing** technique as the main mode of **short-term trading**.
However, in the event you do not want to rebalance the portfolio every day, you
may instead want to rebalance it ever *N* days on the average, timing your
buys and sells in accordance with the **buy/sell points** and **buy/sell
signals**. Another way to interpret these signals is that they represent
possible **N-day trend changes**.

By
the way, you can see all the graphs with either a black background or a white
background, using the **Toggle Dark Colors** button on the Main Window
toolbar. The black or white
backgrounds use a different set of colors for the different features of the
graphs. Generally, the colors for the
black background are the *dark* versions of the colors for the white
background. The black background is on
by default. Lastly, one nice feature of
the **Main Graph** is that, if you rest the mouse pointer at any point in
the graph, a **tool tip** pops up, which lists the price level at that point
and the date. This is very handy for
finding the price and date of any point on the graph. You can also display a
horizontal line at any price point just by clicking the mouse at that point.

This
is the long-term view of the stock data.
Each day of data occupies one pixel of the screen, so there is no tick
for the closing price on this scale.
The future projection, with error bars, is the blue area to the right of
the graph. On this scale, a **2048-day
trend line** (or the length of the data, whichever is shorter) is displayed
which is a **robust straight-line** fit to the data (minimizing the sum of
the absolute deviations from the line).
This is shown as the centerline, in dark yellow. On either side of this line are two sets of **Bollinger
Bands**, at one standard deviation (dark cyan) and two standard deviations
(dark magenta) away from the centerline, respectively. These may be used to gauge the relative
long-term variations of the price away from the long-term robust trend line –
an **overbought/oversold** indicator.
This graph is good for seeing the long-term trend of the price data at a
glance. Also, in the **Buy & Hold** method of investing, the **2048-day
trend line** is the indicator you would use to estimate the **long-term
future returns**. In fact, for large well-established companies on an
established trend we have found that this indicator has a robust correlation
with future returns. (But beware that the trend can change with changes in the
economy.)

This
is the scale which first appears when a stock data file is opened. On this scale, there are two pixels per
trading day. Each vertical bar ranges
between the high and low for the day, and there is a horizontal tick for the
closing price. If you look closely,
underneath the data bars is a dark blue curve, representing the *N*-day
(acausal) smoothing curve of the price data, where *N* is the **time
horizon** that you have selected (in the **Trading & Portfolio
Parameters** dialog box). To the
right is the **Price Projection**, which is the output of the **Linear
Prediction** filter, and the vertical blue bars are the one standard
deviation error bars for the projection.
By analogy with the *Random Walk*, they can be seen to grow
approximately as the square root of the number of days in the future. The dark yellow curve is a 512-day (acausal)
smoothing of the price data. On either
side of this curve, in dark cyan and dark magenta, are the **Bollinger Bands**
corresponding to one and two standard deviations, respectively, away from the
center curve.

Featured
prominently in this scale are the **buy/sell points**, which are the green and
red arrows. These show the optimum
points to buy and sell, given the selected **time horizon**, and correspond
to the positive/negative going zero (actually, **Threshold**) crossing
points of the **Velocity** indicator (on the middle pane of the **Harmonic
Oscillator** splitter window). These
green and red arrows are represented in all the splitter windows as green and
red vertical lines, and they serve to line up all the features on the graphs,
as well as indicate the optimum *past* **N-day buy/sell points**. The green and red arrows in the future **Price
Projection** are *future estimated* **buy/sell points**, based on the
**Harmonic Oscillator** indicator.

This
graph is basically the same as **scale 2**, except a factor of two
larger. There are four pixels per data
point on this scale. This makes it
easier to see the short-term price fluctuations. The main difference from **scale 2** is that, instead of
displaying the **buy/sell points**, it displays the **buy/sell signals**. The **buy/sell signals** are ranges of
buy points and sell points, designed for setting limit orders, with the
starting point in each range of **buy/sell signals** marked as the

This
is the largest scale of the four graph scales.
This scale uses eight pixels for each day of data. It will be noticed that this scale
incorporates **Candlestick Charting** rather than the more usual bar
charting of the other scales. The **Candlesticks**
provide a way to display the **high**, **low**, **close**, and **open**
prices, whereas with the bar charting the open price is not displayed. The **Candlestick** consists of a colored
rectangle superimposed on a vertical line.
The ends of the vertical line mark the high and low prices for the day,
as before. However, the upper/lower
edges of the rectangle mark the open/close or the close/open prices. If the close is higher than the open (an *up*
day), the rectangle is colored sky blue, while if the close is lower than the
open (a *down* day) the rectangle is colored dark blue. There is a whole set of technical patterns
associated with and unique to the **Candlesticks**, which can be found in
books devoted to **Candlestick Charts** (see also an appendix to Pring’s
book on **Technical Analysis** [Pr]).
Also displayed on this scale are the **buy/sell signals** that were
actually *triggered*, meaning that the low price reached down to the buy
signal or the high price reached up to the sell signal. (These are displayed using little green/red
triangles.) From this you can tell the
relative frequency with which these buy/sell signals were actually triggered
(with the benefit of perfect hindsight, of course), and use this to set the **Threshold**
and **Range** controls appropriately.
For the future projection, *all* the projected **buy/sell signals**
are displayed as green/red triangles.
All the other features of the graph, such as **Bollinger Bands**, are
the same as with the other scales (except that the *N*-day smoothing curve
is not shown on this scale). This is
the best scale to use to study the price action for each individual day.

The
**Harmonic Oscillator** is a set of three **technical indicators** in a
splitter window, obtained by three different smoothings of the price data using
the **acausal Savitzky-Golay** smoothing filter. From these three smoothings, a set of **buy/sell points** are
shown as vertical green/red lines in each window. The *present time* is displayed as a vertical yellow
line. To the *past* of this line,
the past data are smoothed, and **buy/sell points** are displayed *with
the benefit of hindsight*. To the *future*
of this line, a **future projection** is displayed (based on *past*
data), and future *estimated* **buy/sell points** are also shown. This **future projection** (of the indicators)
is based on the standard **Burg Linear Prediction **filter, different from
the **Price Projection** used in the **Main Graph**. (The **Burg Linear
Prediction **filter is like an extrapolation of the sinusoidal components of
the signal, which makes it the best choice for this particular indicator.)

The panes of this splitter window are
called **Relative Price**, **Velocity**, and **Acceleration**. These three indicators display a smoothed *difference*
of prices between an *N*-day and 512-day smoothing, a smoothed *first
derivative* or *returns*, and a smoothed *second derivative* or
rate of change of returns, respectively.
Using **acausal Savitzky-Golay** smoothing, so that there is no lag
or phase shift, the **buy/sell points** should line up (at zero **Threshold**
setting) with the minima/maxima (**min/max**) of the **Relative Price**,
the positive/negative zero-crossing (**Z+/Z–**) of the **Velocity**, and
the maxima/minima (**max/min**) of the **Acceleration**,
respectively. The **buy/sell points**
derived from the **Harmonic Oscillator** indicators are shown in all the splitter
windows as green/red vertical lines, and the **Main Graph** as green/red
arrows.

The
**buy/sell signals** are defined from the three **Harmonic Oscillator**
indicators. A **buy point** is
triggered if the **Relative Price** indicator is negative and the **Velocity**
indicator is above a certain level set by the **Threshold** control in the **Trading
& Portfolio Parameters** dialog.
Also the **Velocity** and **Acceleration** indicators must both be
positive. These last two conditions
restrict the range of buy signals to the quarter “cycle” (if the data were
sinusoidal) following the minimum of the **Relative Price** indicator. A **sell point** is triggered if the **Relative
Price** indicator is positive and the **Velocity** indicator is above (in
absolute value) a certain level set by the **Threshold** control in the **Trading
& Portfolio Parameters** dialog.
Also the **Velocity** and **Acceleration** indicators must both be
negative. These last two conditions
restrict the range of sell signals to the quarter “cycle” (if the data were
sinusoidal) following the maximum of the **Relative Price** indicator. The **Threshold** control determines the
minimum level (in absolute value) of the **Velocity** indicator at which **buy/sell
points** are triggered. The **Range**
control determines the range of the daily average **volatility** that
triggers the **buy/sell signal**. In
this way you can set **buy/sell signals** only for extremes of price, or
more often for smaller maxima or minima of price. The **buy/sell signals** are displayed in **scale 4** and **scale
8** of the **Main Graph**. (The
Main Graph **scale 8** only displays those **buy/sell signals** that were
actually “triggered” as limit orders.)

The
**buy/sell points** consist of the first of a series of **buy/sell signals**. Hence a **buy point** will occur (at zero
**Threshold**) when the **Relative Price** indicator is at a minimum (**min**),
the **Velocity** indicator is crossing the zero line moving upward (**Z+**),
and the **Acceleration** indicator is at a maximum (**max**). A **sell point** will occur (at zero **Threshold**)
when the **Relative Price** indicator is at a maximum (**max**), the **Velocity**
indicator is crossing the zero line moving downward (**Z–**), and the **Acceleration**
indicator is at a minimum (**min**).
Actually these points will be delayed a little bit according to the
minimum **Threshold** setting. These **buy/sell points** are mainly for
the purpose of marking the most favorable points to buy and sell in the range
of **buy/sell signals**, and also as markers to line up the features in all
the graphs.

It
should also be mentioned that the logarithmic volume appears at the bottom of
each graph, relative to the *mean* value of the logarithmic volume. You can also display a horizontal line
anywhere in the graph simply by pointing the mouse to that price level and
left-clicking. You can draw a
horizontal line for a given price using the **Horizontal Line** button on
the toolbar. You can also insert an **exponential
Moving Average** (of the prices relative to the 512-day smoothing curve)
using the **Moving Averages** toolbar button. You can select a color for the horizontal line or exponential MA
by using the **Custom Colors** button.
Finally, you can togglethe** buy/sell points** and **buy/sell
signals** on and off using the **Buy/Sell Points** button. You can view the appearance of the **Price
Projection** at any date in the past using the **Historical Projection**
button. You can calculate the *actual*** error bars** (over the past
1024 days) and display these using the **Projected Error Bars** button.
Using this button you can also toggle between the *estimated* **error
bars** and the *actual*** error bars** (after they are calculated).
Finally, you can restore the graph to its default appearance using the **Restore
Data** button.

The
**Portfolio Optimization** routine makes use of the standard **Markowitz
Model** from **Modern Portfolio Theory**.
This calculation uses the **covariance matrix** of all the stocks in
the **portfolio**, along with the **expected returns** computed from the **Price
Projection**, to compute an **Optimal Portfolio** that **maximizes
returns** and **minimizes risk** for the overall portfolio.

The
**Portfolio Optimization** routine computes the **covariance** matrix of
all the stocks in the **portfolio**, consisting of all the *stocks*
(not *indexes* or *averages*) in a particular folder that have the “**Trade
this stock?**” checkbox checked (**Buy/Sell** button on the **Dialog Bar**). The **variance** and **covariance**
are based on the average **volatility** and **correlation** of the
returns between all the stocks. The **variance**
(actually, **standard deviation**, the square root of **variance**) of
returns of an individual stock is a measure of its **risk**. The other quantity that goes into the
calculation is the **expected return**, which is estimated from the *N*-day
future price of the **Price Projection**. (Actually, it is an *N*-day
average of returns starting with the *N*-day *expected* *future*
return and going back *N* days, ending up with the *N*-day *past*
return.) Then a calculation is done to **maximize returns** for the
portfolio as a whole, and at the same time **minimize risk**. This calculation is called the **Markowitz
Model**. This results in an **optimal
portfolio** in which the recommended positions optimize the ratio of **return/risk**. This calculation depends on a parameter
called the **Risk Tolerance** (opposite of **risk aversion**), which you
set in the **Trading & Portfolio Parameters** dialog box. The other parameter you need to set is the
desired **Margin Leverage**, which sets the overall ratio of the value of
the portfolio to the equity of the portfolio (in the **Model Portfolio**
tracked by ** QuanTek**). The
results of this calculation are displayed in the

The
**Short-Term Trades** dialog is a *modeless* dialog box, which can be
viewed from anywhere in the ** QuanTek** program just by pressing the

On
the right-hand side of the **Short-Term Trades **dialog, there is a list box
containing a column of prices on the left and a column of percentages on the
right. In the center (vertically) of
the list box, corresponding to ZERO percent, the price listed is the **estimated
N-day closing price**. This
estimate is based on the estimate of the

The
**Portfolio Report** contains all of the information in the **Short-Term
Trades** dialog, and more besides.
You can create a **Portfolio Report** just by clicking the button on
the **Dialog Bar**, or the toolbar button on the Main Frame toolbar. Then the portfolio information is acquired
from the header files of all the securities in the selected folder, or **Stock
Group**, and the report is then compiled.

The
first part of the **Portfolio Report** consists of a list of all the
securities in the **Stock Group**, together with information such as the **N-Day**
**Expected**, **N-Day** **Average**, **128-day** **Return**, **2048-day**
**Return**, and the **Standard Deviation**. The **N-Day** **Expected** is the *estimated* *N*-day
return from the **Price Projection**. The **N-Day** **Average** is an
average going back *N* days of the *N*-day *future expected* and
*past* returns. The **128-day** **Return** is a wavelet-smoothed
average of past returns, and the **2048-day** **Return** is the slope of
the **2048-day robust trend line**.
The **N-Day** **Average** and the **Standard Deviation** are
just the information that goes into the **Optimal Portfolio**
calculation.

Next
is a section consisting of a list of all the securities actually owned in the
portfolio, together with the **number of shares**, **market value**, **last
price**, and **basis price**. The **basis
price** is updated every time a security is bought or sold.

Then
is a list of the overall portfolio quantities of interest, such as the **account
equity**, **long and short market value**, **cash balance**, and **buying
power**. Also the **margin leverage**
is displayed, which is the long market value plus short market value, as a
percentage of account equity. (Note that the **account equity** is the long
market value minus short market value plus cash balance. When you add to or
subtract from a long or short position, the account equity remains unchanged.)

After
that is a section listing the **Optimal Portfolio** calculation, listing the
**Current Position (shares)**, **Current Position (percent of equity)**
and then the **Optimal Position (shares)**, **Optimal Position (percent of
equity)**. Finally is displayed the **Sharpe
Ratio**, which is the **N-Day Average** divided by the **Standard
Deviation**, expressed as a percent. This quantity is a measure of the ratio
of (recent) **return/risk** for the individual security.

Finally,
the **Optimal Portfolio** calculation yields the **Portfolio Margin
Leverage** (assuming the **Margin Leverage** setting is 100%), the **Portfolio
(N-day, annualized) Expected Return**, and the **Portfolio Standard
Deviation**. This calculation then
gives you an estimate of the overall (*N*-day) performance of the **Optimal
Portfolio**. (Note that the accuracy of the **Portfolio Expected Return**
depends on the accuracy of the **N-day Price Projection**.)

There
are two groups of slider bars in the **Trading & Portfolio Parameters**
dialog box. These control the settings
for the **buy/sell signals **and the **portfolio optimization**
calculation. At the bottom of this
dialog box is a list box to set the **Time Horizon** for trading, which sets
the time scale for smoothing of the graphs and the **buy/sell signals **and**
points**.

This
is a list box for setting the **Time Horizon**, which controls the time
scale of smoothing of the **Harmonic Oscillator** indicators and the
resulting **buy/sell signals **and** points**. It also controls the time scale of the *N*-day smoothing
shown on the **Main Graph**. The
possible values of the **Time Horizon** are from 1 to 128 days, and this
should be thought of as the typical holding period for short-term trading.

The
left-hand group of two slider bars controls the display of the **buy/sell
signals**. These **buy/sell signals**
are displayed on **scale 4** of the **Main Graph**. The **buy/sell signals** that are
actually “triggered” are displayed on **scale 8** of the **Main Graph**.

**Threshold:** This slider bar controls the minimum
absolute value of the **Velocity** indicator (annualized return) above which
the **buy/sell signals** can be triggered. On its lowest setting of 20%, the
**Velocity** indicator must have an annualized value of at least 20% gain or
loss per year before the **buy **or** sell signals** can be triggered.
This limits the threshold of the expected future trend at which the **buy **or**
sell signals** are triggered. On its highest setting of 0%, the **buy/sell
signals** are triggered right on the zero-crossings of the **Velocity**
indicator. So there will be less trading on the lower settings, and more
trading on the higher settings.

**Range:** This slider bar controls the **limit price**
of the **buy/sell signals** displayed on the **Main Graph**, as a
percentage of the **average absolute deviation** of the daily prices
(average range of highs/lows relative to the average intra-day price). This
range is relative to the **N-day smoothing curve** on the **Main Graph**.
For the future **Price Projection**, the range is the percentage of the **average
expected N-day absolute deviation**, as indicated by the **error bars** in
the future **Price Projection**. On the lowest setting of 200%, the **buy/sell
signals** appear at a distance of 200% of the **average (expected) absolute
deviation** from the *N*-day smoothing curve. On the highest setting of
0%, the **buy/sell signals** appear right on the *N*-day smoothing
curve. So there will be less trading on the lower settings, and more trading on
the higher settings.

The
right-hand group of two slider bars controls the settings for the **Portfolio
Optimization** calculation. This
calculation uses the estimated **expected return** and the measured
volatility or **risk** (for each stock in the portfolio) to compute an **Optimal
Portfolio** that *maximizes returns* and *minimizes risk*.

**Margin
Leverage:** This specifies the
(average) margin leverage that you want for the whole portfolio, given the
total equity. By margin leverage, we
mean the amount of money invested in the portfolio as a fraction of the
equity. Then the optimal number of
shares of each stock is computed based on the margin leverage. Generally, due to the way the optimization
is performed, the actual margin leverage invested will be a little less than
that specified. It should be equal to that
specified if the percentage of equity invested in each stock turned out to be
equal. If a large percentage of the
equity were invested in one stock, then the total margin leverage would be
substantially less than that specified.
(We view this as beneficial from the point of view of risk reduction.)
The range of the **margin leverage** settings is from 0% to 200%,
corresponding to the allowed range in a typical margin account. So the higher
the setting is, the more aggressive the trading in the account.

**Risk
Tolerance:** This is the other
parameter in the **Portfolio Optimization** calculation. In order to know what relative weight to
give to the **expected return** versus the **risk**, the portfolio
optimization routine needs to know your degree of **risk aversion**. The opposite of this is your **risk
tolerance**, which is your willingness to tolerate **risk** for the sake
of greater **returns**. Setting the
slider on “min” results in the least possible variance in the total portfolio
return (**risk**), at the expense of the mean value of the return (**expected
returns**). Setting the slider on
“max” basically results in the variance of returns (**risk**) being ignored,
and the proportion of the portfolio invested in each stock is essentially
proportional to the **expected returns** alone (relative to the other stocks
in the portfolio). So the higher the setting is, the more aggressive the
trading in the account.

These
are the most important features of ** QuanTek**. There are many other features as well. The actual prices are displayed in list form
in the

[B] Louis Bachelier, __Théorie de la Spéculation__ (doctorial
dissertation),

*Annales
Scientifiques de l’Éciole Normale Supérieure* (iii),

Vol.17, pp.21-86 (1900) Translation: Cootner (1964)

[BD] Peter J.
Brockwell & Richard A. Davis, __Time Series: Theory and Methods, 2 ^{nd}
ed.__

Springer-Verlag, New York (1991)

[EM] Robert D.
Edwards & John Magee, __Technical Analysis of Stock Trends__,

John Magee Inc. (1992)

[Pt1] Edgar E.
Peters, __Chaos and Order in the Capital Markets__,

John Wiley & Sons, New York (1991)

[Pt2] Edgar E.
Peters, __Fractal Market Analysis__,

John Wiley & Sons, New York (1994)

[Pr] Martin J.
Pring, __Technical Analysis Explained, 3 ^{rd} ed.__,

McGraw-Hill, New York (1991)

[NR] William H. Press, Saul A. Teukolsky, William T. Vetterling, & Brian Flannery,

__Numerical Recipes in C: The Art
of Scientific Computing, 2 ^{nd} ed.__,

Cambridge University Press (1992)