Australian (ASX) Stock Market Forum

Help for Amibroker to change symbol prefix

Joined
25 November 2016
Posts
8
Reactions
0
I need a script to change the name of the prefix for a lot of symbol in the Amibroker Database.
I have many stock with "AU_" by prefix (one example is: AU_AAC) and I want to change in: AU:AAC

Can anyone help me to change all symbol symbols automatically with a script (without change it manually)?

PS: I have Amibroker 5.70

Thanks.
Kiss
 


This script in your link change the "SUFFIX" (latest 3 chars of the symbol)

*** but I ONLY want to change the "PREFIX" **

----------------------------------------------------------------
AB = CreateObject("Broker.Application");
sts = AB.Stocks();
Qty = sts.Count;
for( i = Qty - 1; i >= 0; i = i - 1 )
{
st = sts.Item( i );
Ticker = st.Ticker;
printf("changing " + ticker + "\n" );
Length = StrLen(Ticker );
if( StrFind(ticker, ".TO") )
st.Ticker = StrLeft( ticker, Length-3)+"-TC";
}
-------------------------------------------------------------
***********************************************************

I've modified with "StrReplace" to change TOR: in TSXCA:(see below):

All symbols are changed, but I dont know why many stock(not all) loss copletely their data.
Can anyone help me?

[I have Amibroker 5.70]

-------------------------------------------------------------
AB = CreateObject("Broker.Application");
sts = AB.Stocks();
Qty = sts.Count;
for( i = Qty - 1; i >= 0; i = i - 1 )
{
st = sts.Item( i );
Ticker = st.Ticker;
printf("changing " + Ticker + "\n" );
Length = StrLen(Ticker );
if( StrFind(Ticker, "TOR:") )
st.Ticker = StrReplace( Ticker, "TOR:", "TSXCA:");
}
-------------------------------------------------------------

Thanks in advance for your help.
 
This script in your link change the "SUFFIX" (latest 3 chars of the symbol)

*** but I ONLY want to change the "PREFIX" **

Yes, of course I know that since I know how to read and write code and posts.
The code from that AmiBroker link is supposed to be an EXAMPLE.

I've modified with "StrReplace" to change TOR: in TSXCA:(see below):

All symbols are changed, but I dont know why many stock(not all) loss copletely their data.
Can anyone help me?

[I have Amibroker 5.70]

Possibilities:

1. symbols' data has been lost before applying your code already and you didn't notice.
2. your AB license does not exists and as such AB does not save data in demo mode.
3. Your license is not a legal one and got deactivated and as such AB is in demo mode again (not saving data).
4. You did some other unknown step leading to data loss

Have you actually followed the steps of applying the code in upper link (see "Analysis - Commentary" tool)?
So another reason could be that instead you may have run it in scan or exploration mode and applied on "All symbols and "All quotes" which may have lead to a crash resulting in data loss.


BTW, every clever man/woman creates a backup of data first before experimenting.
Important words in previous sentence: "clever" and "backup".
 
Yes, of course I know that since I know how to read and write code and posts.
The code from that AmiBroker link is supposed to be an EXAMPLE.



Possibilities:

1. symbols' data has been lost before applying your code already and you didn't notice.
2. your AB license does not exists and as such AB does not save data in demo mode.
3. Your license is not a legal one and got deactivated and as such AB is in demo mode again (not saving data).
4. You did some other unknown step leading to data loss

Have you actually followed the steps of applying the code in upper link (see "Analysis - Commentary" tool)?
So another reason could be that instead you may have run it in scan or exploration mode and applied on "All symbols and "All quotes" which may have lead to a crash resulting in data loss.


BTW, every clever man/woman creates a backup of data first before experimenting.
Important words in previous sentence: "clever" and "backup".

-------------------------
discard point 2. and 3.....

remain 1. and 4.

I applied the script in Commentary section as written in the link above.

ok... I retry all procedure in a new database for testing (with hundred simbols) to find the error.


If anyone have another way to change all prefix in all symbols (delimited with ":" or "_" ex. AU:AAC or AU_AAC) wold be appreciate for me.

Thanks
Kiss
 
There is no other way other than using OLE automation.

Instead of running OLE code via AFL (which in general is not a good idea i.e. Microsoft OLE is not multi threading friendly) you can run an OLE script from outside of AmiBroker via jscript, vbscript, ...

BTW since you claim to have purchased AmiBroker simply go to AB technical support. You have paid for it. So why don't you use what you have paid for?
 
There is no other way other than using OLE automation.

Instead of running OLE code via AFL (which in general is not a good idea i.e. Microsoft OLE is not multi threading friendly) you can run an OLE script from outside of AmiBroker via jscript, vbscript, ...

BTW since you claim to have purchased AmiBroker simply go to AB technical support. You have paid for it. So why don't you use what you have paid for?


I haven't paid AB... becuse my friend install his copy of AB 1 years ago on my PC (5.70).
I don't know why it's a registered version.

:)
 
LMAO!

Then why have you written "discard point 2. and 3....."
Just because your criminal friend (me thinks both of you are one and the same guy) installed a copy with stolen key on your PC doesn't make your installation a legal one (most stupid comment for a long time). Also 1 year ago there was no version 5.70 released. 5.70 was released 2014. So it is a stone cold old outdated version.

Anyway help yourself. No help from me.
 
LMAO!

Then why have you written "discard point 2. and 3....."
Just because your criminal friend (me thinks both of you are one and the same guy) installed a copy with stolen key on your PC doesn't make your installation a legal one (most stupid comment for a long time). Also 1 year ago there was no version 5.70 released. 5.70 was released 2014. So it is a stone cold old outdated version.

Anyway help yourself. No help from me.


WHOAAAAAAAAHH...
I'm a "C R I M I N A L"..... LOL

"my friend" "INSTALL" last year, the 5.70 on my PC. (he is a very good friend :) )
I never told: the 5.70 was released in 2015.

anyway, the forum in the world exist to write and reply "everithing"... (whatever is bad or good for you).
 
WHOAAAAAAAAHH...
I'm a "C R I M I N A L"..... LOL

"my friend" "INSTALL" last year, the 5.70 on my PC. (he is a very good friend :) )
I never told: the 5.70 was released in 2015.

anyway, the forum in the world exist to write and reply "everithing"... (whatever is bad or good for you).

Lol as much as you want. I know, no criminal likes the fact of being called what he is... a criminal. It is not surprising to me (same goes for your capital letters showing some subconscious confession). You are just another proof for the fact of majority of criminals having an IQ below 100.
 
Top