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

[amibroker] Re: How to extract position in (non time based) array - AFL EXPERTS?


  • Date: Tue, 22 Dec 2009 03:09:08 -0000
  • From: "kevinoversby" <kevinoversby@xxxxxxxxx>
  • Subject: [amibroker] Re: How to extract position in (non time based) array - AFL EXPERTS?

PureBytes Links

Trading Reference Links

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 amibroker@xxxxxxxxxxxxxxx, "Mike" <sfclimbers@xxx> 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 amibroker@xxxxxxxxxxxxxxx, "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 amibroker@xxxxxxxxxxxxxxx, "Ara Kaloustian" <ara1@> wrote:
> > >
> > > use valuewhen function and return the barindex() value
> > > 
> > > ----- Original Message ----- 
> > > From: "kevinoversby" <kevinoversby@>
> > > To: <amibroker@xxxxxxxxxxxxxxx>
> > > 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
> > > > 
> > > > 
> > > > 
> > > >
> > >
> >
>




------------------------------------

**** 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

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    amibroker-digest@xxxxxxxxxxxxxxx 
    amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/