# I did it my way



## anon (20 February 2007)

I've been in the market for a number of years by now and have done reasonably well without ever having used the tech analysis approach. That's because - (a) I don't know how to work TA and - (b)  I have always considered TA to be an agreed approach whereby investors acted in unison by following the prescribed interpretations of the charts. A bit like traffic lights. However, I have no doubts that the method does work because there are many TA practitioners who do get good results. Sometime back a thought crossed my mind that if TA can work  for individual stocks - why can't a program using TA be written to automatically select stocks which will appreciate in value? For all I know there may be a number of such programs already in use but, I thought, it would be one hell of a challenge to write another one. But I'd have to do it my way.

The reason why I had to do it my way is because I have no idea how commercial stock market programs work. I soon found that writing this program wasn't exactly a walk in the park  but, after a lot of time and lots of effort, I am now seeing a light at the end of the tunnel. About a month back I started running tests to establish if and how my approach performs and am happy to say that at this stage the results are encouraging being better than bank interest by a factor or two.

To test my theories I run two systems, one processing the latest data whilst the other one is running data which is several months old. This second system has selection parameters built in enabling it to identify those stocks which are likely to go up. At the end of each market day's run I "buy" exactly  $1,000  worth of every share that was selected this giving me the numbers of every share "bought". I then display all these stocks using charts that are current, and use the current prices  to get the final values. 

I started running tests using data as from 07/08/06 and processed every market day, the last one being 24/11/06 - a total of 80 trading days. The runs were terminated progressively starting from  06/02/07 and finishing on 16/02/07.  The results are as follows -

  Number of shares selected  275
  Amount "invested"    $275,000
  Amount "returned"    $371,812
  Amount "gained"         $96,812
  % "Gained"       35.2%

Six shares more than doubled in value and four shares lost more than 40%. Overall 64 shares returned losses whilst 211 shares returned gains. On an average there were 3.4 selections per day. More stocks per day were selected in the August-September period than in the October-November period. Also, gains were lower in the latter period, possibly due to the reduction in run time. 

Of course I am ignoring brokerages and CGT.


There were a couple of unexpected results -

1. I expected to see best gains from stocks that had dropped down to the bottom third of their annual price range. That wasn't the case. Best gains came from stocks that were in the top third of their annual price range. Very few came from the bottom range or even the middle range. This could be due to the parameters used in the selection filter.

2. If I was monitoring these stocks from the day they were "bought", the final result wouldn't have been as good. This is because I'd have sold a lot of them on the first significant dip. As it was they dipped and corrected and came up with reasonable final results.


At this stage I believe that better results are possible by doing some vetting of the selected stocks before "buying" them. Some improvement can be gained by modifying the selection filter, though this will require some deep thinking. Also, this program was written using only the daily closing prices without giving any consideration to volumes, except for rejecting all stocks whose annual daily average of shares traded was below 100k. I had looked at volumes but so far haven't been able to recognise any consistent patterns which I could use in this program. Certainly a possibility in the future.

I am looking forward to receiving some comments.

anon


----------



## CanOz (20 February 2007)

*Re: I did it my way.*



			
				anon said:
			
		

> I've been in the market for a number of years by now and have done reasonably well without ever having used the tech analysis approach. That's because - (a) I don't know how to work TA and - (b)  I have always considered TA to be an agreed approach whereby investors acted in unison by following the prescribed interpretations of the charts. A bit like traffic lights. However, I have no doubts that the method does work because there are many TA practitioners who do get good results. Sometime back a thought crossed my mind that if TA can work  for individual stocks - why can't a program using TA be written to automatically select stocks which will appreciate in value? For all I know there may be a number of such programs already in use but, I thought, it would be one hell of a challenge to write another one. But I'd have to do it my way.
> 
> The reason why I had to do it my way is because I have no idea how commercial stock market programs work. I soon found that writing this program wasn't exactly a walk in the park  but, after a lot of time and lots of effort, I am now seeing a light at the end of the tunnel. About a month back I started running tests to establish if and how my approach performs and am happy to say that at this stage the results are encouraging being better than bank interest by a factor or two.
> 
> ...




There are many mechanical traders on this site, some of them i believe are very successful. Perhaps one day i would like to write a system myself. For the time being however i prefer descetionary trading using basic T/A and learning VSA.

I look forward to hearing from the other mech traders, regarding your system.

Cheers,


----------



## mrWoodo (20 February 2007)

I've also been working on a system, but part discretionary, part mechanical. Some quick points :

