# Testing a mechanical plan



## stink (23 June 2006)

Good morning All,

I have been reading through these forums trying to find some information in regards to testing various trading strategies. I did find quite a few posts by Tech and some others where they talk about testing your methods over 100's or 1000's of trades? This seems to me like papertrading on roids no?

So yeah i would love to hear some ways that you can backtest a plan to gain more confidence in it, i have not gone into the market yet with real $ just papermoney so far but i havent been able to find a way to backtest my plan that i have confidence in. I mean i can get the old data but really in my head i know where the stock is going to end up so its not the same.

Any advice would be greatly appreciated

Cheers Stink


----------



## GreatPig (23 June 2006)

You can get stock charting software (I use AmiBroker which is very good for the price) which includes backtesting facilities. It requires getting some experience with writing scripts though, so that you can express your system as a mechanical script, and then run that script over historic data.

Helps if you have done some computer programming, but anyone can learn it with a bit of effort. One of the main things to be wary of is that you don't reference forward data in your system, so that you're not cheating by looking into the future. While that might sound obvious, it can sometimes be a little subtle and easy to overlook.

Other popular software for doing this is Metastock, but I gather that's somewhat more expensive than AmiBroker.

Cheers,
GP


----------



## stink (23 June 2006)

Hi GP,

Thanks for the reply mate, i will have a look into those two you mention. I assume there is no free methods available. 

The scripting wont be to much of a problem as i come from an IT background and have played a bit with that sort of thing.

Cheers Stink


----------



## mit (23 June 2006)

Definitely get some backtesting software. I also use Amibroker and it was a great investment. Then the fun begins because it is extremely easy to curve fit a system to past results.

I think that there are some free ones around but if you were a programmer Amibroker is the go as it is extremely flexible.

MIT


----------



## Milk Man (23 June 2006)

Exactly what MIT said. I use amibroker and have found it great to use and is the best value for money IMO. Also beware curve fitting or "data mining" as some like to call it.

Good luck. :alcohol:


----------



## Magdoran (23 June 2006)

Hello stink,


While I wouldn’t want to dissuade you from embarking on a “mechanical/back testing” path if this is your preference, (and you believe this is the direction you want to go in), it may be worth taking a step back conceptually to consider alternative paradigms including analysis styles, and trading psychology, or at least consciously recognise this choice.

Here’s what I’m on about –anyone involved in the market has a tendency to impose their perspective/bias on the limited information they have access too in their analysis.  Hence understanding your own bias can be a subtle yet critical element right from the core strategic approach to investing/trading.

So, going down the mechanical/back testing route in effect excludes a whole range of alternative approaches.  Many that do this have not considered the trade off they are making.  Certainly if you are convinced this is the best approach for you, please, by all means proceed with confidence, people like tech/a have demonstrated that this approach can work consistently and effectively (I stress “can”).

Here’s my controversial perspective on technical analysis:  I think that oscillators/moving averages actually obscure the individual’s capacity to really perceive the way markets trend.  I would argue that by focussing on formulas and algorithms that a trader becomes reliant on automation, and may cease to really study charts and how markets trade.

I also think that there are discernable market patterns through the ages, and looking at interrelated markets (e.g. currencies and related commodities/indexes) is vital to developing a holistic approach to investment/trading.

My understanding of the back testing regime is that you are assuming that if you run enough numbers through a select piece of history, that this scenario of the past can be usefully extrapolated into the future, and that a positive expectancy result can be achieved by incorporating an algorithm into a mechanical system telling you where to enter and where to exit.  

This approach does have merit, and can be quite effective in certain market conditions, particularly in a sustained trending market.  Also, if you do go down this path exclusively, mit’s suggestion not to “curve fit” is excellent advice.

There are tradeoffs adopting the mechanical/back test style though.  In a way a trader going down this path is surrendering their own inherent direct analytical skills to a “black box (although the better mechanical people at least understand what is in the “black box”).

The problem I see is that the approach is only as good as the backward oriented analysis of a time in the past, and if the trader/investor is looking into the future while imposing their bias on the market (either by machine or by limiting their ability to perceive psychologically, or both), then they are resigning themselves to a limited ability to “see” the market.  eddievanhalen made an excellent point on another thread which I fully agree with:



> *Originally posted by eddievanhalen. Thread:  Which one do you use? Technical or fundamental analysis.  Post:152*
> 
> the best traders I know are "discretionary" and have a system based upon experience and some concrete principles which cannot be punched into a system tester and "proven" - they are based upon a huge amount of observation , experience and hard work.



I am in agreement with this philosophy.

So I’m suggesting a path where you retain an awareness of these pitfalls, and consider actively seeking out alternative perspectives so that your future development is not cramped (much like in learning music – incorporate the “theory”, but also nurture the ability to “improvise” and create original music).

