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

Re: [amibroker] Re: Number of Days between dates



PureBytes Links

Trading Reference Links

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@xxxxxxxxx>
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/