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

Re: Indicator Code



PureBytes Links

Trading Reference Links

Jody,

Your problem is that first you have to visualize the task at hand and then
you visualize how the loop solves the problem.
Here is the loop I was mentioning:

{*******************************************************************
Description: Close of Day
Provided By: Omega Research, Inc. (c) Copyright 1999
********************************************************************}

Inputs: DaysAgo(Numeric);
Array: CloseArray[50](-1);

If DataCompression < 2 Then Begin
 If Date > Date[1] Then Begin
  For Value1 = 50 DownTo 1 Begin
   CloseArray[Value1] = CloseArray[Value1-1];
  End;
  CloseArray[0] = Close[1];
 End;
 If DaysAgo <= 50 AND DaysAgo > 0 Then
  CloseD = CloseArray[DaysAgo - 1];
 If DaysAgo = 0 Then
  CloseD = Close;
End;

{Forcing the function to series}
Value1 = CloseD[1];



The CloseD function keeps a value in an array for the Close of the last 50
days for the current symbol. As the chart progresses from day to day the
array needs to have the values slid back one each day. A loop is used for
that purpose.

Hope this makes it clearer than mud.


Jim Bronke
Phoenix, AZ



----- Original Message -----
From: "Jody Ellis" <ellis_jody@xxxxxxxxxxx>
To: <jvbronke@xxxxxxxx>; <omega-list@xxxxxxxxxx>
Sent: Sunday, July 08, 2001 10:06 PM
Subject: Re: Indicator Code


>
> Jim, I think my problem is visualising exactly what the loop is supposed
to
> do. When the loop is in progress, what is it counting and why does it have
> to loop to count a condition? Would you be able to provide an example of a
> loop code with an explanation please? Thanks Jim.
>
>
>
> >From: "Jim Bronke" <jvbronke@xxxxxxxx>
> >To: "Jody Ellis" <ellis_jody@xxxxxxxxxxx>, <omega-list@xxxxxxxxxx>
> >Subject: Re: Indicator Code
> >Date: Sun, 8 Jul 2001 21:40:03 -0700
> >
> >Jody,
> >
> >MRO is a function( I had to look it up) whereas the for to is a loop. The
> >loop will do a sequence of repitive commands and the function returns a
> >value for one command.
> >Loops can be used to add arrays of numbers or move them one position in
an
> >array, for example.
> >
> >An example is the CloseD function. I was looking at it today. Does that
> >help?
> >
> >
> >Jim Bronke
> >Phoenix, AZ
> >
> >
> >
> >----- Original Message -----
> >From: "Jody Ellis" <ellis_jody@xxxxxxxxxxx>
> >To: <jvbronke@xxxxxxxx>; <omega-list@xxxxxxxxxx>
> >Sent: Sunday, July 08, 2001 9:29 PM
> >Subject: Re: Indicator Code
> >
> >
> > >
> > > Hi Jim, thanks for the response.
> > >
> > > How and what does it count? What is the advantage of using For to's
> >instead
> > > of the MRO function?
> > >
> > >
> > >
> > >
> > >
> > > >From: "Jim Bronke" <jvbronke@xxxxxxxx>
> > > >To: "Jody Ellis" <ellis_jody@xxxxxxxxxxx>, <omega-list@xxxxxxxxxx>
> > > >Subject: Re: Indicator Code
> > > >Date: Sun, 8 Jul 2001 17:41:07 -0700
> > > >
> > > >j is just a variable(it could be i,k,l,m, etc),  1 is where you start
> > > >(helps
> > > >to be simple) and length is the variable that defines where you stop.
> >It
> > > >can
> > > >be changed in the input statements. The loop increments by one each
> >time
> >it
> > > >goes through.
> > > >
> > > >
> > > >Jim Bronke
> > > >Phoenix, AZ
> > > >
> > > >
> > > >
> > > >----- Original Message -----
> > > >From: "Jody Ellis" <ellis_jody@xxxxxxxxxxx>
> > > >To: <omega-list@xxxxxxxxxx>
> > > >Sent: Sunday, July 08, 2001 5:27 PM
> > > >Subject: Re: Indicator Code
> > > >
> > > >
> > > > >
> > > > > Hi Bob,
> > > > >
> > > > > Can I just ask for a quick explanation on how a "for j = 1 to
> >length"
> > > > > statement works and for what purpose it is used for? I understand
> >that
> > > >it
> > > >is
> > > > > a loop that counts the number of times a condition occurred, but
> >what
> > > >are
> > > > > the specifics of the j = 1 etc?
> > > > >
> > > > > Thank you.
> > > > >
> > > > >
> > > > >
> > > >
> > >
> > >
> >_________________________________________________________________________
> > > Get Your Private, Free E-mail from MSN Hotmail at
> >http://www.hotmail.com.
> > >
> >
>
> _________________________________________________________________________
> Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
>