Quantitative Technical Analysis — Programs


This page contains links to the code for the listings in the book.
All the files are plain-text files. They can all be opened with any text editor.

Because some computer systems worry about files with strange file extensions, each file has been renamed from “filename.afl” or “filename.py” to “filename.txt”

When you have downloaded the file and copied it to the directory of your choice, change the extension from “.txt” to either “.afl” or “.py”

The AmiBroker programs are listed first, followed by the Python programs.
The data file used in Chapter 9 is at the end of the listings.

Each file is associated with a single listing in the book.
File Figure_7_26.txt corresponds to Figure 7.26 in the book.

All programs have been tested. They compile without error and produce the results shown in the book (or at least reasonably close).

There may be errors. When errors are reported, corrections will be made and revised listing posted in place of the erroneous ones.
Beyond correcting errors in the code, there is no support for these programs.

Please read and understand the disclaimer.
These programs are intended to be educational.
This is defintely Not investment advice.

 

Click any of the links to download that program.

AmiBroker

Program 2.1

Figure 4.2

Figure 4.3

Figure 4.3 A (December 2016)

Figure 7.1

Figure 7.2

Figure 7.4

Figure 7.6

Figure 7.8

Figure 7.10

Figure 7.12

Figure 7.14

Figure 7.16

Figure 7.18

Figure 7.21

Figure 7.22

Figure 7.23

Figure 7.25

Figure 7.26

Figure 7.42

Figure 8.6

 

Python

As published in the book — using Python 2.7

Scroll down for revisions and Python 3.6

Figure 4.4

Figure 4.7

Figure 4.9

Figure 4.11

Figure 4.12

Figure 5.1

Figure 5.1A  (October 2016)

Figure 8.2

Figure 8.4

Figure 8.10

Figure 8.12

Figure 8.17

Figure 8.19

Figure 8.21

Figure 8.23

Figure 8.26

Figure 8.28

Figure 8.35

Figure 8.38

Figure 8.40

Figure 8.42

Figure 8.44

Figure 8.46

Figure 8.48

Figure 8.50

Figure 8.52

Figure 8.54

Figure 8.56

Figure 8.58

Figure 8.60

Figure 8.62

Figure 8.64

Figure 8.66

Figure 8.75

Figure 8.79

Figure 9.11

Figure 9.21

 

Revised in 2017 to comply with changes in libraries and to migrate to Python 3.6

Figure 4.4 V3

Figure 4.7 V3

Figure 4.9 V3

Figure 4.11 V3

Figure 4.12 V3

Figure 5.1 V3

Figure 8.2 V3

Figure 8.4 V3

Figure 8.10 V3

Figure 8.12 V3

Figure 8.17 V3

Figure 8.19 V3

Figure 8.21 V3

Figure 8.23 V3

Figure 8.26 V3

Figure 8.28 V3

Figure 8.35 V3

Figure 8.38 V3

Figure 8.40 V3

Figure 8.42 V3

Figure 8.44 V3

Figure 8.46 V3

Figure 8.48 V3

Figure 8.50 V3

Figure 8.52 V3

Figure 8.54 V3

Figure 8.56 V3

Figure 8.58 V3

Figure 8.60 V3

Figure 8.62 V3

Figure 8.64 V3

Figure 8.66 V3

Figure 8.75 V3

Figure 8.79 V3

Figure 9.11 V3

Figure 9.20 V3

 

Data file used in Chapter 9

Chapter 9 data in csv format