Friday, April 20, 2007

Automatic Tradesystems

Why do I bother?

  • Because I want to define my trading rules.
  • Because I want to be able to get statistics with the press of a button.
  • Because I want to know, if I have an edge

I'm not a mechanical systems trader. I take trades before a signal is present. I take trades, when I get a feeling, that a trade setup is present. Some of these trades work great, other explode right into my face. The trades which work great in hindsight show a nice setup on the chart, the ones which are BE to -5 tick trades usually show no setup at all on the chart at the close of the day. But the worst trades are the ones, where a tradesignal is present and ultimatly fails. These are the ones which are really expensive.

Sure, I have a lot of screen time, sure I am able to pay for my commissions and for now I make enough to stay in business. I have good and lean periods. I have not been able to make riches in the market. I want to change that, because I see the trades, I see the opportunity, I "just" don't take it.

Why?

Because deep within myself; I'm not convinced I really have an edge. I think in probabilities, I know, that not all trades need to be winners to make me a very profitable trader, but all attempts at defining the rules for a profitable tradesystem did not really work. Yes I can design profitable automatic tradesystems, but these are profitable due to the Money Management rules, not because of the trade entry or exit rules. That doesn't give me the proof I'm looking for. I want an automatic tradesystem with >70 to 75% winners. I can achive these results in discrete trading, but I'm unable to define rules giving me these results in automatic tradesystems.

Why?

Maybe the design process I'm taking is wrong. Maybe when designing an automatic tradesystem I'm looking for something I don't look for in my discrete trading.

What is the most important rule for an automatic tradesystem design?

  • Trades are taken at the open price of the bar following the bar giving the tradesignal

Only if your tradesystem follows this approach you can be sure, that a tradesignal will be present in backtesting and in realtime. If you take the trades intrabar a tradesignal might be present in realtime, but be gone at bar close. In backtesting only the valid tradesignals will be seen, while all the intrabar tradesignals will be gone.

Let's look at a chart

I've marked areas, where I would like to see a signal, just because the move following on the chart makes it a move worth taking.

Let's see where exactly convential automatic trade systems might trigger a trade.

The first trade is a kind of breakout reversal trade. A test to the downside failed, even if the market was downtrending during the period I marked as Flat market. So the market reversed to the upside. An automatic tradesystem might look for a zeroline cross on the CCI or the first retest of that zeroline on the CCI, which was the bar I marked in my example. And in this case such rule might work. Unfortunatly such a rule will  not be profitable in itself as CCI zeroline crosses usually are not followed by 50 tick moves as in this example here. Over the long term trading CCI zeroline crosses will let you die the death of a 1000 stops.

The next trade looks good, but when following CCI pattern trading rules, it's no CCI zeroline reject as these are to be ignored, if they happen above the 100 line or below the -100 line on the oscillator. The reason being that the retracement is just to shallow to warrant a trade in the direction of the trend already. But assume we trade with laxer rules and trigger a trade, you can clearly see the chop following the long entry bar making it probable, that you will get stopped unless you really trade automatic and get the open price of that long bar.

And the third trade: Well that's a real nice zeroline rejection on the CCI with a nice sling on the Turbo. CCI going to 0 and being rejected, Uptrend intact. But that's also the signal which is clearly failing, giving you a Breakeven exit, if you are on your toes. Otherwise it's a stopped trade as this trade started the trend reversal.

What is the common theme in all these signals?

  • Confirmation