* Brokerage / Commissions should be factored in - It can have a suprising impact on systems with many trades, esp if trades are at $1000 each.
* Slippage should be taken into account (I've no idea how to, on mine at the moment). Esp on trades where volumes are low.
* Also would be handy to identify your systems biggest 'losing streak', to see how much you need upfront for worst case scenarios.
* Go for at least 3 yrs of backtest data. You've been testing against a very strong trending market, ie. test how the system acts under a choppy market, bear market, etc.

I recommend a book called "High Probability Trading" by Marcel Link - I'm a beginner so this may be a bit simple for some, but was very easy for my level.


----------



## tech/a (20 February 2007)

Guys.

You're re-inventing the wheel!!

There is software that will do more than you can possibly imagine using the parameters YOU choose.

Anon.

Your test period and sample (1 lot of 275 trades results will not give a statistical significance).

There is much to systems design and development. Ive been at it for 10+ yrs.
The best software Ive found and use is Tradesim.

http://www.compuvision.com.au/

Not far behind is Amibroker.

Most know that one of mine is fully disclosed/discussed and traded live (For the last 4 yrs) here. Youll find lots of good info here from many.

http://lightning.he.net/cgi-bin/suid/~reefcap/ultimatebb.cgi?ubb=forum;f=74

Enjoy the journey.


----------



## mrWoodo (20 February 2007)

tech/a said:
			
		

> Guys.
> You're re-inventing the wheel!!
> There is software that will do more than you can possibly imagine using the parameters YOU choose.



Very true Tech   
Will give AmiBroker Std a go - Looked at TradeSim too, but the AmiBroker website had a lot of "how to's" in the support area that were relevant to what I'm after.
Thanks for pointing all this out!


----------



## anon (21 February 2007)

Thank you   CanOz,  mrWoodo,  tech/a.

Your responses gave me a real spurt up, and I mean it.  Version 2  will be a little different but the testing time will be improved substantially. This was a big drag doing Ver 1. 

Yes I did expect that there would be "mechanical" systems, though I hadn't heard of any till now. Seems like a good way of operating.

Working with $1,000 "buys" is a very neat approach. Makes development of projects such as this one much easier. 

Brokerages and Capital Gains are facts of life, however, bringing them in at this stage would only complicate matters. 

I have given a fair bit of thought to going back as far as three years for testing but decided that it mightn't serve a useful purpose. Market conditions were different then, e.g. they were just coming out of the dot.com debacle, there was no massive resources' influence on the economy then as exists now, affecting employment, consumerism, boosting investmet demands, etc.  I was thinking more of short to medium term trading, not long term investing.


"I did it my way" thing wasn't in the initial scheme of things, it was a diversion from another project. It seemed an interesting and possibly rewarding challenge which I found hard to resist. As I have mentioned I got  results that I wasn't expecting. The original intention was to scan for recovery stocks, but most of the selections came from stocks whose prices were already in the top 20% of their annual price range. Last time I looked there were more than 470 shares which had dropped over the last couple of years from their highest price levels down to the bottom third. And, as I do the daily market update runs I see many of these "dogs" moving up, some doing it quite rapidly. They are the ones I was looking for.  Some samples of previous "dogs" -  AMP, NAB, TLS, DOW, IBA...  I picked them up. Of course there are lots of real cheapie "dogs" which I block out.

There is lots of work to be done, the initial effort being directed at reducing testing time. And then the interesting bit.

Thank you for your interest and if you have any thoughts I'll be very happy to receive them.

A request please ...

I get my daily stockmarket prices data after midnight at a price of  $200 pa.  It was jacked up from $120 last year.
7pm delivery is $600 pa.  I use  csv format.

Is this a reasonable price ?   Can anyone direct me to less expensive but reliable suppliers ?

anon


----------



## stevo (22 February 2007)

Anon
Good to see that you are enjoying yourself. 

Like tech I have been trading longer term mechanical systems for some time. I enjoy coding up systems in Amibroker and testing them using the portfolio testing tools. To write your own software is quite amazing!

Although it makes it easier to just buy $1000 lots for testing purposes position sizing is an obvious area to investigate when it comes to putting real dollars into the market. 



> Best gains came from stocks that were in the top third of their annual price range.



Our natural tendancy is to try to pick up a bargain whilst often the more reliable buy signals are from stocks that have already risen 25% or more. It can be a little hard at first to jump into a stock making all time highs, or that has already risen substantially. 

I am not sure that I understand your approach to exits.

regards


----------



## mrWoodo (22 February 2007)

I'm an AmiBroker convert now  Had an ASX500 import, swing trading buy/sell signals, test portfolio all running in about an hour last night. You don't wanna know _how_ much time I spent Dec/Jan doing roughly the same thing in my own app 

What's amazing is the amount of functionality built into it, considering I paid roughly $AU200 (std version). Have barely scratched the surface I'm sure.


----------



## anon (23 February 2007)

stevo said:
			
		

> Anon
> Good to see that you are enjoying yourself.
> 
> Like tech I have been trading longer term mechanical systems for some time. I enjoy coding up systems in Amibroker and testing them using the portfolio testing tools. To write your own software is quite amazing!
> ...





Stevo, I am retired and have to do something to fill in my time. Gardening doesn't excite me, nor does travel as we have already done quite a bit. About the brain cells, they say youv'e got to use it or lose it. I'm using it. My way.

Writing that software was a challenge. Maybe there will be a small reward somewhere down the line.

I am not putting any real money into it yet. When time comes I might have to switch to the other side of the brain. Not there yet.


Every stock has been at their highest and lowest prices over the past twelve months. I take the difference between these prices and divide it by 9, which gives me nine price levels. Stocks whose prices are within the top three levels I label as Bulls. Stocks in the next three levels I call Cows, connotation being that a stock which was at one time at level 9 has fallen to level six, five or four - then it is a cow of a stock (at this time). If the stock falls further down to levels three, two or one -  it's a Dog.  WPL's  highest and lowest prices over the past twelve months were  49.09  and  35.22.  It  was in price level 2  yesterday with price of  38.00.  Price level 2  defines Dogs.

In the past 18 months there were  647  Dogs, many of which have graduated to Bulls. It was these emerging  Dogs that I was aiming at with the automatic selection feature in my program. Didn't get one. Instead got lots of Bulls and only a few Cows. I am not complaining because a  35.2%  gain in about five months is about  84% annualised. 

Now I have got to sort out where I went wrong.

anon


----------



## tech/a (23 February 2007)

Anon.

You will learn a great deal from your reseach.
Goodluck and enjoy.
But remember your not the first to investigate these nuances.
Much has been done before and you can utilise the experience of others.

The long road or the highway.


----------



## yonnie (13 May 2007)

anon said:


> To test my theories I run two systems, one processing the latest data whilst the other one is running data which is several months old. This second system has selection parameters built in enabling it to identify those stocks which are likely to go up. anon




Interesting test anon
I would like to play around with a test myself and can you tell me what your selection parameters are?

thank you


----------

