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.

AddColumn(myRSI,"RSI");

AddColumn(myStoch,"StochD");

AddColumn(C,"Close");

AddColumn(C>myMovAvg,"C>MAV(19)");

AddColumn(C,"Close",format= 1.4);

296

AMIBROKER

The code snippet starts out by assigning MACD, RSI, StochD, and MAV values

to four user-defined variables: myMACD, myRSI, myStoch, and myAvg. These

variables are then used in the AddColumn function along with a descriptive name.

AddColumn can take a variable number of parameters, but most of the time you

will only need to pass two or three. The first parameter is the name of the array that

you want to print and the second parameter is a string that will be printed as the

column heading. The third and optional parameter is the format the array will be

printed out in. Figure A.1 shows the printout of this particular exploration.

Notice how the first ‘‘Close’’ column only shows two decimal places, whereas

the second ‘‘Close’’ column has been formatted to show four. The AddColumn

capability is very powerful because it is so easy to print out the internal workings

of your algorithm. This tool comes in really handy when a trading algorithm isn’t

performing the way you intended—just print out the values that make up the criteria

of your buy / sell / short / cover logic. Remember to include Filter = 1 at the

top of your code listing. This informs AmiBroker to go ahead and allow values to be

printed out in a spreadsheet format in the Results window.

FIGURE A.1

Results of an exploration with three parameters.

www.rasabourse.com

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

Saved successfully!

Ooh no, something went wrong!