PureBytes Links
Trading Reference Links
|
Manuel, the error arises from Security "IBX" having less data bars
than your base chart's loaded data.
This gets around any data mismatch:
==========
FirstValue
==========
---8<----------------
DataArray:=OPEN;
Bar1:=Cum(IsDefined(DataArray))=1;
FirstValue:=ValueWhen(1,Bar1,DataArray);
FirstValue
---8<----------------
For your example:
---8<----------------
DataArray:=Security("IBX",(O+C+L+H)/4);
Bar1:=Cum(IsDefined(DataArray))=1;
FirstValue:=ValueWhen(1,Bar1,DataArray);
DataArray;FirstValue
---8<----------------
jose '-)
http://www.metastocktools.com
--- In equismetastock@xxxxxxxxxxxxxxx, "Manuel Cabedo" <manelcabedo@xx
..> wrote:
> Help, again, Jose,
>
> I am traying your solution in the following code:
>
> Y:=Security("IBX",(O+C+L+H)/4);
> FV:=ValueWhen(1,Cum(1)=1,Y);
> Y;FV
>
> but I get zero for FV, an incorrect value (actual value shoud be
> 2258.44).
>
> I am obviously doing an error, but where?
>
>
> Thanks again,
>
> Manuel
>
>
> ----- Original Message -----
> From: Jose
> To: equismetastock@xxxxxxxxxxxxxxx
> Sent: Sunday, March 27, 2005 7:47 PM
> Subject: [EquisMetaStock Group] Re: First value of MS arrays
>
> First value in a data array:
>
> ==========
> FirstValue
> ==========
> ---8<----------------
> DataArray:=OPEN;
> FirstValue:=ValueWhen(1,Cum(1)=1,DataArray);
>
> FirstValue
> ---8<----------------
>
>
> Value of a data array on a given date:
>
> =========
> DateValue
> =========
> ---8<----------------
>
> { Plots Data Array value on given date }
> { http://www.metastocktools.com }
>
> { Date input }
> StDay:=Input("Day [1~31]",1,31,1);
> StMnth:=Input("Month [1~12]",1,12,1);
> StYear:=Input("Year [1800~2200]",
> 1800,2200,2005);
>
> { Data Array }
> DataArray:=CLOSE;
>
> { First available Date signal }
> binary:=Year()>StYear
> OR (Year()=StYear AND (Month()>StMnth
> OR Month()=StMnth AND DayOfMonth()>=StDay));
> signal:=binary AND Alert(binary=0,2);
>
> { Data Array value on first available date }
> DateValue:=ValueWhen(1,signal,DataArray);
>
> { Extend DateValue to whole chart }
> DateValue:=LastValue(DateValue);
>
> { Plot DateValue }
> DateValue
>
> ---8<----------------
>
>
> jose '-)
> http://www.metastocktools.com
>
>
>
>
> --- In equismetastock@xxxxxxxxxxxxxxx, "manelcabedo"
<manelcabedo@xxxx
> wrote:
>
> Hi,
>
> A question for the experts:
>
> Is there any way of knowing the value of the first element of a MS
> array? Or still better: Is it possible to know the value of a MS
> array element for a given date?
>
> Thanks in advance.
>
> Manuel
------------------------ Yahoo! Groups Sponsor --------------------~-->
Has someone you know been affected by illness or disease?
Network for Good is THE place to support health awareness efforts!
http://us.click.yahoo.com/Rcy2bD/UOnJAA/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/
|