PureBytes Links
Trading Reference Links
|
OK, thanks Robert, I get it now. In addition to Graham's answer, and going
back to your original post below, I think this is what you are looking to
do:
( Since you are using 5 min charts, I am assuming by wma you mean weighted
rather than weekly MA? )
WMA10 = WMA( Close, 10 ); // create 10pd WMA of Close
WMA20 = WMA( Close, 20 ); // and 20 pd WMA
Crosses = Cross( WMA10, WMA20) // mark bars with 10 crossing above 20
OR Cross( WMA20, WMA10 ) // and bars with 10 crossing below 20;
P4 = ValueWhen( Crosses, WMA10 ); // value of WMA when cross occurs
P3 = ValueWhen( Crosses, Ref( WMA10, -1 ); // and 1 bar before cross
P2 = ValueWhen( Crosses, Ref( WMA10, -2 ); // 2 bars before
P1 = ValueWhen( Crosses, Ref( WMA10, -3 ); // 3 bars before
Steve
----- Original Message -----
From: "Graham" <kavemanperth@xxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Tuesday, August 09, 2005 3:34 AM
Subject: Re: [amibroker] Re: to calculate the value of the point 'P'
>" I'm not clear that if AmiBroker uses which one of the prices to
> calculate MA. Does it use Close, Open, High, or Low? "
>
> AB uses whatever you put into it
> MA(C,10) or MA(O,10) or MA(H,10) or even MA( RSI(10), 10 ) or MA( (H+L)/2,
> 10)
>
> what is normal convention is to use the closing price, but that is
> just the norm from all the books you read. It just depends entirely on
> what you are wanting to calculate
>
> On 8/9/05, cstdc5588 <cstdc5588@xxxxxxxxx> wrote:
>> Hi Graham, Steve and All,
>>
>> Thanks for reply.
>>
>> I want to repeat that this is a special formula. Because the MA of
>> stock prices is a non-connecting curve, looking from the strict
>> mathematic sense, the tangent line does not exist at the P point,
>> and thus there's no slope to calculate. We only can use the
>> mathematical method to simulate a formula, therefore the value to be
>> calculated will not be precise, but will be the approximate value. I
>> asked a mathematician to get the above formula. The simulation
>> process is a little complex, but the formula actually is amazingly
>> simple. This formula uses some limiting conditions. I manually
>> calculated many slopes of the tangent lines at various
>> intersections, and the results have been very satisfying.
>>
>> My question is: How to use AFL to calculate some P value on MA.
>>
>> I'm not clear that if AmiBroker uses which one of the prices to
>> calculate MA. Does it use Close, Open, High, or Low? I suspect it
>> uses Close. I think the best way should use the data that's
>> consistent with the AmiBroker. I've already done a lot of
>> research, but I haven't discovered any contents related to how to
>> use AFL to calculate some P value on MA.
>>
>> Any help is appreciated.
>>
>> Robert
>>
>>
>>
>> --- In amibroker@xxxxxxxxxxxxxxx, Graham <kavemanperth@xxxx> wrote:
>> > all you ahve to do is insert the values you want into the basic
>> slope equation
>> > example for a certain bar, or between 2 bars
>> > Curve = MA(C,10);
>> > slope = (Y2-Y1)/(X2-X1) = ( Valuewhen(barindex()==124,Curve) -
>> > Valuewhen(barindex()==123,Curve) ) / ( 124 - 123 );
>> >
>> >
>> >
>> >
>> >
>> > "calculate the value of a specific point on the MA, not the actual
>> > close price of the stock at the corresponding time (i.e., close
>> > price per bar)."
>> >
>> > On 8/8/05, cstdc5588 <cstdc5588@xxxx> wrote:
>> > > Hi Graham,
>> > >
>> > > Thank you for your reply.
>> > >
>> > > I have searched all about slope posts, but I can't find any
>> > > answers. That's because I have a special formula. It isn't
>> > > a general formula which used to calculate slope. I need to
>> > > calculate the value of a specific point on the MA, not the actual
>> > > close price of the stock at the corresponding time (i.e., close
>> > > price per bar).
>> > >
>> > > I also searched AFL library, but I haven't find any related
>> > > contents which involve how to calculate the value of a specific
>> > > point on the MA.
>> > >
>> > > Any help is appreciated.
>> > >
>> > > Robert.
>> > >
>> > >
>> > > --- In amibroker@xxxxxxxxxxxxxxx, Graham <kavemanperth@xxxx>
>> wrote:
>> > > > a search on slope would give you the answers, but in a
>> anutshell
>> > > > slope = (Y2-Y1)/(X2-X1);
>> > > > just substitute the values for the X's and Y's
>> > > >
>> > > >
>> > > > On 8/7/05, cstdc5588 <cstdc5588@xxxx> wrote:
>> > > > > Hi All,
>> > > > >
>> > > > > I want to calculate the slope of the tangent line at the
>> crossing
>> > > > > point of 2 moving averages. Suppose there are 2 MAs, 10wma
>> and
>> > > 20
>> > > > > wma. K10wma = the slope of the line tangent to the 10wma at
>> the
>> > > > > crossing point.
>> > > > >
>> > > > > K10wma = (A1P1-A2P2-A3P3+A4P4)*n, where a is a constant,
>> > > > > P4 = the value of 10 wma at the crossing point,
>> > > > > P3 = the value at the point just before the crossing
>> > > point,
>> > > > > P2 = the value at the point before P3,
>> > > > > P1 = the value at the point before P2,
>> > > > > and n = the coefficient of the prices at the y-axis.
>> > > > >
>> > > > > I need to stress that `P' is the value of a specific point on
>> > > > > the wma, not the actual close price of the stock at the
>> > > > > corresponding time.
>> > > > >
>> > > > > My question is: if I use a 5-minute real-time chart, then
>> how
>> > > can I
>> > > > > use AFL to calculate the value of P?
>> > > > >
>> > > > > Any help is 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
>> > > > AB-Write >< Professional AFL Writing Service
>> > > > Yes, I write AFL code to your requirements
>> > > > http://e-wire.net.au/~eb_kavan/ab_write.htm
>> > >
>> > >
>> > >
>> > >
>> > >
>> > > 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
>> > AB-Write >< Professional AFL Writing Service
>> > Yes, I write AFL code to your requirements
>> > http://e-wire.net.au/~eb_kavan/ab_write.htm
>>
>>
>>
>>
>>
>> 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
> AB-Write >< Professional AFL Writing Service
> Yes, I write AFL code to your requirements
> http://e-wire.net.au/~eb_kavan/ab_write.htm
>
>
>
> 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
>
>
>
>
>
>
>
>
------------------------ Yahoo! Groups Sponsor --------------------~-->
<font face=arial size=-1><a href="http://us.ard.yahoo.com/SIG=12h01vfap/M=362343.6886682.7839641.1493532/D=groups/S=1705632198:TM/Y=YAHOO/EXP=1123605508/A=2894350/R=0/SIG=10tj5mr8v/*http://www.globalgiving.com">Make a difference. Find and fund world-changing projects at GlobalGiving</a>.</font>
--------------------------------------------------------------------~->
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
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
<*> 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/
|