A B-P ANN Commodity Trader 
Joseph E. Collard 
Martingale Research Corporation 
100 Allentown Pkwy., Suite 211 
Allen, Texas 75002 
Abstract 
An Artificial Neural Network (ANN) is trained to 
recognize a buy/sell (long/short} pattern for a 
particular commodity future contract. The Back- 
Propagation of errors algorithm was used to encode 
the relationship between the Long/Short desired 
output and 18 fundamental variables plus 6 (or 18) 
technical variables into the 
year of past data the ANN 
long/short market positions for 
future that would have made 
investment of less than $1000. 
ANN. Trained on one 
is able to predict 
9 months in the 
$10,301 profit on an 
1 
INTRODUCTION 
An Artificial Neural Network (ANN) is trained to recognize a 
long/short pattern for a particular commodity future con- 
tract. The Back-Propagation of errors algorithm was used to 
encode the relationship between the Long/Short desired out- 
put and 18 fundamental variables plus 6 (or 18) technical 
variables into the ANN. 
2 NETWORK ARCHITECTURE 
The ANNs used were simple, feed forward, single hidden layer 
networks with no input units, N hidden units and one output 
unit. See Figure 1. N varied from six (6) through sixteen 
(16} hidden units. 
551 
552 Collard 
INPUTS 
F' 1 
F 2 
F 3 
F'16 
F'17 
F'18 
T1 
T 2 
T 3 
INPUT 
LAYER 
HIDDEN 
LAYER 
OUTPUT 
LAYER 
OUTPUT 
BUY 
m oR 
  SELL 
 LONG 
OR 
 SHORT 
