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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

244

GENETIC OPTIMIZATION, WALK FORWARD

same algorithm, except instead of adding the volatility level, it subtracts it. Here are

the choppy market long and short entries:

Buy Next Barat Close + xPercent ∗ xAverage(Range, 20)stop

Sell Short Next Barat Close − xPercent ∗ xAverage(Range, 20)stop

Now if the CMI indicates a trending market by exhibiting a higher value, then

the system switches to the trend-following mechanism. Here, the system falls back

on the old Donchian breakout algorithm. Longs are put on at the Highest High of

xTrendBars and shorts are put on at the Lowest Low of xTrendBars. The entry rules

for trending markets are:

BuyNextBarat Highest(High, xTrendBars)stop

Sell Short Next Barat Lowest(Low, xTrendBars)stop

Looking at our entry rules, we can see there are three optimizable parameters:

xLevel, xPercent, and xTrendBars. The last two parameters can be further optimized

for long entries and short entries. If we allow these two parameters to be different

for longs versus shorts, then instead of two parameters we have four. So all in all,

there will be a total of five optimizable parameters:

1. xLevel—Choppy Market value

2. xPercentBuys—Percent of 20-day exponential moving average of Range

3. xPercentSells—Percent of 20-day exponential moving average of Range

4. xTrendBarsBuys—Number of Highest high/Lowest low lookback bars

5. xTrendBarsSells—Number of Highest high/Lowest low lookback bars

We could simply pull out of thin air some values for these parameters or we could

use TradeStation’s tools to help zero in on a robust solution. We now have a trading

system and a set of five optimizable parameters, so the next step is to come up with

a range of values that we want to optimize the parameters across. These different

ranges can also be called our search space. Here are the ranges and iterations for

each of the parameters for our system, TA1:

1. xLevel { 25 to 75 by 5 increments } [11 iterations]

2. xPercentBuys { 0.25 to 0.75 by 0.05 increments } [11 iterations]

3. xPercentSells { 0.25 to 0.75 by 0.05 increments } [11 iterations]

4. xTrendBarsBuy { 8to20by4} [4 iterations]

5. xTrendBarsSell { 8to20by4} [4 iterations]

If we do the math (11 * 11 * 11 * 4 * 4), we come up with a total of 21,296

iterations. It will take this many iterations to search the entire space if we apply an

exhaustive search algorithm. So the computer will need to run 21,296 tests on the

www.rasabourse.com

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

Saved successfully!

Ooh no, something went wrong!