Oddball S&P system

yasu222

Active Member
#1
Strategy snapshot
Strategy: Oddball S&P system
Approach:Systematic, stop-and-reverse
(always in the market)
Market: Index tracking stocks (SPY, QQQ)
and stock index futures
Indicator setup: Create a rate-of-change indicator of
the hourly closing values of the advancing
issues of the NYSE. Include only the closing
data point of the natural hour, starting at
10 a.m. and ending at 4 p.m. EST.
To calculate the indicator,
use the following formula:
Rate of change in advancing issues
(RAI ) = ( AI / AI[n] -1) *100,
w h e r e
AI = Latest number
AI[n] = Number of advancing issues n periods ago
Entry: A buy signal is issued every time the
indicator is greater than 3. A sell signal is
issued every time the indicator
is less than 1.
Exit: Stop-and-reverse. Positions are reversed
with each new buy and sell signal,
as described above.
Risk control/money management: There is no money
management technique employed other
than the system stays in the market 100
percent of the time, either long or short,
with a constant number of contracts.
Note: If a trade is signaled at 4 p.m. EST, you have 15
minutes until the close of the market to place the trade
in the S&P futures (it is not possible to do this when trading
the SPY). This avoids the pitfall of basing real trading
on unrealistic system tests that generate signals on the
close at the end of the session, when the trade can in
practice only be initiated the next session. In such cases
the price may have moved farther away from where the
test indicates the system was filled, giving a false reflection
of the system’s performance.
 

yasu222

