[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[EquisMetaStock Group] Re: Trend Following



PureBytes Links

Trading Reference Links

Yes, well that surely is Kalman's appeal - being able to combine
widely different data streams that may impact price into one
prediction.  When my Kalman filter was working well, it REALLY worked
WELL!

The indicators I use now don't work quite as well, but I don't
constantly worry - hmmmm look at that - is it time to re-tune again?

Standard AmiBroker supports 3 languages right out of the download.
 
1. AB's embedded language AFL - much like MS-FL but more powerful.  
2. MicroSoft's Visual Basic for Applications - VBA
3. Sun's JavaScript

VBA is part of the Windows operating system, and is the macro language
for Word + Excel + many other programs.

JS is part of MicroSoft Internet Explorer and is used to support
compute intensive tasks like mortgage calculators etc.

AB has just provided the hooks so you can take advantage of these
powerful languages inside AB.  As a learn more, I use JS less - AFL
has everything I need.

Just as an example, here is the Heikin-Ashi indicator published in
TASC a while ago.  The script starts out in AFL down to the <%, then
JavaScript, then back to AFL to plot the result.  Note the PLOT
routine allows the user to determine what data goes into the O H L C
values - which is the essence of Heikin-Ashi.


//  *********** EXAMPLE AFL / JS Code  ***************;

// Standard Heikin-Ashi  Translated from EasyLanguage code
// Ed Hoopes
// Rev A
// March 2005

	EnableScript( "jscript");

	haClose   = (Open+High+Low+Close)/4;
	haOpen[0] = Open[0];
	
	for (e = 1; e < BarCount; e++)
	{ 
		haOpen[e] = (Open[e - 1] + haClose[e - 1]) / 2;
	}

	<%  // Switch to JavaScript now;

	JShaClose = VBArray( AFL( "haClose" ) ).toArray();
	JShaOpen  = VBArray( AFL( "haOpen"  ) ).toArray();
	JSHigh    = VBArray( AFL( "High"    ) ).toArray();
	JSLow     = VBArray( AFL( "Low"     ) ).toArray();

	haHigh    = new Array();
	haLow     = new Array();
	haColor   = new Array();

	for (f = 0; f < JSHigh.length; f++)
	{ 
	haHigh[f] = Math.max( JSHigh[f], JShaOpen[f], JShaClose[f] ); 
	haLow[f]  = Math.min(  JSLow[f], JShaOpen[f], JShaClose[f] ); 
	}	

	AFL( "haHigh"  ) = haHigh;
	AFL( "haLow"   ) = haLow;
	AFL( "haColor" ) = haColor;

	%>  //End of JavaScript;

PlotOHLC( HaOpen, HaHigh, HaLow, HaClose, "H-A Std " + Name(),
colorWhite, styleCandle );


Cheers, 

ReefBreak


--- In equismetastock@xxxxxxxxxxxxxxx, mgf_za_1999 <no_reply@xxxx> wrote:
> Thanks for the feedback.  We often use Kalman filters to combine the
> outputs from more than one model into a single, final signal.  Also
> use it in variable parameter work.  Interesting that you can use VB
> and JS in AmiBroker.  Wow!
> 
> Regards
> MG Ferreira
> TsaTsa EOD Programmer and trading model builder
> http://www.ferra4models.com
> http://fun.ferra4models.com 
> 
> 
> --- In equismetastock@xxxxxxxxxxxxxxx, "Ed Hoopes" <reefbreak_sd@xxxx>
> wrote:
> > I read John Ehlers book "Rocket Science for Traders" - he devoted Ch.
> > 6 to the Hilbert Transform. Figure 6.7 has it coded in EasyLanguage. 
> > Looking at the code, I think it would perform like the Triangular
> > option of the moving averaging formula in MS 9.0  -  further, the code
> > looks simple enough to code in MS-FL - which, of course, I am too lazy
> > to do.  
> > 
> > My experience with Kalman is that the sources of noise in the signal
> > need to be well characterized and constant.  This is true for most
> > electronic / electroptic applications.  However in the stockmarket, I
> > found thats not true.  To run a Kalman filter, the several terms
> > required to calculate the next days change need to be constantly (
> > every few months) re-tuned.  After tuning, things work OK for a while,
> > then need to be tweaked again.  
> > 
> > By the time you have a term for every thing you think impacts the
> > price, there are many functions and look up tables.  You need look up
> > tables, since noise sources in the stock market are seldom Gaussian
> > like Kalman wants.  They also suffer from the "Fat Tail" issue -
> > namely that extreme outliers are much more common that would be
> > predicted by a Gaussian distribution.
> > 
> > For this reason, I no longer use my Kalman filter, despite many hours
> > and hundred lines of JavaScript code it required (you can run JS and
> > Vis Basic - both free - inside of Standard AmiBroker.)
> > 
> > --- In equismetastock@xxxxxxxxxxxxxxx, mgf_za_1999 <no_reply@xxxx>
> wrote:
> > > For an easy introduction to the Kalman filter, download the PDF
> > > article from this page.
> > > 
> > >     http://www.ferra4models.com/Kalman.html
> > > 
> > > Ed, given your background, have you ever used the Hilbert
transform? 
> > > It is supposed to give an idea of both the length and the
strength of
> > > the trend, if used correctly.
> > > 
> > > Regards
> > > MG Ferreira
> > > TsaTsa EOD Programmer and trading model builder
> > > http://www.ferra4models.com
> > > http://fun.ferra4models.com 
> > > 
> > > 
> > > --- In equismetastock@xxxxxxxxxxxxxxx, "Ed Hoopes"
<reefbreak_sd@xxxx>
> > > wrote:
> > > > The problem that you are trying to solve is to extract some
> > > > information (trend) from a noisy signal.  My experience ( which
> comes
> > > > from chemical process control and stock trading ) is that the
> simplest
> > > > SMA or EMA will extract about 85% of the information content
from a
> > > > noisy signal.  So the improvements you seek by going to more
exotic
> > > > calculations will not improve things very much.
> > > > 
> > > > My goals for trenders, are:
> > > >      Fast response to trend changes
> > > >      Low rate of whipsaws
> > > > As you can see, these tend to be mutually exclusive.
> > > > 
> > > > The categories are:
> > > > 
> > > > Moving Averages:
> > > >      SMA's have a constant weight for each term of the average
> > > >      Variable weights for each term - EMA, WMA, Gaussian, etc
> > > >      Weights that change depending on some market condition - like
> > > > volatility( try ATR ) - Adaptive moving averages
> > > > 
> > > > Filters:
> > > >      There are many of these (mostly coming out of the electronics
> > > > industry) like a Kalman filter.  Kalman takes the previous
value of
> > > > the smoothed function and adds some fraction of the current
value of
> > > > the signal based on a complex formula.  (Kalman filters are
used to
> > > > position disk drive heads and guide smart bombs) You can look in
> > > > Google for Kalman filters, and will discover they are difficult
> > > > mathematically.  Also you will discover that MS - FL is entirely
> > > > inadequate to implement these - Better to use AmiBroker software -
> > > > cheaper and MUCH more powerful programming language.
> > > > 
> > > > Curve fitting:
> > > >      Here you fit some mathematical function to the price
data.  MS
> > > > has a linear least squares fit, but higher order fits work much
> > > > better.  (don't try programming a quadratic or cubic fit in MS
- FL)
> > > > Fourier transforms are also used, but mathematically complex.
> > > > 
> > > > ______________
> > > > 
> > > > My experience has been that there is some gold to be mined by
trying
> > > > to improve your trend following indicators, but not very much.  My
> > > > production trading system uses custom coded adaptive moving
average,
> > > > and curve fitting.
> > > > 
> > > > Cheers,
> > > > 
> > > > Ed Hoopes
> > > > 
> > > > 
> > > > 
> > > > 
> > > > --- In equismetastock@xxxxxxxxxxxxxxx, "tan ming"
> > > > <reminiscenostalgia@xxxx> wrote:
> > > > > This post hope to starts a discussion on what are the available
> > > > methods or 
> > > > > indicators which can effectively used to determine whether
current
> > > > price is 
> > > > > in a trend mode. Personally moving average is my main
indicator to
> > > > dtermine 
> > > > > trend. However as many of you guys know, it suffer when the
> > market is 
> > > > > starting going to a tradning range. Pls join in the discussion
> > on the 
> > > > > following topic:
> > > > > 
> > > > > 1) What are the effective methods or indicators to determine
> whether
> > > > the 
> > > > > current price is in a trend mode.
> > > > > 
> > > > > 2) What are the effective methods or indicators inorder to tell
> > > > whether the 
> > > > > current price in the early, middle or mature trend?
> > > > > 
> > > > > Great guys like Jose, Roy, MG and many of them in the forum pls
> > > > offer some 
> > > > > pointers.
> > > > > 
> > > > >
_________________________________________________________________
> > > > > Block pop-up ads with MSN Toolbar. http://toolbar.msn.com.my/




------------------------ Yahoo! Groups Sponsor --------------------~--> 
<font face=arial size=-1><a href="http://us.ard.yahoo.com/SIG=12hmph622/M=362343.6886682.7839641.1493532/D=groups/S=1705375617:TM/Y=YAHOO/EXP=1123699182/A=2894352/R=0/SIG=11fdoufgv/*http://www.globalgiving.com/cb/cidi/tsun.html";>Help tsunami villages rebuild at GlobalGiving. The real work starts now</a>.</font>
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/equismetastock/

<*> To unsubscribe from this group, send an email to:
    equismetastock-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/