Self-Adaptive System Design - A unique Approach

Introduction

With the rapid pace of todayís actively traded markets it is more essential than ever before that the systems we use to profitably trade our fast moving, volatile issues and contracts be as accurate as we can possibly make them.

This presentation will expose system developers and traders to a unique method by which an existing system can be modified in such a manner that it will be increasingly more self adaptive to current market conditions as time goes on.

Recall the old college days, just after that chemistry exam when you realized you should have spent more time reviewing the section on oxidation and reduction and less time on electron shell configuration? Or after the English exam when you found the test emphasis on sentence construction rather than proper pronoun usage, which you had spent all night studying?

How about that last trade, when just waiting a few more minutes for your entry or exit would have turned the result into a profitable experience rather than another one of those annoying losses?

Obviously, itís not possible to turn the clock back and alter previous decisions. However, we have all, hopefully, over the years, learned from our previous experiences and have become better traders as the result of this learning process.

Parallel Function Technology operates in much the same fashion as our own learning process. While there is no computer in existence, or even on the horizon, which can come close to the analytical capability of the human mind, we can, with our Parallel Function Technology, enable our trading indicators and systems to learn from their past experiences and become more effective as a result.

When reviewing the results of recent system trading, how often have you searched endlessly for the one or two market factors which have changed recently, resulting in a significant change in your systemís performance? If you are like most traders and developers, in an attempt to solve the riddle of system response to changing market conditions, you have examined multiple market parameters, such as volatility, relative ranges, gap frequency, reaction to reports, seasonal influences, just to mention a few.

If your experience has been similar to that of others going through this process, you have been somewhat successful in your detective work, but only marginally so. When we find a market parameter that has recently changed and seriously affected our systemís performance we then proceed to make several changes in the program code to compensate for the changed parameter. This process is usually successful in the short term, thereby registering a more acceptable system performance over recent market data. However, unfortunately, carrying these recent system changes back to previous market data will, more often than not, decrease the performance of the strategy on the older data.

What happened? Obviously, the system is quite sensitive to your identified parameter, responding quite differently to changes in that factor. To solve this dilemma, we again examine the parameter in closer detail over the two effected periods, finding in more detail the subtle changes which changed our systemís calculations. After changing the system code a second time, we again find better results for the recent data but probably even poorer responses on the older data.

The basic question should then arise: If the system is going to respond this radically to minor single parameter changes in the future, is there a manner by which we can recognize these approaching divergent system responses in time to make necessary changes in our trading patterns?

One solution to this perplexing problem is the ability to monitor multiple versions of the same system simultaneously. In this fashion, one would have the ability to detect gradual, or perhaps even radical, changes in system performance as they evolve over time.

Although this solution is conceptually interesting, its implementation can be somewhat complex.

One method by which this methodology could be used would be to have multiple charts of the same data stream operating simultaneously, each running a slightly different version of your system. In this manner you could monitor each system variation as the trades are generated using slightly different system settings. A side by side comparison, using spreadsheet data created from strategy reports, or a like comparison using equity curves generated by the same source could be created. Such an analysis would reveal trends that are likely to develop as one system version begins to gain on or lose to a rival setting of the same system. Regular examination of this series of strategy and equity curve arrays would give the trader early warning of impending changes in system performance as market conditions are altered as time progresses. Appropriate changes in system inputs, stop or target levels, entry times, etc. could then be implemented by the trader in anticipation of the observed changes in system behavior continuing for some time into the future.

While the above method is obviously possible, it is somewhat time consuming and error prone. Monitoring several system settings can result in the creation of a large number of spreadsheets and graphs that must be updated on a regular basis. The extent to which it can be effectively implemented is dependent upon the amount of time and effort the trader has available for the project.

There is an easier way.

Parallel Functions

The remainder of this presentation will describe in detail the concept of parallel user functions and detail methods by which they may be used to follow the above described changes in market conditions as they affect system performance.

Please be aware that parallel functions must be created to actually mimic the system is every sense of the word. There is no "canned parallel function" which can be applied to any system to provide the desired results. It is therefore necessary to program a unique parallel function for each system to which this technique is to be applied.

Along those same lines, do not expect this technique to be a method by which any system can be made to be profitable. In fact, using this on a poor system will probably result in a system that actually has a poorer performance.

Functions as they can be programmed and used in EasyLanguage are very powerful system development tools. With the new functionality added in ProSuite 2000I that allows the manipulation of arrays within functions the usefulness of these user functions increases exponentially. This new phase in the use of EasyLanguage allows the calculation and extraction of multiple values from a single user function whereas previously programmers were limited to the use of a single numeric return from any given function.

