Mike - thanks for the feedback. I get 11,778 for this one using sbrAll bars. I guess I should subtract barnum or barnum-4 for similar? Will experiment.
Of course, there is probably a much easier way to do what I want: which is to pick out the higher highs between a low and high using Zig. The problem is how to eliminate all the Zig peaks not making new highs. Kevin --- In [email protected], "Mike" <sfclimb...@...> wrote: > > Try this: > > y[1] = 1103; > y[2] = 1107; > y[3] = 1095; > y[4] = 1100; > > highestY = Highest(y); > indices = BarIndex(); > x = LastValue( ValueWhen( y == highestY, indices ) ); > > _TRACE("Highest Y is: " + LastValue(highestY)); > _TRACE("Last index of highest Y is: " + x); > > Keep in mind that although you are creating your own array (y), the length of > that array is dictated by the duration of the > scan/exploration/backtest/optimization. In other words, if you explore a > single bar from the AA window, your code will fail since you require at least > 4 bars to populate your array. Also, array indexing is zero based. So, it > would be cleaner to have your elements populated starting at [0] instead of > [1]. > > Mike > > --- In [email protected], "kevinoversby" <kevinoversby@> wrote: > > > > Thanks Ara, > > > > I tried it like this: > > > > y[1]=1103; y[2]=1107; y[3]= 1095; y[4]= 1100; > > x = ValueWhen(HHVBars(y,4)==0,BarIndex()); > > > > but get 16,758 rather than 2 - is there another way to write it? > > > > Looks like a simple problem! > > > > > > Kevin > > > > --- In [email protected], "Ara Kaloustian" <ara1@> wrote: > > > > > > use valuewhen function and return the barindex() value > > > > > > ----- Original Message ----- > > > From: "kevinoversby" <kevinoversby@> > > > To: <[email protected]> > > > Sent: Monday, December 21, 2009 12:31 PM > > > Subject: [amibroker] How to extract position in (non time based) array > > > > > > > > > >I can't find a function in the reference to do this. > > > > > > > > For example, I have an array of the last 4 highs (from Zig function): > > > > > > > > {1103 1107 1095 1100} > > > > > > > > I want to return the index of the highest value (i.e 2). > > > > > > > > Is there a way to do this? > > > > > > > > > > > > Thanks > > > > > > > > Kevin > > > > > > > > > > > > > > > > > > > > > > > > ------------------------------------ > > > > > > > > **** IMPORTANT PLEASE READ **** > > > > This group is for the discussion between users only. > > > > This is *NOT* technical support channel. > > > > > > > > TO GET TECHNICAL SUPPORT send an e-mail directly to > > > > SUPPORT {at} amibroker.com > > > > > > > > TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at > > > > http://www.amibroker.com/feedback/ > > > > (submissions sent via other channels won't be considered) > > > > > > > > For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG: > > > > http://www.amibroker.com/devlog/ > > > > > > > > Yahoo! Groups Links > > > > > > > > > > > > > > > > > > > > > >
