PureBytes Links
Trading Reference Links
|
> Date: Mon, 15 Jun 1998 10:57:11 -0700
> From: Dennis Holverstott <dennis@xxxxxxxxxx>
> To: Omega List <omega-list@xxxxxxxxxx>
> Subject: Re: EL question
> input: dat(980615), tim(1430), barsbak(20);
> var: barnum(0), toggle(0)
>
> if date = dat and time = tim then begin
> barnum = barsbak;
> toggle = 1;
> end else
> if toggle = 1 then barnum = barnum + 1;
>
> {then you can refer to close[barnum]}
>
> > Would someone tell me how to reference a bar that is x number of bars
> > back from a date and time that are inputs? In other words, say the bar has
> > the date of 980615 and the time of 1430, on a 20 minute chart I want to
> > reference the 20th bar back from that. This is for an indicator I am writing.
> > Thanks any help on this,
> > David Cicia
If I understand the problem, you might have to add some code to the
above in order to find the correct date and time. Seems like you
need to loop backwards until you find the correct date and time.
Using the above inputs -
var: j(0);
While (date[j] <> dat and time[j] <> tim)
Begin
j = j+1;
End;
{ At this point, you should have how far back the specified bar is
stored in the variable j }
barnum = j + barsbak;
If you wanted to reference the close, say, you would use -
Close[barnum]
You might put an additional counter in the While loop that
terminates it after some level is reached in case you enter an
invalid time or date, else you have an infinite loop.
|