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

Re: [EquisMetaStock Group] Are there loop functions in Metastock?



PureBytes Links

Trading Reference Links

CC

PREV is as close as you are going to get. This enables you to access the
previous bars value of the current variable. It's resource intensive so it's
prudent to keep the number used to an absolute minimum.

Here's an example that may demonstrate it's use better than any description.

  {Timed Exit}
D:=25;   {exit delay from entry leading edge}
N:=Cross(Mov(C,15,E),Mov(C,25,E))*C; {entry price}
R:=If(PREV=0,N,If(BarsSince(PREV<=0)>=D,0,PREV));
R;

Roy

----- Original Message ----- 
From: "cobalt_cannon" <no_reply@xxxxxxxxxxxxxxx>
To: <equismetastock@xxxxxxxxxxxxxxx>
Sent: Wednesday, July 16, 2003 1:52 PM
Subject: [EquisMetaStock Group] Are there loop functions in Metastock?


> Not sure how much any of you are into programming
> but I'm hoping you can answer this question or point me in the right
> direction where I can get assistance.
>
> I have done a lot of computer programming and am familiar with quite
> a few languages and have been delving into the Metastock Language.
> Maybe I'm missing the obvious but I don't seem to be able to find
> any loop functions.
> In all other languages I've been involved with you have a least a few
> different types of loops.
>
> I have found the "ref" function that allow you to reference a period
> prior to the current one (say 1 day ago, or 10 days ago) but I'm
> after loop
> functions.
>
> For example if I want to write a function that accepts dynamic input
> from the user and go through data for the past 10 days I want to
> write a loop that traverse the data backwards one day at a time and
> performs calculations
> on that data.
>
> So in English the function would do the following:
>
> Prompt user for number of days to traverse.
> User inputs the number 10 and this is assigned to a
> variable "num_days".
> Define a variable "counter" and initialise it to 1.
> while "counter" <= "num_days" do the following:
>    get price data for day that is "counter" number of days prior to
> today.
>    do whatever you want with this data .. bla bla bla
>    "counter" gets incremented by 1 and go back up to "while"
> statement
> end of loop
>
> So, the above code would traverse through the data for the number of
> days the user has entered and then exit when the loop test fails.
>
> If you are into programming a little you'll know what I mean and if
> not then I hope I've explained things well enough.
>
> Is there another plug-in that enables these types of features or do
> they have to be done outside of Metstock via dll's or do I need to
> get an add-on program or have I just missed how this is done
> altogether.
>
> Thanks in advance
>
> CC
>
>
>
>
>
> 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/
>
>
>
>



------------------------ Yahoo! Groups Sponsor ---------------------~-->
Save up to 80% on top-quality inkjet cartridges & refill kits at Myinks.com
Free shipping on orders $50 or more to the US and Canada.
http://www.c1tracking.com/l.asp?cid=5702
http://us.click.yahoo.com/YrYXfA/AyWGAA/ySSFAA/BefplB/TM
---------------------------------------------------------------------~->

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/