T6 OR 
T18 
DESIRED 
OUTPUT 
Figure 1. The Network Architecture 
3 TRAINING PROCEDURE 
Back Propagation of Errors Algorithm- The ANN was trained 
using the well known ANN training algorithm called Back 
Propagation of Errors which will not be elaborated on here. 
A Few Hods to the Algorithm' We are using the algorithm 
above with three changes. The changes, when implemented and 
tested on the standard 
trained, one hidden unit 
the 4 pattern vectors. 
cited by Rumelhart [2]. 
exclusive-or problem, resulted in a 
network after 60-70 passes through 
This compares to the 245 passes 
Even with a 32 hidden unit network, 
Yves found the average number of passes to be 120 [2]. 
A B-P ANN Commodity Trader 553 
The modifications to standard back propagation are: 
Minimum Slope Term in the Derivative of the Activa- 
tion Function [John Denker at Bell Labs]. 
Using the Optional Momentum Term [2] 
Weight change frequency [1]. 
4 DATA 
In all cases, the six market technical variables (Open, 
High, Low, Close, Open Interest and Volume) were that trad- 
ing day's data for the "front month" commodity contract 
{roughly speaking, the most active month's commodity con- 
tract). 
The first set of training data consisted of 105 or 143 
"high confidence" trading days in 1988. Each trading day 
had associated with it a twenty-five component pattern vec- 
tor (25-vector) consisting of eighteen fundamental varia- 
bles, such as weather indicators and seasonal indicators, 
plus the six market technical variables for the trading day, 
and finally, the EXPERT's hindsight long/short position. 
The test data for these networks was all 253 25-vectors in 
1988. 
The next training data set consisted of all 253 trading days 
in 1988. Again each trading day had associated with it a 
25-vector consisting of the same eighteen fundamental varia- 
bles plus the six market technical variables and finally, 
the EXPERT's long/short position. The test set for these 
networks consisted of 25-vectors from the first 205 trading 
days in 1989. 
Finally, the last set of training data consisted of the last 
251 trading days in 1988. For this set each trading day had 
associated with it a 37 component pattern vector (37-vector) 
consisting of the same eighteen fundamental variables plus 
six market technical variables for that trading day, six 
market technical variables for the previous trading day, six 
market technical variables for the two days previous trading 
day, and finally, the EXPERT's long/short position. The 
test set for these networks consisted of 37-vectors from the 
first 205 trading days in 1989. 
5 RESULTS 
The results for 7 
1. 
trained 
networks are summarized in Table 
554 Collard 
SIZE/IN TRAIN. 
Table 1. Study Results 
% e -XPT PROFIT/RTS TEST 
PROFIT/RTS 
005 6-1 /24 105- 88 100 @.125 
253-'88 76% 
006 6-1 /24 
Targets >>> 
009 10-1/24 
010 6-1 /24 
Targets >>> 
011 10-1/36 
012 13-1/36 
013 16-1/36 
143- 88 
253- 88 
253- 88 
99 @.125-1 253-'88 82% 
$25,296/10 205-'89 $14,596/ 6 
98 @ .25-4 824,173/14 205- 89 8 7,272/ 6 
105- 88 100 @ .1 
251- 88 
251- 88 
251- 88 
251- 88 
817,534/13 253- 88 80% 
$24,819/10 205- 89 $14,596/ 6 
98  .25-4 $23,370/14 205- 89 $ 7,272/ 6 
97 @ .25-7 $22,965/12 205- 89 $ 6,554/14 
99 @ .25-3 $22,495/12 205- 89 $10,301/19 
The column headings for Table 1 have the following meanings: 
Size/In 
Train. 
% @ -Xpt 
Profit RTs 
Test set 
The numerical designation of the Network. 
The hidden-output layer dimensions and the 
number of inputs to the network. 
The number of days and year of the training 
set. 
The percent of the training data encoded in 
the network at less than g error - the number 
of days not encoded. 
The profit computed for the training or test 
set and how many round turns (RTs) it required 
for that profit. Or, if the profit calcula- 
tion was not yet available, then the percent 
the network is in agreement with the EXPERT. 
The number of trading days/year of the test 
set. 
Figure 2 shows how well the 013 network agrees with its 
training set's long/short positions. The NET 19 INPUT curve 
is the commodities price curve for 1988's 251 trading days. 
A B-P ANN Commodity Trader 555 
FILE: j!cBt3; R0: 1 TO 252 ; PLOT OF R0 ! us. 
0UTPUT,TEflCHER & PRICE 
0.89 
9.?8 
9.6? 
9.56 
9.33 
0.22 
O. ll 
,d 
I 
1 29 5? 85 113 140 168 196 Z2 252 
Figure 2. Trained Network 013 
NET 10UTP! i 
PE t? TEfiCHR ..... x- 
NET 19 IHPUt- . 
Figure 3 shows the corresponding profit plot on the training 
data for both the EXPERT and network 013. 
TOLCOF & EXPERT PROFIT 
$24819 
! 
22061. 
! 
19303. 
{ 
16546 
! 
13788. 
11930. 
8273 
5515. 
! 
2757. 
! 29 
i l NETRK 
I I I I I I I I 
57 85 113 149 168 196 22,t 252 
Figure 3. Network 013's and EXPERT's Profit for 1988 data 
556 Collard 
Figure 4 is the profit plot for the network when tested on 
the first 205 trading days in 1989. Two significant fea- 
tures should be noted in Figure 4. The network's profit 
step function is almost always increasing. The profit is 
never negative. 
TOLCOF & EXPERI PROFIT 
$1497 
! 
12975, 
! 
li353. 
I 
9731. 
I 
819. 
{ 
6487. 
{ 
4865. 
{ 
3243. 
{ 
1621. ., 
1 24 47' 
! ..... .x.-.- ........ ] ..... x..i -- 
..... ! 
: 
I I I i I I I 
69 92 115 138 160 183 206 
'89 
Figure 4. Network 013's and EXPERT's Profit for 1989 data 
6 
REFERENCES 
1. Pao, Y.- H., Adaptive Pattern 
Networks, Addison Wesley, 1989. 
2. Rumelhart, D., and McClelland, 
Processins, HIT Press, 1986. 
Recognition and Neural 
J., Parallel Distributed 
