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.

Things All Programmers Need to Know

Before I go into detail about array programming, let’s go over a short introduction

to some key concepts that all programming languages have in common, including

AmiBrokers AFL: reserved words, remarks or comments, variables and variable

naming conventions, data types, expressions and operators, and precedence of

operators. Here is a quick synopsis:

■ Reserved words. Words that the computer language has set aside for a specific

purpose. You can only use these words for their predefined purposes. Using these

words for any other purpose may cause severe problems.

Remarks or comments. Words or statements that are completely ignored by the compiler.

Remarks are placed in code to help the programmer, or other people who

may reuse the code, understand what the program is designed to do. Double

forward slashes // inform the AFL interpreter that anything that follows is

a comment. The double forward slashes can be used anywhere within a line.

The forward slash asterisk combination /* and */ is used for multiline commentary.

The /* opens the remarks and */ closes the remarks block. Anything inside

/* --- */ is ignored by the computer.

Variables. User-defined words or letters that are used to store information. AFL

is not a strongly typed language. You don’t have to formally declare a variable

name or its type prior to its use.

Data types. Different types of storage; variables are defined by their data types.

AFL has three basic data types: numeric, boolean, and string. A variable that is

assigned a numeric value, or stored as a number, would be of the numeric type.

A variable that stores a true or false value would be of the boolean type. Finally,

a variable that stores a list of characters would be of the string type.

Variables and Data Types A programmer must understand how to use variables

and their associated data types before they can program anything productive. Let’s

take a look at a snippet of code.

mySum = 4 + 5 + 6;

myAvg = mySum/3;

The variables in this code are mySum and myAvg and they are of the numeric data

type; they are storage places for numbers. AFL is liberal concerning variable names,

but there are a few requirements (Table 4.1). A variable name cannot:

■ Start with a number or a period (.)

Be a number

Include punctuation

115

INTRODUCTION TO AMIBROKER’S AFL

www.rasabourse.com

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

Saved successfully!

Ooh no, something went wrong!