Changing Information content for several symbols at once (OLE example)

I have been searching within help files and on this forum for the following: I want to add a specific symbol information, that is Tick Size, at once for a big watchlist of symbols, without having to do it individually, which is tedious when you have dozens of symbols or more.
In my case, I just want to indicate a Tick Size of 0.01 for all symbols of my watchlist at once, instead of having to go individually in the “information”’ window for each of them.
Any way to do this, perhaps through a file which I could edit with a text editor?

Thanks,
Carl

I am not sure if this is what you are looking for. Read through these pages and look at the images,

https://www.amibroker.com/guide/w_settings.html

https://www.amibroker.com/guide/h_futbacktest.html

P.S. these links were found by me by just using Google and searching for “AmiBroker tick size”

How to change property for multiple symbols at once.
http://www.amibroker.com/kb/2006/09/01/how-to-change-property-for-multiple-symbols-at-once/

But i think… This part of the manual you need to read carefully
https://www.amibroker.com/guide/d_ascii.html

.
.
.
.
.

*************** PLEASE DO NOT READ BELOW HERE ******************

As it is for more advance users and i am not sure if it is allowed to write all the details here.
Make a BACKUP before you do anything

For me it is easy to make an

  1. ImportTickSize.txt or csv file then write all the information you need with comma separated
  2. In the Format folder I create a file name ImportTickSize.format
  3. Then you need to edit the import.types according to the manual
  4. Go to the AB menu File/import ascii
$NOQUOTES 1
$SKIPLINES 1
$AUTOADD 1
$OVERWRITE 1
$SEPARATOR ,
$FORMAT TICKER, ALIAS, FULLNAME, TICKSIZE

the ImportTickSize.txt look like that.
Note in this example the TICKSIZE is in 4th column

Silver,,,0.0001,
Dow_Jones,daw,,1,
DAX_30,dax,,1
FTSE_100,,,1,
S&P_500,SP,,0.25,

2 Likes

@PanoS,

Quote by PanoS:"... i am not sure if it is allowed to write all the details here."

Quoting Tomasz:
"..., as our software is not really targeted for beginners. It is advanced tools for advanced, computer literate people. Like you don’t buy Matlab if you don’t know what linear algebra is."

So why would it not be allowed (since AmiBroker is mainly targeted to people who know what to do)?

Anyway the OP wants to add ticksize info to multiple symbols at once.

One way is using OLE:
Javascript example below. I repeat below code is Javascript not AFL. So save file to file extension .js

// This is JAVASCRIPT NOT AFL
// It adds defined ticksize of this jscript to symbols of defined watchlist (see lines below)

wlnum = 0; // you can define watch list number here
TickSizeValue = 0.01;// you can define ticksize here

// Amibroker database
database = "C:\\Program Files\\AmiBroker\\Data\\";   //define your Amibroker database

AB = new ActiveXObject("Broker.Application");

// Opening database 
AB.LoadDatabase(database);

Qty = AB.Stocks.Count; 

for( i = 0; i < Qty; i++ ) {
	Stk = AB.Stocks( i );

	if( wlnum < 32 )	{
		if( Stk.WatchListBits & ( 1 << wlnum ) )	{
			Stk.TickSize = TickSizeValue;
		}	
	} else {
		if( Stk.WatchListBits2 & ( 1 << ( wlnum - 32 )) )	{
			Stk.TickSize = TickSizeValue;
		}
	}
}

AB.RefreshAll();
AB.SaveDatabase();

//notify the user when finished 
Shell = new ActiveXObject("WScript.Shell");
Shell.Popup("Ticksize inserted", 1.5);

In upper code

  1. Define WL number, ticksize value and database path.
  2. Save file.
  3. Double click saved Javascript file.
  4. Wait till popup shows up saying "Ticksize inserted".
  5. Done.

Another (different) way to add ticksize to multiple symbols at once:

Close AmiBroker.
Create format file such as this one:

$FORMAT NAME,TICKSIZE
$SKIPLINES 1
$BREAKONERR 1
$AUTOADD 1
$NOQUOTES 1
$OVERWRITE 1
$SEPARATOR ,

Save format file i.e as WL_Ticksize.format to ...\AmiBroker\Formats folder.
In same folder open Import.types file and add line

Add TickSize (to Watchlist) (*.csv)|*.csv|WL_Ticksize.format

to it and save that file.

Next open Excel and add your symbols to Column A and in Column B add your ticksize. Then save table as CSV file.

Example Excel table:

Next,

  1. Start AmiBroker
  2. Go to File - Import Ascii
  3. In "Files of type" drop down menu choose "Add Ticksize (to Watchlist)"
  4. Browse to your CSV file (the one being created via Excel)
  5. Open it
  6. Done, tick size has been added to your defined symbols at once
13 Likes

Thank you all for responding to my help request, this shows again than both Amibroker and its community are rich! I have now more than enough to choose a way to have all my database symbols assigned a tick size; actually this is intended for EOD database Stooq- no ad intended. thanks to a tick size assigned I can now explore, scan and system test. Though some stock symbols might not have the usual 0.01 as tick size but I will then change those exceptions infividually

Thanks very much fxshrat, you are genius. Solved my problem of updating floating shares as well.

Cheers,
Scott

@Tomasz is the genius since he is the one who has created AmiBroker. We (advanced) users just make use of all its (massive) potentials. :slight_smile:

4 Likes

Bach, Mozart, Einstein were geniuses. I am just code craftsman.

5 Likes

It is very usefull method for updating the symbol infromation