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

Re: [amibroker] Re: to calculate the slope at any specific point on a curve by AFL.



PureBytes Links

Trading Reference Links

All: IMHO
If you take any two points off of a daily price array you may get the wrong slope, especially
if the price is volatile.  That's why some folks use a linear regression function and I expect
that's why TJ developed those functions. 
For example, when you look at a price plot and lay a straight edge to that plot, your eyes and gray matter
between your ears will fit a straight line to that plot.   Not exactly a linear regression(least squares fit) but you won't pick the points
that are outside the general trend.   Using ROC or picking  C and Ref(C,-10) to calc slope could lead to
an  error especially if the Close 10 bars 'ago' was an outlying price point...too high or too low to be
representative of  the straight line you would draw.
I have not tested this to see how much difference it would make but I would say you should at least use
the average of the price array to calculate the slope as described below.  
Now if you want momentum, use ROC..
 
JOE
 
----- Original Message -----
From: Bob Jagow
Sent: Tuesday, July 19, 2005 12:12 AM
Subject: RE: [amibroker] Re: to calculate the slope at any specific point on a curve by AFL.

Sorry, meant Berkshira H  c\Class A.

 

Sure convinced me, wm.

Looks like I can make a killing swing-trading BERK.

 

Bob

 

-----Original Message-----
From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx]On Behalf Of wavemechanic
Sent: Monday, July 18, 2005 7:29 PM
To: AmiBroker, User
Subject: Re: [amibroker] Re: to calculate the slope at any specific point on a curve by AFL.

 

Graham and Robert:

 

Graham, irrespective of your methodology, what you are doing is looking at momentum via ROC rather than a slope.  Apples and oranges.  At times, slope and momentum are in synch (i.e., both + or both -) and not at other times (think of velocity and acceleration).  There is a time for each.

 

Robert, if you want slope rather than momentum, just get the value for two bars separated by a specified number of bars and divide by the number of bars.  Here is a shot at the conditions that I think you specified with arbitrary parameters:

x1 = MA(C, 13);

x2 = MA(C, 34);

slope1 = (x1 - Ref(x1, -5) ) / 5;

slope2 = (x2 - Ref(x2, -8) ) / 8;

Buy = Cross(x1, x2) AND slope1 > .5;

Sell = Cross(x2, x1) AND slope2 < -.5;

 

----- Original Message -----

From: Graham

 

To: amibroker@xxxxxxxxxxxxxxx

Sent: Monday, July 18, 2005 7:40 PM

Subject: Re: [amibroker] Re: to calculate the slope at any specific point on a curve by AFL.

 

In order to compare various stocks I find it better to use relative
values. The slope of $101  and $51 price strocks that both have change
of $1 over the previous bar. If you consider normal slope
(y1-y2)(x1-x2) for 1 bar you get 1 for both stocks,
This tells me they are moving the same.
With relative slope 1/100 and 1/50 provide 0.01 and 0.02 showing the
rate faster for the $50 price stock.
This now tells me that the $50 is moving faster. This makes more sense to me

On 7/19/05, wavemechanic <fimdot@xxxxxxxxx> wrote:
> Graham:

> You lost me.  How does ROC(array, 1) = slope?  Aren't the following correct?

> ROC(array, i - n) = (array(i) - array(i - n) / array(i - n))

> and

> slope(i - n)  = (array(i) - array(i - n)) / (i - n)

> In other words, ROC divides the difference of two array values by the first
> array value and slope divides by the number of bars.  Sounds like apples and
> oranges to me.  What am I missing?

> Bill