Hope this is of interest.


Regards


Magdoran


----------



## stink (23 June 2006)

HI Magdoran,

Thanks for your reply, you raise some interesting points. I would like to think that i could trade mechanically but still use my head if something just doesnt seem right.

Then again that totally conflicts with the reasons for having a mechanical system  

From the research and the training i have done so far the mechanical trading concepts or strategies are more comfortable for me at this stage. I somehow do not feel confident basing my trades purely on fundamentals and psychology i think they definately have their place and are not to be ignored but i would not make decisions soley on this type of information.

What i have noticed so far and have been able to pick up on quite consistently is that the charts dont lie, its no surprise to me that prices drop and come back visiting old support and res etc etc. Sometimes the fundamentals have simply not made sense, there has been no correlation between price pattern and company announcements etc.

Its almost like the market remembers, i understand that this is no way to base trading decisions on soley. For me however it does give me the confidence to make an educated decision knowing time and the odds may be ever so slightly in my favour.

I really appreciate your input and i suppose when it comes down to it, its just a personal choice and you do what you are comfortable with.

Have a nice weekend

Stink

By the way keep the ideas and thoughts coming


----------



## mit (23 June 2006)

I agree that discretionary traders can make the most money. But why is it cutting out any other trading method? 

To me the problem with discretionary trading for a beginner is how do they know that they are a good discretionary trader? Are those string of losses a normal drawdown or is their method crap? I'm sure that prior to May there were a lot of people who thought they were terrific traders. 

A mechanical system can show a beginner what works (and can show the crap ideas that sound good to a beginner but never work).

When you run a mechanical system through a period like we have had since May you can compare the draw down against historical drawdowns and keep going if the trading plan is still good. You may not have traded for a long time but a well backtested system gives you a history as though you have traded for 10 years. We have had a 10% drop but there have been many meaner and deeper drops.

My opinion on the best thing for a beginner would be to start a mechanical system, but look at the charts and maybe paper trade your opinion against the systems opinion as confidence builds then start to actually trade in another account.


----------



## Magdoran (23 June 2006)

Hello mit,


I respect that there are many different schools of thought on any aspect of the market you care to speak of.  There are many established debates on questions like fundamental vs technical, whether to use derivatives, which market to trade (sector, country, asset classes – Real estate, equities, commodities, Forex etc, etc).

Then there are countless debates within the technical camp about which approach is best, and where newer players should start.  Look, this area is not simple, and making the “right choice” is not easy.

I tend to argue that each individual has their own path to explore, and their innate abilities and preferences should be a guide as to how they learn, but in the context of offering real choices, and being mindful of allowing the potential of innovating with a smorgasbord of concepts in the future.

Where I offer an alternative perspective is by taking issue with the notion that new technical analysts should necessarily start with the mechanical approach.  I’m suggesting that this approach can actually cramp future development, much like imposing too rigorous an approach to learning to play music where the creative side is stifled, and a rote learned pattern is imposed.

mit, do you play a musical instrument for example?  If you do, can you improvise a melody on the spot? – Many musicians can’t “jam” if they were trained to rote learn pieces, and just sight read – and many of these people have also been rendered creatively impotent to composing music of their own.  They are in effect slaves to the stave.

In much the same way, many traders have become slaves to the black box, and have lost the ability to develop creatively beyond their confined “prison of the mind”, and grow beyond the limits of a necessarily finite system.

My argument stems in part from observation of how people learn and develop.  There is a mental divide in the way people process information – the creative side of the brain and the analytical side. 

I think the best traders I know use their creative side to reflect the subliminal possibilities of the future, and once this is done, then engage their analytical side to do the practical calculations.  In effect inspiration provides the impetus to see an opportunity, then the perspiration is in actually planning and executing the trade – two different mental processes aligned in harmony (based on the idea one tenth inspiration, nine tenths perspiration – but you need the inspiration).

My belief (reads my personal opinion, hence not an objective fact) is that many technical analysts put the proverbial cart before the horse by using their analytical side solely for making forecasts, when they may find that the imagination of what the future could look like (and the subliminal ability to recognise complex patterns) is effectively severed (I call this “technical castration”).

The fallacy is that a machine can see the market better than a human can.  Maybe this is true when the probabilities are finite (like the super powered chess computers for instance), but I’ve yet to see a PC be anything near a human when it comes to free thinking and creativity in the wider context – that day may come, and when/if it does, it’s game over for any of these discussions.  

By sacrificing the creative ability to really interpret charts (which I would have thought is what a “Technical Analyst” is supposed to be in the pure sense); I think this is akin to the way newspeak was imposed in George Orwell’s book “1984”.

