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

Re: EasyLanguage translation



PureBytes Links

Trading Reference Links

 The  code I just posted in the previous mail has this line:

DW:= If(DayOfWeek<>ref(DayOfWeek(),-1),{then}1,{else}0);
   {Daily High}
DH:=If(DW=1,{then}ref(HighestSince(1,DW=1,H),-1),{else}0);

To translate...If Dw = "1" then we have a new day.
When DW = "1" then we have DH look at the prevoius bar...
(which is the last bar of the prevouis day) and find the highest
value since DW =1  {from the current bar this would be the
second most recent occurance of DW=1, but from the
previous bar it is the first or most recent occurance...hence
we have this line :  ref(HighestSince(1,DW=1,H),-1)   }

There is No reason this should not work...In fact I use
this same procedure EVERYDAY to find weekly and
Monthly levels on daily bar charts!!

Adam Hefner





----- Original Message -----
From: Owen Davies <owen@xxxxxxxxxxxxx>
To: <metastock@xxxxxxxxxxxxx>
Sent: Saturday, November 18, 2000 9:15 AM
Subject: Re: EasyLanguage translation


> Among other useful information, Dave Nadeau suggested:
>
> > The other situation is for Intraday data.  If you are using intraday
> > bars, the determination of the high of the previous day will require a
> > couple more lines.  Everything will be the same as above, except replace
> > the A:=..... line with the following:
> >
> > NewDay:=DayOfMonth()<>Ref(DayOfMonth(),-1); {this finds the breakpoints
> > in your intraday data from one day to the next without having to worry
> > about the length of afterhours trading}
> > HHY:=HighestSince(2,NewDay,H); {this looks at two "newday" occurances
> > backwards, today and yesterday, and finds the highest value since then}
> > PDH:=ValueWhen(1,NewDay,HHY); {finally this selects the HHY value just
> > before today's "newday" occurance}
>
> Actually, that doesn't quite accomplish what's needed, does it?  HHY winds
> up
> as the highest high since yesterday's open, not the highest high between
> yesterday's open and yesterday's close.  If this morning puts in a price
> above
> yesterday's high, that is what we'll see in HYY.
>
> I've been staring at this problem off and on for weeks -- posted a request
> for help with it, in fact -- and haven't come up with an answer.  As far
as
> I can
> see, there just isn't any way to say "value since TimeX and before TimeY"
> within the limitations of Metastock's language.  The closest I can come is
> something like "If(NewDay,HYY,Prev)", but that's as ugly as it is slow to
> calculate, and there seem to be cases where it breaks down (though at
> the moment I can't quite remember what they were.)
>
> If anyone has a better solution to this, I'd be deeply grateful to hear
it.
>
> Thanks.
>
> Owen Davies
>
>