PureBytes Links
Trading Reference Links
|
--- In amibroker@xxxxxxxxxxxxxxx, "Ed Hoopes" <reefbreak_sd@xxx>
wrote:
>
> AB doesn't have a built in "Stat Pack", but the language is
certainly
> capable of calculating most anything you would want. I have coded
> various curve fitting functions other than the linear one included
in AB.
>
> As an example, I've included the correlation coefficient I coded as
a
> 'function'.
Thanks Ed.
You confirm what I suspected - that good coders can do these things
in AB.
I expect that I will try to make that climb at some stage (I can't
resist any old Mt Everest that appears in my path).
A handy function too - I see that Prof Aronson proposes correlation
among rule (backtested performance) returns as one of the five
factors that determine the degree of data-mining bias.
I got the formula from the book "Standard Math Tables"
> published by CRC.
If it doesn't take too long to type - any chance of the formula as it
appears in the CRC book - since I have some self interest in this one
it would make a good example for me to learn off - I can see how you
have transcribed a text book maths formula into a programming
language.
If it isn't a good idea or you are busy don't worry - no offence will
be taken.
>
> The X param is a custom time array.
> The Stk is a custom stock price array.
> The Pers param is the length.
>
> >>>>>>>>>>>>>>>>>>>>>>>>>>
> function Correl( Stk, X, Pers )
> { // Start of Correlation function;
>
> // Define global variables to be returned from function;
>
> global CorrelVal;
> global X;
> global Stk;
> global Pers;
>
> //Initialize variables;
> SUMX = 0.00; SUMY = 0.00; SUMXY = 0.00; SUMX2 =
0.00;
> SUMY2 = 0.00;
>
> //Calculate array values for X SUMS;
> for ( i = 0 ; i < Pers; i++ )
> {
> SUMX = SUMX + X[i];
> SUMX2 = SUMX2 + X[i] * X[i];
> }
>
> // Calculate values for Y, XY Sums;
> for ( i = 0; i < Pers; i++ )
> {
> SUMY = SUMY + Stk[i];
> SUMY2 = SUMY2 + Stk[i] * Stk[i];
> SUMXY = SUMXY + Stk[i] * X[i];
> }
>
> // Calculate more terms;
> TERM1 = Pers * SUMXY;
> TERM2 = SUMX * SUMY;
>
> TERM3 = Pers * SUMX2 - SUMX * SUMX;
> TERM4 = Pers * SUMY2 - SUMY * SUMY;
>
> // Calculate the correlation coefficient;
>
> CorrelVal = (Term1 - Term2) / (TERM3 * TERM4)^0.5;
>
> } // **** END OF FUNCTION **** ;
>
>
> --- In amibroker@xxxxxxxxxxxxxxx, "brian_z111" <brian_z111@> wrote:
> >
> > --- In amibroker@xxxxxxxxxxxxxxx, "bilbo0211" <bilbod@> wrote:
> > >
> > >
> > > I will give some examples of what I would like to be able to do.
> > >
> > > 1. http://www.topgunsoftware.com/ has some interesting trading
> > tools.
> > > One thing it does is make statistical range projections (i,e.,
next
> > > bar's high and low with confidence levels). I would like to do
> > > something similar with Amibroker.
> > >
> >
> > I have had a quick look at that site and yes, there are one or
two
> > interesting things there e.g. the idea that buyers/sellers taking
the
> > offer are agressive, cf passive traders who set a limit, and
> > therefore they are influencing the market in a way that allows
> > prediction is one of them. It's beyond the capabilities of most
> > traders to test that type of thing though - you have to be able
to
> > acquire, manage and analyse vast amounts of data 'on the fly'
(unless
> > you are willing to test their idea out with real money).
> >
> > (Now that I have said that someone will probably jump up and say
that
> > you can do it in AB).
> >
> > I use a lot of basic stats in my work so I am interested in your
> > comments - I describe myself as a naive mathematician though.
> >
> > Re statistical ranges with assigned probability levels (like a
> > probability cone?).
> >
> > I think you need to be absolutely clear what it is you are asking
for
> > before you can consider if it can be done e.g. they talk about
> > something called "statistical range projections" and somewhere
else
> > the "average bar range and vol" (they don't say how many bars the
> > average is calculated over) - are they related to each other or
> > separate?
> >
> > Whether or not you can model your ideas depends on how complex
the
> > model is that you envisage.
> > My model might be entirely different to yours so wouldn't we
first
> > have to agree on the model?
> >
> > Anyway AB definitely doesn't do frequency distributions and/or
plot
> > them.
> >
> >
> > > 2. I would like to do a statistical analysis of how often Pivot
> > Point
> > > S/R levels hold and see if there is any correlation to ATR.
> > >
> >
> > I guess by Pivots that you mean the (H+L+C)/3 version?
> > Once again you would need to clarify exactly what you want to do.
> > Possibly you are mixing two ideas together there.
> >
> > In Howard's book,Quantitative Trading Systems, he uses a 'hold
for x
> > days' stategy to benchmark entries, which is a fair enough method.
> > Volatility band crosses e.g. ATR bands is another method that I
have
> > used.
> >
> > Pivot S/R lines I would consider more as an exit method so I
would
> > test the efficiency of them as an exit strategy (stop loss and
profit
> > stop) in a different way (from memory Howard also gives example
> > methods for doing that).
> >
> > I have done similar things using very simple, albeit rather
tedious
> > methods, within AB (it is a good place to do it because I get the
> > visuals with the charts and also the Reports from Explorer to
back up
> > the study). I start with the simplist logic that I can boil it
all
> > down to and then see if I can do it in AB - if I can't, and it is
> > important, then it is time to go to another program - so far I
> > haven't found the need to use Matlab or similar.
> >
> > Not to dissuade you though - often our own ideas (hunches) lead
us to
> > the best outcomes, or 'learnings', when we follow them - I am
just
> > suggesting you power up the ideas.
> >
> > > 3. I would like to do a statistical analysis to see if there is
any
> > > bias as to when (time of day) the high and low occur.
> > >
> >
> > Kaufman provides a nice intro to this type of analysis in his
> > book "New Trading Systems and Methods" e.g. for S&P futures the
H/L
> > near the opening or close are significant.
> >
> > Pretty easy in AB if you have the data and the patience.
> >
> > > Does Amibroker have any built in functionality that makes these
kind
> > > of calculations easy?
> > >
> > > Bill
> > >
> >
> > Apparently it does!
> >
> > So far I seldom use any of the stats functions and I have done
> > everything I wanted to do using simple methods.
> > I do work a lot in my head though - so that the 'lab tests' are
well
> > organised,, and meaningful, by the time I get to do them (I
analyse
> > to prove, or disprove, the hypothesis not to find one).
> >
> > I do use Excel a lot because I am familiar with it (at an average
> > level of competency) - why scratch around trying to do stats
analysis
> > in AB, or another maths program, when I can have the job over and
> > done in Excel - it is actually only two clicks away from AB (from
the
> > users point of view what difference would it make if YTomasz
built-in
> > stats analysis - it would still be two clicks away at any given
time -
> > I doubt if Tomasz will ever build the functionality of Excel
into AB
> > anyway- after all Excel is a powerhouse in its own right so why
> > reinvent the wheel - it's just as easy to export to a specialist
> > maths/stats/graph program if you need it.
> >
> > FYI
> >
> > I did spend 100's or 1000's of hours in Excel studying the 'null
> > hypothesis' - the 'random walk' - otherwise known as an RNG (not
a
> > super-dooper one I know but good enough for my purposes).
> >
> > "Sometimes the best way find out 'what is' is to get a handle
> > on 'what isn't', especially if the little bugger is proving a bit
> > slippery to get a hold on.
> >
> > Here's to lots more stats fun in the future!
> >
> > brian_z
> >
>
Please note that this group is for discussion between users only.
To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com
For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
For other support material please check also:
http://www.amibroker.com/support.html
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/amibroker/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:amibroker-digest@xxxxxxxxxxxxxxx
mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx
<*> To unsubscribe from this group, send an email to:
amibroker-unsubscribe@xxxxxxxxxxxxxxx
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|