# Metastock - Peak/Trough Finder



## traderc (22 February 2009)

Hi guys,

As mentioned to you about a formula I'm working on at the moment I thought I'd post the underlying formula I'm using as a basis for my research.

To give credit where it's due, this was invented by someone of the name Jose Silva but I'm using it to see if I can use this as the basis of my research into using previous results generated by his formula to create a predictive model to generate or estimate "next peaks"! 

Anyway, thought you might like a copy of it. It's helped my immensely in my trading.

I've modified it so it only displays Percentage change as it used to show lots of other information for trading options. If you'd like that one just post a message and I'll put that up as well.

Just create a new indicator and away you go!

Peak/Trough Finder

pr:=Input("Peak/Trough %minimum change", 0.05,50,8); 
pk:=PeakBars(1,C,pr)=0; 
pkVal:=Peak(1,C,pr); 
tr:=TroughBars(1,C,pr)=0; 
trVal:=Trough(1,C,pr); 
pk-tr


Regards,



Christian


----------



## tech/a (22 February 2009)

Know Jose well.

Thought you maybe attempting to use Zig Zag in your formula (which is a function of Peak and Trough bars.)


The problem with using Zig Zag is that what is true in a search today may well (And often is) false tommorow.
Zig Zag is dynamic and as the % change cannot be confirmed until the % change has been reached.
So it is a hindsite indicator and a very dangerous one to rely on in trading.

You cannot "Predict" the completion of the next Peak Trough or Zigzag.

Plenty of reading on the dangers or using formula with Zig Zag in their code here on the Equis forum. (Jose resides here!)
http://forum.equis.com/search/SearchResults.aspx?q=Zig+Zag


----------



## traderc (22 February 2009)

tech/a said:


> Know Jose well.
> 
> Thought you maybe attempting to use Zig Zag in your formula (which is a function of Peak and Trough bars.)
> 
> ...





Hi there,

I realise Zig-zag isn't a forward Predicting type system (at the moment anyway) and just because it says there was a current Peak, I know it's only calculating from previous historical data to draw it's lines as do all formulas and also that we can never know the "unknown" and elusive "next bar" 100%; we can all really only give a "best guess" based on current trends. In fact, with Zig Zag being so dynamic based on the fact that adding the "unknown next bar" changes its readings that actually might turn out to be a plus as it effectively shows change immediately right up to the last tick to assist with projecting the next movements.

I think that given enough time I might be able to create an adaption of the Zig Zag so that using the data from past Peaks/Troughs, I can plot projections from them by working backwards, getting 110 points of previous price points to statistically prove the Zig and Zag pattern of the individual stock itself in terms of characteristics and from there work out the behavioural pattern of the stock itself.

This would allow a fairly accurate calculation, especially with 110 previous price points as a baseline to provide a good likelihood of when next price peaks/troughs will happen. Using some kind of weighting so the most current data has more credence than the older data and also placing recent trends in these calculations using current support/resistance lines, it should allow the system to project the next peak/trough plot projections pretty accurately.

I know it doesn't sound too easy but some of my formulas I've worked on for the past 7-8 years now so it's more a labour of love than anything else.

Kind of how I visualize the formula I guess you could say is similar to how a crystal prism splits light. I'm trying to see if it's possible to create a similar effect using mathematics and applying it to backtested stock market movement theories instead of applying it to light and physics. Similar in principal I guess to something akin to quantum physics or dark matter but geared to making money if that makes any sense.  

hehe... might call it a "warp drive" or "light speed regression". Has a nice ring to it. Anyway I'd much prefer to be filthy stinking rich and live life in the lap of luxury than work out the weight of dark matter and rot it some dingy laborotory!  If I can achieve this, I'd buy new laborotories for people to figure out the weight of dark matter! 


Christian

P.S.: Please tell Jose thankyou if you chat to him any time soon; he's really helped me with a lot of ideas so far on how to mathematically express my ideas in Metastock.


----------



## tech/a (23 February 2009)

Christian.

Jose is on a beach somewhere in Thailand last I heard.

Think your pushing a barrow at 45 degrees on a wet slope.

Funny you should mention physics/maths.
Kris my son is in his last year of his Doctorate in Physics.
http://www.physics.adelaide.edu.au/photonics/people.html

He has an interest in Trading however has wisely chosen to complete his Doctorate.
His mathamatical talent and amazing skill in programming and formula creation will in years to come be very helpful in looking at some of the ideas I have.

Not to mention the software at his disposal to investigate data sets.

Goodluck in your formula writing and application.
Alays interested in anything that you may have.


----------



## traderc (25 February 2009)

Hi there,

Thanks for the encouragement. Seems your son knows could be a formidable ally for you in analysing the stock market with his background.

Anyway, good luck with your future endeavours and will keep you posted about any new developments I make on the formulas. 

Christian


----------



## wabbit (25 February 2009)

Christian,

If you haven't seen the work of Spyros Raftopoulos and his validation techniques for the MS Zig() function, then have a look at these (at least, Google for more):

http://forum.equis.com/forums/post/16140.aspx
http://trader.online.pl/MSZ/e-w-ZigZag_Trend.html
http://www.traders.com/Documentation/FEEDbk_docs/Archive/052006/Letters/Letters.html

and there is plenty more out there too...

Some of this might be useful?  


wabbit


----------



## traderc (28 February 2009)

Definitely some interesting stuff in there. Will have a read of it.

Regards,


Christian



wabbit said:


> Christian,
> 
> If you haven't seen the work of Spyros Raftopoulos and his validation techniques for the MS Zig() function, then have a look at these (at least, Google for more):
> 
> ...


----------

