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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

FIGURE 4.3

The AFL Editor’s auto-completion tool.

124

INTRODUCTION TO AMIBROKER’S AFL

keyboard sequence, only two options will appear: BBandBot and BBandTop.

If you still can’t find the name of the keyword or function, then you will have to

use the trial-and-error method and keep typing different words or take the time and

look up the keyword in the AFL Language Reference under the Help menu. Delete

whatever you typed as the second line and let’s continue with the first algorithm. As

you type the second line of code and type the keyword Optimize it will turn blue

and right after you type the left parentheses a small box will open up right under

your cursor (Figure 4.4).

The box is helping you by providing a template of what the function Optimize

is expecting (this is called the informal parameter list). If a word turns blue, the

editor is letting you know the keyword is a built-in function. This line of code links

the source code with the AmiBroker optimizer. This is how I was able to do all

those cool optimizations in Chapter 3. The function Optimize wants you to provide

a name inside quotes, a default value for the variable avgLen, a min value, a

max value, andastep value. When you optimize the variable avgLen it will

start out at the min value and increase each iteration by the step value until it

reaches the max value. If you don’t run the optimizer, the variable will assume the

default value. The AFL editor has all these helpers or tips for all of the built-in

functions. You will notice another helper window pop up as you type the keyword

Param. The Param function acts similarly to the Optimize function. Instead of

providing an interface to the optimizer, the Param function provides an interface

FIGURE 4.4

AFL Editor function helper.

www.rasabourse.com

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

Saved successfully!

Ooh no, something went wrong!