PureBytes Links
Trading Reference Links
|
http://groups.yahoo.com/group/amibroker/message/17288
For PnF.dll information.
Peter
-----Original Message-----
From: bluesinvestor [mailto:investor@x...]
Sent: Friday, July 19, 2002 4:23 PM
To: amibroker@xxxxxxxxxxxxxxx
Subject: RE: [amibroker] Re: Point & Figure Chart in AFL
Hello Mirat,
Good stuff!! I made some modifications to your code to call my Point &
Figure DLL and plot the data using your jscript code. I tested it on one
stock (PYPL - short history) and it looks correct (except for the beginning
bars:
I have attached the AFL to this email (and posted below for Yahoo
viewers).
Thanks again,
Peter
// PF Chart by Mirat Dave
// Copy and paste this as a custom indicator.
x=calcPnF(0,3);
EnableScript("jscript");
<%
PnFValue = VBArray( AFL( "PnFVal" ) ).toArray();
PnFColumn = VBArray( AFL( "PnFCol" ) ).toArray();
// Calculate running average stock price for use in calculating the Box
size.
PFO = new Array();
PFC = new Array();
// initialize first element
j = 0;
PFO[j] = PnFValue[0];
PFC[j] = PnFValue[0];
// perform the loop that produces PF Chart
for( i = 1; i < PnFValue.length; i++ )
{
if ( PnFColumn[i] == 0 )
{
if( PnFColumn[i] == 0 && PnFColumn[i-1] == 0)
{
PFC[j] = PnFValue[i];
}
if( PnFColumn[i] == 0 && PnFColumn[i-1] != 0 )
{
j++;
PFC[j] = PnFValue[i];
PFO[j] = PnFValue[i-1];
}
}
else
{
if (PnFColumn[i] == 1)
{
if( PnFColumn[i] == 1 && PnFColumn[i-1] == 1 )
{
PFC[j] = PnFValue[i];
}
if( PnFColumn[i] == 1 && PnFColumn[i-1] != 1 )
{
j++;
PFO[j] = PnFValue[i-1];
PFC[j] = PnFValue[i];
}
}
}
}
// Shift chart to the right to eliminate trailing empty data
// - PF charts are generally smaller/shorter then the full stock charts
because they lack a time scale.
delta = PnFValue.length - PFO.length;
for( i = PnFValue.length; i > delta; i-- )
{
PFO[ i-1 ] = PFO[ i-delta-1];
PFC[ i-1 ] = PFC[ i-delta-1];
}
for( i = 0; i < delta; i++)
{
PFO[ i-1 ] = 0;
PFC[ i-1 ] = 0;
}
AFL.Var("delta") = delta;
AFL.Var("length") = PnFValue.length;
AFL.Var("PFO") = PFO;
AFL.Var("PFC") = PFC;
%>
O = PFO;
C = PFC;
H = (O+C)/2;
L = (O+C)/2;
GraphXSpace = 9;
Graph0Style = 64;
Graph0Color =1;
Graph0 = C;
Filter=C>0;
AddColumn(PFO,"PFO");
AddColumn(PFC,"PFC");
-----Original Message-----
From: mirat_dave [mailto:mirat_dave@x...]
Sent: Friday, July 19, 2002 10:00 AM
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] Re: Point & Figure Chart in AFL
Hello Richard and Dimitris,
Sorry to have caused so much confusion.
Since most stocks since 2000 have been trending down, you may get a
only a few bars because the P&F Chart ignores small up moves and only
extends down bars when the price moves more than the box size. Since
2000, you may very well have only a few bars. Try loading more data
for at least one stock.
I used AmiQuote and Yahoo for the data. I have data from January
1994. The AmiBroker version on which I created this file is 4.0.0
Apr 26 2002.
I do not know if the AmiBroker version is causing the difference. I
saw that it worked for Richard on MSFT (although I am not sure what
the whole MSFT v. MSFT issue was - it seems to have resolved
itself). Perhaps Richard also has more data loaded.
As you can see from the script, it is very simple. If problems
continue, I would be happy to go through it in detail to see if there
is a coding error.
I'm afraid I have no other explanation other than more data. Let's
try that first.
Mirat
PS I would post .gifs of my charts but I do not know how to attach a
file to my reply. Although that would not help resolve the issue. :-)
--- In amibroker@xxxx, "Richard Alford" <richard.alford@xxxx> wrote:
> I am just isolating variables. If we have the same program and
version (4.06.1 Jun 19 build), the same indicator code (this I
confirmed) and same data we should get the same result. (I continue
to believe in deterministic computing - probably naive in light of
Microsoft!). The questionable variable, and a big one, is the data
source - I use qp2. Perhaps someone using yahoo could compare to
your results?
>
>
> It does appear that the "box size", the significant change that
defines an X or O in my understanding, should be normalized to the
price of the instrument to account for the difference in WCOME
pricing vs. DJIA, for example. I am referring to the code fragment:
>
> // Calculate PF Chart Box size and minimum Reverse values
> // Box = ((tot[i]/(i+1))^.5)/7.3374;
>
> Cheers,
>
> Richard
> ----- Original Message -----
> From: dtsokakis
> To: amibroker@xxxx
> Sent: Wednesday, July 17, 2002 2:49 PM
> Subject: [amibroker] Re: Point & Figure Chart in AFL
>
>
> Richard,
> YHOO via Amiquote.
> Why do you think it is a matter of data provider ?
> Dimitris Tsokakis
>
> --- In amibroker@xxxx, "Richard Alford" <richard.alford@xxxx>
wrote:
> > but the point remains that you and I get different results.
what
> is your data source?
> >
> > Richard
> > ----- Original Message -----
> > From: dtsokakis
> > To: amibroker@xxxx
> > Sent: Wednesday, July 17, 2002 1:47 PM
> > Subject: [amibroker] Re: Point & Figure Chart in AFL
> >
> >
> > Richard,
> > ANY other function works just fine with my valuable Amibroker
> 4.06.
> > Just fine.
> > I can not see the reason for this P&F script.
> > Anyway, the author perhaps could expain.
> > Dimitris Tsokakis
> >
> > --- In amibroker@xxxx, "Richard Alford" <richard.alford@xxxx>
> wrote:
> > > DT, I agree it was not easy to understand. The attached
charts
> > showed the TWO results that were generated whenever I entered
the
> > symbol MSFT - it appears to be a fluke and I cannot reproduce
it
> any
> > longer. Although there is not ticker name in the formula,
there
> was
> > strange behavior occurring for MSFT and MSFT only at that
time.
> > >
> > > The gist of my reply to you was that using the SAME code as
you
> > posted and using the code I copied from the files sections, I
> > generated the same results - and not the results that you
were
> > creating. That suggests that you have a problem in your data
> and/or
> > setup. The only reason for the two codes was to guarantee
that
> there
> > wasn't a subtle error - there was not.
> > >
> > > Sorry for adding the confusion about the MSFT fluke at the
same
> > time.
> > >
> > > Cheers,
> > >
> > > Richard
> > > ----- Original Message -----
> > > From: dtsokakis
> > > To: amibroker@xxxx
> > > Sent: Wednesday, July 17, 2002 12:47 AM
> > > Subject: [amibroker] Re: Point & Figure Chart in AFL
> > >
> > >
> > > Richard,
> > > It is not easy to understand this
> > > "the plot for MSFT changes when one changes the symbol go
> MSFT
> > from
> > > MSFT??? "
> > > I copied the formula from
> > > http://groups.yahoo.com/group/amibroker/files/Point-Figure
> > > pasted in my Ind. builder and get the posted gifs.
> > > No ticker name is into the formula.
> > > What is "the two MSFT " ???
> > > Do you use the same code from the above address??
> > > DT
> > >
> > >
> > > --- In amibroker@xxxx, "Richard Alford"
<richard.alford@xxxx>
> > wrote:
> > > > Those are not the figures I generate using the code in
> > the "files
> > > section". (Why wasn't this put in the AFL library is a
> question
> > in
> > > my mind???)
> > > >
> > > > Just noticed that the plot for MSFT changes when one
> changes
> > the
> > > symbol go MSFT from MSFT??? Not the case for AMZN or
ORCL?
> > > >
> > > > I attached the two MSFT for comparison, one is "my"
copy,
> and
> > the
> > > other is a copy and paste of the code in your note. The
> > difference
> > > is the quirk in MSFT, not an error in the code you have
used.
> And
> > DT
> > > do you really like black on blue borders? Personally, I
can
> > never
> > > read your chart titles.
> > > >
> > > > Cheers,
> > > >
> > > > Richard
> > > >
> > > >
> > > > ----- Original Message -----
> > > > From: Dimitris Tsokakis
> > > > To: amibroker@xxxx
> > > > Sent: Tuesday, July 16, 2002 1:14 PM
> > > > Subject: [amibroker] Re: Point & Figure Chart in AFL
> > > >
> > > >
> > > > Mirat,
> > > > Here is P&F charts for AMZN, MSFT and ORCL.
> > > > Data since Jan 2000.
> > > > Is it the expected picture ?
> > > > The code, copied from files section
> > > >
> > > > // PF Chart by Mirat Dave
> > > > // Copy and paste this as a custom indicator.
> > > >
> > > > EnableScript("jscript");
> > > > <%
> > > >
> > > > High = VBArray( AFL( "High" ) ).toArray();
> > > > Low = VBArray( AFL( "Low" ) ).toArray();
> > > >
> > > > // Calculate running average stock price for use in
> > calculating
> > > the Box size.
> > > >
> > > > tot = new Array();
> > > > tot[0] = (High[0] + Low[0])/2;
> > > > for( i=1; i < High.length; i++ )
> > > > {
> > > > tot[i] = tot[i-1] + ((High[i] + Low[i])/2);
> > > > }
> > > > PFO = new Array();
> > > > PFC = new Array();
> > > >
> > > > // initialize first element
> > > >
> > > > j = 0;
> > > > PFO[j] = High[0];
> > > > PFC[j] = Low[0];
> > > > down = 1; // By default the first bar is a down bar.
> > > >
> > > > up = 0;
> > > > swap = 0;
> > > >
> > > > // perform the loop that produces PF Chart
> > > >
> > > > for( i = 1; i < High.length; i++ )
> > > > {
> > > > // Calculate PF Chart Box size and minimum Reverse
values
> > > >
> > > > Box = ((tot[i]/(i+1))^.5)/7.3374;
> > > > Reverse = Box * 3;
> > > > if( Low[i] < PFC[j] - Box && down)
> > > > {
> > > > PFC[j] = Low[i];
> > > > }
> > > > else
> > > > {
> > > > if( High[i] >= PFC[j] + Reverse && down)
> > > > {
> > > > j++;
> > > > swap = 1;
> > > > PFO[j] = Low[i];
> > > > PFC[j] = High[i];
> > > > }
> > > > }
> > > > if( High[i] > PFC[j] + Box && up)
> > > > {
> > > > PFC[j] = High[i];
> > > > }
> > > > else
> > > > {
> > > > if( Low[i] <= PFC[j] - Reverse && up)
> > > > {
> > > > j++;
> > > > PFC[j] = Low[i];
> > > > PFO[j] = High[i];
> > > > swap = 1;
> > > > }
> > > > }
> > > > if( swap )
> > > > {
> > > > swap = 0;
> > > > if( up )
> > > > {
> > > > up = 0;
> > > > down = 1;
> > > > }
> > > > else
> > > > {
> > > > up = 1;
> > > > down = 0;
> > > > }
> > > > }
> > > > }
> > > >
> > > > // Shift chart to the right to eliminate trailing
empty
> data
> > > > // - PF charts are generally smaller/shorter then the
> full
> > stock
> > > charts because they lack a time scale.
> > > >
> > > > delta = High.length - PFO.length;
> > > > for( i = High.length; i > delta; i-- )
> > > > {
> > > > PFO[ i-1 ] = PFO[ i-delta-1];
> > > > PFC[ i-1 ] = PFC[ i-delta-1];
> > > > }
> > > > for( i = 0; i < delta; i++)
> > > > {
> > > > PFO[ i-1 ] = 0;
> > > > PFC[ i-1 ] = 0;
> > > > }
> > > > AFL.Var("PFO") = PFO;
> > > > AFL.Var("PFC") = PFC;
> > > > %>
> > > >
> > > > O = PFO;
> > > > C = PFC;
> > > >
> > > > H = (O+C)/2;
> > > > L = (O+C)/2;
> > > >
> > > > GraphXSpace = 9;
> > > > Graph0Style = 64;
> > > >
> > > > Graph0Color =1;
> > > > Graph0 = C;
> > > >
> > > > Thanks in advance for any reply.
> > > > Dimitris Tsokakis
> > > >
> > > > Yahoo! Groups Sponsor
> > > >
> > > > Click here to find your contact lenses!
> > > >
> > > > Your use of Yahoo! Groups is subject to the Yahoo!
Terms
> of
> > > Service.
> > >
> > >
> > > Yahoo! Groups Sponsor
> > > ADVERTISEMENT
> > >
> > >
> > >
> > > Your use of Yahoo! Groups is subject to the Yahoo! Terms
of
> > Service.
> >
> >
> > Yahoo! Groups Sponsor
> > ADVERTISEMENT
> >
> >
> >
> > Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> Service.
>
>
> Yahoo! Groups Sponsor
> ADVERTISEMENT
>
>
>
> Your use of Yahoo! Groups is subject to the Yahoo! Terms of
Service.
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
------=_NextPart_001_0085_01C22F41.830ECC40
Content-Type: text/html;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE></TITLE>
<META http-equiv=3DContent-Type content=3D"text/html; charset=3Dus-ascii">
<META content=3D"MSHTML 5.50.4916.2300" name=3DGENERATOR></HEAD>
<BODY>
<DIV><SPAN class=3D741082920-19072002><FONT face=3DArial color=3D#0000ff si=
ze=3D2>Forgot=20
to mention:</FONT></SPAN></DIV>
<DIV><SPAN class=3D741082920-19072002><FONT face=3DArial color=3D#0000ff=20
size=3D2></FONT></SPAN> </DIV>
<DIV><SPAN class=3D741082920-19072002><FONT face=3DArial color=3D#0000ff si=
ze=3D2><A=20
href=3D"http://groups.yahoo.com/group/amibroker/message/17288">http://group=
s.yahoo.com/group/amibroker/message/17288</A></FONT></SPAN></DIV>
<DIV><SPAN class=3D741082920-19072002><FONT face=3DArial color=3D#0000ff=20
size=3D2></FONT></SPAN> </DIV>
<DIV><SPAN class=3D741082920-19072002><FONT face=3DArial color=3D#0000ff si=
ze=3D2>For=20
PnF.dll information.</FONT></SPAN></DIV>
<DIV><SPAN class=3D741082920-19072002><FONT face=3DArial color=3D#0000ff=20
size=3D2></FONT></SPAN> </DIV>
<DIV><SPAN class=3D741082920-19072002><FONT face=3DArial color=3D#0000ff=20
size=3D2>Peter</FONT></SPAN></DIV>
<BLOCKQUOTE dir=3Dltr style=3D"MARGIN-RIGHT: 0px">
<DIV class=3DOutlookMessageHeader dir=3Dltr align=3Dleft><FONT face=3DTah=
oma=20
size=3D2>-----Original Message-----<BR><B>From:</B> bluesinvestor=20
[mailto:investor@x...]<BR><B>Sent:</B> Friday, July 19, 2002 4:2=
3=20
PM<BR><B>To:</B> amibroker@xxxxxxxxxxxxxxx<BR><B>Subject:</B> RE: [amibro=
ker]=20
Re: Point & Figure Chart in AFL<BR><BR></FONT></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2>Hello Mirat,</FONT></DIV=
>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2>Good stuff!! I mad=
e some=20
modifications to your code to call my Point & Figure DLL and plot the=
data=20
using your jscript code. I tested it on one stock (PYPL - short his=
tory)=20
and it looks correct (except for the beginning bars:</FONT></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2></FONT> </DIV>
<DIV><IMG alt=3D"" hspace=3D0 src=3D"cid:741082920@xxxx" align=
=3Dbaseline=20
border=3D0></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2></FONT> </DIV>
<DIV><IMG alt=3D"" hspace=3D0 src=3D"cid:741082920@xxxx" align=
=3Dbaseline=20
border=3D0></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2>I have attached the AFL =
to this=20
email (and posted below for Yahoo viewers).</FONT></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2>Thanks again,</FONT></DI=
V>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2>Peter</FONT></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2><FONT color=3D#008000 si=
ze=3D1>
<P>// PF Chart by Mirat Dave</P>
<P>// Copy and paste this as a custom indicator.</P></FONT><FONT color=3D=
#000000=20
size=3D1>
<P>x=3D</FONT><FONT color=3D#0000ff size=3D1>calcPnF</FONT><FONT color=3D=
#000000=20
size=3D1>(</FONT><FONT color=3D#ff00ff size=3D1>0</FONT><FONT color=3D#00=
0000=20
size=3D1>,</FONT><FONT color=3D#ff00ff size=3D1>3</FONT><FONT color=3D#00=
0000=20
size=3D1>);</P></FONT><FONT color=3D#0000ff size=3D1>
<P>EnableScript</FONT><FONT color=3D#000000 size=3D1>(</FONT><FONT color=
=3D#ff00ff=20
size=3D1>"jscript"</FONT><FONT color=3D#000000 size=3D1>);</P>
<P><%</P>
<P>PnFValue =3D VBArray( AFL( </FONT><FONT color=3D#ff00ff=20
size=3D1>"PnFVal"</FONT><FONT color=3D#000000 size=3D1> ) ).toArray();</P=
>
<P>PnFColumn =3D VBArray( AFL( </FONT><FONT color=3D#ff00ff=20
size=3D1>"PnFCol"</FONT><FONT color=3D#000000 size=3D1> )=20
).toArray();</P></FONT><FONT color=3D#008000 size=3D1>
<P>// Calculate running average stock price for use in calculating the Bo=
x=20
size.</P></FONT><FONT color=3D#000000 size=3D1>
<P>PFO =3D new Array();</P>
<P>PFC =3D new Array();</P></FONT><FONT color=3D#008000 size=3D1>
<P>// initialize first element</P></FONT><FONT color=3D#000000 size=3D1>
<P>j =3D </FONT><FONT color=3D#ff00ff size=3D1>0</FONT><FONT color=3D#000=
000=20
size=3D1>;</P>
<P>PFO[j] =3D PnFValue[</FONT><FONT color=3D#ff00ff size=3D1>0</FONT><FON=
T=20
color=3D#000000 size=3D1>];</P>
<P>PFC[j] =3D PnFValue[</FONT><FONT color=3D#ff00ff size=3D1>0</FONT><FON=
T=20
color=3D#000000 size=3D1>];</P></FONT><FONT color=3D#008000 size=3D1>
<P>// perform the loop that produces PF Chart</P></FONT><FONT color=3D#00=
0000=20
size=3D1>
<P>for( i =3D </FONT><FONT color=3D#ff00ff size=3D1>1</FONT><FONT color=
=3D#000000=20
size=3D1>; i < PnFValue.length; i++ )</P>
<P>{</P>
<P>if ( PnFColumn[i] =3D=3D </FONT><FONT color=3D#ff00ff size=3D1>0</FONT=
><FONT=20
color=3D#000000 size=3D1> ) </P>
<P>{</P>
<P>if( PnFColumn[i] =3D=3D </FONT><FONT color=3D#ff00ff size=3D1>0</FONT>=
<FONT=20
color=3D#000000 size=3D1> && PnFColumn[i-</FONT><FONT color=3D#ff=
00ff=20
size=3D1>1</FONT><FONT color=3D#000000 size=3D1>] =3D=3D </FONT><FONT col=
or=3D#ff00ff=20
size=3D1>0</FONT><FONT color=3D#000000 size=3D1>)</P>
<P>{</P>
<P>PFC[j] =3D PnFValue[i];</P>
<P>}</P>
<P>if( PnFColumn[i] =3D=3D </FONT><FONT color=3D#ff00ff size=3D1>0</FONT>=
<FONT=20
color=3D#000000 size=3D1> && PnFColumn[i-</FONT><FONT color=3D#ff=
00ff=20
size=3D1>1</FONT><FONT color=3D#000000 size=3D1>] !=3D </FONT><FONT color=
=3D#ff00ff=20
size=3D1>0</FONT><FONT color=3D#000000 size=3D1> )</P>
<P>{</P>
<P>j++;</P>
<P>PFC[j] =3D PnFValue[i];</P>
<P>PFO[j] =3D PnFValue[i-</FONT><FONT color=3D#ff00ff size=3D1>1</FONT><F=
ONT=20
color=3D#000000 size=3D1>];</P>
<P>}</P>
<P>}</P>
<P>else</P>
<P>{</P>
<P>if (PnFColumn[i] =3D=3D </FONT><FONT color=3D#ff00ff size=3D1>1</FONT>=
<FONT=20
color=3D#000000 size=3D1>)</P>
<P>{</P>
<P>if( PnFColumn[i] =3D=3D </FONT><FONT color=3D#ff00ff size=3D1>1</FONT>=
<FONT=20
color=3D#000000 size=3D1> && PnFColumn[i-</FONT><FONT color=3D#ff=
00ff=20
size=3D1>1</FONT><FONT color=3D#000000 size=3D1>] =3D=3D </FONT><FONT col=
or=3D#ff00ff=20
size=3D1>1</FONT><FONT color=3D#000000 size=3D1> )</P>
<P>{</P>
<P>PFC[j] =3D PnFValue[i];</P>
<P>}</P>
<P>if( PnFColumn[i] =3D=3D </FONT><FONT color=3D#ff00ff size=3D1>1</FONT>=
<FONT=20
color=3D#000000 size=3D1> && PnFColumn[i-</FONT><FONT color=3D#ff=
00ff=20
size=3D1>1</FONT><FONT color=3D#000000 size=3D1>] !=3D </FONT><FONT color=
=3D#ff00ff=20
size=3D1>1</FONT><FONT color=3D#000000 size=3D1> )</P>
<P>{</P>
<P>j++;</P>
<P>PFO[j] =3D PnFValue[i-</FONT><FONT color=3D#ff00ff size=3D1>1</FONT><F=
ONT=20
color=3D#000000 size=3D1>];</P>
<P>PFC[j] =3D PnFValue[i];</P>
<P>}</P>
<P>}</P>
<P>}</P>
<P>}</P></FONT><FONT color=3D#008000 size=3D1>
<P>// Shift chart to the right to eliminate trailing empty data</P>
<P>// - PF charts are generally smaller/shorter then the full stock chart=
s=20
because they lack a time scale.</P></FONT><FONT color=3D#000000 size=3D1>
<P>delta =3D PnFValue.length - PFO.length;</P>
<P>for( i =3D PnFValue.length; i > delta; i-- )</P>
<P>{</P>
<P>PFO[ i-</FONT><FONT color=3D#ff00ff size=3D1>1</FONT><FONT color=3D#00=
0000=20
size=3D1> ] =3D PFO[ i-delta-</FONT><FONT color=3D#ff00ff size=3D1>1</FON=
T><FONT=20
color=3D#000000 size=3D1>];</P>
<P>PFC[ i-</FONT><FONT color=3D#ff00ff size=3D1>1</FONT><FONT color=3D#00=
0000=20
size=3D1> ] =3D PFC[ i-delta-</FONT><FONT color=3D#ff00ff size=3D1>1</FON=
T><FONT=20
color=3D#000000 size=3D1>];</P>
<P>}</P>
<P>for( i =3D </FONT><FONT color=3D#ff00ff size=3D1>0</FONT><FONT color=
=3D#000000=20
size=3D1>; i < delta; i++)</P>
<P>{</P>
<P>PFO[ i-</FONT><FONT color=3D#ff00ff size=3D1>1</FONT><FONT color=3D#00=
0000=20
size=3D1> ] =3D </FONT><FONT color=3D#ff00ff size=3D1>0</FONT><FONT color=
=3D#000000=20
size=3D1>;</P>
<P>PFC[ i-</FONT><FONT color=3D#ff00ff size=3D1>1</FONT><FONT color=3D#00=
0000=20
size=3D1> ] =3D </FONT><FONT color=3D#ff00ff size=3D1>0</FONT><FONT color=
=3D#000000=20
size=3D1>;</P>
<P>}</P>
<P>AFL.Var(</FONT><FONT color=3D#ff00ff size=3D1>"delta"</FONT><FONT colo=
r=3D#000000=20
size=3D1>) =3D delta;</P>
<P>AFL.Var(</FONT><FONT color=3D#ff00ff size=3D1>"length"</FONT><FONT=20
color=3D#000000 size=3D1>) =3D PnFValue.length;</P>
<P>AFL.Var(</FONT><FONT color=3D#ff00ff size=3D1>"PFO"</FONT><FONT color=
=3D#000000=20
size=3D1>) =3D PFO;</P>
<P>AFL.Var(</FONT><FONT color=3D#ff00ff size=3D1>"PFC"</FONT><FONT color=
=3D#000000=20
size=3D1>) =3D PFC;</P>
<P>%></P><B>
<P>O</B> =3D PFO;</P><B>
<P>C</B> =3D PFC;</P><B>
<P>H</B> =3D (<B>O</B>+<B>C</B>)/</FONT><FONT color=3D#ff00ff size=3D1>2<=
/FONT><FONT=20
color=3D#000000 size=3D1>;</P><B>
<P>L</B> =3D (<B>O</B>+<B>C</B>)/</FONT><FONT color=3D#ff00ff size=3D1>2<=
/FONT><FONT=20
color=3D#000000 size=3D1>;</P><B>
<P>GraphXSpace</B> =3D </FONT><FONT color=3D#ff00ff size=3D1>9</FONT><FON=
T=20
color=3D#000000 size=3D1>;</P><B>
<P>Graph0Style</B> =3D </FONT><FONT color=3D#ff00ff size=3D1>64</FONT><FO=
NT=20
color=3D#000000 size=3D1>;</P><B>
<P>Graph0Color</B> =3D</FONT><FONT color=3D#ff00ff size=3D1>1</FONT><FONT=
=20
color=3D#000000 size=3D1>;</P><B>
<P>Graph0</B> =3D <B>C</B>;</P><B>
<P>Filter</B>=3D<B>C</B>></FONT><FONT color=3D#ff00ff size=3D1>0</FONT=
><FONT=20
color=3D#000000 size=3D1>;</P></FONT><FONT color=3D#0000ff size=3D1>
<P>AddColumn</FONT><FONT color=3D#000000 size=3D1>(PFO,</FONT><FONT color=
=3D#ff00ff=20
size=3D1>"PFO"</FONT><FONT color=3D#000000 size=3D1>);</P></FONT><FONT co=
lor=3D#0000ff=20
size=3D1>
<P>AddColumn</FONT><FONT color=3D#000000 size=3D1>(PFC,</FONT><FONT color=
=3D#ff00ff=20
size=3D1>"PFC"</FONT><FONT color=3D#000000 size=3D1>);</P></FONT></FONT><=
/DIV>
<DIV><BR><BR></DIV>
<P><FONT size=3D2>-----Original Message-----<BR>From: mirat_dave [<A=20
href=3D"mailto:mirat_dave@xxxx">mailto:mirat_dave@x...</A>]<BR>=
Sent:=20
Friday, July 19, 2002 10:00 AM<BR>To: amibroker@xxxxxxxxxxxxxxx<BR>Subjec=
t:=20
[amibroker] Re: Point & Figure Chart in AFL<BR><BR><BR>Hello Richard =
and=20
Dimitris,<BR><BR>Sorry to have caused so much confusion.<BR><BR>Since mos=
t=20
stocks since 2000 have been trending down, you may get a<BR>only a few ba=
rs=20
because the P&F Chart ignores small up moves and only<BR>extends down=
bars=20
when the price moves more than the box size. Since<BR>2000, you may=
very=20
well have only a few bars. Try loading more data<BR>for at least on=
e=20
stock.<BR><BR>I used AmiQuote and Yahoo for the data. I have data f=
rom=20
January<BR>1994. The AmiBroker version on which I created this file=
is=20
4.0.0 <BR>Apr 26 2002.<BR><BR>I do not know if the AmiBroker version=
is=20
causing the difference. I<BR>saw that it worked for Richard on MSFT=
=20
(although I am not sure what<BR>the whole MSFT v. MSFT issue was - it see=
ms to=20
have resolved<BR>itself). Perhaps Richard also has more data=20
loaded.<BR><BR>As you can see from the script, it is very simple. I=
f=20
problems<BR>continue, I would be happy to go through it in detail to see =
if=20
there<BR>is a coding error.<BR><BR>I'm afraid I have no other explanation=
=20
other than more data. Let's<BR>try that=20
first.<BR><BR>Mirat<BR><BR>PS I would post .gifs of my charts but I=
do=20
not know how to attach a<BR>file to my reply. Although that would n=
ot=20
help resolve the issue. :-)<BR><BR><BR><BR><BR><BR>--- In amibroker@xxxx,=
=20
"Richard Alford" <richard.alford@xxxx> wrote:<BR>> I am just=20
isolating variables. If we have the same program and<BR>version (4.=
06.1=20
Jun 19 build), the same indicator code (this I<BR>confirmed) and same dat=
a we=20
should get the same result. (I continue<BR>to believe in determinis=
tic=20
computing - probably naive in light of<BR>Microsoft!). The question=
able=20
variable, and a big one, is the data<BR>source - I use qp2. Perhaps=
=20
someone using yahoo could compare to<BR>your results?<BR>><BR>><BR>=
>=20
It does appear that the "box size", the significant change that<BR>define=
s an=20
X or O in my understanding, should be normalized to the<BR>price of the=20
instrument to account for the difference in WCOME<BR>pricing vs. DJIA, fo=
r=20
example. I am referring to the code fragment:<BR>><BR>> //=20
Calculate PF Chart Box size and minimum Reverse values<BR>> // Box =3D=
=20
((tot[i]/(i+1))^.5)/7.3374; <BR>><BR>>=20
Cheers,<BR>><BR>> Richard<BR>> ----- Original Messag=
e=20
-----<BR>> From: dtsokakis<BR>> To:=20
amibroker@xxxx<BR>> Sent: Wednesday, July 17, 2002 2:49=20
PM<BR>> Subject: [amibroker] Re: Point & Figure Chart =
in=20
AFL<BR>><BR>><BR>> Richard,<BR>> YHOO=
via=20
Amiquote.<BR>> Why do you think it is a matter of data pro=
vider=20
?<BR>> Dimitris Tsokakis<BR>><BR>> --- I=
n=20
amibroker@xxxx, "Richard Alford"=20
<richard.alford@xxxx><BR>wrote:<BR>> > but the po=
int=20
remains that you and I get different=20
results. <BR>what<BR>> is your data=20
source?<BR>> ><BR>> >=20
Richard<BR>> > ----- Original Message=20
-----<BR>> > From: dtsokakis<BR>> &=
nbsp;=20
> To: amibroker@xxxx<BR>> > =
Sent:=20
Wednesday, July 17, 2002 1:47 PM<BR>> > Sub=
ject:=20
[amibroker] Re: Point & Figure Chart in AFL<BR>> =20
><BR>> ><BR>> > =20
Richard,<BR>> > ANY other function works ju=
st=20
fine with my valuable Amibroker<BR>> 4.06.<BR>> &n=
bsp;=20
> Just fine.<BR>> > I can no=
t see=20
the reason for this P&F script.<BR>> > =
=20
Anyway, the author perhaps could expain.<BR>> > &n=
bsp;=20
Dimitris Tsokakis<BR>> ><BR>> =20
> --- In amibroker@xxxx, "Richard Alford"=20
<richard.alford@xxxx><BR>> wrote:<BR>>  =
;=20
> > DT, I agree it was not easy to understand. Th=
e=20
attached<BR>charts<BR>> > showed the TWO re=
sults=20
that were generated whenever I entered<BR>the<BR>> =20
> symbol MSFT - it appears to be a fluke and I cannot=20
reproduce<BR>it<BR>> any<BR>> > &nb=
sp;=20
longer. Although there is not ticker name in the=20
formula,<BR>there<BR>> was<BR>> > &=
nbsp;=20
strange behavior occurring for MSFT and MSFT only at=20
that<BR>time.<BR>> > ><BR>> &nbs=
p;=20
> > The gist of my reply to you was that using the SAME=
code=20
as<BR>you<BR>> > posted and using the code =
I=20
copied from the files sections, I<BR>> > =20
generated the same results - and not the results that=20
you<BR>were<BR>> > creating. That sug=
gests=20
that you have a problem in your data<BR>> =20
and/or<BR>> > setup. The only reason =
for=20
the two codes was to guarantee<BR>that<BR>> =20
there<BR>> > wasn't a subtle error - there =
was=20
not.<BR>> > ><BR>> =20
> > Sorry for adding the confusion about the MSFT fluke=
at=20
the<BR>same<BR>> > time.<BR>>  =
;=20
> ><BR>> > >=20
Cheers,<BR>> > ><BR>> =20
> > Richard<BR>> > =20
> ----- Original Message -----<BR>> =20
> > From: dtsokakis<BR>> =20
> > To: amibroker@xxxx<BR>> =
=20
> > Sent: Wednesday, July 17, 2002 12:47=20
AM<BR>> > > Subject: [amibro=
ker]=20
Re: Point & Figure Chart in AFL<BR>> > =
=20
><BR>> > ><BR>> =20
> > Richard,<BR>> =20
> > It is not easy to understand=20
this<BR>> > > "the plot for =
MSFT=20
changes when one changes the symbol go<BR>> =20
MSFT<BR>> > from<BR>> =20
> > MSFT??? "<BR>> =20
> > I copied the formula=20
from<BR>> > > <A target=3D_b=
lank=20
href=3D"http://groups.yahoo.com/group/amibroker/files/Point-Figure">http:=
//groups.yahoo.com/group/amibroker/files/Point-Figure</A><BR>> &nbs=
p;=20
> > pasted in my Ind. builder and get the p=
osted=20
gifs.<BR>> > > No ticker nam=
e is=20
into the formula.<BR>> > > W=
hat=20
is "the two MSFT " ???<BR>> > > &nb=
sp;=20
Do you use the same code from the above address??<BR>> =20
> > DT<BR>> > =
=20
><BR>> > ><BR>> =20
> > --- In amibroker@xxxx, "Richard=20
Alford"<BR><richard.alford@xxxx><BR>> > &nbs=
p;=20
wrote:<BR>> > > > Those a=
re=20
not the figures I generate using the code in<BR>> =20
> the "files<BR>> > =20
> section". (Why wasn't this put in the AFL library =
is=20
a<BR>> question<BR>> > =20
in<BR>> > > my=20
mind???)<BR>> > > =20
><BR>> > > > Just noti=
ced=20
that the plot for MSFT changes when one<BR>> =20
changes<BR>> > the<BR>> =20
> > symbol go MSFT from MSFT??? Not t=
he=20
case for AMZN or<BR>ORCL? <BR>> > =20
> ><BR>> > > &nbs=
p;=20
> I attached the two MSFT for comparison, one is=20
"my"<BR>copy,<BR>> and<BR>> >  =
;=20
the<BR>> > > other is a copy=
and=20
paste of the code in your note. The<BR>> > &=
nbsp;=20
difference<BR>> > > is the q=
uirk=20
in MSFT, not an error in the code you have<BR>used.<BR>> =20
And<BR>> > DT<BR>> =20
> > do you really like black on blue=20
borders? Personally, I<BR>can<BR>> > =
=20
never<BR>> > > read your cha=
rt=20
titles.<BR>> > > =20
><BR>> > > >=20
Cheers,<BR>> > > =20
><BR>> > > >=20
Richard<BR>> > > =20
><BR>> > > =20
><BR>> > > > &nbs=
p;=20
----- Original Message -----<BR>> > =20
> > From: Dimitris Tsokakis<BR>> &n=
bsp;=20
> > > To:=20
amibroker@xxxx<BR>> > > =20
> Sent: Tuesday, July 16, 2002 1:14 PM<BR>> =
=20
> > > Subject: [amibroker] R=
e:=20
Point & Figure Chart in AFL<BR>> > =20
> ><BR>> > > &nbs=
p;=20
><BR>> > > > &nbs=
p;=20
Mirat,<BR>> > > > &n=
bsp;=20
Here is P&F charts for AMZN, MSFT and ORCL.<BR>> =20
> > > Data since Jan=20
2000.<BR>> > > > &nb=
sp;=20
Is it the expected picture ?<BR>> > =20
> > The code, copied from files=20
section<BR>> > > =20
><BR>> > > > &nbs=
p; //=20
PF Chart by Mirat Dave<BR>> > > &nb=
sp;=20
> // Copy and paste this as a custom=20
indicator.<BR>> > > =20
><BR>> > > > &nbs=
p;=20
EnableScript("jscript");<BR>> > > &=
nbsp;=20
> <%<BR>> > > &nb=
sp;=20
><BR>> > > > &nbs=
p;=20
High =3D VBArray( AFL( "High" ) ).toArray();<BR>> =20
> > > Low =3D VBArray( AFL( =
"Low" )=20
).toArray();<BR>> > > =20
><BR>> > > > &nbs=
p; //=20
Calculate running average stock price for use in<BR>> =20
> calculating<BR>> > =20
> the Box size.<BR>> > =20
> ><BR>> > > &nbs=
p;=20
> tot =3D new Array();<BR>> >  =
;=20
> > tot[0] =3D (High[0] +=20
Low[0])/2;<BR>> > > =20
> for( i=3D1; i < High.length; i++ )<BR>>  =
;=20
> > > {<BR>> =
=20
> > > tot[i] =3D tot[i-1] +=
=20
((High[i] + Low[i])/2);<BR>> > > &n=
bsp;=20
> }<BR>> > > =
=20
> PFO =3D new Array();<BR>> >  =
;=20
> > PFC =3D new Array();<BR>>  =
;=20
> > ><BR>> > &nbs=
p;=20
> > // initialize first=20
element<BR>> > > =20
><BR>> > > > &nbs=
p; j=20
=3D 0;<BR>> > > > &n=
bsp;=20
PFO[j] =3D High[0];<BR>> > > =
=20
> PFC[j] =3D Low[0];<BR>> > =
=20
> > down =3D 1; // By default the first bar=
is a=20
down bar.<BR>> > > =20
><BR>> > > > &nbs=
p; up=20
=3D 0;<BR>> > > > &n=
bsp;=20
swap =3D 0;<BR>> > > =20
><BR>> > > > &nbs=
p; //=20
perform the loop that produces PF Chart<BR>> > &nb=
sp;=20
> ><BR>> > > &nbs=
p;=20
> for( i =3D 1; i < High.length; i++ )<BR>> &nb=
sp;=20
> > > {<BR>> =
=20
> > > // Calculate PF Chart =
Box=20
size and minimum Reverse<BR>values<BR>> > =20
> ><BR>> > > &nbs=
p;=20
> Box =3D ((tot[i]/(i+1))^.5)/7.3374;<BR>> =
=20
> > > Reverse =3D Box *=20
3;<BR>> > > > =
if(=20
Low[i] < PFC[j] - Box && down)<BR>> > &=
nbsp;=20
> > {<BR>> > =
=20
> > PFC[j] =3D Low[i];<BR>> =
=20
> > > }<BR>> =
=20
> > > else<BR>> &nbs=
p;=20
> > > {<BR>> =
=20
> > > if( High[i] >=3D PF=
C[j] +=20
Reverse && down)<BR>> > > &=
nbsp;=20
> {<BR>> > > =
=20
> j++;<BR>> > > &nbs=
p;=20
> swap =3D 1;<BR>> > =20
> > PFO[j] =3D Low[i];<BR>> =
=20
> > > PFC[j] =3D=20
High[i];<BR>> > > =20
> }<BR>> > > =
=20
> }<BR>> > > =
=20
> if( High[i] > PFC[j] + Box &&=20
up)<BR>> > > >  =
;=20
{<BR>> > > > =
=20
PFC[j] =3D High[i];<BR>> > > =
=20
> }<BR>> > > =
=20
> else<BR>> > > &nbs=
p;=20
> {<BR>> > > =
=20
> if( Low[i] <=3D PFC[j] - Reverse &&=20
up)<BR>> > > >  =
;=20
{<BR>> > > > =
=20
j++;<BR>> > > > &nbs=
p;=20
PFC[j] =3D Low[i];<BR>> > > =
=20
> PFO[j] =3D High[i];<BR>> > =
=20
> > swap =3D 1;<BR>> =20
> > > }<BR>> =
=20
> > > }<BR>> =
=20
> > > if( swap=20
)<BR>> > > > =
=20
{<BR>> > > > =
swap=20
=3D 0;<BR>> > > > &n=
bsp;=20
if( up )<BR>> > > =20
> {<BR>> > > =
=20
> up =3D 0;<BR>> > > =
; =20
> down =3D 1;<BR>> > =20
> > }<BR>> > =
=20
> > else<BR>> > &nbs=
p;=20
> > {<BR>> > =
=20
> > up =3D 1;<BR>> > =
; =20
> > down =3D 0;<BR>> =20
> > > }<BR>> =
=20
> > > }<BR>> =
=20
> > > }<BR>> =
=20
> > ><BR>> > &nbs=
p;=20
> > // Shift chart to the right to eliminat=
e=20
trailing<BR>empty<BR>> data<BR>> =20
> > > // - PF charts are=20
generally smaller/shorter then the<BR>> =20
full<BR>> > stock<BR>> =20
> > charts because they lack a time=20
scale.<BR>> > > =20
><BR>> > > > &nbs=
p;=20
delta =3D High.length - PFO.length;<BR>> > =
=20
> > for( i =3D High.length; i > delta; i=
--=20
)<BR>> > > > =
=20
{<BR>> > > > =
PFO[=20
i-1 ] =3D PFO[ i-delta-1];<BR>> > > =
; =20
> PFC[ i-1 ] =3D PFC[ i-delta-1];<BR>> =20
> > > }<BR>> =
=20
> > > for( i =3D 0; i < d=
elta;=20
i++)<BR>> > > > &nbs=
p;=20
{<BR>> > > > =
PFO[=20
i-1 ] =3D 0;<BR>> > > =20
> PFC[ i-1 ] =3D 0;<BR>> > =20
> > }<BR>> > =
=20
> > AFL.Var("PFO") =3D PFO;<BR>> &n=
bsp;=20
> > > AFL.Var("PFC") =3D=20
PFC;<BR>> > > > &nbs=
p;=20
%><BR>> > > =20
><BR>> > > > &nbs=
p; O=20
=3D PFO;<BR>> > > > =
=20
C =3D PFC;<BR>> > > =20
><BR>> > > > &nbs=
p; H=20
=3D (O+C)/2;<BR>> > > =20
> L =3D (O+C)/2;<BR>> > =20
> ><BR>> > > &nbs=
p;=20
> GraphXSpace =3D 9;<BR>> > =
=20
> > Graph0Style =3D 64;<BR>> =
=20
> > ><BR>> > &nbs=
p;=20
> > Graph0Color =3D1;<BR>> =20
> > > Graph0 =3D=20
C;<BR>> > > =20
><BR>> > > > &nbs=
p;=20
Thanks in advance for any reply.<BR>> > =20
> > Dimitris Tsokakis<BR>> =20
> > ><BR>> > &nbs=
p;=20
> > Yah=
oo!=20
Groups Sponsor<BR>> > > =20
><BR>> > > =20
> Click here to find y=
our=20
contact lenses!<BR>> > > =20
><BR>> > > > &nbs=
p;=20
Your use of Yahoo! Groups is subject to the=20
Yahoo!<BR>Terms<BR>> of<BR>> > &nbs=
p;=20
> Service.<BR>> > =20
><BR>> > ><BR>> =20
> > Yah=
oo!=20
Groups Sponsor<BR>> > =20
> &nb=
sp; =20
ADVERTISEMENT<BR>> > =20
> &nb=
sp; <BR>> =20
> =20
> <BR>> =20
> ><BR>> > > &nbs=
p;=20
Your use of Yahoo! Groups is subject to the Yahoo!=20
Terms<BR>of<BR>> > Service.<BR>> &n=
bsp;=20
><BR>> ><BR>> =20
> Yahoo! Groups=20
Sponsor<BR>> =20
> &nb=
sp; =20
ADVERTISEMENT<BR>> =20
> &nb=
sp; <BR>> =20
> <BR>> =20
><BR>> > Your use of Yahoo! Groups is su=
bject=20
to the Yahoo! Terms of<BR>> =20
Service.<BR>><BR>><BR>>  =
; =20
Yahoo! Groups=20
Sponsor<BR>> &nbs=
p; =20
ADVERTISEMENT<BR>> &nbs=
p; <BR>>  =
;<BR>><BR>> =20
Your use of Yahoo! Groups is subject to the Yahoo! Terms=20
of<BR>Service.<BR><BR><BR>------------------------ Yahoo! Groups Sponsor=
=20
---------------------~--><BR>Will You Find True Love?<BR>Will You Meet=
the=20
One?<BR>Free Love Reading by phone!<BR><A target=3D_blank=20
href=3D"http://us.click.yahoo.com/O3jeVD/R_ZEAA/Ey.GAA/GHeqlB/TM">http://=
us.click.yahoo.com/O3jeVD/R_ZEAA/Ey.GAA/GHeqlB/TM</A><BR>------------------=
---------------------------------------------------~-><BR><BR><BR><BR>Yo=
ur=20
use of Yahoo! Groups is subject to <A target=3D_blank=20
href=3D"http://docs.yahoo.com/info/terms/">http://docs.yahoo.com/info/ter=
ms/</A><BR><BR><BR></FONT></P></BLOCKQUOTE></BODY></HTML>
------=_NextPart_001_0085_01C22F41.830ECC40--
Attachment:
Description: ""
|