How to change the symbol name permanently ?
Author: abegy
Creation Date: 3/29/2020 2:04 PM
profile picture

abegy

#1
Hi Eugene,

Is there a possibility to change the Symbol name and store it with the symbol with the Wealthscript ?
profile picture

Eugene

#2
Hi,

The Data Tool should help you. Choose "Change symbol" from its right click menu.
profile picture

abegy

#3
Thanks again. But in the Data Tool, the change is only for the symbol code. I would like to change the symbol name.
Is there a way to do it ?
profile picture

Eugene

#4
I must have missed the gist of your question Alexandre. In theory it should be possible to do if you assign a custom string to the Bars.SecurityName property, save the resulting Bars object to a disk file with Bars.SaveToFile and then overwrite the original .WL file with the one you produced. With some providers your change to the SecurityName property may persist until you refresh the data. Others will most likely replace it with the original string - and some may even do it on a daily update.

P.S. Those that don't support the BarDataStore (like ASCII, MetaStock, Database, MetaTrader etc.) are not considered: they might have own means to change the symbol name.
profile picture

abegy

#5
Thanks a lot. I will try it. Can you give me how I can find the current directory on the symbol processed to be able to overwrite it in the wealthscript ?
profile picture

Eugene

#6
Why do you think this is required?
profile picture

abegy

#7
Right :-). Thanks again !
profile picture

Eugene

#8
CODE:
Please log in to see this code.


I mean, certainly it's possible to find the currently processed symbol's directory in WealthScript. All it takes some Reflection usage to determine the current data provider. Code above is incomplete but examples can be found on the forum. I just don't understand why you're looking to overwrite it in WealthScript?
profile picture

abegy

#9
I need this because my data provider doesn't have the security name in standard.
Thanks for your help.

PS : I tested SaveToFile. It doesn't save by default in the current data directory. You need to force the path.
profile picture

Eugene

#10
Perhaps an easier solution could be to have a plain text file with symbol and security name pairs and look it up in your script.

Anyway, here's a quick solution for you that finds processed symbol's file name and path:

CODE:
Please log in to see this code.


It uses undocumented features so you're on your own with it.
profile picture

abegy

#11
Great ! More simple for me like this. Thanks again for your help.
profile picture

Eugene

#12
Don't mention it.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).