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.

Calculating Start Trade Drawdown With the use of a computer, the process of

this calculation is easily accomplished. This calculation is somewhat similar to the

Monte Carlo simulation in that you are recreating multiple histories of a trading

algorithm. However, this time an RNG is not utilized. The first trade history is the

trade history that contains all of the historic trades. Subsequent trade histories start

at the subsequent trade in the original history. For example, the second trade history

starts at the beginning of trade #2 and the next trade history starts at beginning of

trade #3, and so on. An original trade history containing 100 trades will spawn 100

histories starting at different trade numbers. Once all of the histories are created

then all one needs to do is flow through each history and keep track of cumulative

profit and maximum drawdown.

After creating and analyzing the 100 trade histories a cumulative frequency distribution

table (CFDT) must be created. A CFDT is created by distributing the 100

drawdowns into different bins. The bins are the same size but have different boundaries.

Assume the 100 drawdowns range from $5,000 to $25,000 and you want to

store the different drawdown in 20 bins. The range is equal to $20,000 ($25,000 −

$5,000) so each bin would have to be $1,000 wide ($20,000/20). Bin #1 would contain

the drawdowns that ranged from $5,000.00 to $5,999.99, bin #2 would contain

the drawdowns that ranged from $6,000 to $6,999.99, bin #3 would contain the

drawdowns that ranged from $7,000 to $7,999.99, and so on. See how the bins are

the same size but have different low and high boundaries?

Once the drawdowns are distributed into the different bins you can easily create

a cumulative frequency by summing up the number of drawdowns in each bin.

Once you have the cumulative frequency it is simple to calculate the probability

of occurrence for each bin. With 100 different trade histories starting at different

trade numbers, it is not uncommon to have less than 100 distinct max drawdown

values. In some cases, the same max drawdown value will be observed when

the starting point of each history is in close proximity. I wouldn’t be surprised

if the max drawdown was the same starting at trade #2 versus starting at trade

#3. The fact is you will have 100 max drawdown values but they won’t all be

distinct. The bins will contain multiple duplicate drawdown values. Each bin will

contain N number of values and the probability of the occurrence of that bin’s

max value and below will be the sum of N up to that bin/Total N. Let’s say bin

#1 [$5,000 − $5,999] contains 5 values and bin #2 [$6,000 − $6,999] contains

3 values. The probability of a drawdown less than $6,999 would be 8/100 or 8%.

This type of information can be very beneficial at the beginning stage of trading a

new algorithm.

265

GENETIC OPTIMIZATION, WALK FORWARD

Implementation of Start Trade Drawdown Simulation Using Python Simulation

of the different trade histories depends on the actual number of trades generated by

the algorithm. This simulation requires a nested for-loop where the outside loop

www.rasabourse.com

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

Saved successfully!

Ooh no, something went wrong!