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.

If high of tomorrow is greater than the buy stop, then buy price = buy stop. This

one makes sense, where is the future leak; the price moved above the buy stop so

the stop was filled at the specified price. If you test using this exact logic in the ESB,

then you will hyperinflate your algorithm’s performance. The error is hard to see,

but it’s there. What if the high is equal to your buy stop? Using this logic, the trade

will not be executed and you will skip a trade that buys the absolute high price of the

day. Skipping these trades will, without a doubt, increase your bottom line. Most

system-testing platforms go out of their way to prevent future leak. TradeStation’s

EasyLanguage only lets you peek at the next bar’s open. You can use it as a price to

execute a trade or as a base price in a calculation of stop or limit orders. You can

say buy next bar at open of next bar + 1/2 ATR(10) on a stop or buy next bar at

open – 1/2 ATR(10) on a limit. This makes future leak impossible and that should

be a good thing. In most cases, this is true. However, this safety feature can make

things a lot more difficult, too. Let’s say you are placing multiple orders for the

next bar, and one of them is filled, and you need to know exactly which order was

executed. Some platforms simply execute the trade and don’t let you know which

order generated the trade. You might have different trade management algorithms

for each order. In the ESB, I give the user complete power and therefore unlimited

creativity. However, as you know, with great power comes great responsibility.

Just be careful.

■ Software Structure

Figure 5.2 shows a simplified structure of how the software works. There’s a lot

more going on behind the scenes, but this diagram gives a good overview of how

the software in general works.

There are just two major components in the ESB, as you can see from the diagram.

The two components are actuated by two simple buttons on the Data worksheet

in the workbook. The GetData component forms the top of the diagram. This is

where the programs asks for and then processes the data and puts the data into a

digestible format. The second component, TestSystem, makes up the rest of the

diagram and the rest of the software. Here is a breakdown of each component:

GetData—this button first asks you to locate a comma-delimited file (CSV)

through an Open File dialog box. Once the file is opened it is cross-referenced

with the data in the DataMaster to determine the Tick Value and Min Tick

properties. The first two letters of the file names are used as the search key. If the

file name is CLXXX.CSV, then the CL will be used to determine what market

data is being utilized. In most cases CL is crude oil. If the symbol is not located

in the DataMaster, then the software assumes it is a stock and defaults the Tick

Value to one dollar and the Min Tick to a penny.

149

USING MICROSOFT EXCEL TO BACKTEST YOUR ALGORITHM

www.rasabourse.com

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

Saved successfully!

Ooh no, something went wrong!