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.

or program any trading idea. Practice makes perfect, so don’t just stop after you

have programmed your initial trading idea—keep going because I guarantee your

creativity won’t stop.

■ Summary

The objective of this chapter was to introduce the fundamentals necessary to take

a trading idea and program it in EasyLanguage. Along the way we discussed data

types, expressions, and statements. EL requires all variables to be declared before

use and we reviewed how this is done. The use of inputs, built-in function calls,

and how to verify your code was explained as well. The EL Editor is a very

powerful tool and is the center of your creativity. TradeStation and its programming

language, EasyLanguage, provides a very tightly integrated trading environment that

can facilitate the programming of any trading idea. Learning this powerful language

is best accomplished by examining as much code as you can. I have used EL for 25

years and I am still learning.

I will leave you with the finite state machine (FSM) code from Chapter 1.

224

AN INTRODUCTION TO EASYLANGUAGE

{Finite State Machine

Pivot Point Example from Chapter 1.

The switch case structure is used in place of

if-then constructs. This increases the readability

considerably.}

vars:state(0),maxRsi(0),state1BarCount(0),state1Price(0),

state3Price(0),state1BarNumber(0);

vars: isHiPivot(false);

isHiPivot = h[1] > h and h[1] > h[2];

Switch(state)

begin

case(0):

begin

if isHiPivot then

begin

state = 1;

state1Price = h[1];

state1BarNumber = barNumber;

print(date," State 1 : ",state1Price,

" ",state1BarNumber);

value1 = text_new(date[2],time,h+20,"S1");;

end;

end;

www.rasabourse.com

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

Saved successfully!

Ooh no, something went wrong!