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

[amibroker] Re: Number of Days between dates



PureBytes Links

Trading Reference Links

Tomasz,

Thanks, there is so much help documentation that I sometimes cannot 
find the right reference areas and then it can be hard for me 
to "connect the dots" to tie together what I pick up in one area with 
what I find in another. Sooner or later, it will all come together 
for me.

Bill

--- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko" <amibroker@xxxx> 
wrote:
> Bill,
> 
> If you lookup the AFL reference 
(http://www.amibroker.com/guide/afl )
> you will see that 
> 
> 1. BarIndex() returns the sequential bar number
> 2. EndValue and BeginValue are universal functions that
> allow you to lookup values of the array at the BEGINNING and
> the END points of range.
> 
> 3. WriteVal is really needed only in commentaries. It just converts
> the number to string, since only strings (texts) can be outputted 
in commentary window.
> 
> But... In AA window you don't need to use WriteVal at all.
> 
> For example in exploration mode you just write
> 
>  // display only results for last bar of range
> Filter = BarIndex() == EndValue( BarIndex() );
> 
> Period = EndValue( BarIndex() ) - BeginValue( BarIndex() );
> 
> AddColumn( StDev( Close, Period ), "StDev" );
> AddColumn( ROC( Close, Period ), "ROC" );
> AddColumn( MA( Volume, Period ), "Average Volume" );
> 
> 
> Best regards,
> Tomasz Janeczko
> amibroker.com
> ----- Original Message ----- 
> From: <wbarack@xxxx>
> To: <amibroker@xxxxxxxxxxxxxxx>
> Sent: Sunday, February 16, 2003 7:19 PM
> Subject: [amibroker] Re: Number of Days between dates
> 
> 
> > Tomasz,
> > 
> > So the thought sequence I need to go through is something like 
this:
> > 
> > 1. What AFL variable defines the quantity I'm interested in -   
> > BarIndex().
> > 2. What value of that variable do I want - EndValue().
> > 3. What do I want to do with that value - WriteVal().
> > 
> > I've go a lot to learn to get my mind wrapped around AFL and the 
> > language structure.
> > 
> > Thank you for your patience with me.
> > 
> > Bill
> > 
> > 
> > 
> > --- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko" 
<amibroker@xxxx> 
> > wrote:
> > > Bill,
> > > 
> > > One WriteVal() and some braces were missing, corrected one 
follows:
> > > 
> > > Period = EndValue( BarIndex() ) - BeginValue( BarIndex() )+1;
> > > 
> > > PerChange = WriteVal(100*(EndValue(Close)-BeginValue
> > > (Close))/BeginValue(Close));
> > > 
> > > Title ="Percentage change of close is " + 
> > > PerChange + 
> > > "%, \nStandard Deviation over the period is   " +  
> > > WriteVal( EndValue( StDev( Close, Period ) ) );
> > > 
> > > BTW: I don't think you need to add +1 to the Period.
> > > 
> > > Best regards,
> > > Tomasz Janeczko
> > > amibroker.com
> > > ----- Original Message ----- 
> > > From: <wbarack@xxxx>
> > > To: <amibroker@xxxxxxxxxxxxxxx>
> > > Sent: Sunday, February 16, 2003 6:53 PM
> > > Subject: [amibroker] Re: Number of Days between dates
> > > 
> > > 
> > > > Tomasz,
> > > > 
> > > > Well, it didn't take long until I ran into my next roadblock. 
> > Here is 
> > > > the code:
> > > > -----------
> > > > Period = EndValue( BarIndex() ) - BeginValue( BarIndex() )+1;
> > > > 
> > > > PerChange = WriteVal(100*(EndValue(Close)-BeginValue
> > > > (Close))/BeginValue(Close));
> > > > 
> > > > Title ="Percentagechange of close is " + PerChange + "%, 
> > \nStandard 
> > > > Deviation over the period is   "+ EndValue( StDev( Close, 
> > Period ) ) ;
> > > > 
> > > > ----------------
> > > > When I apply it, I get an error indication at the last 
semicolon 
> > in 
> > > > the Title statement. 
> > > > 
> > > > Now, another question and this is based on an interpretation 
of 
> > the 
> > > > Period calculation in line 1. Is the appropriate value to use 
the 
> > > > difference between the bar indexes or the difference plus 1 
to 
> > use 
> > > > all the bars in the range. It seems to me that the 
appropriate on 
> > > > depends on how the barindex function is constructed.
> > > > 
> > > > Thanks
> > > > 
> > > > Bill
> > > > --- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko" 
> > <amibroker@xxxx> 
> > > > wrote:
> > > > > Hello,
> > > > > 
> > > > > I have added the sample codes to:
> > > > > 
> > > > > http://www.amibroker.com/guide/afl/afl_view.php?
name=BEGINVALUE
> > > > > 
> > > > > and
> > > > > 
> > > > > http://www.amibroker.com/guide/afl/afl_view.php?
name=ENDVALUE
> > > > > 
> > > > > 
> > > > > Best regards,
> > > > > Tomasz Janeczko
> > > > > amibroker.com
> > > > > ----- Original Message ----- 
> > > > > From: <wbarack@xxxx>
> > > > > To: <amibroker@xxxxxxxxxxxxxxx>
> > > > > Sent: Sunday, February 16, 2003 5:28 PM
> > > > > Subject: [amibroker] Number of Days between dates
> > > > > 
> > > > > 
> > > > > > I am trying out 4.29.1 and its wonderful new functions 
that 
> > let 
> > > > me 
> > > > > > select a from-to range on a price plot. Thanks Tomasz. 
Great 
> > > > addition.
> > > > > > 
> > > > > > What I want to do is calculate a standard deviation over 
the 
> > > > selected 
> > > > > > range. While the example for "percentage change" in price 
> > that is 
> > > > > > included withe download works great, the standard 
deviation 
> > > > function, 
> > > > > > like many others, wants to know the period to be calcated 
> > over.
> > > > > > 
> > > > > > StDev(array, period);
> > > > > > 
> > > > > > So I am trying to find the period as follows:
> > > > > > 
> > > > > > Range (or period) = EndValue(Datetime())-BeginValues
(DateTime
> > ());
> > > > > > 
> > > > > > however, this expression and the variants of it that I 
have 
> > tried 
> > > > > > results in error messages when I try to write the value 
of 
> > StDev 
> > > > in a 
> > > > > > Title expression.
> > > > > > 
> > > > > > I'm sure I messing up formats or something similar and I 
> > cannot 
> > > > find 
> > > > > > the Help descriptions that will get me out of my dilema.
> > > > > > 
> > > > > > Long winded, but the basic question is: "How do I find 
the 
> > range 
> > > > > > in "bars" for a given From-to range such that I can use 
it in 
> > > > > > functions like StDev?"
> > > > > > 
> > > > > > Second associated question: "How do I direct the Title 
> > function 
> > > > to 
> > > > > > execute a carriage return?"
> > > > > > 
> > > > > > Thanks
> > > > > > 
> > > > > > Bill
> > > > > > 
> > > > > > 
> > > > > > Post AmiQuote-related messages ONLY to: 
> > amiquote@xxxxxxxxxxxxxxx 
> > > > > > (Web page: 
http://groups.yahoo.com/group/amiquote/messages/)
> > > > > > 
> > > > > > Check group FAQ at: 
> > > > http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
> > > > > > 
> > > > > > Your use of Yahoo! Groups is subject to 
> > > > http://docs.yahoo.com/info/terms/ 
> > > > > > 
> > > > > > 
> > > > > >
> > > > 
> > > > 
> > > > Post AmiQuote-related messages ONLY to: 
amiquote@xxxxxxxxxxxxxxx 
> > > > (Web page: http://groups.yahoo.com/group/amiquote/messages/)
> > > > 
> > > > Check group FAQ at: 
> > http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
> > > > 
> > > > Your use of Yahoo! Groups is subject to 
> > http://docs.yahoo.com/info/terms/ 
> > > > 
> > > > 
> > > >
> > 
> > 
> > Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
> > (Web page: http://groups.yahoo.com/group/amiquote/messages/)
> > 
> > Check group FAQ at: 
http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
> > 
> > Your use of Yahoo! Groups is subject to 
http://docs.yahoo.com/info/terms/ 
> > 
> > 
> >


Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 

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