>
> ----- Original Message -----
> From: Graham
> To: amibroker@xxxxxxxxxxxxxxx
> Sent: Monday, July 18, 2005 2:08 AM
> Subject: Re: [amibroker] Re: to calculate the slope at any specific point on
> a curve by AFL.
>
> Cond = Cross( MA (Close, 20), MA(Close, 50) );
> Cond1 = Cross( MA (Close, 50), MA(Close, 20) );
> Buy = Cond;
> Sell = Cond1;
>
> Well i pointed to using ROC
>
> Slope20 = ROC(ma(c,20),1);
> Slope50 = ROC(ma(c,50),1);
>
>
> to help yourself see what type of results use an exploration to provide
> numbers
>
> filter=cond or cond1;
> addcolumn(slope20,"slope20,1.3);
> addcolumn(slope50,"slope50,1.3);
>
> checking this against your charts you can work out the slope value you
> want, then add this to your buy/sell conditions, something like this
>
> eg
> buy = cond and roc(ma(c,20),1)>0.5;
>
>
>
> On 7/18/05, cstdc5588 <cstdc5588@xxxxxxxxx> wrote:
> > Hi Graham,
> >
> > Thanks a lot.  You're so nice.
> >
> > Actually, I just need one simple formula, i.e., when 2 moving avgs
> > cross, as in this formula:
> >
> > ///////
> > Cond = Cross( MA (Close, 20), MA(Close, 50) );
> > Cond1 = Cross( MA (Close, 50), MA(Close, 20) );
> > Buy = Cond;
> > Sell = Cond1;
> > ///////
> >
> > I hope when a fast MA crosses a slow MA from bottom upward, the
> > slope of the crossover tangent point of the fast MA is more than
> > 0.5.  On the other hand, when a fast MA crosses a slow MA from top
> > downward, the slope of the crossover tangent point of the fast MA is
> > less than -0.5.  That is, the "buy" signal must satisfy the
> > specified condition and with a slope > 0.5.  On the other hand,
> > the "sell" signal must satisfy the specified condition and
> > with a slope < -0.5.
> >
> > I understand that this slope must be calculated first, but I
> > don't know how to calculate it using AFL.
> >
> > Could you please help me with this function?  Your help would be
> > much appreciated.
> >
> > Robert.
> >
> >
> > --- In amibroker@xxxxxxxxxxxxxxx, Graham <kavemanperth@xxxx> wrote:
> > > Unless you need intensive help, or want someone else to just write
> > > them for you then stick with this group to help solve the little
> > > things.
> > > Don't know of any paid service, except maybe by AB. Checik with
> > the AB
> > > website and see if anything is there.
> > > Otherwise us freebie helpers can assist each other with the
> > learning curve.
> > >
> > > On 7/18/05, cstdc5588 <cstdc5588@xxxx> wrote:
> > > > Hi Graham,
> > > >
> > > > Thanks a lot.
> > > >
> > > > Because I don't know much about AFL, I need some help to do this.
> > > > I remember I've seen a link saying that someone can provide this
> > > > service (of course, there'll be a charge), but I can't find
> > > > it now.  Do you know about this service?  Where can I get it?
> > Any
> > > > suggestions?  Or do you know the link?
> > > >
> > > > Robert.
> > > >
> > > >
> > > > --- In amibroker@xxxxxxxxxxxxxxx, Graham <kavemanperth@xxxx>
> > wrote:
> > > > > just use ROC(indicator,1) to get slope, will be expressed as Y-
> > > > value/bar
> > > > >
> > > > > do a search for other posts of the same type if you want to
> > > > convert to
> > > > > some other value slope.
> > > > >
> > > > > On 7/18/05, cstdc5588 <cstdc5588@xxxx> wrote:
> > > > > > Hi Friends,
> > > > > >
> > > > > > I want to know whether the AFL of AmiBroker could be used to
> > > > > > calculate the slope at any specific point on a curve.
> > > > > >
> > > > > > For instance, if I want to find out the slope of the point
> > when
> > > > a 10-
> > > > > > period moving average crosses a 20-period moving average,
> > could
> > > > this
> > > > > > slope be calculated by AFL?  For the slope I hope it'll be
> > > > > > expressed as 3/2 or -0.5, not as 30 degrees or 45 degrees,
> > as the
> > > > > > latter is too complicated and needs to use trigonometry to
> > > > calculate.
> > > > > >
> > > > > > Any help would be much appreciated
> > > > > >
> > > > > > Robert.
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > 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 other support material please check also:
> > > > > > http://www.amibroker.com/support.html
> > > > > >
> > > > > >
> > > > > > Yahoo! Groups Links
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > > > --
> > > > > Cheers
> > > > > Graham
> > > > > http://e-wire.net.au/~eb_kavan/
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > 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 other support material please check also:
> > > > http://www.amibroker.com/support.html
> > > >
> > > >
> > > > Yahoo! Groups Links
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > >
> > >
> > > --
> > > Cheers
> > > Graham
> > > http://e-wire.net.au/~eb_kavan/
> >
> >
> >
> >
> >
> > 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 other support material please check also:
> > http://www.amibroker.com/support.html
> >
> >
> > Yahoo! Groups Links
> >
> >
> >
> >
> >
> >
> >
>
>
> --
> Cheers
> Graham
> http://e-wire.net.au/~eb_kavan/
>
>
> ________________________________
>
>
> No virus found in this incoming message.
> Checked by AVG Anti-Virus.
> Version: 7.0.323 / Virus Database: 267.9.0/50 - Release Date: 7/16/05
>
>
>
>
> 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 other support material please check also:
> http://www.amibroker.com/support.html
>
>
>
>
> ________________________________
> YAHOO! GROUPS LINKS
>
>  Visit your group "amibroker" on the web.
>  
>  To unsubscribe from this group, send an email to:
>  amibroker-unsubscribe@xxxxxxxxxxxxxxx
>  
>  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
>  To unsubscribe from this group, send an email to:
>  amibroker-unsubscribe@xxxxxxxxxxxxxxx
>  
>  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
>  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
> ________________________________
>


--
Cheers
Graham
http://e-wire.net.au/~eb_kavan/


No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.323 / Virus Database: 267.9.1/51 - Release Date: 7/18/05




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 other support material please check also:
http://www.amibroker.com/support.html





SPONSORED LINKS
Investment management software Investment property software Investment software
Investment tracking software Return on investment software Stock investment software


YAHOO! GROUPS LINKS