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.

156 FIGURE 5.9 The Visual Basic Editor (VBE) in Microsoft Excel.

USING MICROSOFT EXCEL TO BACKTEST YOUR ALGORITHM

in green. In VB, everything green is considered a comment. This information is just

there for the benefit of the person reading the code—it is hidden from the computer.

Notice the first character in each line that is green. It is a single quote (‘). A single

quote at the beginning of a line of VBA code tells the computer to ignore the line.

Just like the double forward slashes ‘‘//’’ in AmiBroker. This area of the source code

lets the reader know the title, version, subversion of the software, and any notes

pertaining to revisions and necessary information a user may need to know. If you

scrolled through the source, you will see multiple lines of comments. I did this to

modularize the code and explain what the individual sections were doing. Breaking

down a large program into sections helps explain the code in block-by-block fashion.

Source code read as a whole is very difficult to understand, but if you can break the

code into individual blocks, it will help make things much clearer.

You will notice several banners or blocks of green text embedded in the source

code. Figure 5.10 is an example of one of these blocks.

These comments, in this format, help break up the code and also explain what’s

happening in the next few lines of code. This commentary explains how the data

contained in the cells of the Data worksheet will be imported into the individual

data arrays. Column 1 holds the Dates of each individual daily bar. The first row of

www.rasabourse.com

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

Saved successfully!

Ooh no, something went wrong!