Active Member
#2
PHP:
Introduction
Creating a Mechanical Trading Model
Detailed and outlined below are the primary building blocks one can use to construct a
successful, fully mechanical trading model. Establishing and utilizing core techniques, ideas
and strategies that have been rigorously tested, a firm foundation is established on which
many mechanical trading systems can be created and built upon for trading a broad range of
markets.
Foundational Components for the System Trader
Modeling Mechanics
Understated, would be the use of the word "complex," to describe the process required to
develop a robust and fully mechanical trading model or system. Only with the advent of the
computer have we been able to analyze and test theories and ideas which would have been
previously impossible to calculate in a practical, thorough and timely manner.
Mental Conditioning
Psychological attitude is a key element to any endeavor and trading is not an exception. The
researcher’s mind must be open and free from misconceptions. Throughout the development
process, an open mind and the attitude that anything is possible must be preserved as well
as actively pursued. A tenacious commitment and a passion for the process of discovery are
also good traits to acquire and cultivate.
Strategy Process
If we are to have any success trading the markets, we must rely upon a wellplanned
mechanical strategy. A mechanical system is nothing more than an idea, which has been
tested and then, automated. Mechanical research allows a trader to discern a good idea from
a bad idea. Being able to examine facts and not rely upon human emotions will provide the
trader a much more solid foundation for a successful trading system. Modeling a system
produces a significant benefit in that capital is preserved through the process of being able to
reject many ideas when subjected to computerized back testing. Mechanical trading will not,
by itself, overcome the emotional side and aspects of trading. However, after a period of
testing, time and realtime
trading experience, you will be able to gain confidence if you
have a sound method and system.
Capital Commitment
Longterm
commitment to mechanically trading the markets requires proper capitalization
coupled with a total commitment to following the system. The capitalization and investment
that is required to endure the inevitable system drawdowns is not to be taken lightly. It is
highly recommended that capital allocated to trading the markets or a respective system be
only the "risk capital" portion of a person's total available investment portfolio. Typically, it
would not be unreasonable to expect a perfectly sound/robust trading methodology to exceed
its tested maximum historical drawdown percentage by a factor of two (2). This unforeseen
and statistically more valid drawdown calculation will, more often than not, happen
sometime in the future. A serious and also very common detriment to capitalization is the
desire to over trade.
Money Management
Common types of money management would include the use of fixed stop loss amounts and
trailing stops. Stop reversals and increasing/decreasing leverage via pyramiding of the
underlining trading vehicle are also actively utilized for money management. Though not
commonly thought of as a money management technique, diversification of assets can also
be achieved by trading a broad range of markets. Other examples of money management
may incorporate not only a portfolio of markets, but also a portfolio of trading models. The
expected benefit of this type of diversification is primarily to limit market exposure to any
one market or system.
Timing Implementation
Timing is probably one of the most important factors when it comes to mechanical system
trading. It is critical that the performance of the tested model be executed in realtime
as
accurately portraying the historical testing as reasonably possible. It serves no purpose to
historically test a mechanical model and then not execute the model according to the same
rigid statistical standards in realtime
trading. It is very difficult for the human eye
concentrating on the hard right edge of a chart to visualize the same success that might be
seen with the longerterm
view that the historical testing has produced. For this reason, the
models trade signals for buying, selling and money management must be executed with
precision and timeliness. The primary goal of the mechanical trader should be, as practically
possible, to replicate in realtime
trading the same results as the model produced in
historical testing.
Discipline and Execution of Trading Signals
Emotions are the primary villain in hindering the trader, as it pertains to successful
mechanical trading. When real money is being traded and is at risk, the historical testing and
logic, which was so well thought out and planned for the system, is often quickly abandoned.
This is a very common occurrence and one, which is hard to overcome even for the
seasoned veteran. Experience, perseverance and dedication are critical ongoing aspects of
every successful trader's personality composite. Commitment and focus of the longterm
goal to become successful at implementing mechanical trading strategies should not be
discarded because of shortterm
price volatility.
Visual Cues vs. Actual Trade Statistics
Throughout my professional career as a mechanical model developer, there's one thing that I
have observed which stands out beyond all other lessons. It can be stated as this the
human eye is often unable to extract a nonbiased opinion of how well a system looks on a
chart vs. the actual numbers and statistical representation of the same system.
Modern technical analysis programs have created this phenomenon. Many software packages
are capable of producing automated buy and sell signals (arrows) when a system is applied
to a chart. These charting programs typically offset the sell arrow a few ticks above the high
of the entry bar, and offset the buy arrow a few ticks below the low of the entry bar.
Admittedly, this practice seems to be an innocent act of improper programming or data
management committed by the software vendor. Ultimately, this practice is misleading and
caution is in order.
Furthermore, this method of arrow placement can be very deceiving to the casual observer
who views a seemingly profitable system applied to a chart. These arrows, more than likely,
do not accurately portray the actual entry of the system. For example, the arrows in fact are
placed there as a marker to identify the bar of entry, while the actual entry is found
somewhere within the confines of the high/low of the bar. This practice of offsetting the
arrows can be very misleading without looking at the actual entries.
Following is an example where one might casually observe that the placement of the buy/sell
arrows of the system, seemingly look profitable. However, if you look closely within the
actual high/low of the entry bar you'll see a small flag indicating the actual entry point of the
system. Notice that the sell price flag is often lower than the following buy flag. Note
however that the actual corresponding sell arrow itself is higher than the following buy
arrow. This casual observance of our eyes to focus upon the seemingly obvious, is in fact a
wrong assumption that the trade was profitable.
Components of Building a Position Model
Primary Components, Switches
Switches will be acquired by thoroughly testing specific market price action which will then
be separated into nontrending
and trending samples. Through the unique use of switches,
combinations will then be implemented. Switches can be more easily explained as a method
the trading model must use to gain permission to place a trade or to implement other
strategies such as money management.
NonTrending
Switches
First, consider the market to be traded and its respective volatility. Tests should be
conducted to understand what the underlying structure of each particular market is. Most
markets will fall into some category of tradable ranges that reoccur over time. Nontrending
ranges rather than trending price action will dominate most markets. Each market must be
individually examined and it must be determined what is the predominate price action and
volatility.
Once it is determined that nontrending
price action is the predominant makeup of the
targeted market, concentrated efforts of model building and testing can begin. The primary
objective should be to encapsulate the nontrending
price action with an algorithm that is as
profitable as possible. It should be noted that when viewing the system statistics they might
appear to be lackluster. This can be attributed to the losses, which will occur when the
subject market trends.
The primary objective to building a nontrending
model is to specifically isolate, with as
much accuracy as possible, those particular price traits, which are most prevalent in the data
series being tested.
Trending Switches
As previously stated, the particular markets primary price movement and volatility need to
be considered when performing research to build a valid trending model. It is a valid
statement that most all markets exhibit some trending tendencies given a long enough look
back period. However, the algorithm that it would take to capture some of these extremely
longterm
trends would most likely simulate a buy/sell hold strategy.
The assumption that the trend is your friend is a mistake and should be avoided. If indeed a
theory exists that a particular market has a higher tendency to trend this
may be valid –
however, the data needs to validate this theory. One of the primary pitfalls of the human eye
is the ability to focus in on that which it wishes to see, especially when a preconception
exists, rather than the underlying statistical analysis.
The objective is to determine if there are, shorter term consistently replicable price actions
which can be utilized and capitalized upon. These shortterm
identifiable trends are most
likely to have fewer occurrences than their counterpart nontrending
price action. Through
validated testing mentioned earlier, there are some markets which show trending
characteristics as the primary market movement.
Combination Switches
As the name implies, this method of combining different strategies, attempts to capture the
bulk of a market price movement. There are certainly other personality traits that markets
can and to tend to exhibit. Through extensive testing, it has been determined that the
majority of markets can be primarily broken down into two parts: trending and nontrending.
This twopart
method will be a solid foundation to build a system upon.
Create and design each model to specifically perform its role as accurately as possible. Then
combine the resulting models using a switch algorithm. This results in the models being
combined to reach the final objective of profitability on a single market.
It should be noted, that overall profitability of each system tested independently will more
than likely be less than desirable. However, the objective is to create two components, which
then perform their specific tasks independently. The desired effect of the outcome when
combining these models is to have greater profitability than any one single model could have
operating independently. This process is achieved through the utilization of switches, which
are programmed in various combinations.
This is a very valuable concept and allows one to avoid many fallacies inherent in trading
platform software programs. The whole concept of switches allows clearly conceptualized
ideas to be isolated. A very simple example of coding for this concept of switches is listed
below:
If such and such then switch 1 = 1
If such and such then switch 2 = 1
If switch 1 + switch 2 = 2 then do this
Secondary Components
Trade Profit Enhancements
Many items can be included to maximize performance of a constructed model. These items
may be incorporated as switches and are more typically related to money management
techniques. When used in the latter case, the code is simply appended to the end of the
respective buying/selling conditions.
Other techniques may include algorithms which allow a position to be reversed as in the case
of an always in the market position system (this can also be referred to a "stop and reverse"
defined system.) These techniques may be standalone
or incorporated alongside money
management to form a composite system.
Summary
If the problem of seemingly random market data is to be conquered with a mechanical
model, the modeling will need to separate the data into quantifiable sections. What these
sections are and how they are defined is actually dictated by the market data itself. The
primary focus should be upon price actions, which are most prevalent and validated within
the data.
Specific models are developed independently to accurately encapsulate as much of the
targeted price action as possible. These models are then combined through the use of
switches to complete the base model. Other components, such as money management, can
then be included to enhance overall performance.
Specialized Components of Model Building
NonTrending
Components would include oscillators of various types and shorter term, price patterns.
These price patterns are normally and specifically defined for a particular market because of
the shorter term nature of trades typically taken in nontrending
market conditions.
Caution needs to be exercised when establishing inputs of the nontrending
components.
Avoid longterm
inputs and using shortterm
indicators. For the purpose of discussion, price
patterns will also be included when the terminology associated with indicators is used.
Oscillators are often normalized between an upper and lower limit, then buy/sell zones are
established for the oscillator. The oscillator can also be normalized over a zero line used as
the reference point to enter long or short positions. There are a variety of shortterm
nontrending
indicators covering a broad spectrum that can be used in model development and
testing.
Trending
Components in their simplest forms would be defined as moving averages, trendlines, price
channels and extremely longterm
oscillators. Trending market conditions, by their nature,
are longerterm.
Logically it is expected that longerterm
inputs would most likely apply to
indicators, which are being used to detect and follow trends.
However, it should be noted that these longerterm
inputs introduce lag. This lag can of
course be detrimental to the profitability of the trading model. When using switches this
concern is somewhat minimized. The longerterm
trend following model is being calculated
in the background, while the shorterterm
nontrending
model is active in producing the
trades.
This technique essentially emulates a backup system, which has its calculations up to speed,
ready to be implemented upon demand. This will hold true if the targeted market shows a
preference to nontrending
characteristics while these conditions will reverse when applied to
the subject of a trending market.
Outline of Position Model Components
Entry Techniques
NonTrending
entry method switch
Trending entry method switch
Combining the entry method switches
Money Management
Is another component that could possibly be implemented as a standalone
system. Thus, it
is a very powerful tool by itself it
can also be a detriment when improperly deployed with a
successful trading system. Some trading models will incorporate their own dynamic money
management by being able to reverse a position dynamically. Other models may only
incorporate a catastrophic stop loss of some fixed amount. Variations of this stop theme
would be to employ a dynamic stop loss amount calculated and based upon volatility.
Stop Techniques
Fixed Cost Stops
Percentage stops
Trailing stops
Range stops
No stops
Target exits
Fixed Target Amounts
Range based targets
Percentage targets
No targets
Timed Exits
Exit after number of bars
Exit if profitable
Exit upon time of day
Other Strategies
Might include seasonal patterns such as a specific time or month of the year, week or time
of the month, day of the week and time of the day. It is important to not overlook interesting
strategies that can also be developed for possible future use within a system by utilizing
system statistics such as: number of losing trades in a row, number of winning trades in a
row, percentage of winners, percentage of losers, etc.
First Things First Final
Summary
The above items have been outlined to serve as a step by step guideline to building a
successful model. The first basic steps in creating such a model should be to build the nontrending
and trending components.
Analyzing the Results
Great care should be taken when analyzing the nontrending
systems results. Large losing
trades will generally occur when the nontrending
model is caught in a countertrend trade.
These trades should be omitted from the system's results so concentration can be placed
upon how well the model performed on nontrending
price action.
Likewise, omission of extended nontrending
system results should be utilized when
modeling the trend following component. Concentration should be placed upon analyzing the
results of how profitable the trending component performed at its specified task of trading
the trend. Just as the price action itself should be broken down and analyzed, it is important
to also analyze the performance and results of the systems.
Combining the Techniques
Once the nontrending
and trending components have been tested and the results are
satisfactory, they can then be combined to form a singular trading methodology and trading
platform. The next step is incorporating switches within the new platform building on the
success of the trend functions and methodology. The highly desired benefit of the switches is
that they can be incorporated and deployed in an almost infinite combination, covering a
wide spectrum of criteria. The truly significant core to this approach is that optimization
determines the best possible combination of potential model components (switches) to be
utilized.
Only after these steps are taken and accomplished with satisfactory results should the focus
move forward implementing additional strategies such as (but not limited to) money
management. By building the models first with no constraints, solidifies the foundation that
the true personality and nature of a particular market has been defined by the best
performing combination of the respective models.
 

Similar threads