31.07.2021 Views

Ultimate Algorithmic Trading System

Using automated systems for trading in stock markets

Using automated systems for trading in stock markets

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

This is just one possible solution. You can keep propagating and create a whole

slew of solutions, which is what we are after when we use genetic optimization on

trading algorithms.

Go through the steps until you understand the processes involved. Each step

is logical and nonmath intensive and should give you confidence to utilize this

technology in your own research. Even if you don’t utilize it in research you

can impress your friends at your next cocktail party by explaining what a genetic

algorithm is and the impact of a higher mutation rate on subsequent generations.

■ Using Genetic Algorithms in Trading System

Development

‘‘The same principles which at first view lead to skepticism, pursued to a certain

point, bring men back to common sense.’’

George Berkely

Now armed with a little knowledge the veil of skepticism can be pulled back. This

knowledge can now be applied to a real-life trading problem. Earlier in this chapter,

a trading algorithm was mentioned that consisted of five optimizable parameters.

The system (TA1) utilizes an indicator to determine the market condition so it

can either apply a trend-following or choppy-market algorithm. The switch that

determines condition measures the actual distance a market travels versus the entire

distance a market travels over a certain time period. Imagine a subdivision with a

lot of cul-de-sacs. If you leave your house and go in and out of each cul-de-sac prior

to exiting the subdivision, you will have traveled a long route to go a very short

distance. This indicator is based on momentum and has been around for years. It is

known as the Choppy Market Indicator (CMI). Here is the formula to the indicator:

CMI = (ABS(close(xBars)−close))∕(highest(high, xBars)−lowest(low, xBars))

If the difference between the today’s close and the close xBars back is small and

the highest high and lowest low xBars back is large, then the CMI will be a small

value (Numerator small / Denominator large). A low CMI indicates the market has

traveled a relatively large distance but hasn’t gone anywhere. In other words, the

market is chopping around with no evidence of a trend.

There are two ways we can approach a choppy market condition: We can

(1) avoid it; or (2) implement a swing trading algorithm. TA1 attempts the latter

by using volatility breakout from the prior day’s close as an entry point. If the CMI

is less than xLevel, then long entries are placed at today’s close plus xPercent times

xAR (Exponential Average Range) of the past 20 days. The sellshort signal uses the

243

GENETIC OPTIMIZATION, WALK FORWARD

www.rasabourse.com

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!