In essence, I think that a narrow diet of “mechanical/back testing” has a potential to mortgage the future of an aspiring technical analyst, conditioning them to think inside the square, with little chance of ever “spreading their wings” to achieve their potential.  But this is not always so, and some traders thrive using the mechanical approach, and I respect their choice.  What I object to is when this is foisted on new technical analysts as the only alternative.

As for paper trading, mit, excellent point, I’m all for it.  I think it takes at good 3 years to become adept at technical analysis, and small positions is the way to go until a new trader/investor has had the chance to study the market enough to make some informed financial decisions.


Regards,


Magdoran


----------



## Magdoran (23 June 2006)

Mit,


By the way, don’t get me wrong, you raised some really good points…

It is very difficult to become a good technical analyst per se, discretionary or mechanical.

You raised a very relevant point about how is a new trader to learn, and where we agree is by studying the past (although I’d say look at the charts with a range of different theories, and not just with a back testing formula – actually looking physically at the charts - daily, weekly, monthly, in as many different markets as possible, right back to early data record up to the present).

The other point you make is about the actual trading plan approach about entries and exits (money management), and this is a very relevant component in effectively trading, but an area I was not addressing in the last post  - this was specifically about interpreting charts, not about the planning and execution, which are of course critical in themselves.

As for the May pull back, using technical analysis, many people identified that the trend was at risk, and had exited their longs by the end of April (I certainly did).  The more aggressive players actually went short, or entered a sideways strategy… that’s the advantage of not using lagging indicators.

I also agree that using the back test approach as one of several methods can quickly unearth poor strategies for beginners as you suggest.  This can be valuable, as can any examination of events and how different strategies and approaches may have fared.

But re discretionary trading, you may not be aware, but in this camp there are many divisions of thinking too, just like technical vs fundamental, and mechanical vs discretionary.

What I’m suggesting is almost a step back from this, which is about how each person views what they see, and how to manage your own market bias.  I hope the subtlety of the point isn’t lost in the text…


Warm Regards


Magdoran


----------



## Magdoran (23 June 2006)

Hello stink,


Spot on, there is a potential contradiction, and I hope my posts above flesh this out a bit for you.

As for lines of support and resistance, I do think markets can trend in discernable patterns which can allow for forecasting in time and price.  Beware though, have a look at Mark Douglas’ book “Trading in the Zone” which will really make you think about an overall approach, probably the sooner the better really.

The stage you are at though is trying to sift through all the alternative technical analysis schools, and later the intra school refinements as you develop.

Consider reading through all the technical analysis threads you can find, get all the books you can and read them too, discuss aspects with as many traders as you can, and keep your mind open, but also be discerning, and learn to trust your own abilities (in essence nurture these).

There are many schools of technical thought around – please do explore tech/a’s approach, look at the Elliott Schools (Prechter and Frost have some interesting interpretations), there’s Stan Weinstein, Larry Williams, Jack Schwager, Stephen Bigalow, Martin Pring, W.D. Gann, R.N. Elliott, the list is endless…  I’m sure that there are many more names that other “techies” can throw in – these are off the top of my head, and I personally both agree and disagree with many aspects of these “big names”.

But here’s the biggest advice I can give you.  Be patient with yourself, and invest in your own knowledge.  Accept that this is a very complex and difficult field, and expect to fail initially while you learn and grow.  You will make mistakes, but what is most important is how you will deal with them.  George Soros talks about this in “Soros on Soros” - he didn’t worry about making mistakes, - he saw this as normal, what he did was to focus on recognising and correcting them.

Good luck!


Regards


Magdoran


----------



## MichaelD (23 June 2006)

There are some very interesting points of view here, so I'll add mine into the mix as a mechanical trader.

I mechanically trade because many, many of my preconceptions of what I thought would work in the marketplace have been proven incorrect with backtesting and thus unprofitable/harmful to profitability. Trading mechanically ensures that I am exposed to the market via a profitable methodology whilst I figure out "what's really going on".

I do not see it as limiting my growth at all, but merely ensuring my survival in the meantime.

Or to put this another way, I see discretionary trading well as the ultimate goal of a trader's journey;

Start of journey: Discretionary trading - unconscious incompetence. Buy now and wait for the one way elevator. Money is lost, but there is no conception of why money is lost. Most fail here.

Next step: Mechanical/system trading - conscious incompentence to conscious competence. There's more to it than just buying anything and everything. Survival is learnt and money begins to be made. This allows the trader to survive until they reach the final step. Most profitable traders do not progress beyond this point.

Final step: Discretionary trading again - unconscious competence. The trader is in tune with what the market is saying and trades accordingly. Only the elite traders get to this stage.


----------



## mit (23 June 2006)

*** this was to your first reply. Just noticed a few posts since. I'll leave the body as is ***

Magdoran,

