General Topics
Markets
Technical Topics
Brokerage Firms
Community Lounge
Site Support

Discussion in 'Automated Trading' started by AmCan, May 11, 2004.

1. ### AmCan

This article will deal with the development of a fully automatic (self-optimizing) system. We will not post any proprietary code but we will post samples if available based on what is now in public domain.

To start. There are 4 areas (in our opinion) that must be addressed
1st. What will trigger the entries and how often?
2nd. What will keep us in trade and prevent from unnecessary swings.
3rd. What will be the exit policy and why.
4th. What will be re-entry policy if trend continues.

In this post we will start triggers for entries. and keep developing as the time allows.

First thing is to realize what is suitable system to drive the averages, channels and oscillators and how.

Best system can be categorized as those based on averages. Problem is that longer the average, smoother it is but also less profitable system will be specially in sideways channels. Therefore logical alternative is to use average that is reasonable fast responding and quite smooth. Second issue is that such average needs a longer filter to be able to extricate just in trend trades. Since there really is not such average or combination, we must construct one.
Nice would be to have a 3 time frame average, but problem is that highest time frame average will be behind times. Lets assume that we plot 3 linear regression lines based on High. One with length of 3, second with length of 6 and third with length of 18. These 3 linear regression lines will intercept and create a triangle shaped area on the chart. Repeat the same with Low. These areas will have a "Center of Gravity" which we can use to plot a curve. This will be our average that satisfies all 3 time frames. Now add these two averages and divide by two and you have the resultant average. This is if one paints a rigid average. Now lets do the same but use some sort of automatic length algorithm. There are several publicly available. For simplicity use "Hilbert" that was posted in various other threads.
Now we need a confirmation of the direction. For this we can easily use the oscillator. Double smoothed stochastic was posted in several threads, (we like using PFE of momentum). These are extreme zones indicators and are suitable for giving sufficient early warning as to new trend change.
Final part of the entry decisions is a some sort of the channel break out. This should be independent of the average that we use. For simplicity, one should look at confirmation by volume, since volume usually lead the action of the market and it is quite easily spotted. Somewhere on this forum there was posted Volume Weighted Average. This average when based on High and Low will form suitable channel. In our own analysis we use our own auto ave pro version.

We will continue in the next post tomorrow.

Now that we have decided to use a program that automatically adjusts the length, we have a problem. This program (possibly Hilbert) puts out only one length. This can be overcome bys assuming that the longest length is equal to 18, which is what we have arbitrarily selected. We know the ratio of 3, 6 and 18 and therefore apply inverse of this ratio to output from Hilbert. This will give us 3 lengths. We have also decided that part of our confirmation will be the oscillator. In order to have stronger confirmation from oscillators, we will also need an oscillator that is based on volume. For this purpose, the stochastic of the RSI should be used, where input into stochastic is volume. Again we have similar task of coming up with a multi-time oscillator. There were several articles published on MTF indicators. It would seem that about 8 years ago, Omega introduced a small formula that can simulate the multi time data without having second or third data stream on the chart, and this formula performs much better than any of the MTF schemes.

Formula looks like this.:

Code:
{
Study Name:  CombineDays
Study Type:    Indicator
Description:   Combine a number of bars to produce a OHLC bar chart of those bars.
ie: Three bars OHLC bar chart
}

Inputs: NumDays(3); {Three bars)

IF FracPortion(CurrentBar / NumDays) = 0 Then Begin
Plot1(Open[NumDays -1],"Open");
Plot2(Highest(High,NumDays),"High");
Plot3(Lowest(Low,NumDays),"Low");
Plot4(Close[0],"Close");
END;

We now can simulate the data stream of higher time frame, therefore output of this formula can be used directly as a an input into the oscillator. When we have the three oscillators constructed (with one length of Hilbert) we need to achieve single oscillator. This cam easily be accomplished by taking geometric average between 1 and third oscillator and again this result and middle oscillator. We now have 3 oscillators that will change length according to the data and yet independent because of their construction. First is PFE of the Double Stochastic, Second is Stochastic of RSI based on volume and the final one is just plain PFE of the momentum based on length 52 and 23 of Weighted close.

2. ### AmCan

Attached is a screen shot of the average created by 3 linear regression lines.

File size:
58.1 KB
Views:
882
3. ### AmCan

Attached is also the screen shot of three resultant oscillators. Notice how the Magenta oscillator (based on Volume) leads.

File size:
76.1 KB
Views:
660
4. ### AmCan

Screen shot of AutoAve Pro forming a High and Low channel for entries confirmation.

File size:
70 KB
Views:
506
5. ### AmCan

For illustration purposes we have attached a screen shot of our own automatic length (RED line) and Hilbert (BLUE line). Notice that Hilbert can not process correctly certain data situations and fluctuates causing havoc with the oscillators and linear regressions. For this reason we have developed our own. Principles and basic formulas of this automatic length algorithm were disclosed in previous threads on this forum.
AutoSys_Hilbert vs AmCan.jpg

We will continue in the next post tomorrow.

File size:
55.4 KB
Views:
573
6. ### Everest

How do you automatically adjust for length at the open when there is no data to support a change?

AmCan,

You said "

TIA,

NT

8. ### AmCan

Part Two

Now that we have several indications of possible trade, we must decide how to enter. Our system entries and exits have basically four modes.
First entry is a âScalperâ mode. In this mode we try to execute a trade when the data crosses inside of the channel from the outside. This gets us in trade extremely fast but generates quite a few entries.
Second entry is a âSwingâ mode. In this mode we try to execute a trade when the data crosses into the channel and crosses the center line. This gets us into the trade one or two ticks later but entries are more stable. This entry mode generates about one third less trades then the Scalper mode.
Third entry is a âTrend Changeâ mode. This occurs when the data crosses complete channel. This happens when data bar enter one side of the channel and peeks out over the opposing channel. This mode generates about 50% of the trades that Scalper mode does but trades are usually of longer duration.
Final mode is a âScaredâ mode. This mode is exercised when the Data behaves same as in âTrend Modeâ or data crosses out o the channel and short average also crosses the channel, therefore establishing the trend. In every case this pattern is recognized by computer or trained trader and entry order of either stop, limit or stop limit is entered.
Note: these patterns are specific to our software and may not work as well on other averages.
After this exercise, we all enter into a âPraying Modeâ which goes like this âWho ever is listening, please here our prayer and do not let the stupid market reverse against usâ. In most cases this is sufficient.

Combo screen shot of all four modes is enclosed.

File size:
66.3 KB
Views:
374
9. ### AmCan

When we are in trade, we now have a dilemma of establishing if it is a trend how strong etc. For this purpose we have developed a channel that is based on linear regression lines and averages that we created earlier. This is what we do. Project the linear regression to the left to create interception point with previous trend. Now anchor a regular linear regression to the average that directs the trend. This is the original average of High created with 3 intersecting linear re. Lines. We do the same for Low. We now have a linear regression channel that is anchored to the reversal point and extends with data in real time on every tick. As the trend continues, this linear regression has greater and greater length, therefore it will take more effort of the market to sway this channel to change direction. Therefore, inevitable must happen, trade is kept in for as long as the market is not strong enough to effect the substantial change in slope of this channel, thus avoiding all kind o vibrations.

Screen shot attached.