PureBytes Links
Trading Reference Links
|
x = iif(h == hhv(h, 30), 1, 0);
y = barssince(x and not ref(x,-1));
As a non-programmer, can someone explain the 2 lines of code in plain
english?
If I correctly understand it, the 1st line will return a 1 if the
argument h==hhv(h,30) is true and a 0 if it isn't. However, what
confuses me is why the iif statement is needed in the first place.
Shouldn't the 1st line simply say x = h == hhv(h, 30)?
Also, what does "and not ref(x,-1))" mean in the 2nd line?
Apologies for the very basic question...
--- In amibroker@xxxxxxxxxxxxxxx, "Mike Lucero" <m.lucero@xxx> wrote:
>
> For just the initial breakout:
>
> x = iif(h == hhv(h, 30), 1, 0);
> y = barssince(x and not ref(x,-1));
> ----- Original Message -----
> From: wavemechanic
> To: amibroker@xxxxxxxxxxxxxxx
> Sent: Thursday, November 08, 2007 9:30 AM
> Subject: Re: [amibroker] Re: Help with some Coding
>
>
> "Calculate the number of Bars (x) since the HHV of the High over
the last 30 periods."
>
> x = iif(h == hhv(h, 30), 1, 0);
> y = barssince(x);
>
> Bill
>
>
> ----- Original Message -----
> From: "chorlton_c_hardy" <chorlton-c-hardy@xxx>
> To: <amibroker@xxxxxxxxxxxxxxx>
> Sent: Thursday, November 08, 2007 8:18 AM
> Subject: [amibroker] Re: Help with some Coding
>
>
> >
> > Hi Ton,
> >
> > I can see why it sounds confusing....
> >
> > Basically, I don't want condition 1 to be met if the price simply
> > breaks all time highs.
> >
> > Instead, Once we have the HHV of the High over the last 30
periods, I
> > then want price to retrace back down and then rise again and
finally
> > break out (ie. Cross the HHV of the previous 30 periods). Only at
> > this point do I want condition 1 to be met!
> >
> > Is this any clearer? :-/
> >
> > If it isn't, then for this exercise in regard to coding, I can
change
> > condition 1 to:
> >
> > 1: Calculate the number of Bars (x) since the HHV of the High
over
> > the last 30 periods.
> >
> >
> > All the best....
> >
> >
> > --- In amibroker@xxxxxxxxxxxxxxx, "Ton Sieverding"
> > <ton.sieverding@> wrote:
> >>
> >> I am probably missing something in your logical problem
definition,
> > Chorlton. When I am taking the highest high over a certain
period,
> > how can I get a high during this period that will be higher ?
> >>
> >> Regards, Ton.
> >>
> >>
> >> ----- Original Message -----
> >> From: chorlton_c_hardy
> >> To: amibroker@xxxxxxxxxxxxxxx
> >> Sent: Thursday, November 08, 2007 1:01 PM
> >> Subject: [amibroker] Help with some Coding
> >>
> >>
> >> Hello All,
> >>
> >> I want to code the following conditions and would welcome some
> > help.
> >> I've included my attempt of the code but would appreciate
> > comments as
> >> to whether this is an accurate translation into AB code.
> >>
> >> Conditions:
> >>
> >> 1: Calculate the number of Bars (x) since the last time High
> > crossed
> >> above the HHV of the High over the last 30 periods.
> >> 2. The value of RSI(14) x periods ago should be more than the
> > current
> >> value of RSI(14)
> >>
> >> eg. If the output from condition 1 was say 8, then condition 2
> > would
> >> be RSI(14)>Ref(RSI(14),-8)
> >>
> >> My attempt at the Code:
> >>
> >> x:=BarsSince(Cross(H,Ref(HHV(H,30),-1)));
> >> RSI(14)> Ref(RSI(14),x*-1)
> >>
> >> Would this work?
> >>
> >> Thanks in advance,
> >>
> >> Chorlton
> >>
> >
> >
> >
> >
> > 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.503 / Virus Database: 269.15.22/1112 - Release Date:
11/5/2007 7:11 PM
> >
> >
>
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
<*> 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:
mailto:amibroker-digest@xxxxxxxxxxxxxxx
mailto: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/
|