I think you have a very narrow view of mechanical trading. Admitedly there are people who can trade from day one. However, the failure rate from trading is often quoted at between 90% to 98%. There are those who never should trade. There are those that I think that can be successful but give up after a string of losses. Now the string of losses could be part of a trading plan that has positive expectancy, but as a beginner unless you have somebody holding your hand, a string of losses is very hard to take and it is tempting to give up.

Mechanical trading is not "black box". Black Box is being handed a trading plan and told to trade it. With backtesting you can see the effect of widening or shrinking stops. The effect of different position sizing methods. The effects of taking profits or using trailing stop. You can also test a lot of things you see in books which don't work.

Apart from just systems it can tell you such things as whether in general it is better to buy/sell on open/close. Sell at a stop or at EOD. The cost of trading CFDs against margin. In fact it gives you a bag of tools handy for a discretionary trader.

My point that it could get the number of failures down. It allows somebody to try things without blowing up their account a few times. I think it would only narrow your view if you were that kind of person already. I think we see enough of that kind of person here and other forums for all trading styles.

MIT

ps. I do play piano and guitar. I learn music by rote and no I can't improvise. But it wouldn't have any difference as I couldn't improvise before. Lack of talent unfortunately.


----------



## mit (23 June 2006)

Magdoran,

I see your points better now and agree. I still greedily read everything I can on different styles of trading and investing. Learning never stops. Also, nothing annoys me more than some threads you see where people say that method x does not work but their method y does work. It's surprising how people who have traded for years fall into the trap of a very narrow view (although the fundie/tech wars are always fun).

MichaelD,

We are on the same wavelength. I'm looking to make enough capital to leave work and study this stuff full time.

MIT


----------



## Magdoran (23 June 2006)

Hi mit,




> *Originally posted by mit*
> 
> ps. I do play piano and guitar. I learn music by rote and no I can't improvise. But it wouldn't have any difference as I couldn't improvise before. Lack of talent unfortunately.




Really, so you play, that’s great!  I used to play guitar in a few bands years ago, and even taught a bit too… I did a lot of improvising, and helped quite a few musicians to learn how to “jam”… a bit rusty now though, and probably going slowly deaf… what’s that???  You know, you actually might have some hidden talent.  Can you hear pieces in your head for example? Anyway, back to the main topic.

The problem with this field is that we don’t have any universal benchmarks for terminology, and where there are some, there are still polemics raging about the finer points.

Maybe our definitions of what mechanical trading is are different – good point.




> *Originally posted by mit*
> 
> With backtesting you can see the effect of widening or shrinking stops. The effect of different position sizing methods. The effects of taking profits or using trailing stop. You can also test a lot of things you see in books which don't work.




Oh, I agree with this approach, very worthwhile, but I’d class this as developing money management parameters (position sizing), so maybe our labels are different… 


Ok, let’s try to clear up the semantics – would you mind illustrating what you know the term “mechanical” to mean please?  Sorry for the 50 questions, but this will help me understand where you are coming from, if you don’t mind of course…

What triggers your entry/exit?

Do you forecast price for entries and exits? 

Do you forecast time for entries and exits?

Do you interpret bar/volume in you process?  

Do you use any kind of wave structure analysis in your mechanical system?

Does your system define the stop for you, or do you actually use a method of interpretation of the chart to do this (i.e. use a technical stop)?

How do you determine the trend?

I could go on, but don’t want to burden you too much… you might be surprised by the range of ways you can interpret a chart.


Regards


Magdoran


----------



## Magdoran (23 June 2006)

Hi MichaelD,


I like the way you illustrated the technical analyst’s journey.  It really puts the whole experience in perspective, doesn’t it?

Examining the past and assessing the best approaches to certain conditions makes a lot of sense to me, in fact I’d say it is vital.

The key point is that you’re actively feeling forward from the brink (ala Bronowski)… as am I.


I agree, this is the “way of the trader”.


Kind Regards


Magdoran


----------



## mit (23 June 2006)

Magdoran said:
			
		

> Hi mit,
> 
> 
> 
> ...




Yes, guitar especially. If I can't hear it in my head it is almost impossible to play. I also find it hard to keep time without hearing it in my head

For below. I am describing one mechanical system and the golden rule with mechanical systems is to keep it simple. I do have a very small account with about 5% of my capital where I trade discretionary. 



> What triggers your entry/exit?



If you mean the system then:
Entry - Distance from Dividend, amount of Dividend and currently bullish
Exit   - Ex Div Day

If you mean how I get a trigger:
I use a spreadsheet and load data in from Amibroker, Don's Dividend sheet and live prices.



> Do you forecast price for entries and exits?



No 



> Do you forecast time for entries and exits?



exit at exdiv unless stopped out.



> Do you interpret bar/volume in you process?



Liquidity has to be high enough. I find anything averaging below $400k turnover per day not worth the hassle and will usually give me slippage between the backtested system and what actually happens.

