Australian (ASX) Stock Market Forum

AmiBroker Tips and Tricks

Joined
27 November 2017
Posts
1,200
Reactions
1,886
Sharing a couple of things that I learnt today and should be part of your backup, as I have learnt the hard way ( as usual )

- When creating your own snippets of code Amibroker creates a new file
C:\Program Files\AmiBroker\UserSnippets.xml​

- When creating notes for each stock Amibroker stores them here
C:\Program Files\AmiBroker\Notes​

 
I was thinking that there a few users here and some novices like myself, so I better explain the snippets comment from above.

In AFL Formula editor you can save the snippets of code that you create ( find while surfing the web etc ) and store in the library for future use. The images below show the default code ( green box ) and the user created code ( pink box ). When adding a snippet you will be prompted to add some properties as shown. Once this is done the file UserSnippets.xml is created or updated.

upload_2020-5-27_6-45-13.png upload_2020-5-27_6-45-58.png
 
One thing that caught me out recently was the Drag-drop folder. I was working on some code and didn't realise it hadn't been moved out of the hidden folder yet. As I didn't have hidden folders displayed, when I copied the files over to my laptop to take away with me on a trip I didn't get a copy of the code I was working on.

Make sure hidden folders are displayed if you want to copy everything.
upload_2020-5-27_22-9-24.png
 
Thanks for that @Lone Wolf as I was unaware of this folder.

My folder is not hidden so that is something to look at, but I investigated the Insert and Insert Linked options here and found that if I just drag and drop (insert) then a copy of my custom code is made and stored in the Drag-drop folder.

The Insert Linked option will not create a copy. I am not sure what the benefits of creating a copy is so maybe someone can enlighten me, but having multiple copies can only lead to some confusion.

upload_2020-5-28_4-58-37.png
 
The Insert Linked option will not create a copy. I am not sure what the benefits of creating a copy is so maybe someone can enlighten me, but having multiple copies can only lead to some confusion.

It just depends whether you want to modify the original code.
Insert makes a copy, so you can then modify that code all you want without worrying about overwriting the original code.

Only use insert linked if you want to make and save changes to the original code.
 
Yeh, who wants to right click the "Maint" button once a day anyway haha, Disclaimer: i use the batch lol

You can also set dynamic watchlists in in NDU also, can be handy
actually will be useful, just finished installing AB and Premium data on aws, ideally i auto update after market close, run explore and email me the buy/sell to order automatically
 
Righto I'm back with another piece of useless information for the AmiBroker users :rolleyes:

One of favourite sites is Market Index which I find very useful to check out the latest announcements for stocks that I am interested in and you can link that directly to which code you have a chart open on to the web research panel....confused :confused: well let me try to explain a bit better with pictures

1 - I run a scan and a stock is suggested - in this case BVS

upload_2020-5-31_18-9-29.png

2 - I click on the stock and it opens in my chart window

upload_2020-5-31_18-10-29.png

3 - I want to view the latest announcements
a) I select New Web Research and Market Index web page is displayed with BVS already selected​

upload_2020-5-31_18-11-18.png

upload_2020-5-31_18-12-42.png


What .... how did that happen .... Lets have a look see o_O

4 - Select the following.......Tools - Customize - Web Pages
a) Delete the other pre loaded rubbish.....(well that is up to you)
b) add the following​
upload_2020-5-31_18-17-16.png

Now if you are still confused just put me on ignore and carry on....:D:D:D
 
Righto I'm back with another piece of useless information for the AmiBroker users :rolleyes:

One of favourite sites is Market Index which I find very useful to check out the latest announcements for stocks that I am interested in and you can link that directly to which code you have a chart open on to the web research panel....confused :confused: well let me try to explain a bit better with pictures


Now if you are still confused just put me on ignore and carry on....:D:D:D

Thanks for that. I am using Norgate data and my codes use a ".au" suffix - whereas Market Index doesn't recognise the ".au" - any ideas how to strip out the ".au" in the web research?
 
