Archive for the ‘Artificial Nerual Networks’ Category

June 1, 2014 0

ERRB Prediction Week 23

By in Artificial Nerual Networks, Investment




Backtest One:


Backtest Two:


Backtest Three:



Any stock price and market data provided on my website is for informational purposes only, and should not be relied upon for trading purposes. Historical and current stock price performance data is not necessarily indicative of future performance.

Neither we, the third party that provides such data nor their data or content providers guarantee the sequence, accuracy, or completeness of any stock price information or other data displayed, nor shall any such party be liable in any way to the reader or to any other person, firm or corporation whatsoever for any delays, inaccuracies, errors in, or omission of any such information or data or the transmission thereof, or for any actions taken in reliance thereon or for any damages howsoever arising there from or occasioned thereby or by reason of nonperformance or interruption, or termination, of the stock price information for any cause whatsoever. You should not rely on the stock price and market data provided on my website for investment purposes.

January 19, 2011 1

Artificial Neural Networks: Principles and Applications

By in Artificial Nerual Networks, Information Technology

I gave an Advanced Topics presentation last night in SE Portland. I had a lot of fun and judging from the audience’s reaction I gauge my presentation a success.

In order to view this page you need Flash Player 9+ support!

Get Adobe Flash player

December 8, 2010 0

Neural Screencast

By in Artificial Nerual Networks, Information Technology

I posted my week’s predictions (pulled an “all-nighter” actually). Here’s a video of what the prediction process looks like:



November 8, 2010 0

ANN Presentation

By in Artificial Nerual Networks

Here’s a sneak preview of my Advanced Topics ANN presentation I’m giving in Portland on the 19th:

[caption id="attachment_297" align="aligncenter" width="538" caption="ANN's: What are they used for?"][/caption]

October 25, 2010 0

United States Oil (USO), Week 43 Prediction

By in Artificial Nerual Networks

Here is the Artificial Neural Network’s prediction for United States Oil (USO), week 43:

Backtest USO week 42:

Backtest USO week 41:

Backtest USO week 40:

October 25, 2010 0

Currency Shares Euro Trust (FXE), Week 43 Prediction

By in Artificial Nerual Networks

Here is the Artificial Neural Network’s prediction for Currency Shares Euro Trust (FXE), week 43:

Backtest FXE week 42:

Backtest FXE week 41:

Backtest FXE week 40:

October 25, 2010 0

Graphs: Executive Edition

By in Artificial Nerual Networks

I wrote the de-scaling logic and x-axis labeling for the prediction/backtesting graphs. Here’s my first draft, complete with a format readable by normal human beings:

There are a couple of things I have to fix.

First, see that spike near the “Tuesday” mark? That spike actually happened at Tuesday’s opening. The discrepancy is because my tick data is missing some ticks. This is also the reason why the blue “Observed” line is longer than the “Predicted” line. That means that I have to write a routine that preps the tick data before feeding into the ANN.

The good news is that the prediction actually “nailed” Tuesday morning’s spike–the ANN “knew” a surge was coming before the currency trust basically moved sideways for the rest of the week.

October 23, 2010 0

Week 42 Predictions

By in Artificial Nerual Networks

Here are this week’s predicted vs. actual  graphs. I transposed my prediction graphs with this week’s Yahoo! weekly graph. I did this as I’m now pushing more toward a business, “USA Today” look and less toward  “hard line” engineering output. I want to provide meaningful results for investors that they can easily use.

Overall my predictions are pretty good. I know from other experiments this week that the proper selection of inputs is critical to the prediction’s outcome. While I haven’t looked yet at two more securities I analyzed, I am nearly certain that they will “bomb.” My backtesting/numerical analysis showed that the neurals didn’t “get” the other two securities I analyzed with the inputs I supplied. In other words, if the neurals are going to be wrong, I can tell you ahead of time with fair certainty. Here are the two I knew would be right. I bet with more experimentation I will make them even better (hint: trend reversal signals):