See what you get with confirmation on the HSI. (This market is actively traded right when I'm writing this)

The first trade  is right into the afternoon session open and i usually avoid it, as the market is extremly illiquid then showing spreads of 10 ticks or more. Besides it's again the zeroline CCI cross type trade, which I know has no real edge. The next 3 longs are valid CCI-Signals and all 3 are stopped. Trading these will get you frustrated and you will for sure start questioning the whole approach you take in trading, when your day starts with 3 losers in a row on signals which are supposed to give you good returns.

Why do all these signals fail?

The market needs to turn in the direction of the trend before you get the signal and then take the trade. But in my daily trading, that's not the approach I take. I often anticipate a signal, because I know from experience, from long hours of screentime, that a market will most likely react at a certain level.

Is it possible to design an automated tradesystem with this kind of anticipation?

Well I have to admit I have not yet done it, I'm writing this to structure my ideas and to force myself to take the time think about it.

One bar makes all the difference.

One bar makes the difference between a system barely profitable and a system placing you smack in the middle of the road to riches.

You don't believe me? Try this approach, if you have the ability to backtest your tradesystem. Instead of taking the open of the bar following the bar giving the tradesignal let your tradesystem take the open of the bar giving the tradesignal itself.

I tested that on some systems I developed. 1 contract, 10 trades and the profit jumped from 700$ to around 5000$. The clear sign you just developed a hindsight trading system. Btw: Don't get the idea, that you should only take the trade, if the next bar goes back to the open of the previous bar, giving you the entry there. That usually backfires, as then the probability of the tradesignal failing increases by a very high degree. No, we need an automatic tradesystem giving the tradesignal one bar earlier, giving the tradesignal when there is not (yet) confirmation.

I see ways to do that. It's not so simple as looking for a zeroline rejection on the CCI, but the rewards are sure worth it.

Still there will be a price to pay. When waiting for confirmation, we know for sure there is a signal present, which meets all our criteria, we defined for say a long signal. What we don't know is whether that signal will bring money into our account or not. That's the probability we usually deal with.

What I propose to do is introducing probability to the signal level itself. What will this approach bring us?

Instead of being sure whether a signal is present, we don't know until the next bar closes whether a signal will be present or not.

But what will the reward be?

A trade which is for sure profitable when the signal materializes for at least 1 bar. We don't know how profitable, but we know the trade will be profitable as otherwise the regular tradesignal (eg the CCI zeroline rejection) will not be present.

Look at the HSI example above. Tradesignals at the open of the bars marked with the Long arrow would have given you about 60 ticks.

The CL M7 chart shown above would have netted about 35 ticks more and the third trade would have been a winner instead of a Breakeven or losing trade.

The goal is designing a system with 70% to 75% profitability and the question to be asked is no longer: Is there a trend reversal, is there a rejection of the 34ema or a CCI sling, but : What are the conditions, what are the rules making a rejection, a CCI sling a trend continuation or trend reversal likely.

Will see if that is possible.

1 comment:

Mike said...

Globetrader,

This post reminds me a lot of the issues I have faced over the past few years developing automatic tradesystems, or "stock bots" as I would call them. I have a few ideas that may help.

First, is the software your using only capable of backtesting at the end or begging of bars? Such as close on the bar the signal was given or open the next day etc... If so you may want to look at using software that would allow you to backtest intraday. For example trade using 5 minute data bars. This way you have a higher chance of the signal generating, since you mentioned on end of data bars the signal may not show up. I think this change would make it much easier to put together an auto system that more closely resembles your descretionairy methods. I am not familiar with what commercial software out there would allow you to do this, as all of my software I use is my own custom applications.

Your second problem I gathered is in your discretionairy methods you can "anticipate" things that your indicator will do. This allows you to enter BEFORE it happens. Have you ever considered neural networks? Neural networks are great at memorizing patterns. So, for example if you fed a neural network a lot of data outputted from an indicator such as a moving average, the neural network often times can "predict" where the moving average will be for the next bar.. or the next few bars. Predicting a stocks movement is much harder and generally neural networks fail at this, but predicting the value an indicator will output in the next bar or next few bars generally works very well.

I hope my comment gives you some new ideas to explore. If you would like to discuss these ideas some more feel free to send me an email at mike@stockbotprogramming.com

If you have any programming experience and would want more information on how to use neural networks I have a section of tutorials under the Artificial Intelligence category of my website

Good luck