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.

Scroll down and select AvgTrueRange and it will be inserted into your code.

Now go back and delete it. Keep the EL Editor open; we will be back with it shortly.

■ Syntax

The syntax of EasyLanguage is very similar to other programming languages, but

there are a couple of differences in how remarks are demarked and the use of SKIP

words:

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 // informs the EasyLanguage compiler that anything that follows

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

curly left bracket { and curly right bracket } are used for multiline commentary.

The { opens the remarks and } closes the remarks block. Anything inside { --- }

is ignored by the computer.

SKIP words. Words used to help EasyLanguage look more like English than a

programming language. Here is a list: an, at, by, does, is, of, on, than, the,

and was.

EasyLanguage is the medium used by traders to convert a trading idea into a form

that a computer can understand. Fortunately for nonprogrammers, EasyLanguage

is an extremely high-level language; it looks like the written English language.

It is a compiled language; programs are converted to computer code when the

programmer deems necessary. This is different from VBA and Python. The compiler

then checks for syntactical correctness and translates your source code into a program

that the computer can understand. If there is a problem, the compiler alerts the

programmer and sometimes offers advice on how to fix it. This is different from a

translated language, which evaluates every line as it is typed.

Unlike AmiBroker’s AFL, VBA, and Python, EL requires all variables names to

be declared/defined prior to use. The declaration statement defines the initial value

and data type of the variable. In a compiled language, the compiler needs to know

how much space to reserve in memory for all variables. The following code is a

complete EasyLanguage program.

209

AN INTRODUCTION TO EASYLANGUAGE

Vars:

mySum(0),myAvg(0);

mySum = High + Low + Close;

myAvg = mySum/3 ;

The Vars: (orVariables:) statement tells the computer what variables are

being declared and initialized. We declare the variables by simply listing them in

www.rasabourse.com

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

Saved successfully!

Ooh no, something went wrong!