Australian (ASX) Stock Market Forum

Lichello AIM Plugin for AmiBroker

GreatPig

Pigs In Space
Joined
9 July 2004
Posts
2,368
Reactions
14
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 and here.

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
 

Attachments

  • GP_AIM.zip
    38.2 KB · Views: 373
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
 
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.
 
WaySolid said:
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
 

Attachments

  • SSI_Parm_GP2.gif
    SSI_Parm_GP2.gif
    9.7 KB · Views: 707
  • SSI_GP2.gif
    SSI_GP2.gif
    10.7 KB · Views: 400
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
 

Attachments

  • GP_AIM_v1-1.zip
    52.9 KB · Views: 156
  • AIM_FMG_GP1.gif
    AIM_FMG_GP1.gif
    12.1 KB · Views: 356
  • AIM_FMG_PARM_GP1.gif
    AIM_FMG_PARM_GP1.gif
    19.7 KB · Views: 646
  • AIM_FMG_EXP_GP1.gif
    AIM_FMG_EXP_GP1.gif
    20.7 KB · Views: 649
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
 

Attachments

  • GP_AIM_v1-2.zip
    52.9 KB · Views: 301
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
 
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
 
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?
 
dcarlson said:
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
 
Nick Radge said:
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
 
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.
 
I just came across your plugin i love it but it need to grab the scan from date as a buy.
Currently it take all quotation and start with the fist in your database
the afl needs to read the from to date
I did it once before in ami and amidll but dont remember how
 
I just came across your plugin i love it but it need to grab the scan from date as a buy.
Currently it take all quotation and start with the fist in your database
the afl needs to read the from to date
I did it once before in ami and amidll but dont remember how

Do you mean like this?
startbar = Lastvalue( Valuewhen( Status( "firstbarinrange" ), bi ) );
endbar = Lastvalue( Valuewhen( Status( "lastbarinrange" ), bi ) );
 
Top