aNNie began by attempting to answer this question: how likely is it that the last buyer (or seller) can exit profitably within the next 30 minutes? Over the years it has evolved into a self-taught system that makes real trades in the stock market.
There are many aNNs that could be designed for intraday trading. It's a simple matter of choosing some parameters, training, testing and refining about a hundred times. With that accomplished over the last few years, aNNie output is being provided live in the Internet for review. This has prompted several discussions with traders which have validated the theory that aNNie is actually learning combinations of technical analysis techniques.
Training a neural network is simple. Getting it to produce good signals with something as complicated as intraday stock data is an art. aNNie's training "magic" is in an iterative process that clusters groups of similar training data to form multiple neural networks. There are 10 "buy" networks and 30 "sell" networks. aNNie "buy" training data is based loosely on a 5% price drop in 5 minutes followed by a 5% rise. The "sell" networks are inverted and use smaller price changes. The parameters could actually be anything as long as there is enough training data available... and the right data is used. The parameters used for this aNN system require at least one year of data from dozens of volatile issues per day to produce good results.
Data supporting the results posted on any of these pages can be provided on request.
aNNie posts live in her irc channel and a summary is wrapped up daily.
For about a year, aNNie has been backtesting with trading starting at 1pm EST and a double penalty for losses. This was working pretty well. In December 2010, though, her daily quote stream of up to 200 stock symbols turned into this message: Not Authorized For All Quotes. Ugh. Now we have to see if enough symbols can be tracked each day to make it practical to ever turn on live trading again.
If the other results were pretty dismal, then what is this? The backtest was terminated and another started with a window size of around 1.5 minutes. Maybe there are some really quick things the aNN will be able to use.
The 30 second backtest finished up with pretty dismal results (txt). Rather than try to understand why, we back up to some parameters that were used a few years ago. One, the ticker input window for the aNN was upped from 5 mins to 10 mins. Reasoning: the shorter window was used to favor quicker round-trip times. In practice, however, aNNie would frequently hold a stock until the 3pm closeout time. Two, it seems reasonable to use a training/update window that favors more stable price action while using something like a 30 second limit or canceling after first partial fill in live trading. We don't need to think about number two for a while.
More puter problems and something had to go. Live signals during trading hours from the old, already-broken system were disabled. The 30-second backtest continues on one less CPU. The pursuit of the elusive Forex edge has top priority and was not even considered.
A full filesystem around 03/24/2008 wiped out the best two of the three genetic variants of the old system still running live in simulation mode. Three copies of the same variant were used to keep things running. The backtest in progress was unaffected.
Adjusted daily screener to exclude issues that touched a price of $3.00 and above to speed up live processing.
The delay before canceling orders was reduced from 5 minutes to 30 seconds.
The NASD 2520 trading strategy was modified to trade on any day and account for a 5 day window. As a safety net, aNNie will use a bid count on any given trading day. For example, if there have been 2 daytrades in the last 5 days she will make at most one bid on the current day.
Part of the reason for this change is that aNNie has taught herself to trade a few time per week instead of a few times per day on average. In the training that led up to live trading, commission was ignored when profitability was fed back through the genetic selection. As a result she was thinking that more trades at lower average profit would make more money. This is not necessarily the case in real life.
aNNie is playing with real cash on Mon,Wed,Fri to avoid being a "pattern daytrader" as specified in NASD 2520. She places a bid with the first "buy" signal of the day and exits using "sell" signals. There is nothing magic about the first signal as it should be a random selection of all signals and result in the same performance.
With real trading underway it became clear that commission should be accounted for in the genetic selection process. Otherwise many low profit trades can easily appear to be more profitable. This change was made without restarting a year of backtraining which takes several months.
Backtesting updates leading up to a live trading aNNie are going primarily into a paper (also available in pdf). The old version that posts to #blackbox at 4pm now looks for twice as many trades in 40 days (i.e. lower buying threshold). We need a little more excitement in there.
With so much focus on creating a final version of aNNie, we overlooked that the genetic update in the old 4pm version has been broken since January. It is fixed (??). As a quick snapshot, the latest version is finding 120 trades in 40 days and is 4 times more profitable.
We can look back at earlier attempts at daily updates and see why they failed to improve performance. In genetic terms, the "daily retraining" mentioned in the daily data (used to create the long-term test table on the home page) were always replacing the parent with the new child. Its performance would generally slip and never had a chance to recover.
So a new twist has been added to the current genetic retraining strategy. We start with finding a "buy" threshold for the 20 buy subnetworks that yields at least 40 trades over 40 days. Then the threshold for the 20 exit subnetnetworks is adjusted to maximize backtest profit (this is the same). The final trading system is the top 10 performing combined subnetworks for the best parent. The daily genetic update then compares these truncated subnets to prepare for the next day.
This truncated trading set allows some of the subnets to become essentially "dormant", while the prior strategy relied on new training data to squish the lower-performing subnets to zero output. With this strategy, the daily genetic update will allow the overall system to choose several things:
- the distribution of buy and exit subnets (maybe exit subnets should be ignored and all positions held until 3pm).
- a dormant subnetwork that just needed more training to get in the top ten.
- the trade-off between the number of trades and the avg profit per trade (40 trades with a certain avg profit can be better than 20 trades at a higher profit.
At 4pm the most recent aNNie (v2.6) is tested against the current day. This version does not have the truncated trading subnets. It also creates the first trading sim table on the home page. The version described above (v2.7) should be caught up and active in a week or two.
- Each parent generates a child each day. This slows the daily update, but it's not always the case that the best-performing parent will create the best child. A backtest with the single-parent genetics picked one of the original parents to replace 2 months of updates using another parent.
A delta snapshot of aNNie2 training parameters:
- training/testing input window reduced from 15mins to 5mins.
- replaced "hold" nets with "buy" nets.
A delta snapshot of aNNie2 trading parameters:
- increased number of issues processed per day to 200.
The 5 minute window means that aNNie2 is ready to buy at 9:35 vs 9:45. Earlier attempts to do this have yielded lower returns, however, the genetic update strategy has turned that around.
Exit strategies are still driven toward extremely short hold times. Elimination of the "hold" nets leaves us with 10 "buy" nets and 30 "sell" nets.
These are fairly minor adjustments. As adjustments are made they are compared to a "baseline" aNNie-v2.0 that posts results to the irc channel at 4pm. Bottom line is that adjustments are getting smaller and aNNie is much closer to getting a funded trading account.
A snapshot of aNNie2 training parameters:
- 2 full years of intraday quote history forms the initial training set.
- 3 months of test data with daily genetic updates is used for evaluation.
A snapshot of aNNie2 trading parameters:
- entry thresholds are set for a minimum 20 trades in a 2 month backtest.
- exit thresholds are set by scaling maximum profit to favor lower thresholds.
- "buy" signals for issues with projected day share volume less than 200k are ignored.
- bids are entered between 9:45am and 2:00pm.
- asks are entered when "sell" signals overcome "hold" signals.
- bids and asks expire in 5 minutes.
- a "hit the bid" exit strategy occurs at 3:00pm to close out any open positions.
The aNNie2 genetic update strategy is wildly different from the daily updates used in early 2003.
- 3 parent aNNie networks are maintained.
- the best-performing parent is used for trading.
- training data from the best parent and a new day are combined to train a new child aNNie.
- a child replaces the weakest parent if backtest performance is better than the best parent.
This configuration was derived to overcome some key problems noted in repeated backtests.
- the exit threshold would increase each day until aNNie2 learned to ignore exit signals before the genetics could refine "hold" and "sell" networks.
- aNNie2 would frequently be stuck in a thin stock and have to "hit the bid" with a huge spread.
- a short backtest interval caused the genetics to dip into the noise during slow market periods and never recover.
Current test results are hovering in the 4% average profit per trade area. Not quite up to the target of 5-10%. But close.
Wow! Four months without any new developments? Well, that's because the aNN implementation currently on line has been on autopilot for a long term test since 07/07/2003. All new efforts have been toward creating an aNNie2 that fills in some gaps observed over the past year.
Some observations that can be derived from the data that has been used for the home page results:
- the aNNie design as a whole is on target... higher aNN signals yielded higher profits.
- on average, higher profits come from longer hold times.
- the daily update strategies would improve results for a few days and then decline steadily.
- performance for a static training set declined steadily.
Some observations that come from the online paper trading that aNNie performed over the last months:
- entries are fine, but something other than short sell aNNs are needed for exits.
- performance declined over time along with the fixed exit time results.
- a target average profit of 5-10% per trade isn't unreasonable.
And finally, some results of the offline testing over the last months:
- aNNie2 entries are near the bottoms of extreme oversold conditions (find VXGN on the sample page for a great example).
- aNNie2 can usually get in with a "buy from sellers" strategy.
- aNNie2 will exit with a "sell to buyers" strategy before the close of each session.
- aNNie2 will stop buying around 1pm and use the rest of the day to exit.
So what are the significant changes with aNNie2?
- the daily screener was adjusted to target stocks in the $0.50-$5.00 range with > $200k day volume.
- the amount of test data used for realtime processing was reduced from 35 minutes to 14 minutes.
- there will be 20 "exit" aNNs and 10 "hold" aNNs to close out entries from 10 "buy" aNNs.
- there is a daily update strategy that has remained stable in backtesting since 09/01/03.
- aNNie2 will enter the best bid followed by exit at best ask using solely on aNN trigger levels.
- execution logic will determine if/when orders would have been taken.
- buy orders will be cancelled if not executed within 5 minutes.
aNNie2 is not currently on line but offline results are occasionally posted in #blackbox.
The daily update is turned off and we'll explore the screening strategy using the nets from 06/26 for a while. In the background, some new nets are being developed that will include exit signals as well as "buy" signals when a stock is eating through resistance.
aNNie is providing a bit more entertainment in #blackbox. In addition to posting signals, she posts paper trades much like humans do in other channels. A variety of trading strategies will be tested over time. This experiment moves us a tiny step closer to a fully automated AI trading system.
The new screener works quite well at picking volatile issues... perhaps too well. The aNNs now get a few new training inputs per day instead of one every few days. This change seems to have caused a slight downtrend in signal performance over the last two months.
A new training set with refined daily update technique went into effect on 06/17. It will take a few weeks to see how these changes affect performance.
A new screener is running that selects the 100 Nasdaq issues with the highest hod/lod ratio from the previous trading day. The day volume must exceed 400k shares and $400k to be on the aNNie watch list.
Retraining is complete and aNNie is back to incremental daily updates.
Retraining has been underway since its mention on 03/15. This has been a little disruptive in #blackbox. It may take another week to get back to some stable signals.
- aNNie is running on a faster puter and processing about 50 issues each day in under 15 seconds.
- additional tests to remove quote errors were added after the burst of KLAC long calls on 03/13.
Monday 03/10 was test day in #blackbox. aNNie bots were running simultaneousely on the old and new puters and posting calls #blackbox. Channel residents could see that the new aNNie posted up to two minutes earlier and output was identical. Also, the new aNNie was able to generate more signals as expected with a shorter processing interval.
The stream of KLAC calls on 03/13 pointed to a quote error problem. aNNie was signalling long calls on just about every iteration of the processing loop... more than 50 in 20 minutes. They were generally correct but the high signal values took their toll on the daily trading simulation results. Beginning 03/14 these errors are filtered out but are probably scattered throughout earlier training and test data.
Ask yourself what you would have done if KLAC was trading at $35 and the day high was $127,236,390,912. From a technical standpoint it's quite fascinating that aNNie's networks have learned how to deal with quote errors. It also means that aNNie should be completely retrained at some point to see what she is really capable of.
The stars were in alignment on 01/24/2003 which resulted in monster aNNie signals. This alignment happens when:
- the watch list contains issues with sharp intraday reversals, and
- the aNN sampling loop lands near the time of reversal and, of course,
- the aNN is well trained.
At this point it appears that daily training update is gradually pulling good signals out of the noise while filling in the "holes". The simulation results for aNNie signals above a threshold of 2.0 and a 10 minute exit strategy were:
* sell 13.70 from long 12.89 12:27:50-VXGN -937.16 1000 62.84 1000.00 10 mins
* sell 13.59 from long 11.77 12:28:24-VXGN 217.47 1000 154.63 0.00 10 mins
* cover 1.97 from short 2.15 16:04:43-ANAD 301.19 1000 83.72 0.00 10 mins
One might say (as I did), "Well, that's nice but maybe that auto update thing put recent intraday data into the training set and the aNN was trained for those specific issues". To answer that question we find that the training set has these training inputs for VXGN and ANAD (intraday images are here):
- positive short ANAD at 11:03:59 on 09/20/2002.
- positive long ANAD at 11:07:45 on 12/20/2002.
- no training inputs at all for VXGN.
aNNie's training set will be updated daily beginning on 01/13/2003. This automated process will add new positive and negative signals to fill in "holes". Some examples were described below on 01/01/2003. The clustering algorithm will then be run over the entire training set to create slightly modified networks for the following trading day.
To illustrate, here's a snapshot of the training set covering Feb 2000 through Dec 9, 2002:
- 208/2698 long inputs (positive/negative)
- 207/2703 short inputs (positive/negative)
To play catch-up, ticker data from 12/10/2002 to 01/10/2003 was applied to the update process. This added the following inputs:
- 021220 ANAD 11:07:45 (positive long, negative short)
- 021220 IMCL 15:57:45 (negative long, positive short)
- 021230 MONE 13:44:38 (negative long, neutral short)
- 030103 TTMI 10:39:09 (negative long, positive short)
- 030106 AMEV 10:58:14 (negative long, negative short)
- 030110 IPXL 10:17:54 (negative long, negative short)
After the clustering algorithm adjusted the inputs, the final training set for 01/13/2003 has:
- 209/2736 long inputs (positive/negative)
- 209/2745 short inputs (positive/negative)
Trading simulations and daily results for 12/30/2002 and 12/31/2002 were quite interesting. See MONE here and NVAX here. These conflicting signals were due to trading volumes below the levels in the aNN training set. These signals are now being removed from the trading simulation but still posted to #blackbox. The margin cap was lifted so that the time and threshold parameters can be more easily compared. This strategy is being evaluated here.
- throw $1000 at last sale on every signal above threshold
- ignore signals for issues that have a projected day volume less than 400k
- exit at last sale 5, 10, 15 or 20 minutes after entry
aNNie is tracking issues that produced signals on the previous trading day in addition to the big movers. (disabled on 01/06/2003)
A partially trained network with reduced input noise was tested on 12/20/2002. The fully trained network will be used starting on 12/23/2002. This will produce output levels higher than the previous set, so aNNie will begin posting values above 0.2 (vs 0.1).
A more simplified trading strategy is being evaluated here:
- throw $1000 at last sale on every signal above threshold
- close out the most profitable position if the margin cap is reached.
- exit at last sale 5, 10, 15 or 20 minutes after entry
For example, t0.5-15m-5k.html is a threshold of 0.5, 15-minute exit strategy, 5k margin limit.
Several aNN training strategies have been running live since May 2002. These were recently tested against a simple enty and exit strategy:
- throw $1000 at last sale on every signal above a threshold
- use a tight stop at the entry level
- use a wider stop when riding profits
- close any open positions at the end of the trading day.
Results for different entry thresholds are here ( 0.1 0.2 0.5 1.0 ). Results for 0.5 with valid(?) historical data is here.
With the results until mid-July indicating profits of a few percent per day, aNNie will begin using new coefficients with parameters "4 iterations, 30 mins" on 12/09/2002. aNNie will begin posting intraday signals above a threshold of 0.1.