PureBytes Links
Trading Reference Links
|
I think the point that John was trying to make is that regardless of
whether they're written with an IIF or not they'll always be true ...
Given that the comment in the code says
"// New 2 month low has occurred in the last 5 days?"
One would think the appropriate code would be ...
NewHighs = HHV(H,5) = HHV(H,40);
NewLows = LLV(L,5) = LLV(L,40);
--- In amibroker@xxxxxxxxxxxxxxx, "Lesmond V" <ebsn247lsm@xxx> wrote:
>
> John L, here is the answer to one of your questions:
>
> > I also have an observation about this piece of code:
> > NewHighs = IIf(HHV(H,5) >= HHV(H,40), 1, 0);
> > NewLows = LLV(L,5) <= LLV(L,40);
> >
> > Shouldn't the second line be like the first with an IIf statement?
> > Like this: NewLows = IIf(LLV(L,5) <= LLV(L,40),1 , 0) ?
>
> As you only want the formula to return 1 (true) or a 0 (false) you
don't really need IIF() function. Actually both lines could be as
follows:
>
> NewHighs = HHV(H,5) >= HHV(H,40);
> NewLows = LLV(L,5) <= LLV(L,40);
>
> This is explained in AFL Reference Manual here:
>
> http://www.amibroker.com/guide/a_language.html
>
> Go to paragraph "Conditional function IIF()".
>
> Lesmond
>
> --- In amibroker@xxxxxxxxxxxxxxx, "John Larsson" <amibroker@> wrote:
> >
> > Hi Daniel, nice of you to join! I'd like to ask you a few
questions
> > about your code, if you don't mind!
> >
> > Maybe I did not express myself correctly, but what I mean is that
I
> > expected both buy and sell. And you have indeed coded both buy
and sell.
> > I am playing long only. The system just buys once, and never
sells. Is
> > this really correct?
> >
> > I also have an observation about this piece of code:
> > NewHighs = IIf(HHV(H,5) >= HHV(H,40), 1, 0);
> > NewLows = LLV(L,5) <= LLV(L,40);
> >
> > Shouldn't the second line be like the first with an IIf statement?
> > Like this: NewLows = IIf(LLV(L,5) <= LLV(L,40),1 , 0) ?
> >
> > And about this piece:
> >
> > (HHV(H,5) >= HHV(H,40) isn't this always true? The time period to
the
> > left is a part o longer time period to the right, right?
> >
> > Should it read something like this:
> > IIf(HHV(H,5) >= Ref(HHV(H,40),-6), 1, 0);
> >
> > Sorry to ask of you to answer these questions about something you
did
> > so long ago, and I also must confess that I am not at all good at
> > coding in afl. Your code is probably correct, but I had to ask.
> >
> > Thanks,
> >
> > John
> >
>
------------------------ Yahoo! Groups Sponsor --------------------~-->
Try Online Currency Trading with GFT. Free 50K Demo. Trade
24 Hours. Commission-Free.
http://us.click.yahoo.com/RvFikB/9M2KAA/U1CZAA/GHeqlB/TM
--------------------------------------------------------------------~->
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 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/
<*> 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/
|