A parallel function is one that is written to mimic the base system in every respect. At first this might seem simple, as one could simply copy the entire system code and save it as a function. However, system functions such as buy, sell, exitlong, exitshort, marketposition, positionprofit, are not available for use in functions. You must therefore write your function to perform as a system without the use of these extremely useful commands.

The output of these functions is reported as actual system results according to the system inputs that are passed into the function from the base system. With the system results now available as a function output, multiple uses can be made of this data.

Perhaps the easiest and possibly the most useful use of these parallel function outputs is as an indicator which plots the various system results in a subgraph below the actual price bars. One is therefore able to observe the reaction of the system to changes in market conditions as time progresses and the various system settings respond differently as conditions change. Frequently, such changes in market personality do not happen over night. Rather, the changes in market conditions as they effect mechanical systems evolve gradually over time, often taking literally weeks to make their presence known.

Simply observing the system reports from a single version of a system will not make one aware of the changes which are occurring in the market in question which have significant impact on the overall performance of the system. The system may still be profitable to one degree or another, or may actually move from a profitable performance stance to one of a losing stature. Observing only a single setting of the system will not reveal to the user of the system what the other system settings could be doing. Granted, the trader could regularly experiment with various system settings in an attempt to discover more profitable routines, but as we all know this procedure is time consuming and can be rather boring as the changes do take considerable time to evolve.

Using the output of your parallel function to plot system results as an indicator makes available to the user a graphic representation of the results of various system settings. It is possible to track any number of possible system settings using this method. Since the parallel function will report the results of simulated trading across several system settings as the trades are completed, it is possible to observe the results of these settings in real time, therefore making it unnecessary to manually enter and tabulate various system setting results on a regular basis.

The observation of these various system results as they are calculated and plotted in real time can be quite intriguing. The various system simulations can be observed to compete with each other as time passes. I often compare this competition to a horse race, with the various entrants gaining and loosing on each other as the race progresses. As you will observe on the following charts, one can observe some settings gaining and some settings losing on the same day. Over a multiple day period definite trends develop with respect to the behavior of the results of multiple system settings to each other. Careful observation of these multiple trends will give the trader significant insight as to the reaction of his / her system to the changes which are taking place in market personality.

For the purpose of demonstrating this system development technique only, I have programmed a simple early morning breakout system for the S&P market. This system simply determines the range of the day at a predetermined time into the session and then places a buy stop above this range and a sell stop below this early range. The system enters the market when the stops are activated by market action. Only one trade per day is taken. A definite stop point is used for money management. Profits are taken at a target value.

Hereís the system code.

If you wish to use this system code and parallel function it is available as both a .ela and a .els file on my website: http://www.clayburg.com. Follow the links to the Parallel Function section of the site. At this same location you will find a section-by-section description of the code and how it works. You will also find detailed explanation of the programming of the parallel function for this system.

Inputs:Delay(45), Tgt(7), Stp(4);

Vars: NuHi(0), NuLo(0), Bpt(0), Spt(0);

If D<>D[1] then begin

††††††††††† NuHi = H;

††††††††††† NuLo = L;

††††††††††† Bpt = 9999999;

††††††††††† Spt = 0;

end;

If H>NuHi then NuHi = H;

If L<NuLo then NuLo = L;

If T = CalcTime(Sess1StartTime,Delay) then begin

††††††††††† Bpt = NuHi +.1;

††††††††††† Spt = NuLo - .1;

end;

If TradesToday(d) = 0 then begin;

††††††††††† BUY Bpt stop;

†††††††††††

††††††††††† SELL Spt stop;

end;

If MarketPosition = 1 then begin

††††††††††† Exitlong("L_ TGT") entryprice + tgt limit;

††††††††††† ExitLong("L_Stp") entryprice - Stp stop;

end;

If MarketPosition = -1 then begin

††††††††††† ExitShort("S_Tgt") entryprice - tgt limit;

††††††††††† ExitShort("S_Stp") entryprice + stp stop;

end;

Hereís the code for the parallel function associated with the above breakout system. Again, this code is available as both a .ela and a .els at: http://www.clayburg.com. Follow the links to the Parallel Function section of the site. At this same site there is a section-by-section explanation of the parallel function and how it is programmed to simulate the base system.

Inputs:Delay(numeric), Tgt(numeric), Stp(numeric);

