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

Re: [EquisMetaStock Group] Interger and Reference functions



PureBytes Links

Trading Reference Links



--- In equismetastock@xxxxxxxxxxxxxxx, "Roy Larsen" <rlarsen@xxxx> 
wrote:
> Hi Harry
> 
> This will work as long as Perx is a "constant" variable. By that I 
>mean that it does not vary at 
> different points across the chart. 

It is manually entered in an Input statement, so I had assumed it was 
considered as a constant, but apparently MS doesn't see it that way.

>Surrounding, shall we say, a "fixed" variable with LastValue() 
> converts it to a constant as far as MetaStock is concerned. 
> Perx:=LastValue(Int(Period/4))

That works great. I'll stick that tip away in my memory bank.

>>I'm not sure that the Int() function is 
> necessary, but either that or Floor() should ensure that you 
>eliminate any fractions.
> 
I'm not sure either. From my initial testing, it appears that without 
Int(), MS rounds the value calculated by Ref(), and then selects the 
appropriate bar. I was concerned that not having a whole number might 
cause some problems with MS, which is why I thought about adding Int 
(). My formula is somewhat arbitrary, so as long as MS performs the 
calculation, it doesn't really matter to me if the bar/date is exactly 
correct or not. 
> 
Harry
> 
> 
> 
> 
> 
> ----- Original Message ----- 
> From: "bex1210" <hmw3@xxxx>
> To: <equismetastock@xxxxxxxxxxxxxxx>
> Sent: Friday, February 18, 2005 1:50 PM
> Subject: [EquisMetaStock Group] Interger and Reference functions
> 
> 
> >
> >
> > I have MS 8.01, EOD. I am getting an error with a formula that I 
don't
> > understand, and thought someone might be able to put me on the 
correct
> > path.
> >
> > Lets say that I have a formula which looks like this:
> >
> > Period:=Input("Periods",2,1000,100);
> > Perx:=(Period/4);
> > Price1:=Ref(C,-3*Perx)-Ref(C,-Period);
> > etc, etc
> >
> > This works just fine in MS. However, since "Perx" may not be a 
whole
> > number, I tried to substitute the following for line 2, above.
> > Perx:=Int(Period/4);
> >
> > When I do this, MS will not accept the formula. The cursor stops 
just
> > after "Ref(C, " , and the error message says that "This variable 
or
> > expression must contain only constant data".
> >
> > Clearly "Perx" is a variable no matter whether it contains Int() 
or
> > not. What am I missing here, and how can I assure that "Perx" is
> > always a whole number?
> >
> > I also substituted ValueWhen () for Ref (), but got the same error
> > message.
> >
> > Thanks for your help,
> >
> > Harry
> >
> >
> >
> >
> >
> >
> >
> >
> > ------------------------------------------------------------------
--------------
> > Yahoo! Groups Links
> >
> >  a.. To visit your group on the web, go to:
> >  http://groups.yahoo.com/group/equismetastock/
> >
> >  b.. To unsubscribe from this group, send an email to:
> >  equismetastock-unsubscribe@xxxxxxxxxxxxxxx
> >
> >  c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of 
Service.
> >
> >








------------------------ Yahoo! Groups Sponsor --------------------~--> 
What would our lives be like without music, dance, and theater?
Donate or volunteer in the arts today at Network for Good!
http://us.click.yahoo.com/Tcy2bD/SOnJAA/cosFAA/BefplB/TM
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/equismetastock/

<*> To unsubscribe from this group, send an email to:
    equismetastock-unsubscribe@xxxxxxxxxxxxxxx

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