PureBytes Links
Trading Reference Links
|
Hi Gary –
The procedure you describe is called “Evolutionary
Operation” (and, as you describe it, is not related to genetic
algorithms). It works well when searching for optimal points among
variables that do not have interactions.
You can easily test to see if there are
interactions. Pick a trading system that has two (or more) variables, and
run an optimization on them using two variables at a time. Export the
results to Excel. Plot the objective function of your choice as a surface
with the values for the two variables as the x and y axis. In the two
dimensional case, if the surface shows concentric circles (or close to circles)
with the best solution somewhere inside the circles, then your method will
work. If two or more variables have interactions, you will see scattered non-contiguous
areas, or banana shaped areas. The method you suggest will not work in
these cases.
An approach that is based on genetic
algorithms is roughly as follows:
<span
>Generate (through iteration or
random selection) some number of points in your search space. If
your system is a moving average crossover, and has two variables –
one for each moving average length, with limits of 1 and 100 for both,
then your search space is the “square” defined by MA1 from 1
to 100, and MA2 from 1 to 100. The initial points are pairs (v1,v2)
which represent values for the MA1 and MA2 variables. In order to
reasonably cover the space, you might want about 5 data points in each
dimension. So a two variable system will start with 25 points, a
three variable system with 125 points, etc.
<span
>Calculate the objective
function at each point.
<span
>Go through a loop as follows
until some stopping criterion (such as no significant improvement in
objective function, or ten minutes of searching, or 100000 iterations, or whatever)
is met:
<font size=2
color=navy face=Arial>1.
<span
>Pick the best point(s)
and remember the parameter values and objective function value.
<font size=2
color=navy face=Arial>2.
<span
>Generate some new test
points in the search space. There are many methods for doing this.
The literature will describe them as “crossover”, “mutation”,
“steepest descent”, etc. Using crossover, you might create
the new points by taking the value for v1 from one good point and the value for
v2 from another. Using mutation, you might perturb one or more variables
of a good point. Using steepest descent, you might perturb every variable
from a good point, then move in the direction of the best improvement.
<font size=2
color=navy face=Arial>3.
<span
>Calculate the objective
function at each point.
Note several things.
<span
>You must have complete
confidence that your objective function ranks alternative results in the
order you want them to be ranked. You will not have an opportunity
to evaluate intermediate results or alternative solutions. See my
earlier posts concerning objective functions for more details.
<span
>You will not be able to cover
all the possible data points in the search space, so it is possible that
there are better solutions that have not been explored. The
literature discusses this as the problem of being “stuck” at a
“local optimum” rather than finding the “global optimum”.
In my opinion, it is not necessary to find “the best”
solution. It is only necessary to find “a sufficiently
profitable” solution.
<span
>If the surface formed by the
objective function is not smooth, and you are using the crossover
technique, the search routine will be trying to combine values from two or
more good areas that are separated by bad areas, and will be confused.
Building a “smoothness” component into the objective function
helps overcome this.
<span
>You may or may not need to use
AmiBroker’s Optimize procedures. You may be able to simply use
a loop, calculating your own objective function, and storing intermediate results
in an array or writing them out to a disk file periodically. Or, you
may want to use Optimize over a dummy variable in order to have AB
calculate its standard objective functions.
<span
>Genetic search procedures (and
neural network search procedures) seem to encourage modelers (us people
designing systems) to work with search spaces that have large
dimensions. Be Very Careful to avoid curve fitting. I Strongly
Recommend that an Independent out-of-sample data set be reserved for
testing before real trades are taken.
<span
>Genetic and neural network
searches, when applied to time series, often use three data sets.
The earliest is the “learning” set and is used to determine
the best parameter values. The next is the “testing” set
and is used to determine when to stop the search. The most recent is
the “validation” set and is used Once (or a Very Few number of
times) to determine whether the model will perform profitably out of
sample.
Howard
-----Original Message-----
From: Gary A. Serkhoshian
[mailto:serkhoshian777@xxxxxxxxx]
Sent: Wednesday, November 12, 2003
4:00 PM
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] Help on
automating optimization (genetic algorithms)
Hi all,
I should preface this e-mail by saying that I'm not trying to create a
Rube Goldberg as I can go through the process ourlined below manually.
So, if what I'm suggesting requires a Rube Goldberg type solution let me know,
and I'll let it go.
Essentially what I'm doing with optimizations over multiple variables
is prioritizing variables on importance, and optimizing one variable at a time
leaving the others static. I just keep iterating through all the
variables until things stabilize in terms of standard measures. The
cocktail party term is genetic algorithms, but between us it's necesary as
optimizing over multiple variables (4+) will either take too long or
worse cause AmiBroker to crash due to memory issues.
Here's the punchline. Can you all give some input on ways to
program this in afl so as to automate the process outlined above rather
than me manually iterating through as it is labor intensive.
Many thanks,
Gary
<font size=3
face="Times New Roman">
Do you Yahoo!?
Protect your identity with
Yahoo! Mail AddressGuard
Send
BUG REPORTS to bugs@xxxxxxxxxxxxx<font size=2
face="Courier New">
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to:
amiquote@xxxxxxxxxxxxxxx
(Web page: <a
href="">http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: <a
href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Your use of
Yahoo! Groups is subject to the Yahoo!
Terms of Service.
Yahoo! Groups Sponsor
ADVERTISEMENT
Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
|