OOPS!

same variable name was used in 2 premises-

use this code rest same-


a=LastValue(Month())-1;

z=LastValue(Month())-2;

 b=Month()!=Ref(Month(),-1);

bi=BarIndex();

d=LastValue(ValueWhen(Month()==a *AND* b,bi,1));

e=*BarCount*-d;

f=LastValue(ValueWhen(Month()==z *AND* b,bi,1));

g=*BarCount*-f;

i=LastValue(HHV(*H*,e)) ; j= LastValue(HHV(*H*,g));
*

Filter*=i *OR* j;

AddColumn(*C*,"close",1.2);

AddColumn(i,"1 month high",1.1);

AddColumn(j,"2 month high",1.1);


On Mon, Jun 21, 2010 at 10:03 PM, Inquisitive Voyager <
[email protected]> wrote:

> (1)use this-
>
>
> _SECTION_BEGIN("Price");
>
> SetChartOptions
> (0,*chartShowArrows*|*chartShowDates*);
>
> _N
> (*Title* = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo
> %g, Close %g (%.1f%%) {{VALUES}}", *O*, *H*, *L*, *C*, SelectedValue( ROC(
> *C*, 1 ) ) ));
>
> Plot
> ( *C*, "Close", ParamColor("Color", *colorBlack* ), *styleNoTitle* |
> ParamStyle("Style") | GetPriceStyle() );
>
> _SECTION_END
> ();
>
> _SECTION_BEGIN
> ("steve");
>
> a=
> LastValue(Month())-1;
>
> b=
> LastValue(Month())-2;
>
> b=
> Month()!=Ref(Month(),-1);
>
> bi=
> BarIndex();
>
> d=
> LastValue(ValueWhen(Month()==a *AND* b,bi,1));
>
> e=*BarCount*-d;
>
> f=
> LastValue(ValueWhen(Month()==b *AND* b,bi,1));
>
> g=*BarCount*-f;
>
> i=
> LastValue(HHV(*H*,e)) ; j= LastValue(HHV(*H*,g));*
>
> Filter
> *=i *OR* j;
>
> AddColumn
> (*C*,"close",1.2);
>
> AddColumn
> (i,"1 month high",1.1);
>
> AddColumn
> (j,"2 month high",1.1);
>
> _SECTION_END
> ();
>
> (2) select range as ->n last days
>
> and write n=1
>
> (3)if Intraday data then use timeframe -> daily
>
>
>   On Mon, Jun 21, 2010 at 5:58 PM, Steve_Almond 
> <[email protected]>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] <amibroker%40yahoogroups.com>,
>> Inquisitive Voyager <hedonist2...@...> 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 <
>> > hedonist2...@...> 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
>> > >>
>> > >>
>> > >>
>> > >
>> > >
>> >
>>
>> 
>>
>
>

Reply via email to