Chart Formulas Missing After Restart


Hi, as I currently understand it, the process leading to my problem is this:

  1. start windows 10
  2. open instance of AmiBroker 6.25 to database “trading” with OLE (not default database)
  3. open another instance of AmiBroker 6.25 to default database, this time from the start menu
  4. work only with the instance using the default database
  • open formula editor & write some code
  • save new afl file to a common “Code” folder that’s not in the AmiBroker 6.25 install directory
  • apply the code to a chart pane
  • save layout as local default
  • exit second instance of AmiBroker
  1. exit first instance of AmiBroker

The next time this process is repeated, some of the charts in the second instance have the error message: “The formula file (null) referenced by this chart cannot be found…”

  • despite the implication of the error message, these chart formulas have not been moved
  • some charts using formulas that are located in the same common code folder are plotting correctly
  • charts with built-in indicators (eg, price, volume, etc) also have the error message

The “current working directory” targets the AmiBroker 6.25 installation folder. I believe this is required for relative paths to work correctly.

Don’t know if any of these are related:

  • AmiBroker 6.1 is also installed but not used
  • the chart formulas that are ‘missing’ do not appear under the “File” menu in the “Recent” list in the formula editor when the second instance is opened again
  • when these formulas are saved from an auto generated name like “Formula 25” to a descriptive name, the text on the tab doesn’t change.

Where might I be going wrong? Thanks


If you are using 2 instances from same working folder then last writing instance “wins” (i.e. overwrites anything what you wrote in other instance). If you modified your charts in one instance and saved the other one as last then you would lose your modifications since last saving instance overwrote your changes. You should be using different working folders. If you are using same folder you should not be doing changes to charts while you are using 2 instances in same older. It is like opening the very same file with Notepad twice and editing in two instances. If you save the file the last write overwrites any previous writes.


Thank you Tomasz.

The current working directory holds all the system files & folders. What are the rules for creating additional working directories?

For example:

  • can each additional working directory be located on a drive/partition different from the default installation folder?
  • what system files & folders should be copied into each additional working directory so they don’t get overwritten?

Many thanks!!




Thank you Tomasz.

I’ve added the following files to a new folder “WorkingDirectory” located in an AmiBroker database folder which resides on a different partition from the installation files:



While some of these files were not included in the “Data” list at the link you provided, they appear to hold data the program may need to function correctly. For someone reading this in the future: files in the “Data” list, but not in the list above, appear to be files that are contained within a database folder and are not needed within a working directory folder.

I’ve also created a shortcut to Broker.exe that has the path (above) to these files in the “Start In” box. The program opens from this shortcut without a problem.

Please let me know if you foresee any issues with this implementation.

Many thanks!!


The process outlined in my last post did not solve the problem. The charts are still empty. The error messages state the working directory is the installation folder, despite the path to the second working directory in the shortcut.

It appears there are many “do’s & don’ts” to getting this right, and guessing in the dark will only bring more troubles and questions later. Experimenting is fun until something explodes.

If it’s not too much trouble it would be very helpful for myself as well as future readers if support provided step-by-step instructions on how to create a second working directory for AmiBroker:

  • should a user install AmiBroker again, this time to a new folder?
  • should a user copy all the files listed in your link above to the second working directory folder?
  • etc

Many thanks!!


I don’t know what you did wrong, but I am using multi working directory setups for 20 years and it is always working just fine. Do you know how many different installs and configurations do I need to have to test and develop AmiBroker? Dozens.


Thank you Tomasz for the continued encouragement.

After some more experimenting this process appears to do the job:

  1. Create a folder to hold the files for the new working directory.
  2. Copy ‘Broker.exe’ and ‘Broker.chm’ from the installation folder into the new folder.
  3. Create a shortcut to the ‘Broker.exe’ that resides in the installation folder. Replace the path in the shortcut’s “Start In” box with the full path to the new working directory.
  4. Place the shortcut somewhere convenient ( eg, Desktop, Taskbar, etc )

When the shortcut is double clicked for the first time, AmiBroker should start with the default database, preferences, etc. AmiBroker will add files to the new working directory as needed.

Copying the ‘broker.prefs’ file from the installation directory to the new working directory folder will transfer all the previously saved settings.

Copying the “Formulas” folder from the installation directory will provide all the built-in indicators to the instance of AmiBroker that will use the new working directory.

To verify the shortcut is using the new working directory, save preferences (Tools>Save Preferences) and check the timestamp of the ‘broker.prefs’ file in the new working directory.

As a word of caution, this seems to set the working directory for all future instances of AmiBroker, so each working directory used should have its own shortcut.