@CNHTractor I also use Norgate but I dont have the .au suffix issue and not sure how to strip it out.

When you enter symbol for a chart do you just put in the code as per below

upload_2020-5-31_20-8-46.png
 
@CNHTractor I also use Norgate but I dont have the .au suffix issue and not sure how to strip it out.

When you enter symbol for a chart do you just put in the code as per below

View attachment 104021
Thanks for your reply.

This is my entry

Temp.jpg

So if I type in APX it automatically shows APX.au

Unless someone knows - i will have a look at Amibroker help etc tomorrow.
 
I just had @Joe Blow move some post into this new thread so thanks mate.

Another tip for you today.....

Norgate Data - Determining the Sector/Industry Index symbol for the current security

I had been using some code to look up the relevant index and thought that there must be a better way to do this.

I read the Norgate usage page ( https://norgatedata.com/amibroker-usage.php#hics ) and couldn't figure it out, so I emailed Norgate and @Richard Dale was kind enough to provide a solution that works for me.

NorgateIndex = NorgateIndustryIndex("$XJO", 1 ,"PR");
AddTextColumn( NorgateIndex, "Norgate Index");

This returns the following when put into exploration

upload_2020-6-2_16-32-15.png

so then you can use the relevant index code for the sector healthy indication. This can be done in a number of ways as it is up to you and your imagination.

Give it a go and hopefully you get some good results..

Trav.
 
I was looking at the Custom Backtest (CBT) interface again this week and learnt something which I thought would be good to share.

As usual there is more than one way to do something and here I have discovered 3 ways to do the same thing....wow what is this magic I hear you ask o_O

When you have some CBT code you want to run you can do it via one of the below options;

Option 1 - on the Analysis settings -- Portfolio tab select you CBT .afl code to load

upload_2020-6-5_18-35-18.png

Option 2 - Insert your CBT code within your main .afl system code

upload_2020-6-5_18-36-37.png


Option 3 - have a single line of code in your main .afl system code which loads your CBT .afl code

SetCustomBacktestProc("c:\\Program Files\\AmiBroker\\Formulas\\Custom\\CBT_CustomBackTest.afl");​

So there you go, another interesting tip for you to digest or even better share one of your own.
 
I was looking at the Custom Backtest (CBT) interface again this week and learnt something which I thought would be good to share.

As usual there is more than one way to do something and here I have discovered 3 ways to do the same thing....wow what is this magic I hear you ask o_O

When you have some CBT code you want to run you can do it via one of the below options;

Option 1 - on the Analysis settings -- Portfolio tab select you CBT .afl code to load

View attachment 104344

Option 2 - Insert your CBT code within your main .afl system code

View attachment 104345


Option 3 - have a single line of code in your main .afl system code which loads your CBT .afl code

SetCustomBacktestProc("c:\\Program Files\\AmiBroker\\Formulas\\Custom\\CBT_CustomBackTest.afl");​

So there you go, another interesting tip for you to digest or even better share one of your own.
Great indeed, i used option 2 but as the BT code is often shareable, these other options are probably actually better
 
Just to add to the discussion, I also find option 3 to be the best of the above. I use different custom backtest procedures to cater for the different custom metrics that I'm after given whether a system is mean reverting or trend following.

Save a bunch of Custom Backtest Procedures under their appropriate names and call them as required.
 
While we're on the subject of custom backtest procedures and custom metrics, what's everyones favorite metric when looking at a backtest report (besides looking at the equity and drawdown curves)
Is everyone sticking with the old CAR/MDD or does anyone have a particularly good alternative.

I have experimented with H_Bandy's CAR25 but found it to be extremely CPU intensive. My second favorite is a variation of Expectancy where it is made unitless by dividing by avgLoss

It is in essence E = AvgTrade / AvgLoss

I'm keen to hear thoughts particularly for trend following systems
Cheers
 
Top