PureBytes Links
Trading Reference Links
|
The topic of whether or not you can program a discretionary trader's
"system" comes up from time to time. A while back I posted my
experiences on this topic on another list.
I thought it might be relevant in the present context so am including
it below.
Bob Fulks
-------
I have worked with quite a few very successful discretionary traders
who want to convert their "methodology" into a mechanical system so I
thought the group might benefit from some of my experiences. This
post will summarize some of them. This message turned out to be a lot
longer than I had intended but I hope it is useful to others.
Since I often relay this information by answering somebody's email
questions, I am writing this as a response to questions in a pseudo
"interview" to be able to cut and paste thoughts from past messages.
Keep in mind that this is my experience and may or may not agree with
other people's experience on this topic.
Bob Fulks
-----
Begin "Interview"...
Are the people you have worked with really successful discretionary traders?
Many are. Some have been making a living doing this for 15 to 20 years.
Do they have a method?
Absolutely. The successful ones do.
Why do they want to convert to a mechanical system?
Because discretionary trading is a lot of hard work. Staring at a
computer screen all day waiting for a signal is tiring and very
stressful.
Why don't they learn to program it themselves?
They usually have little programming experience and do not want to
take the time to learn. Some have programmed various custom
indicators that they use.
Can they describe their method?
They think they can and spend a lot of time trying. Some have sent
charts with patterns marked, some have meticulously logged their
impressions at each potential entry and noted why they would and
would not take the trade.
Do they live near you? How do you communicate the ideas?
Mostly by email transferring files. "pcAnywhere" has been useful in
two cases for the trader to walk me through a process, along with
phone calls.
Can you program what they describe as their method?
Usually. I am a pretty good EasyLanguage programmer and can program
almost anything that can be precisely described. I cannot program
TradeStation to "recognize" subjective patterns such as Head &
Shoulders. Computers do not "recognize". The rules must be
meticulously precise, which most people find very frustrating.
So what happens when you program their method?
The system gets lousy results. There are usually far too many trades.
There are many more entry signals that meet their criteria than they
think there will be. We then try to understand how they filter out
the bad trades. This usually turns out to be far more subjective than
they thought it would be.
So do you end up with anything that works?
It usually is pretty easy to end up with some ShowMe's that will
identify potential trade situations. This is often a big help because
then they do not have to watch the tube intently all day and can do
other things, read a book, watch TV, etc., and wait until an alert is
hit. They can then look at the tube and decide whether or not to take
the trade. After a period of doing this, they may then begin to see
more criteria and we are able to narrow down the number of alerts.
Do you ever end up with a mechanical system?
Sometimes, but not always. But it is not by using what they tell me
they use. A good trader will have discovered some characteristic of
the market that is repeatable enough to trade. This is clear. Some
have very high success rates with well over 90% of their trades being
profitable. But they may not exactly know what the characteristic is.
In all cases where I have been successful creating their system, I do
it by finally understanding what that tradable characteristic is.
Once I understand what it is, I can usually design some fancy digital
filter, moving average, or oscillator, etc., to find it fairly
consistently. This still usually ends up with too many potential
trades but most will be profitable, neglecting trading costs. Many
small trades become unprofitable when trading costs are added so we
then try to eliminate the less profitable ones to get a higher
average profit per trade.
How long does the process take?
Usually several months of part-time work. Usually we get some
ShowMe's which the trader uses for a while and then we refine the
criteria. It seems to take time for the trader to divorce himself
from his previous biases of what the computer program should do and
just understand what characteristic of the market he is using. A
computer cannot think like a person and cannot recognize things. The
human brain can process far more complex information in a split
second than a computer and can have "judgement". But a computer
program is very much more consistent, never gets tired, etc., so once
a program works it works consistently.
What about changing market conditions?
Almost all of my systems adapt to changing conditions in some way.
Usually, it is possible to "measure" the characteristic you are
trading after it has happened (not in real time) to see what its
parameters have been running. Then you use these parameters to
dynamically adjust the trading system parameters. This adjustment
process is also active during back testing so effectively makes a
first order correction for market changes, making the system more
robust.
What sort of "characteristic" are people trading?
It is often related to some cycle phenomenon or trading a trend of
some kind. The set-up can involve a sequence of conditions to
indicate that a favorable trading opportunity may be about to occur.
Once you get a system that works, does the trader use it?
They seem to. And they often come back later with improvement ideas.
Some call me a year or two later for help on something. The almost
always use the Indicators and ShowMe's that we develop as part of the
system development. We almost always use the same code for both the
system and one or more indicators so that we can monitor how the
system is working.
Does the trader really understand what the system does?
I am often amazed at how the trader will check every trade the system
makes in excruciating detail to make sure it meets the conditions and
that there is not a bug in the code. A typical interchange might
start out:
"At 10:50 on 9/8/99, the system went long. It shouldn't have."
At which point I reply one of two ways:
"Sorry, the whatsit was not initialized before the framis kicked in. Try
the attached."
or:
"But that is what you told me should happen."
"Than may be what I told you but it really should be doing ...." I guess
I forgot to tell you about that."
Do they take every trade signaled by the system?
No. They continue to use some judgement. I have used the analogy of
an autopilot as a good example. The system might handle 80 to 95% of
the situations but there are always situations where the trader feels
that the risks outweigh the potential rewards and he will pass a
trade. In other words, there is still a pilot in the cockpit to take
over in the event of an abnormal event. Stating this on a list such
as this one always generates a flurry of messages about how "you
should always take every signal of your mechanical system, no matter
what". This is hogwash almost always promulgated by people who have
never done it. A computer program can handle conditions it was
designed to handle. A system that can handle 90% of the cases
automatically might require two or three pages of code. One that can
handle 95% of the cases might take ten time that amount of code, most
of which will never have been tested with real cases since they occur
so rarely. A system that can handle 99% of the cases might take still
another factor of ten more code to cover cases that might occur every
10 years and thus can never be properly backtested with enough
occurrences to be statistically significant. Anyway by then the
markets would have evolved so much that it wouldn't work well anyway.
So what does the system do when it gets into a situation that it cannot handle?
It exits with a loss, much as with any stop loss technique. I
consider stops as something that should rarely be hit, only in
situations that the program was not designed to handle. Normal exits
should all be programmed. Hitting stops means that something happened
in the market that the program did not expect to happen.
Do you use the built-in TradeStation stops?
Sometimes, but not usually. It is very easy to mislead yourself with
those stops. For example, you might have an entry condition that is
true when XXX <= YYY. The TradeStation stop might take you out but
since the condition may still be true, the code would reenter. This
is very hard to track during backtesting since it might only occur
during some range of values. To prevent this you need to use the
"crosses over" kinds of conditions that may not work as you wanted.
This is not the fault of the TradeStation stops - they work as
advertised. It is the result of trying to do surgery with a blunt
instrument.
I am not real sure I understand the difference between what the system can handle and what it cannot handle. Could you give an example?
Assume we get a particular signal to go long and know that typically
after such a signal we can expect a move up for 10 to 20 bars. But in
some cases this doesn't occur and the price stalls after going up 2
or 3 bars. The trader then might say "reverse now to short" since he
recognizes this failed signal as a powerful indication that the
market has changed. So now we have three options in the code:
1. Do nothing and watch the small long position profit evaporate
and the losses built up until the TradeStation money management
stop gets us out with, say, a $500 loss.
2. Immediately exit the position with a small $125 loss and go
flat since the market didn't do what we were expecting it to do.
3. Add code to try and recognize that condition and reverse to
short. We try this and it takes a half page of code and it works
fine to reverse this trade. But it also reverses us in eight
other trades where we really wanted to remain long. So now we
look at all nine cases and try to determine why they are
different. They look about the same to me but not to the trader.
And this is only one case of a failed signal, there are lots of
other cases that rarely occur but the trader has them all stored
in his brain and can spot them when they occur. It is rarely
worth trying to code these since it would require a lot of code
for situations that rarely occur. So we default to option 2 and
just exit. In trading the resulting system the trader will be in
the trade and be watching the screen intently. He will spot the
pattern and not exit as the system tells him to but instead will
reverse, muttering something like "stupid computer". When I trade
the system, I will just exit like the system says. His method
results in a higher percentage of wins, obviously.
So how do you measure the success of a system?
I consider a system successful if it has an annualized Sharpe Ratio
of about 3 or higher in back testing and has a trading style
consistent with what the trader can trade. By trading style, I am
referring to things like how closely you have to monitor the system,
how long you are in the trade, number of consecutive losses, capital
requirements, etc.
What about the statistics of a typical system?
I am not sure there is a typical system but most of the mechanical
systems do far poorer in terms of percentage profitable trades than
the discretionary trader did. They tend to run about 50%. But the
winning trades are much bigger than the losing trades so the Profit
Factor should be over 2 to 3 and the Return on Account should be 500%
to 1000% or higher in back testing. The most important criterion is
the smoothness of the equity curve that I measure with the Sharpe
Ratio. (A better measure would be deviation from a straight-line
equity curve as proposed by Chande, etc., but Sharpe Ratio does a
pretty good job.)
Why is a linear equity curve desirable?
A linear equity curve is very easy to trade. It increases X dollars
each week so you have confidence that the system is still working if
it is returning about X dollars per week. You also can easily
estimate what it will cost you to take a week's vacation, etc. With
an equity curve that has lots of losses followed by the "big win" you
never know if the system is still working and you cannot take any
time off because then you might miss the big win. It takes a lot of
confidence to trade such a system.
Can the same system work for many markets?
The trader is almost always trading a single market (sometimes
several stocks) and has discovered a characteristic that works on
that market. Often the characteristic only exists strongly on that
market but may exist to some extent on other markets.
How does the final system compare with what the trader was doing?
As I said there are usually many more trades with a lower percent
profitable since the system often just exits quickly on a failed
signal whereas the trader might see how to turn a failed signal into
a winner. But the system makes a lot more money per month than the
trader did because it finds more trades. In real life the trader
doesn't take all of the system trades, he stops for lunch, skips a
day to go Christmas shopping, quits after a great morning to play
golf, etc.
Sound complicated. Don't you run out of memory with the 64K limit on TradeStation 4.0?
Hardly ever. Once you understand the characteristic you are trying to
trade, the code for the final system is only three or four pages
including comments and debug code. Very complicated code usually
indicates that the programmer didn't understand what market
characteristic the trader was trying to trade or was trying to
include code for lots of special cases.
Do you ever include code to handle special cases?
It is not black and white. There is usually some primary tradable
market characteristic that the trader has discovered that works a
reasonable percentage of the time. But sometimes it doesn't work.
Over time the trader has usually discovered ways to turn what would
have been a losing trade into a winner:
> If X happens then reverse the trade
> If Y happens, do not exit yet, this is probably just a pause and the
price will continue going up
> If Z happens wait for the pull-back and add another contract
> Etc.
If there are only a few such special cases and if they can be
precisely defined, they can be added to the code. Otherwise it is
often better to just trade the primary characteristic and exit
quickly with a small loss when it doesn't work. Code for special
cases often screws up the primary trading system. Then, to fix these
problems, you get into special cases of special cases and this rarely
works.
Do you ever start with code the trader developed himself?
If it is available, I usually try to figure out how it works. Most
often it is a mess since the trader is usually not a great programmer
and the code usually "grew" over time. It is often just bumping into
the 64K limit and probably would be bigger if TradeStation 4.0 would
have allowed it.
You say TradeStation 4.0. Do you ever use TS2000i?
I have it but it is still in the box. I consider it unusable for real
trading in its present state. I have heard that the new PowerEditor
has some nice features and that it can be useful in back testing
beyond the 13000 bar limit so I might load it on a computer some day
soon.
Sounds time consuming and expensive. What do you charge?
I do it for free in return for being able to use the results myself.
I only do it if I think the process will end up with something
useful. Frequently, we find that the method does not lend itself to a
computer program so we discontinue the effort. (p.s.: I am not
looking for projects now and am busy with a project.)
Seems like a lot of effort. Why do you do it?
To learn how markets work from people with lots of experience so I
can develop trading systems for myself. I do this full time along
with my trading. It is quite clear that on-the-job-training on your
own can be extremely expensive.
How do you decide what projects to work on?
I try to work with only experienced traders who have been doing it
for years. I also look for someone who understands something about
what computers can and cannot do. If they understand EasyLanguage,
this is a plus since this makes it easier to communicate. I also
choose projects related to something I wanted to learn about. For
example, I worked on one project that involved point and figure
charts since I wanted to learn something about them. I often get
messages from people with just an "idea" for a trading system that
the person would like help converting to code. I usually pass on
these and recommend that the person contact one of the people who do
programming for a fee. When I hear words like "the RSI has to be
higher than... and the MACD has to be ... and the fast stochastic has
to be ... my eyes glaze over and I suggest that the person go
someplace else. Likewise on Elliott Waves, Gann angles, astrology,
moon phases, etc. Maybe these work for some people but I have not!
seen them work with mechanical systems since they are too subjective.
Do your systems use any "rocket science"?
I am an electrical engineer by training so I understand a lot about
digital filters. Such filters are used in essentially all electronic
equipment today and are also useful in trading systems. (All moving
averages are digital filters.) This is about as close as I get to
rocket science. I have a lot of special moving averages I use for
various purposes to isolate trading signals from noise.
How long have you been doing this?
About four years. When I "retired" from my last real job, and started
looking into ways to learn trading, I found TradeStation and quickly
learned that there was no organized way to learn how to use it to
trade. Then, by accident, a trader on one of the email trading lists
asked me to help him. I quickly realized that he knew a lot more than
I would ever know about how the market really worked so I started
doing this to learn from him.
How many people have you worked with?
It is hard to define "worked with" but I have probably done a
significant work with 20 or 30 people which ended up with probably 10
real projects lasting periods of months.
.. End "Interview"
Bob Fulks
--------
|