> I don't understand what x today is x. Oh no, as I said, I was only concerned with the second line, regarding the MA and specifically the "3 or fewer bars" part. I was just trying to show that I had two buy triggers: one for today and one for within the last 3 days. Just trying to make clear what I wanted with the second trigger. Probably just made things worse, eh? ;-)
Anyway, thanks very much for the help. I'll give your code a shot. Grant > But to check if price crossed ma (I assume up and not necessarily > closed above) just modify to buy = h > hhv(ma(h, 15), 3) > > Bill > > ----- Original Message ----- > From: "longarm61" <[EMAIL PROTECTED]> > To: <[email protected]> > Sent: Friday, February 29, 2008 4:18 PM > Subject: [amibroker] Re: How To Code "...three or fewer bars ago"? > > > > Thanks Bill. I think the example I gave may not have been exactly > > what I wanted (I used the wizard). Just to clarify, what I want to > > do is: > > > > Buy if X TODAY is X > > AND if price crosses MA within last 3 days. > > > > Would your code still apply? (Only concerned with the second line, of > > course.) Thanks. > > > > Grant > > > > > > > > --- In [email protected], "wavemechanic" <timesarrow@> > > wrote: > >> > >> Only. See if this works - > >> buy = c > hhv(ref(ma(c, 15), -3), 3); > >> > >> Bill > >> ----- Original Message ----- > >> > >> From: "longarm61" <norm1@> > >> To: <[email protected]> > >> Sent: Friday, February 29, 2008 3:12 PM > >> Subject: [amibroker] How To Code "...three or fewer bars ago"? > >> > >> > >> > Sorry for yet another newb question. Does the following code > > mean > >> > "buy if cross occurs 3 bars ago ONLY" or does it mean "buy if > > cross > >> > occurs 3 OR FEWER bars ago?" I would like it to state the > > latter. > >> > How is this done if not with the code below?: > >> > > >> > Buy = Close > Ref( MA( Close , 15 ) , -3 ); > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > Please note that this group is for discussion between users only. > >> > > >> > To get support from AmiBroker please send an e-mail directly to > >> > SUPPORT {at} amibroker.com > >> > > >> > For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG: > >> > http://www.amibroker.com/devlog/ > >> > > >> > For other support material please check also: > >> > http://www.amibroker.com/support.html > >> > > >> > Yahoo! Groups Links > >> > > >> > > >> > > >> > > >> > > >> > -- > >> > No virus found in this incoming message. > >> > Checked by AVG Free Edition. > >> > Version: 7.5.516 / Virus Database: 269.21.2/1304 - Release Date: > > 2/29/2008 8:18 AM > >> > > >> > > >> > > > > > > > > > > Please note that this group is for discussion between users only. > > > > To get support from AmiBroker please send an e-mail directly to > > SUPPORT {at} amibroker.com > > > > For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG: > > http://www.amibroker.com/devlog/ > > > > For other support material please check also: > > http://www.amibroker.com/support.html > > > > Yahoo! Groups Links > > > > > > > > > > > > -- > > No virus found in this incoming message. > > Checked by AVG Free Edition. > > Version: 7.5.516 / Virus Database: 269.21.2/1304 - Release Date: 2/29/2008 8:18 AM > > > > >
