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

[Metastockusers] Re: Simple Code Question



PureBytes Links

Trading Reference Links

Thanks Roy.  I'm going to have to think more about what I want and how
to display it.  I'm in now rush as I'm using it only for the purpose
of satisfying my curiosity from time to time.

--- In Metastockusers@xxxxxxxxxxxxxxx, "Roy Larsen" <rlarsen@xxxx> wrote:
> Hi Invest
> 
> 
> Selecting the first loaded bar and its price is simple. However,
your question suggests that you want the first "visible" bar and I
think this would be impossible unless you were displaying all open
bars. Unloading unwanted bars is possible but not something you'd want
to do frequently.
> 
> Cum(1)=1 identifies the first loaded bar (for chart, exploration or
system test). Finding the price associated with that bar is as simple as
> ValueWhen(1,Cum(1)=1,C).
> 
> One way that you could reference the price on a bar that is not the
first bar loaded would be to use a "date spike" to flag a particular
date, and use that to trigger the ValueWhen()
> 
> Sd:=Input("Start day"  ,1,31,1);
> Sm:=Input("Start month",1,12,1);
> Sy:=Input("Start year" ,1980,2010,2002);
> Start:=(DayOfMonth()>=Sd AND Month()=Sm AND
> Year()=Sy) OR Year()>Sy OR (Year()=Sy AND
> Month()>Sm);
> Trigger:=Start and ValueWhen(2,1,Start)=0;
> ValueWhen(1,Trigger,C);
> 
> If you then wanted to spread that value across the entire chart
rather than starting at the nominated date (but still reference the
price for the nominated date) then you could change the last line to
> 
> LastValue(ValueWhen(1,Trigger,C));
> 
> There are probably a number of other ways to access prices on
particular bars, but it's difficult to try and guess what would work
for you.
> 
> 
> Regards
> 
> Roy
> www.metastocktips.co.nz
> 
>  
> ----- Original Message ----- 
> From: invest0890 
> To: Metastockusers@xxxxxxxxxxxxxxx 
> Sent: Saturday, September 17, 2005 5:35 PM
> Subject: [Metastockusers] Simple Code Question
> 
> 
> Is there any way in Metastock to reference the first value in the
> visible chart?
> 
> Lets say I want to use the close of the first value in whatever
> metastock chart I'm looking at as a 'base' for an indicator I build. 
> How would I get metastock to look at that first close in the chart?  
> 
> I see the "bar since" function but I may not want a fixed value. I may
> want to look at a one week chart one time and a three month chart
> another. I want the program to simply know to use the first day on the
> chart but I know not how to reference it.
> 
> 
> 
> 
>
--------------------------------------------------------------------------------
> YAHOO! GROUPS LINKS 
> 
>   a..  Visit your group "Metastockusers" on the web.
>     
>   b..  To unsubscribe from this group, send an email to:
>    Metastockusers-unsubscribe@xxxxxxxxxxxxxxx
>     
>   c..  Your use of Yahoo! Groups is subject to the Yahoo! Terms of
Service. 
> 
> 
>
--------------------------------------------------------------------------------





------------------------ Yahoo! Groups Sponsor --------------------~--> 
Get fast access to your favorite Yahoo! Groups. Make Yahoo! your home page
http://us.click.yahoo.com/dpRU5A/wUILAA/yQLSAA/zMEolB/TM
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

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

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

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