AI For The Individual Trader: John Jonelis
AI For The Individual Trader: John Jonelis
John Jonelis
Presented to a joint meeting of the Chicago Area MetaStock and TradeStation groups
INTRODUCTION—
This is the story of a search for a truly outstanding testing/trading platform—the killer application.
Does such a program exist? You be the judge. Our team looked through ads, websites, user forums, and demo
programs. This report will start with a brief overview of the eight platforms we liked, and then examine in detail the
capabilities of the one we selected.
Backtesting 401—The section on Artificial Intelligence (AI), as well as the description of Walk Forward Analysis
(WFA) adds to Backtesting 101, 201, and 301, from the previous paper BUILDING A SYSTEM.
PLATFORMS CONSIDERED—
● eFloor Trader
● Mechanica
● Wealth Lab Pro
● AmiBroker
● NeoTicker
● TradeStation (with and without TradersStudio)
● MetaStock Professional (with Excel and Macro)
● NeuroShell Daytrader Professional
GOALS—
1—Real-time charting
2—Portfolio capabilities
3—Testing Automation—(Artificial Intelligence and Walk Forward Analysis)
4—Auto-trading or clear trading signals
5—One language for all functions
Each platform will be ranked by these five goals. Unique strengths and weaknesses will also be considered.
Comments on Goals—I like to diversify my time horizons, so I’m interested in real-time charting. I prefer to test and
trade strategies across groups of symbols, so portfolio capabilities are a must. I have learned first-hand how long it
takes to build and properly test strategies, so I wanted to add a degree of testing automation. Walk-Forward Analysis
can be performed by hand, but I need a platform that automates at least some of that process. I have put discretionary
trading behind me, so my ideal platform will auto-trade or give extremely clear signals. I am a programmer by
necessity, not by choice, and therefore prefer to limit the number of languages that I use.
I recognize that my needs and goals may not coincide with those of others, so a certain amount of detail will be shown
for each of the eight programs that caught and held our team’s interest. This paper is exploratory. It was not possible
to test every program function. All readers should do their own research.
The Team—
Project 304, is a collaboration that includes two whiz kids (as I like to call them), a seasoned trader, and myself. Whiz
kids tend to grow up and find dynamic careers. One has gone off to head a statistics department doing mergers and
acquisitions. The other has found his niche in computer science. His software firm, Avogon Consulting, performed
much of the research shown in this paper as well as the macro application that will be demonstrated.
I have a high regard for all of the platforms on the list. Let’s take a look at each of them in turn—
PLATFORMS CONSIDERED—
eFloor Trader—
No demo program is available, but I met with a company principal and saw the platform run live at the Chicago
Mercantile Exchange. This looks to be a powerful and rapid auto-trading engine, capable of portfolio level trading,
using intra-day data while running more than one strategy at a time. It’s a pure auto-trading engine, and doesn’t offer
charting or strategy testing. Our interest was using it in combination with some other program that lacked auto-trading
capabilities. Interestingly enough, one of the company reps uses it with TradeStation, which might spark the
imagination of some in our group who feel limited to one broker. By itself, eFloor Trader met two out of five goals.
Mechanica—
Again, no demo program is offered. I called an acquaintance, a prominent CTA who uses the program, and asked a
few pointed questions. He was so enthusiastic that we decided to look into it further. Mechanica is a pure backtesting
engine that handles full portfolio-level strategies. It appears unique in its ability to test dynamically changing portfolios
and keep track of open-trade risk on a daily basis. It uses a simple spreadsheet-style programming interface. But it has
no testing automation, and its strength isn’t as a trading machine. It’s limited to daily data. This program should appeal
to those who design commercial strategies, trading diversified portfolios of commodities. The pro version has the
flashy features, but its price isn’t published. Word-of-mouth, the cost may be about 16K. By itself, Mechanica met two
out of five goals.
AmiBroker—
We liked this package very much and spent several weeks with the demo. AmiBroker uses real-time and offline data
from several sources, and auto-trades with Interactive Brokers. The charting is crisp and intuitive. A unique feature—
portfolio-level backtests can include custom risk management strategies. AmiBroker uses one language for all
functions and the editor looks good. But it offers no testing automation. The program appears to be copyrighted to an
individual. The user forums are replete with enthusiastic references to the Warsaw Exchange and a Polish version is
available. Our one major objection was the complete absence of telephone support. It’s a nice package and costs only
about $300. AmiBroker met four out of five goals.
NeoTicker—
A respected colleague recommended that we look into this package and I had hopes that it would be the one platform to
handle all my needs. We spent a full month running the demo. NeoTicker is an extremely powerful program. It uses
real-time and offline data from many sources, and auto-trades through many brokers. It performs some portfolio-level
testing. It can trade and test in multiple timeframes and even optimize to find the best timeframe. The program has no
real testing automation, but can perform huge grid optimizations. To do this in a manageable amount of time, a separate
engine runs grids on multiple linked computers. (We didn’t test this feature.) NeoTicker prints detailed reports in
annual, monthly, weekly, or daily formats, and includes just about every statistic known to the industry. It keeps track
of trade orders and trade fills for comparison. The technical support is quite good. We found a bug in the demo, and
they fixed it within 24 hours. They provide a ~2000 page owners manual.
The charting looks clean, but is painfully awkward to work with. Custom indicators are clumsy to use. The internal
formula editor is primitive, and the internal script language could not be optimized. This is disappointing, since the
internal language is powerful and transparent to use. As it turns out, major programming skills are required, as all
serious work is done in a major outside language—preferably C++. In addition, SQL database language is needed to
manage the grid optimizer.
NeoTicker is an enterprise-level solution, and should appeal to institutions or perhaps to individuals interested primarily
in the programming process. It was difficult to put it aside, and I insisted on learning to use it before I finally came to
recognize that, as an individual, it would slow down my creative process. At about $1,300, NeoTicker met three out of
five goals.
2
TradeStation—
This is a well-known entity—a unique, vertically integrated package, with one source for data, charting, testing,
brokerage, and auto-trading, (which is both its greatest strength and greatest weakness). TradeStation can test in
multiple time frames, but testing is limited to one symbol—one strategy. Workarounds and added capabilities can be
programmed into the package using its internal script language, which is used for all functions.
A number of programs have been developed to extend the capabilities of TradeStation. TradersStudio appears to make
a good match. It adds some portfolio capability, testing automation (Genetic Optimization), and performs full Walk-
Forward Analysis. It adds a second language, Visual Basic, but also reads and de-bugs TradeStation’s Easy Language.
TradersStudio is a stand-alone program at approximately a $600 one-time cost.
TradeStation’s costs are hard to quantify. A stock and E-mini subscription runs about $1,400/year, but is reduced by
commission costs. We considered this to be a good base platform. Alone, it met three out of five goals. In combination
with TradersStudio it met four out of five.
MetaStock Professional—
This also is a well-known entity, and is my current platform. I already know the warts and workarounds, and as we
compared, it began to look better and better. MetaStock uses real-time data from two sources and offline data from
many sources. Several of the programs we reviewed advertise that they can read MetaStock data. MetaStock uses one
compact language for all functions. It can test across a basket of symbols and has a unique ability to access details
within each optimized solution. It offers no testing automation. It doesn’t auto-trade, but gives extremely clear entry
and exit signals. A major flaw is that it does not recognize futures multiples. At $1,700, this is another good base
platform. It met 4 out of 5 goals.
Before we complete the review, lets see how a basic program can be extended—I don’t use MetaStock entirely as
the manufacturer intended, and it’s interesting what can be done to extend the capabilities of these platforms. While my
team was testing demo programs, I was struggling to complete a Walk-Forward test for a CTA, using no automation.
My consultant took note of my suffering, and wrote a macro that automated part of the process. Below is a grid
optimization in MetaStock, with 648 solutions, optimizing in five variables. This is a multi-market, multi-period test.
Detail Report
Using the macro, statistics are generated from the 648 detail reports and then automatically exported to Excel in rows—
4
Once in Excel, the five-variable, multi-market, multi-period optimization is easily sorted to find the best solution—
Below is the best solution in the grid. Even with this limited diversification, the portfolio experiences no losing years—
Bottom line—Many conventional platforms can be made to do new things, and automated to improve their utility.
5
Now to complete the review, let’s look at the final candidate—
NeuroShell offers portfolio-level testing and trading, including hedging strategies. It uses one bulletproof point-and-
click language, and also supports major programming languages through DLL protocol. It reads real-time data from
eSignal, or Interactive Brokers, and offline data directly from text files. It also read offline MetaStock data.
Auto-trading is through Interactive Brokers—my personal favorite. NeuroShell is unique in that it places hard Stop-
Loss orders on the broker’s server. This reduces one of the greatest risks of auto-trading—failure of power, equipment,
or connectivity. The program also gives clear signals for manual trading. Its reports provide plenty of statistics. The
company offers very good support—they produced two beta versions during our evaluation. NeuroShell isn’t just about
Neural Nets—it’s a full-function testing and trading machine. It met five out of five goals. This is the program I kept.
SUMMARY—
Before we take a closer look at NeuroShell, let’s review all the platforms and goals:
NeuroShell fulfilled all five of my personal goals, and came with an unexpected attribute—It’s completely different
from any other platform I’ve seen. Therefore, it forces me to think about trading in entirely different ways.
Let me illustrate, using the story of the hats.
THIS IS DIVERSIFICATION
I don’t wear their hat, but the Colts fill out the football season (and also made for one interesting Super Bowl).
I have a lot of respect for the makers of all the programs that we reviewed. I believe that there’s an important place for
conventional platforms that build static systems that work over time. NeuroShell, on the other hand, approaches trading
as constantly adaptive.
My Strategy has Evolved—to diversify my portfolio, to diversify my systems, but also to diversify my thinking.
7
WARNING—What you’re about to see is dramatically different.
Before taking a closer look at NeuroShell, let’s try to visualize how AI fits into the picture—
First, for comparison, let’s look at a grid optimization, as used by conventional platforms—
A conventional grid optimization tests every possible combination within the limits and increments set by the user. The
above example is a simple two-variable grid—well within the practical limits of the technology. Large optimizations take
a very long time, and the more complex, the more challenging the evaluation process. As additional variables are added,
the time to compute grows exponentially. The result—in a given period of time, only a limited amount of work can be
accomplished.
8
Genetic Algorithm (GA)—
The term “genetic algorithm” is an analogy to the theory of evolution. Analogies tend to break down even more
quickly than theories. But as you’ll see, fancy explanations aren’t needed. GA is actually a flashy name for
automated non-linear optimization. Let’s do a simple visualization—
GA #1—Tens or hundreds of solutions may be tested GA #2—The optimization algorithm identifies several
simultaneously, covering a huge search space. Let’s watch areas that fall close to the search goals.
as the test progresses—
GA #3—These areas are further investigated by a GA #4—The final solution is the one that best satisfies
random selection process. (Testing isn’t done in the goal selected by the user. (The list of possible goals
increments.) is extensive.)
Using GA, many possible solutions are never explored, and the very best solution may not be encountered. But due to
the constraint of time, the same can be said of a grid optimization. Using GA, a much larger search space is covered in
a reasonable amount of time, likely resulting in a better solution than a grid.
9
Neural Net Predictions—
NeuroShell has been designed to make Artificial Intelligence (AI) accessible to the individual trader. (During the live
presentation of this paper, an animation was shown to illustrate the way Neural Nets work. Here, we’ll settle for a few
notes.) Quite simply, Neural Nets build models using theories of the function of the human brain. They find patterns
not discernable to the human eye. They use non-linear techniques to solve problems in a non-linear world.
In the slide above, the user enters inputs, and also a goal or objective function. The Neural Net will attempt to make a
prediction—the output—that best fits the goal. As it progresses, hidden neurons are added, until the prediction error has
been reduced to an acceptable level. The number of hidden neurons, and other prediction details, are selectable options.
To make this process intuitive to traders, NeuroShell uses ordinary technical indicators as inputs. The outputs are
trading signals. As will be shown later, this makes model building an amazingly rapid and straightforward process.
To understand how Neural Nets work, it’s important to recognize that they’re pattern-recognition engines.
In this stylized example from the manufacturer’s Here, the same price data (time series) is normalized.
help files, a repeated pattern is clearly discerned by The patterns occur at similar price levels, and can be
the human eye. But a computer won’t recognize interpreted by the computer. Normalization can be
the patterns as similar, because they’re each at a accomplished as easily as transforming price to the
unique price level. Close minus a Moving Average of the Close. Since
most indicators are already normalized, they can be
used as inputs in their raw form.
10
LET’S LOOK UNDER THE HOOD—
We’ll visualize what the program can do. I’ll present some sample images, and let you determine their utility.
(For clarity, Neural Nets are referred to as “Predictions,” while conventional rule-based tests are called “Strategies.”
Both are “Systems.”) The images are shown to illustrate program functionality—not to display any trading system.
When a Neural Net is built in NeuroShell, the magnitude of the contribution of each input is reported as a percent.
Input Contributions
Below is a Neural Net prediction. (Other sample charts will follow a similar format)—
Short
Entry
Long
Entry
Equity—One Symbol
Equity—Entire Portfolio
Equity —Buy-and-Hold
Symbols in Portfolio
The program is designed to prevent the common errors that occur during testing, and includes a number of built-in
features that help make testing more robust, intuitive, and bulletproof. The platform keeps track of open trades and
testing decisions can be made off of that information. When making an entry/exit, price gaps are automatically taken
into account. Slippage is handled realistically, and does not cause trades to be skipped. Clairvoyance is eliminated,
unless intentionally used for a specialized purpose.
11
Conventional Rule-Based Strategy vs. Buy-and-Hold—6 symbols
When testing a portfolio, one solution can be optimized for the entire portfolio, or a separate optimization can be run
for each symbol simultaneously.
12
Hedging Strategy—6 symbols
The above example is simultaneously Long and Short in an attempt to eliminate the effect of broad market swings.
13
Trailing Stop
System Exit.
(Fill at Open of Next Bar)
Of course, a good system may simply stop working, but more often, the real cause is the well-known phenomenon of
over-fitting the curve. Even a simple strategy can be over-fit, but the efficiency of AI optimization makes good lab
procedures vital. The industry standard for proving the validity of an optimization is Walk Forward Analysis (WFA) as
described by Robert Pardo in his landmark book DESIGN, TESTING, AND OPTIMIZATION OF TRADING
SYSTEMS. Let’s look at some examples in NeuroShell—
14
The strength of AI is the rapid search of a very large space. But left uncontrolled, AI methods will optimize every facet
of every input. The challenge is to keep this to a minimum. Even then, the number of variables will be much larger
than a conventional approach, and a thorough Walk-Forward is essential to prove that the optimization is predictive.
NeuroShell includes some features that automate WFA. In the window below, four years are selected for Optimization
and one year for Out-of-Sample evaluation. (Of course, we can choose any ratio that seems appropriate.) To test the
following increment of time, we save the chart under a new name, change the end-date, and push the re-optimize button.
We walk the optimization forward one year at a time. Shown above are 10 years of Out-of-Sample results. By this
exercise, we validate our optimization technique. Set up properly, each Out-of-Sample period is identical to actual
trading—but without risk. When we reach the latest period, we’ve already proven that our optimization is predictive,
and can move to live trading with justifiable confidence. (If we were creating an intra-day system, we’d perform the
same test using smaller increments of time.)
15
4x1 Walk Forward Set
In the above chart, the Out-of-Sample period looks favorable. We’ll walk this forward incrementally in time, repeating
the process again and again. (An example of a statistical report is shown later in this paper.)
Eventually we reach the most recent data set, and no Out-of-Sample data remains. If all has gone well up to this point,
we’re ready for live trading. From here on, re-optimizing is performed at the same intervals as our test—in this case,
annually.
16
THE 3x1x1 WFA—
NeuroShell adds another function called “Paper Trading.” The optimization is completed as before, but the solution that
performed best on the recent Paper Trading period is selected and then evaluated on the Out-of-Sample period. This
assures that the model is skewed to the recent data. As will be shown, this can create a better periodic re-optimization.
As in the previous example, we walk the optimization forward one year at a time. The result is 10 years of Paper
Trading and 10 years of Out-of-Sample results. (Again, if we were testing an intra-day strategy, we’d use smaller
increments of time. The 3x1x1 ratio is an example—other ratios may be more appropriate.)
17
3x1x1 Walk Forward Set
Shown above, both the Paper Trading and Out-of-Sample periods looks favorable. We’ll walk this forward in time,
repeating the process again and again. (An example of a statistical report is shown later in this paper.)
When we reach the most recent period, Paper Trading gives us a good look at the recent system performance. If the
model were to fail here, we might pull the plug, but since it looks favorable, we’re ready for live trading. From this
point on, the model is optimized at the same interval as the test—in this case, annually. Every time the system is re-
optimized, the Paper Trading period displays the best solution for the most recent available data.
18
NeuroShell provides statistical reports, trade-by-trade reports, and other information for each optimization. The same
report format is used for each individual instrument in a portfolio as well as for the entire portfolio.
The example below includes three reports from one set of a 3x1x1 test, shown together in Excel.
The Optimization period, its corresponding Paper Trading period, and the Out-of-Sample period are compared.
We’ll start by building a Neural Net Prediction. First, we’ll bring up a chart of the S&P E-mini. Next, we’ll insert
prediction inputs.
19
Building a Neural Net Prediction—
Point-and-click to select inputs. Here we simultaneously choose six inputs from the same category
(We’ll accept the default values.)
Point-and-Click to construct a simple indicator, a displaced linear regression, and add it to the inputs.
(Previous inputs are shown in the background window)
20
Select what to predict, from the list of choices, Select an optimization goal from the list of choices
and then choose how far into the future to predict Set maximum hidden neurons (fewer reduce over-fitting)
Check the box to force equal bull and bear data periods
Note the eight tabs at the top of the windows shown above. Under the tabs, select how detailed the optimization will be.
Choose the dates to test. Select from three methods to size positions. Enter commissions in one of three different ways.
Include margin using two methods. Enter slippage. Enter point multiples. Set the optimization of threshold levels.
Set maximum total inputs (to reduce over-fitting). Select whether to optimize each symbol individually, or to find one
solution for an entire portfolio. Set minimum and maximum trade lengths. Set a time limit, if desired.
During the live presentation, all of that—from programming through test setup—took less than 5-minutes.
Of course, the optimization phase can run several hours. We’ll limit this test to 15 minutes.
21
Creating a Rule-Based Strategy—
We’ll use the pre-built Prediction Outputs in lieu of Previously, our team built an adaptive Stop function.
conventional trading rules. Enter these under the Long We’ll point-and-click to enter this under both Short
Entry, Long Exit, Short Entry and Short Exit windows and Long. (Note tabs for Entry, Exit, and Stop)
The other parameters are set as before. Again, during the live presentation, that took less than 5-minutes.
We’ll limit the optimization to 15-min.
22
Rule-Based Strategy—Close-up (Note stop-loss function)
23
CONCLUSION—
We’ve looked at eight worthy platforms in an industry that’s constantly bringing out new products. The one I selected
may not be for everybody, but I’m enthusiastic about it. For those who want to diversify their thinking, NeuroShell
provides a true foil to the conventional approach. What particularly appeals to me is the way it minimizes the time
required to build and test an idea. The programming is intuitive. Syntax errors are eliminated. Functions that I
normally code into a system are already built-in. Repetitive tasks are automated. That frees up my time to develop
ideas.
We’ve glimpsed Artificial Intelligence in the form of Neural Nets and Genetic Algorithms, looked at Walk Forward
Analysis, and found that these tools are no longer exclusively for institutions. Given the current software offerings, the
individual trader can readily take advantage of the power of such techniques.
Caveat Emptor. Don’t expect to crank out winning systems right from the start. If it were that easy, everybody would
be in this business. But I believe that, given a real commitment of work and imagination, an individual can create a
suite of tradable systems. I plan to do all of that, and I expect to thoroughly enjoy the ride.
CREDITS—
Charts and examples are used by permission of Ward Systems Group. Many are taken from copyrighted sample
material, and then reformatted to illustrate a particular feature of the program. Some of the text is a paraphrase of
material found in the company’s websites.
Walk-Forward Analysis (WFA) was described by Robert Pardo, CTA, in his book,
DESIGN, TESTING, AND OPTIMIZATION OF TRADING SYSTEMS
Published 1992 by John Wiley and Sons. ISBN 0471554464
DISCLAIMER—
This report is not an endorsement of any product. It includes information from demo programs, web postings, and other
sources of information. Research was performed June-August 2007. This paper is exploratory. It was not possible to
test every program function within the time constraints. The efficacy of auto-trading is complex and not proven in
every program by the author. Readers are urged to verify all information and do their own research. All sample charts
are purely for the purpose of illustration, and are not intended as completed trading systems. This is not investment
advice. As is well known, past performance is not a guarantee of future success. I make mistakes. Please make your
own decisions. It’s not my fault if you lose money.
PERMISSIONS—
This report is for educational purposes, and individuals may make one copy for personal use. Any use beyond that must
be by permission of the author.
24