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

Re: [amibroker] Re: Dave Landry Pullback - someone has a fully working afl copy?



PureBytes Links

Trading Reference Links

 On Mon, 20 Feb 2006 21:08:28 -0000, John Larsson wrote:
> 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?

There are no sells/exits coded in the system.  I see now that I did use a Sell statement, which should actually be a Short statement.  The idea at the time was to simply use this as an Exploration nightly, to find candidate stocks, and I would manage my trailing stops/profit targets/stop losses outside of Amibroker.  So I used this to scan *only for entry signals*.

 

To correct the code you can simply substitute Short in the last line, instead of Sell.

 

> 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) ?

This is another oversight.  They both achieve the same thing, but if I remember correctly, I think I went back and added the IIF() around the statements for code clarity.  Looks like I missed the NewLows line as I added them.

 

> 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);

No, the line above is correct.  What  am looking for is that the Highest High over the last 5 days is also the Highest High over the last 40.  This was meant to find a new high that occurred in the last five days, meaning the five day high is also the 40 day high.

 

Technically, this isn't quite correct, as the high of the last five days merely has to match the high of the last forty days.  If we are looking for a *new* high, then the following is more appropriate:

 

NewHighs   = HHV(H,5) > Ref(HHV(H, 40), -5);

NewLows    = LLV(L,5) < Ref(LLV(L, 40), -5;

 

In plotting this and the original code on a chart, you'll notice that they are pretty close, so I wasn't way off... :)

 

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

This was coded very early in my AFL learning curve.  Looking at it now, I realize how much I've progressed.  There are probably much more elegant ways to code this pattern, but I'd still say this is a good example for AFL newbies.

 

I've attached a cleaned up version of the code for convenience.

 

Daniel



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





SPONSORED LINKS
Investment management software Real estate investment software Investment property software
Software support Real estate investment analysis software Investment software


YAHOO! GROUPS LINKS




Attachment: Description: Binary data