Vars: NuHi(0), NuLo(0), Bpt(0), Spt(0), tt(0), Lng(false), Sht(false);

If D<>D[1] then begin

††††††††††† NuHi = H;

††††††††††† NuLo = L;

††††††††††† Bpt = 9999999;

††††††††††† Spt = 0;

††††††††††† Lng = false;

††††††††††† Sht = false;

††††††††††† Value1 = 0;

††††††††††† tt = 0;

end;

If H>NuHi then NuHi = H;

If L<NuLo then NuLo = L;

If T = CalcTime(Sess1StartTime,Delay) then begin

††††††††††† Bpt = NuHi + .1;

††††††††††† Spt = NuLo - .1;

end;

If H > Bpt and tt = 0 then Lng = true;

If Lng then begin

†††††††††††

††††††††††† If H > Bpt + Tgt then begin

††††††††††††††††††††††† If tt = 0 then Value1 = tgt;

††††††††††††††††††††††† tt = 1;

††††††††††† end;

††††††††††† If L < Bpt - Stp and lng[1] = true then begin

††††††††††††††††††††††† If tt = 0 then Value1 = -stp;

††††††††††††††††††††††† tt = 1;

††††††††††† end;

††††††††††† If tt = 0 and T = Sess1EndTime then Value1 = C - Bpt;

†††††††††††

end;

†††††††††††

If L < Spt and tt = 0 then sht = true;

If sht then begin

†††††††††††

††††††††††† If L < Spt - tgt then begin

††††††††††††††††††††††† If tt = 0 then Value1 = tgt;

††††††††††††††††††††††† tt = 1;

††††††††††† end;

††††††††††† If H >= Spt + stp and sht[1] = true then begin

††††††††††††††††††††††† If tt = 0 then Value1 = -stp;

††††††††††††††††††††††† tt = 1;

††††††††††† end;

†††††††††††

††††††††††† If tt = 0 and T = Sess1EndTime then Value1 = Spt - C;

†††††††††††

end;

OMW_BO = Value1;

 

The chart below shows the plots that result from the parallel function driven indicator which simulates the system results from a selected array of system settings. This chart covers simulated trading from 2-25-2000 through 3-09-2000 in the March S&P 500 futures contract.

There are 8 system simulations plotted in subgraph 1. The scale at the right side of the chart depicts the actual dollar return for each system simulation.

The "horse race" phenomenon is particularly evident on 3-7-2000. You will notice that some settings showed a profitable trade for the day while others did not, significantly changing the relative positions of the various system results. In fact, this was a significant day in the performance array of this system. In two days time, the system setting in third place went to first place by a significant amount.

The next chart reflects the system simulations for 2-10-2000 through 2-24-2000 for the March, 2000 S&P 500 futures contract.

Again note the "competition" between various system settings as time progresses.

You will notice that there are two system settings that are clearly superior to the rest of the group as our chart begins during the second week of February 2000. However, note how the profile changes beginning on February 18. Note that two of the systems formerly "in the pack" suddenly begin to approach, and then overtake, the leading systems. Clearly there have been changes in the market causing the system to react in a different manner than earlier in the month.

The pure student of the market may wish to hunt and probe for the actual changes in the market that brought about the changes in system results. The average trader, on the other hand, simply realizes that the systemís reaction may be changing and alterations in the system settings for the version actually being used to trade may be in order.

In both charts above, so as to not clutter the chart and create a more legible illustration, I have only graphed the results of 8 rather random settings for the base system. In actual practice the trader will want to be rather selective when selecting the actual system settings he / she wishes to monitor. Additionally, it should be pointed out that you are not limited to 8 system selections. Although you are able to only create four plots for an indicator, you can apply the same indicator multiple times to the same chart, all with slightly different system settings. The number of systems you can monitor on the same chart is practically limited only by the amount of screen real estate you wish to devote to this analysis.

One could logically ask at this point - why not just use the System Equity Indicator to check the progress of the system? The differences between the two approaches are that the system equity indicator only measures the performance of the system currently being run on the chart. Our approach utilizing the power of the parallel function gives us the flexibility to check various system settings against each other over the life of the chart to get a reading of system behavior under varying market conditions.

An additional adaptation to consider is the possibility of running not only variations of a single system against a single price chart but also checking the performance of multiple systems against the data. It is possible to plot parallel function indicators from more than one system on the same price chart. One could then determine at a glance not only which systems were more profitable than others, but also assess which settings of which systems were gradually gaining or losing against each other as time passes.

