Creating Trading Models
by
Larry Swing - July 17, 2005
Education:
Trading Systems Development
Now that you
have an idea and know how to measure trading system success, you can
create a model.
The Model
The model
typically will consist of two parts:
- Data preprocessing
- Trading Rules
Data
Preprocessing
Data
preprocessing is the translation of raw stock data into a more meaningful form.
This step may also include cleaning errors from data.
Cleaning
Errors
Errors may be
found through three methods: Logical checks, comparison checks, and
anomaly checks.
Logical checks
ensure that the data does not contradict itself. For example:
- If there is a trade (the price changes), volume must
be greater than zero
- The high must be greater than or equal to both the
open and close
- The low must be less than or equal to both the open
and close
Comparison
checks ensure that the database you are using matches up reasonably well with
another database.
Anomaly checks
automatically search for data points that are several standard deviations away
from the mean. These data points may then be inspected manually.
For example, a search may be done for 1-day percentage returns in excess of
200%, or below -70%. Unusual data points are more likely to be erroneous,
and correction of these data points is especially important since their
magnitude will make them important points in your testing.
Data
Transformations
Data
transformations turn raw data into something that is more meaningful from a
trading standpoint. Instead of using percentage changes in a stock to
predict future percentage changes, one may instead wish to use the MACD, a moving
average, stochastics, or a host of other data transformations.
Data
transformations may have multiple steps involved. A simple example:
- Generate a moving average over a six year period
- Subtract the stock price from the moving average each
day
- Find the standard deviation of (2)
- Set all values that are more than four standard
deviations above the mean equal to 1, and all values that are more than
three standard deviations below the mean equal to -1.
- Scale the remaining values between -1 and 1, such
that they are normally distributed with mean of zero.
The above data
transformation will generate a signal line and ensure that it does not take on
very extreme values that may skew the interpretation of the indicator.
The downside is that extreme positive values are all treated the same, when in
fact they may not be.
Trading
Rules
Trading rules
may be based on predetermined statements, expert systems, or they may be
generated automatically. The choice between the three is based on the differences
between development cost, the type of system, and the knowledge available.
Predetermined
Statements
A trader may
develop a set of rules that states exactly how he wants to trade. This
makes sense when:
- It is based on arbitrage
- The relationship between the indicator(s) and profits
is complex, and not amenable to optimization
- Developing rules using other methods is too expensive
Expert
Systems
Similar to a
complex set of predetermined statements, expert systems take codified knowledge
by and generate inferences. These are different from predetermined
statements in that they generally consist of two separate parts:
- A knowledge base
- An inference engine
Expert systems
are usually more expensive to develop than predetermined statements, but may be
more successful when it is difficult to create explicit trading rules.
Automatic
Rule Generation
Trading rules
may be automatically generated using neural networks, genetic algorithms, or
other algorithms. This method has the advantage of being able to detect
complex nonlinear patterns and develop optimal strategies to profit from these
nonlinear patterns. The disadvantages are:
- The costs of building the system
- The requirements for a large amount of data
- The possible lack of transparency in how the system
the interprets data
When
generating trading rules automatically, one should have an idea of how
variables will interact before inputting those variables into the neural
network or other fitting algorithm.
Analyses of HOLDRs
We are neutral
on all Holdrs this week; the majority of Holdrs are overbought and positive
momentum. None are within any convincing technical patterns.
Analyses of Individual Stocks
Bullish
Stocks
HLTH
- Consolidation breakout
- Strong volume
- Bullish money flow
- MACD crossover
SwingTracker
MrSwings
Real-Time Stock Charts RISK-FREE TRIAL featuring one-click access to Larry
Swing's profit-generating indicators - Force Index, EquiVolume, True Strength
Index
Bearish
Stocks
HOTT
- Double top
- Bearish volume
|