months = Month();
newMonth = months != Ref(months, -1);
runningHigh = HighestSince(newMonth, Close);
Plot(Close, "Price", colorDarkGrey, styleBar);
Plot(newMonth, "", colorLightGrey, styleOwnScale | styleHistogram |
styleNoLabel);
Plot(runningHigh, "Highest", colorBlue, styleDashed);
Filter = 1;
for (i = 1; i <= 12; i++) {
AddColumn(ValueWhen(newMonth, Ref(runningHigh, -1), i), "" + i + "
Months Ago");
}
Mike
--- In [email protected], "Steve_Almond" <m...@...> wrote:
>
> Voyager,
>
> Thanks for the answers.
> I'm afraid I didn't explain myself properly. I wasn't looking for the
"2 month high", I was looking for the monthly high for each of the past
two months!
>
> In other words, I want to do an exploration for a stock and find its
highest value in June, its highest value in May etc.
>
> Can you help with this, apparently easier, problem?
>
> Steve
>
>
>
> --- In [email protected], Inquisitive Voyager hedonist2008@
wrote:
> >
> > or overlay this on price chart-
> >
> >
> > a=LastValue(Month())-2;
> >
> > b=Month()!=Ref(Month(),-1);
> >
> > bi=BarIndex();
> >
> > d=LastValue(ValueWhen(Month()==a *AND* b,bi,1));
> >
> > e=*BarCount*-d;
> >
> > f=LastValue(HHV(*H*,e));
> >
> > PlotText("2 month high"+f,d,f,*colorRed*);
> >
> >
> > On Mon, Jun 21, 2010 at 12:08 PM, Inquisitive Voyager <
> > hedonist2008@ wrote:
> >
> > >
> > > try this in commentary-
> > >
> > >
> > > a=LastValue(Month())-2;
> > >
> > > b=Month()!=Ref(Month(),-1);
> > >
> > > bi=BarIndex();
> > >
> > > d=LastValue(ValueWhen(Month()==a *AND* b,bi,1));
> > >
> > > d=*BarCount*-d;
> > >
> > > e=LastValue(HHV(*C*,d));
> > >
> > > WriteVal(e);
> > > On Mon, Jun 21, 2010 at 4:49 AM, Steve_Almond m...@wrote:
> > >
> > >>
> > >>
> > >> I want to find the highest closing price for a stock in the last
month and
> > >> the one before that (say highest for May and for April).
> > >> I thought I could use something like:
> > >>
> > >> HHV(C,Ref(Month(),-1))
> > >>
> > >> but it seems only to return a recent high value.
> > >>
> > >> Can someone point me in the right direction?
> > >>
> > >> Thanks,
> > >>
> > >> Steve
> > >>
> > >>
> > >>
> > >
> > >
> >
>