I don't put stops in the market and will look at the day's volume if a stop is hit and the share recovers (This is the only discretionary element, but it is very rare that I'll override but you do get kangaroo tails)



> Do you use any kind of wave structure analysis in your mechanical system?




Pretty hard to code. Kind of thing I'd like to try to code when I retire. More because I'd like to try and code it not that I'd think it would add anything, I think these kind of stuff plus support and resistance, 1-2-3 patterns and fibs work better straight off charts. You might be able to code the patterns but there are a lot of little judgement things here.





> Does your system define the stop for you, or do you actually use a method of interpretation of the chart to do this (i.e. use a technical stop)?




Mechanical stop based on an ATR multiple. Trail it up based on the High of the day. After last October I positioned sized based on the ATR multiple but I used the most recent low as an actual stop if the low was higher than ATR stop. Back testing over October it didn't make much difference actually.




> How do you determine the trend?




For this system I use a fast and slow EMA (10/20) and just look for the fast EMA to be higher than the slow EMA.


----------



## stink (23 June 2006)

Ha what a great Forum,

I seem to have hit a nerve that i in my infancy of trading am yet to develop  

You guys really seem to know your **** and hopefully one day i can revisit this post and add my two cents.

Back to the topic though, the best way to backtest a mechanical plan is by using something like the software that has been suggested.

The way i see it,
I am a noob to trading so the only way i can verify if my trading plan (mechanical at this stage) has some potential, is to use some sort of backtest solution. I totally agree as stated earlier that there are probably hundreds of valid trading methods but for now in my position i see a mchanical backtest the only way?

penny for your thoughts!

Cheers Stink


----------



## Mr Hurricane (23 June 2006)

Hi Stink,
              I created an Fx system using the back testing facilities incorporated in Trade Station. I had traded for some time and was aware of a good setup for a trade but it only happened about once a week. That is a long time to sit and wait for the right trade. So I automated the idea and back tested it over 3 years to see how good the idea was. It worked well and I would recommend back testing your ideas to see how they stand up over long periods. 

Mr Hurricane


----------



## It's Snake Pliskin (23 June 2006)

Magdoran,



> Hence understanding your own bias can be a subtle yet critical element right from the core strategic approach to investing/trading.
> 
> So, going down the mechanical/back testing route in effect excludes a whole range of alternative approaches.  Many that do this have not considered the trade off they are making.
> 
> ...




Good stuff! and Eddie said it well.

Mit,



> To me the problem with discretionary trading for a beginner is how do they know that they are a good discretionary trader? Are those string of losses a normal drawdown or is their method crap? I'm sure that prior to May there were a lot of people who thought they were terrific traders.




Results and psychology!

Yes bullmarket champions. 

Stink,



> You guys really seem to know your **** and hopefully one day i can revisit this post and add my two cents.




Always keep a sceptical mind to what you read or hear - in general. 



> I am a noob to trading so the only way i can verify if my trading plan (mechanical at this stage) has some potential, is to use some sort of backtest solution. I totally agree as stated earlier that there are probably hundreds of valid trading methods but for now in my position i see a mchanical backtest the only way




I see mechanical trading better for people who don`t have the time or psychology to deal with discretionary trading. I`m with Magdoran and the latter though if you have the time to make a killing.

Doctors go to university to study for years and they never stop. If one wants to trade should just reading one or two books be enough? NO!

Snake


----------



## stink (26 June 2006)

Hi Again,

I was just thinking about the methods or software for used for backtesting and how does the software know if a stock has broken a long term trend line? Or does it not matter?

Cheers


----------



## MichaelD (26 June 2006)

stink said:
			
		

> I was just thinking about the methods or software for used for backtesting and how does the software know if a stock has broken a long term trend line? Or does it not matter?



If your exit is the break of a long term trend line, then this is specified in the Exit Trigger formula.

As an example, using MetaStock and TradeSim, you would code this as;

ExitTrigger:=CLOSE<MOV(CLOSE,175,EXPONENTIAL).

This signals the trading simulator to exit a trade if the day's CLOSE is below a long term moving average.


----------



## tech/a (26 June 2006)

For a cross of the close I prefer this

Cross(Ref(Mov(C,175,E),-1),C).

But thats not the question.
Stink I'm yet to see a software that will allow you to code the crossing of a Trendline.
The problem being that you need to use Zig Zag in the coding to identify peaks and troughs.Your idea is to have price cross a downtrend as one of your entry criteria.
Specifying troughs or peaks can be in % or point value.Either way the leg in question (The now peak or trough) is dynamic.
To explain.Lets say you have 10% move in a peak and tommorow the stock retraces to 8% the peak is clearly 2% above the 10% value.
Trend is drawn
2 days later the price has moved 5% beyond the original 10% and is still not correcting.
The old peak is no longer there as price is still seen as an up move without a new trough being made.
So yesterdays trendline is no longer there.
Dynamic code cannot be used in systems tests.

As for software.

I use the same as Michael, Metastock coupled with Tradesim -- Enterprise edition with Montecarlo capability.Around $2500 for both
If youve never coded Amibroker is cheaper and very very good.About $400 I think.


----------



## GreatPig (26 June 2006)

tech/a said:
			
		

> Dynamic code cannot be used in systems tests.



Actually it can in this respect, as buy and sell signals are generated each day based on the trend line as it is that particular day. If the next day the trend line changes, then the next day's signals will be generated with the new trend line. What can happen though is that after a buy signal is generated, the trend line can move such that there wouldn't have been a buy signal at all, meaning there won't now be any condition to look for for a sell signal. Some alternate sell signal may be needed for protection in this case.

And when you back test and look at all the buy and sell points, they may not match where the final trend line signals would be, as the trend lines may have moved since those particular signals were generated.

Recalculating trend line history for every day can be pretty slow though, making back tests take a long time.

Cheers,
GP


----------



## tech/a (26 June 2006)

GP in systems tests the software will look for a true condition and as systems tests are on past history then the peaks and troughs are no longer dynamic except of course for the current one.
You'll get the results but they will not reflect live trading.


----------



## GreatPig (26 June 2006)

tech/a said:
			
		

> then the peaks and troughs are no longer dynamic



They don't have to be. All that is required is that buy and sell signals be based on trend lines as they would have been placed on each particular day ignoring all future data, which mimics live trading (on an EOD basis of course). How they change on subsequent days doesn't matter, except as mentioned before where a trend line changes after a buy signal so as to remove the buy indication. That's what I meant about having to recalculate the trend lines for every day.

This is exactly what I do in my AmiBroker trend line plugin, and why backtests are so slow.

Cheers,
GP


----------



## kaveman (27 June 2006)

You can use zigzag for signals, BUT, you must allow for the retracement to have occured. Once the retracement % has been made then the last peak or trough point is fixed and can be used. In my own coding for zigzag I call this the CreateTrough (CTB) and CreatePeak (CPB) bar. backtesting can then be done provided you always specify the the barssince the CTB or CPB is less than the barssince the respective trough or peak


----------



## stink (27 June 2006)

Thanks for all the input peeps,

I was playing around last night and i am having problems finding the right indicators to use to take advantage of possible trades. I intially started using moving average cross overs where the fast crosses the slow would indicate a potential entry point.

What i found though was when i reviewed the report and then when to that particular time on the chart there may have been another two or three opportunities to do a trade but the system didnt pick it up. I then thought maybe if i add a price and volume increase into the entry criteria but so far have not been happy with the results. also the more entry criteria i add the harder to actually find the entry points, on a couple of runs i ran it from 04 through to present and it didnt pick up one trading opportunity (asx200).

I suppose its just a matter of trying different combinations and seeing what works the best, theres just so many indicators and i dont have a clue about half of em   

At the moment i am papertrading successfully mainly using trend lines and a couple of basic indicators but trying to get the system to do that is harder than i thought it would be.

Cheers All
Stink


----------



## GreatPig (27 June 2006)

Trend lines are particularly difficult to use in an automated system as their placement is tricky and time-consuming to calculate. Moving averages are considerably easier, but of course have time lag.

I think you'll find that it will be difficult to find a good system based on simple moving average crossovers, otherwise everyone would be doing it already.

Cheers,
GP


----------



## tech/a (27 June 2006)

GP and Kave.

Thanks.
Must be "easier" to do in Ami.
Nigh impossible in Metastock


----------



## Staybaker (27 June 2006)

Magdoran said:
			
		

> As for the May pull back, using technical analysis, many people identified that the trend was at risk, and had exited their longs by the end of April (I certainly did).  The more aggressive players actually went short, or entered a sideways strategy… that’s the advantage of not using lagging indicators.



Hi Magdoran,

Just picked up this statement in an earlier post of yours. I'm a not-very-good trader who _didn't_ identify that the trend was at risk - apart from having a sort-of gut feeling that things were moving too fast - so I'm keen to know how others made that judgement. Would you care to elucidate? (Of course, if you don't wish to reveal any of your own "proprietary" methods, that's fine too!)

Cheers, Staybaker.


----------



## kaveman (27 June 2006)

Tech I wrote my own code for zigzag which allows me much greater flexibilty and control than built in zigzag function. eg built in is just single array (eg high to High), and percent change
I can do dual array (eg High to Low), percent/point/array reversals (eg reversal using multiple of ATR)
Also allows me to properly build into a trading system


----------



## Magdoran (27 June 2006)

> Originally Posted by *Staybaker*
> 
> Quote:
> Originally Posted by Magdoran
> ...





Hello Staybaker,


That’s actually quite a hard question to answer.  You know, I think there is a skill in asking the right questions (like the one you’ve just posed), and quite a skill to answer these (trying to answer this is a daunting task), and quite another to actually know what you are talking about and be able to express it so other people can understand the concept.

Judging by the array of moving average/back testing methods populating this thread, my approaches will probably be as alien as speaking a foreign language to the majority of readers.

My perspective of technical analysis is that it is more art than science, and that interpreting charts is more akin to appraising fine art, while forecasting future events involves imagination (for how future events may unfold), and an appreciation for pattern recognition (including recognising subtle shifts which may give clues that larger changes are imminent).  

It’s a bit like being an actuary for an insurance company.  You have to look at macro trends, and assess the risk of different potential events.  I was involved in enterprise IT projects in the past, and was involved in the development of risk management systems for complex deployments into the government.  An aspect of this involved making project estimates to price for tenders, and establishing risk management approaches.

So, having said that, here is the core answer:  I was using a version of Gann based time forecasting.  The analysis was based on the pattern of trend, (which encompassed both the shorter 180 calendar day drive, and the whole bullish campaign from 2003).  This also involved using a division of the range projected up to forecast levels of resistance in price.

Partly I was looking at the wave structure (a Gann/Prechter-Frost/R.N. Elliott hybrid of Elliott Wave theory with some embellishments), and how it had moved in time and price over the last 20 years, and looked at how blow off moves tend to trend and what they look like.  What I (and others of my ilk) concluded was that the probabilities favoured a “topping pattern”.  

I got the time point wrong though, the projected top was for the 19th of April (interestingly I had made this projection independently, and others came in with the same date, but by different methods), but there was an extension for a marginal high above the projected date (actually it was about a quarter extension in time of a square of 90 in hindsight, but there was no way I was capable of forecasting this was going to happen on this day with my methods, but I did know from the pattern and time and price that the trend was at risk).  

The time cycles certainly lined up once the top was clearly identified, exactly 360 calendar days from the key higher low on 17th May 2005.  My approach is not to try to trade major highs and lows, I try to ride the trends and counter trends once I can measure either time, price (preferably both), wave structure, and primarily see a pattern that I can trade with reasonable accuracy in time and price. Hence I just stay out of the market during times when I can’t make high probability forecasts.

So, I just sat out watching the pattern of trend when the major high came in for a few days, looking at the bars and volume (volume can confirm or throw doubt on certain patterns – where high or low volume can tell a lot about what’s going on ).  I was also trying to see potential wave structures forming, looking at “harmonic price ranges” for support/resistance, looking for dominant time cycles in daily weekly and monthly charts… 

Add to this the backdrop of looking at the related indexes and stocks too with the same analysis… Forex, commodities, international indexes, bond rates etc etc - all with full analysis as suggested above, then a process of factoring the probabilities for all of these into the potential way the XAO may behave.

For instance, for me to trade BHP, several factors will effect the way it trends above it’s own vibration – futures prices in metals, crude oil, fuels (like Hu-spotV), currency cross rates (like US-Australian Dollar, Euro – US, Yen-US, etc), other price movement in overseas markets for BHP, indirectly – US bond rates, etc etc.  So I actively forecast for all of these in time and price.  If any deviate from these projections, I have to revise my projections.  

So, my price and time targets in the trading plan actually can be modified if a key factor moves beyond tolerance (so there is a two level approach to the plan – the core plan, and the ability for exception handling for unfavourable events).  A classic example would be the fall in copper prices recently which would trigger a partial or full exit from a long position depending on the magnitude.

As you can imagine, there is a lot more to this than I have covered, but that’s essentially it… hope it made sense!



Regards


Magdoran


----------



## Magdoran (27 June 2006)

Woops, it was actually 358 days from the low, not 360 - I had the time cycle noted on the chart, but the actual high came in 2 days earlier...


----------



## Staybaker (27 June 2006)

Magdoran,

Wow. Thanks. I won't pretend to understand all that ... but I'll have fun trying!

Cheers, Staybaker.


----------



## Nick Radge (28 June 2006)

Tech/a
TradeStation can do trend line trading systems. The following chart shows automatic trend lines drawn in basis input criteria. Below that is a trading system that uses trend line breakouts.








Input:  TrendLen(20);

VALUE1=@MOMENTUM(C,3);
VALUE2=@MOMENTUM(C,3)[1];
VALUE3=0.3*(VALUE1-VALUE2)+(1-0.3)*VALUE3;
VALUE4=WAVERAGE((VALUE3),6);
VALUE5=@RSI(C,9)+VALUE4;

{     Determine then beginning and ending points of an Upward Trend Line.   }

Value6 = SwingLowBar(1,Low,3,TrendLen);
Print("Date: ",Date:0:0," Time: ",Time:4:0," SwingLowBar 1st# =  ",Value6:2);
If Value6 > -1 then begin
   Value7 = SwingLowBar(1,Low,3,TrendLen)[Value6];
Print("Date: ",Date:0:0," Time: ",Time:4:0," SwingLowBar 2nd# =  ",Value7:2);
   If Value7 > -1 then begin
      Value8 = TLValue(Low,Value6,Low,Value7,-1);
Print("Date: ",Date:0:0," Time: ",Time:4:0," Trend Line UP =  ",Value8);
   End;
End;

{     Determine then beginning and ending points of a Downward Trend Line.   }

Value9 = SwingHighBar(1,High,3,TrendLen);
Print("Date: ",Date:0:0," Time: ",Time:4:0," SwingHighBar 1st# =  ",Value9:2);
If Value9 > -1 then begin
   Value10 = SwingHighBar(1,High,3,TrendLen)[Value9];
Print("Date: ",Date:0:0," Time: ",Time:4:0," SwingHighBar 2nd# =  ",Value10:2);
   If Value10 > -1 then begin
      Value11 = TLValue(High,Value9,High,Value10,-1);
Print("Date: ",Date:0:0," Time: ",Time:4:0," Trend Line DN = ",Value11);
   End;
End;

{    Breakout of a Downward Trend Line.   }
CONDITION1=SLOWD(9)[1]<SLOWD(9);
CONDITION2=VALUE4[1]<VALUE4;
CONDITION3=VALUE5[1]<VALUE5;
CONDITION4=VALUE5>50;
CONDITION5=Close>Value11;

{    Breakout of an Upward Trend Line.   }
CONDITION6=SLOWD(90)[1]>SLOWD(9);
CONDITION7=VALUE4[1]>VALUE4;
CONDITION8=VALUE5[1]>VALUE5;
CONDITION9=VALUE5<50;
CONDITION10=Close<Value8;

If Value9 < Value6 and Value10 < Value7 then begin
   IF {CONDITION1 AND CONDITION2 AND CONDITION3 AND CONDITION4 AND} CONDITION5 THEN BUY ON CLOSE;
End;

If Value9 > Value6 and Value10 > Value7 then begin
   IF {CONDITION6 AND CONDITION7 AND CONDITION8 AND CONDITION9 AND} CONDITION10 THEN SELL ON CLOSE;
End;


----------



## rubles (3 July 2006)

Hi Stink, and the others who have contributed to this thread

I'm also going through the process of developing a system and looking for ways to back test it - I've also been looking through this forum for a while for just this reason and decided to join today when I found this thread.

The charting system I have does not have a back-testing facility; I may look  into Amibroker as it seems to get a good wrap.

I look forward to joining in on and reading other threads; this is really a great forum.

Cheers
rubles


----------



## Riles (3 July 2006)

Rubles, have a look here
http://www.spacejock.com/
FCharts Pro is what I use, but you can get the free version which also has a trade tester and stock scanner.
You enter your formulae into two areas (four with the pro version), and it plots out green and red dots on the chart for entry and exits.

They have a forum which discusses formulae and general usage of FCharts.
IMHO it's an awesome charting program. Locally developed and supported.
The pro version is only a couple of hundred bucks and well worth it.


----------



## rubles (4 July 2006)

Thanks Riles, that looks good too!


----------



## swingstar (6 July 2006)

For those who use AmiBroker, do you also use MarketCast data? I was going to go AmiBroker until I realised you can only get realtime data for it via SBS TV signal. No good for when I'm roaming around... Where did you get historical ASX data from?

Might trial MetaStock. Been using The Bourse / Bourse Scan for a while but it's not as clean as AmiBroker and MetaStock.

Also, for those who use TradeStation, does it support ASX data? I can't find any info on data sources...


----------



## Bobby (6 July 2006)

swingstar said:
			
		

> For those who use AmiBroker, do you also use MarketCast data? I was going to go AmiBroker until I realised you can only get realtime data for it via SBS TV signal. No good for when I'm roaming around... Where did you get historical ASX data from?
> 
> Might trial MetaStock. Been using The Bourse / Bourse Scan for a while but it's not as clean as AmiBroker and MetaStock.
> 
> Also, for those who use TradeStation, does it support ASX data? I can't find any info on data sources...



 Hullo Swingstar,

If you're roaming around & wish to use Marketcast this may be the answer :-

Portable satellite dish.
A satellite decoder enabled to receive SBS.
Smart card to get free to air services.
A bitwalker decoder conected to the satellite decoder.
SBS use Optus Aurora Satellite.

All this information is in their site.
Tech uses marketcast & knows what hes doing, hope he comes along.
My question is~ can Marketcast be used as a stand alone system to generate more complex signals ?

Bob.


----------

