Recover Templates, Layouts from backup

I am running AmiBroker 6.39.1 build 9.3.21. I backup my AmiBroker directory in full every 30 minutes. My Preferences Misc. tab Auto Save for Templates and also for Layouts is UNCHECKED. If I ADD say, an indicator to a chart, and then exit AmiBroker, on re-opening AmiBroker the charts for every ticker code I then open, show that newly added indicator. Re-loading the Default Template also includes the new indicator as does the reloading of a saved Layout.
I have read the article Files and Directories used by AmiBroker. I restored the Default Template and Layout from a backup which pre-dates the addition of the new indicator but charts still show the recently added indicator. The only means I found to recover the pre-indicator chart display was to re-install the complete AmiBroker directory from a pre-indicator time. I would appreciate advice as to why the previously saved Default Template and also a previously saved Layout as restored from a backup did not "recover" the pre-indicator version of the charts. Why did I need to restore the entire AmiBroker directory?

No, you don't need to restore entire directory. What you need to do is to learn how the system works.

First thing to understand is that AmiBroker is not symbol-centric. It does not revolve around individual symbols.

AmiBroker is systems design and research platform that works on entire universe of symbols and does not require setting up the chart individually for each symbol because this would be super time-consuming and pointless if you want to scan tens of thousands of symbols visually. In AmiBroker you do your main analysis chart setup once and super quickly can scroll across the entire universe (select symbol and hold down DOWN ARROW key and you will be able to see hundreds of symbols in matter of seconds)

What takes ages in other platforms takes seconds in AmiBroker.

So it is meant to use a same layout for all symbols in the universe, for speed of scrolling thru zillions of charts.

Now of course, the fact that it is the "default" way of using it, does not mean it is the only way.

You CAN have separate chart layout (i.e. different indicators) for each symbol, but you have to CREATE such layouts (starting from BLANK CHART) and save them SEPARATELY using Layout SAVE AS and give the layout the name of the symbol.
You also have to go to Tools->Miscellaneous and TURN OFF AUTO-SAVE of LAYOUT to prevent accidental overriding of layouts.

And you then use OPEN LAYOUT for given symbol if you want to open particular layout.

Second thing is that you don't understand the difference between Template and Layout.

Template is normally NOT USED for your existing chart at all.

Template is a TEMPLATE, it is meant as default setup FOR NEW CHART WINDOW only, i.e when you use File->New->Default Chart.

The only way to get TEMPLATE to be used for existing chart is to load template manually.

General advice is: DO NOT USE TEMPLATES, except if you want to setup a new default for File->New->Default Chart option.

What you should be using are LAYOUTS. That is why there is a "Layouts" window, for easy access but no "templates" window. Templates are kind of hidden, yet people insist on using them for wrong purposes.

LAYOUTS are meant to store chart setups and LAYOUTS are what you should use.

LAYOUTS store entire multi-window chart setups and LAYOUTS allow easy switching

Having said that it is important to remember that BOTH templates and layouts are simply references to ChartIDs. They don't store any data nor formulas just references to ChartIDs. Those ChartIDs are stored in global file called broker.newcharts This file stores what AFL formula is attached to say ID 1234

Therefore if your layout or template contains window panes SHARING same ChartIDs, the change in one layout/template would affect other templates sharing same ChartIDs.

For this reason, when creating independent templates/layouts, ALWAYS START FROM File->New->BLANK CHART.

This is explained in great detail here (please really DO READ the entire KB article carefully before asking any follow up questions, as without reading and understanding the concept explained there you will be lost in invalid assumptions)

Other recommended reading


Thanks for your detailed reply. I do understand that AmiBroker is not "symbol-centric". I have not made my problem clear. I have Auto Save for both templates and layouts UNCHECKED in Preferences. However, changes which I make to a set of work sheets are being automatically saved on exiting/closing AmiBroker. When I re-open AmiBroker and select New Default Chart the default chart now has the changes made in the previous session although I did NOT save the changes then as Save as Default. . Similarly if I load the Default layout, it now includes the changes made in the previous session. Why is my default template and default layout being automatically updated when Auto Save for these is UNCHECKED.

Precisely what changes do you mean? Formula changes? Parameter changes? Drawings??? Different things are stored in different places. It is important to be precise.

The changes to which I refer are changes to parameters and also drag n' drop's from the Chart tab i.e. changes thus made are updating the Default Template and the Default Layout even though I have not Saved the changes as a Default (or any other) Template or Layout. I have also not clicked on the File menu Save All , or Save, before Closing AmiBroker. I have closed/exited using the top right hand corner X Close.

Did you read that carefully ?


It explains clearly that drawings, parameters and formulas are CONNECTED to ChartID. If you have two chart panes that use same ChartID, any changes made to parameters, drawing and formulas will be SHARED between those two panes.

Therefore to be able to save these separately, you have to CREATE charts with SEPARATE ChartIDs as explained in the article. Please re-read.
If you are using New Default Chart you are creating SAME CHARTID.

I told you previously, use NEW BLANK CHART, if you want to have independent charts.

  1. I have my Preferences / Misc. Tab Auto save Templates Unchecked (i.e. OFF). I have my Auto save Layouts Unchecked (i.e. OFF).

  2. I do not want my Default Template and Default Layout being automatically updated every time I add a drag n' drop indicator or change the price style or change parameters, on a chart. Tomorrow I may wish to revert to my Default Template prior to any of those changes I just made by using File/New/Default Chart

  3. after Closing AmiBroker (via the X in the top RHC) and later re-opening AmiBroker and accessing File/New/Default Chart I find that
    a. the Default Template has been automatically updated with the changes I last made i.e. the changes that I made before closing AmiBroker
    b. the Default Layout has been automatically updated with the changes I last made i.e. the changes that I made before closing AmiBroker

  4. Why is the Default Template and Default Layout being automatically updated when I have the Auto saves UNCHECKED in my Preferences?

  5. My question above is NOT about a specific symbol or wanting independent charts. It is not about changes to a specific chart or layout.
    My question is only about WHY the Default Template and the Default Layout are being automatically updated given my autosave settings are unchecked?

How do you know it is saved? Did you check MODIFICATION TIME of layout file ?
If not, check the modification time. Don't assume.

Are you running 32-bit version or 64-bit version? It is important, yet missing info in your post.

Chances are that you don't have AmiBroker properly installed and you have so called VirtualStore that Microsoft invented and it causes file system to play games.
VirtualStore can cause lots of troubles:

Also send a screenshot of what you have in preferences. A picture is worth 1000 of words.

1 Like