PDA

View Full Version : Lichello AIM Plugin for AmiBroker



GreatPig
25th-January-2006, 01:47 AM
I've created another plugin for AmiBroker that implements the Automatic Investment Management (AIM) algorithm devised by Robert Lichello.

The attached ZIP file contains the plugin DLL, an indicator AFL file, and instructions in a PDF file.

For more information about AIM, see here (http://www.aim-users.com) and here (http://home.earthlink.net/~beand/cpt/aimbasic.htm).

For AIM to give good results, wide-ranging volatility is needed. Try it with stocks like SSI, NRT and PTD. And to see where it can go bad if the stock falls and stays down with little volatility, take a look at AMP.

In general though, for most stocks in the top 200 or so over the last decade, straight buy and hold will often outperform AIM due to the bull market. AIM was designed for stocks ranging sideways rather than uptrending. And AIM is an investing method rather than trading method, with trades typically only checked for something like weekly, monthly, or even quarterly - presumably depending on how fast-moving the stock is. With this plugin, you can play around with all these parameters.

In my opinion, to use this trading method with a stock, you'd want to be fairly confident that the company wasn't going to go broke and that its price will recover at some stage before following all the buy orders as the price falls. Ultimately though, buying will be limited by the available cash reserve.

Let me know if you have any problems with the plugin. And I don't guarantee that the calculations are entirely accurate, although to the best of my knowledge they are, so use this plugin at your own risk. If in doubt, hand-calculate an example to see if you get the same results.

Cheers,
GP

wayneL
25th-January-2006, 03:19 AM
Damn! I wish I could do stuff like that!

Great work GP and thanks.

It is an interesting concept for certain types of stocks.

Cheers

WaySolid
25th-January-2006, 04:00 AM
Nice stuff GP, will just have to learn how to plug it into Ami(AIM?)broker now.

I have done a little testing, enough to know it will stay off my radar for some time yet as a strategy I use, but it seems like a decent strategy for certain markets and stocks.

I'm just not the sort of person who can load up on a stock as it's falling in price though.

GreatPig
25th-January-2006, 08:59 AM
will just have to learn how to plug it into Ami(AIM?)broker now.
Instructions are in the included PDF file.

Basically though, all you have to do is copy the plugin DLL into the "Plugins" folder under AmiBroker, copy the AFL file into the appropriate folder (which depends on which version of AmiBroker you have - for 4.70 it should be the Formulas\Custom folder), and then when running AmiBroker, insert a new indicator somewhere using that AFL file.


I'm just not the sort of person who can load up on a stock as it's falling in price though.
Yeah, I think it would be hard through a big fall. With SSI for example, when the price has been to about $5.80, I don't know that I could keep buying in volume when it's dropped down to below 20 cents :eek:. In hindsight we know it went back up, but at the time I'd be worried!

Cheers,
GP

GreatPig
28th-January-2006, 10:04 PM
I've updated this plugin with the following main changes:

- includes an option to remove cash from the system on a regular basis.
- allows for interest to be paid on cash balances.
- calculates and displays compounded annual gain as well as total gain.
- supports explorations based on annual gain and scans.

Also fixed one or two minor issues.

Note though that while it now supports scans for buy and sell indications, it can't readily be used to track a real portfolio, since there's no way to enter actual trade quantities and prices. You'd need to use a spreadsheet for that (Nick has one).

This plugin is mainly intended to allow experimentation with AIM parameters giving immediate visual feedback of the results, and to allow explorations to find the most suitable stocks to use it with (based on their history of course).

Updated instructions included.

Any problems or errors, let me know.

Cheers,
GP

GreatPig
12th-February-2006, 06:33 PM
Another upgrade to fix a problem with the calculation of the annual return.

Under some conditions, the annual return calculation was invalid and returning a value that was sometimes obviously way too large.

The attachment includes the whole package again, but only the plugin DLL has changed (and the version number in the manual).

GP

dcarlson
10th-February-2008, 04:42 AM
GP
1. Consecutive Buy Delay Periods.....One of the ways to keep AIM from applying all cash to quickly, is to let the user define the number of days delay between consecutive Buys. Typically, people have a delay of one-month between consecutive Buys.

2. Consecutive Buy Safe % Increment.....Another method that some people use to keep AIM from applying all cash to quickly, is to 'add' a user defined % to the 'Buy Safe' when there are consecutive Buys (so each time there is a consecutive Buy, the user defined "Consecutive Buy Safe % Increment" is added to the 'Buy Safe'.....Then reset the 'Buy Safe' to the original 'Buy Safe' when there is a Sell.

Perhaps both methods can be added to your program.
DC

Nick Radge
10th-February-2008, 07:06 AM
GP,
I did a tonne of work on this strategy several years ago in the ASX. It really needs a lot more volatility than what our market offers, unless if you go right down into the 1c - 5c area and then it starts to work well. The problem then of course is you're into stocks that will go bust.

Nick

agro
10th-February-2008, 08:44 AM
as far as data feeds are concerned, i assume everyone here is paying for a subscription base?

cause i cannot find any that are free?

GreatPig
10th-February-2008, 12:12 PM
let the user define the number of days delay between consecutive Buys
That's sort-of what the Time parameter does, except that's just the period at which it tests for more trades, not specifically consecutive buys.


Consecutive Buy Safe % Increment
An interesting idea. To be honest though, I've barely looked at this algorithm much since I wrote the plugin, as I've never found it to give very good results on the ASX compared to other methods. And I know there's been a lot of work done on refinements to the algorithm.

Cheers,
GP

GreatPig
10th-February-2008, 12:20 PM
It really needs a lot more volatility than what our market offers
Yes, from what I experimented with it after first writing the plugin, I couldn't get very good results for many stocks on the ASX. And those that did show reasonable annual returns were still significantly less than other methods.

I have kinda wondered though whether something similar could be done using CFDs to compensate for the lower volatility, using a shorter time frame than the standard month (maybe daily). Building up all those leveraged losses on the way down though might cause a few sleepless nights. :eek:

Cheers,
GP

thankugod
21st-February-2011, 04:09 PM
Great work, GP.

I wonder if it is possible to test it for smaller timeframes e.g. weekly or even daily?
Lichello in his book mentions fortnightly though.

Have you tested it for index or sector ETFs?

I would be happy to get your feedback.

Thanq.