Systematic Trading with Parallel Functions

It is also possible to automate a great deal of the above process using parallel functions and the above-mentioned ability of 2000I to manipulate arrays within functions.

Properly constructed, such a system has the ability to periodically check its recent performance across multiple system settings by passing a set of system settings to the parallel function. This "self test" can be scheduled to occur at the discretion of the user. The user can also specify over what amount of past data the self-test can be performed.

After running this self-diagnostic examination of its own performance using multiple system settings, it is also possible to program the system to alter itself to reflect the parameters which were recently most useful.

By checking its recent performance, such a system may then install the optimum system settings, as determined by the most recent market activity, for the next trade.

Although this routine is not a neural network as such, it does have the effect of creating an automated system that is self-optimizing.

Although many will choose to reset the system inputs according to the most highly profitable combination, the ability exists to also reset according to any other system parameter which can be calculated from system results.

Many will often ask how this technique is an different than simply optimizing a system and then using the result of the most favorable optimization. Is some ways this is a valid comparison, but in the final analysis it is quite different.

When we speak of optimization, we are most often relating to a process whereby an entire contract or series of contracts is tested over a set of system settings. The trader will then use the appropriate setting for trading in the future. The settings obtained from this test are an average of performance over the entire data series and does not take into account periods where certain settings are superior for a short period of time.

The type of automated testing that one can accomplish with the use of parallel functions is significantly different. The testing done by these sequences is done repeatedly over a defined amount of back data over a regular basis, with the appropriate changes being made for the next few days, if necessary. In other words, one may chose to test the last ten days of trading every five days. Depending on the results of that testing, the system parameters may be changed for the next several trades.

Since the system settings are altered frequently throughout the course of simulated trading, it is not possible to accomplish this type of system testing with the regular optimization routine used in TradeStation. The testing done by this feature can test the various combinations of system settings across an entire chart but does not have the ability to selectively apply varying system settings to portions of the chart as indicated by current market conditions.

Although it is possible to do this type of testing mechanically, the process can become quite time consuming and error prone.

During the actual presentation at Omega World versions of this system will be demonstrated which adjust themselves for time of the breakout, the target value, and the stop value. I will also show a version of the system which self adapts for all of the three system inputs simultaneously.

Conclusion

My attempt here has been to demonstrate the usefulness of a rather unique approach to self adaptive system design. Although this technique is not always applicable to every trading style or system, there are instances where the close observations of system behavior across changing market conditions can be quite beneficial to the trader.

While it is possible to create a self-adaptive, self-optimizing system using this technique, in all practicality it will most likely be the use of parallel functions as an indicator that will be found to be most useful by the individual trader.

There are two reasons why I make the above statement. First of all, the programming required to create even a relatively simple self optimizing system is quite involved, and by its complicated nature, rather error prone. Also, when even the slightest alteration to the base system is made, corresponding changes must also be made to the parallel function(s) that drive the self adaptive features. Substantial changes in system theory may also require changes in the manner in which the self-adaptive routines are constructed.

Second, as I mentioned earlier, there is no substitute for the human mind when in comes to processing all of the decisions that are necessary to create a viable trading strategy. Constant observation of the patterns created by parallel function indicators will lead the trader to logical conclusions concerning the behavior of a particular system to changing market conditions which are difficult if not impossible to simulate using a computer program.

****************************************************************

I am often asked about the practical application of this technology to system and indicator based trading for the average trader who does not have the programming skills necessary to construct these functions or who does not wish to have these concepts applied to their system on a custom basis.

Toward that end I have created a library of 25 indicators and 3 systems that make use, in one fashion or another, of the techniques described in this presentation.

In the presentation we describe in detail a logical, four step day trading method using these indicators that is capable of generating a high percentage of profitable day trades.

Briefly, the steps are:

1. Define the major trend for the day;

2. Define the minor trend, looking to enter in the direction of the major trend;

3. Define an exact entry point;

4. Define as exact exit point.

On the video presentation we also detail the use of three automated trading systems using self-adaptive techniques.

These systems can be used to trade any market, any time frame.

Several other practical methods of evaluating charts, from one minute to monthly, are also covered.

These programs, along with a 14 hour video tape explaining their use for everyday trading, is also available on my website at: http://www.clayburg.com. Follow the links for the Day Trading Video.

Contact Information:

Dr. John Clayburg

29568 Hwy 141

Coon Rapids, Iowa 50058-7278

712.684.5239

clayburg@pionet.net

http://www.clayburg.com