I have a general Query. Which option would be the best to import data into Amibroker if there is a sudden power outage while importing the data.
Manually importing using the ASCII option or Import wizard.?
Using Batch processing?
Using JScript or VBA ?
I am specifically asking because Amibroker is not visible when importing data using jscript or VBA. I presume it runs in the background and just wanted to know about the safest method of importing data in case of frequent power outages.
Set Amibroker = CreateObject("broker.application")
Amibroker.Visible = False
Also broker.newcharts is frequently getting corrupted. What precautions should be taken to avoid this. I have excluded the amibroker folder from windows scanner as mentioned in various articles.But it still happens in case of sudden power failure.
Note:- I have databackup plans. The above question is out of curiosity to know.
I use a laptop, and they spare is also a laptop but from my experience they're all the same. None is safer than the other.
Reason is, Amibroker doesn't save every bar that it imports. It would kill itself.
So you have to see, how frequently you save the DB either by clicking "save all/DB" or using the save Db via OLE in your script.
All the above is theoretical, but if you have such frequent power problems, you better get a good power backup. Saving before power crash is the wrong way to deal with the problem.
Not only AB, you may end up with problems in the OS too.
I agree laptop would be the best alternative. Due to Covid-19 I was not able to replace the battery in UPS. Even If I immediately close the Amibroker application just before the timeout of UPS, the file broker.newcharts and layouts always get corrupted and I need to replace them from the backup folders.
My post actually went into moderation before i was able to edit and type some more.
Power failures can damage hardware too.
I think i read somewhere, but a graceful AB exit ensures proper save of everything.
There are many components, maybe layout/WL files etc, the DB, static variables.
Also, drawings are saved in DB along with tick/bar info.
The script should also try and simulate save all stuff.
SetOption("StaticVarAutoSave", 60 );
This is from the Guide, so one way to save SV periodically.
I'm not sure of any other way like OLE to save SV without exit.
You could have save DB from script, because you asked, and that may run periodically.
I haven't tried calling it from Batch or within AB but you could run it periodically.
Sub SaveDatabase ()
Function SaveLayout (ByVal pszFileName As String) As Boolean
- You could then use save all from the UI when you remember.
Hope it helps you through the lockdown.
Thank you. I am using EOD data only.
Wow amisur.....I think you are overthinking everything. If you actually have all these problems and worries, then making sure that you have no corruptions in your database and files in your Amibroker folder is the least of your worries. Especially when you only care about EOD quotes.
So as soon as your EOD quotes are imported (which ever way you do it), then press the save database icon, then possibly use Tools/Save preferences, and you should never have any problems from within your Amibroker.