September 28, 2010 0

Update Databases Dynamically

By in Artificial Nerual Networks, Programming

I recently had to work with data for importation into a database that provided several challenges. Here’s the raw output:

Calculating indicator AroonUp[25, {I:Prices HIGH}, {I:Prices LOW}] …
AroonUp[25, {I:Prices HIGH}, {I:Prices LOW}][2010-05-03 09:01:00] = 68.0000
AroonDown[25, {I:Prices HIGH}, {I:Prices LOW}][2010-05-03 09:01:00] = 12.0000
AroonOsc[25, {I:Prices HIGH}, {I:Prices LOW}][2010-05-03 09:01:00] = 56.0000

About 45,000 or so of these records. My table should look like this:


|     date        |     time   | aroonup25 | aroondown25 | aroonosc25 |

| 2010-05-03  | 09:01:00 | 68.0000    |     12.0000      |  56.0000    |


I don’t know ahead of time which indicator the file will specify (i.e. up25, down25, osc25) nor do I know whether or not the record is already in the database.

Putting the correct values is especially acute as a) I need to ensure the date & time corresponds with the correct values (using UNIX’s ‘cut’ just won’t cut it, pun intended) and b) over the course of literally “hundreds of thousands” of records, performance becomes a real issue.

I wrote a script (listed below) that coordinates the indicator type, date, time, and value. The first step is to parse the input file to an output into database syntax. Here’s the intermediate step’s output:

INSERT INTO ARG (aroonup25, date, time) VALUES (‘68.0000’, ‘2010-05-03′, ’09:01:00′) ON DUPLICATE KEY UPDATE aroonup25=’68.0000’;
INSERT INTO ARG (aroondown25, date, time) VALUES (‘12.0000’, ‘2010-05-03′, ’09:01:00′) ON DUPLICATE KEY UPDATE aroondown25=’12.0000’;
INSERT INTO ARG (aroonosc25, date, time) VALUES (‘56.0000’, ‘2010-05-03′, ’09:01:00′) ON DUPLICATE KEY UPDATE aroonosc25=’56.0000’;

Now that I’ve created a file that contains the correct database syntax, all that’s needed is to import it into the database:

$ cat ./aroon.sql | mysql minute -u cstevens -p

While the script seems simple enough it’s actually a cornerstone to building a sophisticated method for storing indicator (in this case) data.

Here’s the script:




#break down the input file
for i in 25 #25 is the period length of the indicator (for future expansion to other time lengths)
cat $parse_file | while read line
#grab ’em (ticks), parse, and convert to lower case
awk -F'[‘ -v counter=$i ‘{print $1’counter’,$3}’| sed s/’] =’//g | tr [:upper:] [:lower:] > $tmp_parse_file

if [ -f $sql_file ]
rm $sql_file

# create sql file output
cat $tmp_parse_file | while read indicator date time value
print INSERT INTO ARG ‘(‘$indicator’, date, time)’ VALUES ‘(‘”‘”$value”‘”, “‘”$date”‘”, “‘”$time”‘”‘)’ ON DUPLICATE KEY UPDATE $indicator=”‘”$value”‘”‘;’ >> $sql_file

Note that this script contains a couple of “hard coded” variables. I consider this poor programming practice. In this case, the hard coded variables are actual variables in my master script. I will run through the necessary changes as I import this code into the code tree.

September 15, 2010 0

Securities Price Fluctuations

By in Artificial Nerual Networks

The red line in the graph (click on the image below for a better view) is what the ANN predicted the price fluctuations for the MSFT security. The green line is how the stock actually moved.

My system:

  • Downloads the necessary tick data
  • Parses the user-specified technical indicators as arguments
  • Computes each indicator’s value
  • Imports all the data to a database
  • Parses the appropriate data
  • Scales the data
  • Analyses the data through an Artificial Neural Network
  • Creates Predictions

Here is a sampling of the results: