Click here to Login

                                                   Adding symbols and changing properties from script


Alexander Horn
2014-10-01 06:52:45

Hi QS, in a script I want to create a larger number of symbols, and then immediately edit some of their properties, like names... Looks like this

Symbols symbols1 = new Symbols();
foreach ...

Symbol sym = symbols1.GetSymbol(txt);
sym.Name1 = "something;
sym.Name2 = "something else"

but seems that the GetSymbol(txt) part does now work, as symbol not yet created (seems QS still adding them internally)

Is there any Symbol.added event I can wait for? Or any other way to assign properties before adding symbols?

Thanks, Alex

2014-10-02 02:40:53


Best Answer
Hi Alex,

Symbols are created in real time. You just need to use this:


Do not create a new instance of the "Symbols" class.

Alexander Horn
2014-10-02 02:54:27


Yep, that's it! Was working in VisualStudio, so needed to create a new Symbols instance. But now solved within QS. Thanks!

No more messages


No html code. URLs turn into links automatically.

Type in the trading objects you want to include: - Add Objects
To add a trading object in your message, type in the object name, select it and then click on "Add Objects"


Trading Items
Stock News from Articles, Bloggers, Columnists, Traders and Analy...
Market cap, ROE, ROA and Forward PE for U.S. Stocks - Fundamental...
Futures, Forex and Indices Symbols
Historical EOD data for LSE-listed Stocks and ETFs
Simple pattern detection rules using close and open prices

How-to Lessons
How to run a screen or a watchlist from a script
How to get trading orders from a portfolio programmatically
How to import trading data from CSV files
How to get stocks for a particular index using the global script
How to execute a script at regular intervals

Related Forum Threads
Script to remove Symbols from an Index
Reuse optimization parameters from Strategy script in Money Mgmt
Speed of script execution for symbols with many bars
Erase all quotes from database and start over
Can I update the sector and industry information in the stock dat...

Blog Posts
How to filter quotes data from high and low price spikes
Reading and Exporting Data from QuantShare to Excel Programmatica...
Adding Trading Indicators and Formulas to a Chart
QS Trading Software: Global Script
Compare stocks and securities by creating a relative performance ...

Create an account
Affiliate Program
Contact Us
Trading Forum
How-to Lessons
About Us
Terms of Use

Copyright 2021
Social Media
Follow us on Facebook
Twitter Follow us on Twitter
Follow us on Google+
RSS Trading Items

Trading financial instruments, including foreign exchange on margin, carries a high level of risk and is not suitable for all investors. The high degree of leverage can work against you as well as for you. Before deciding to invest in financial instruments or foreign exchange you should carefully consider your investment objectives, level of experience, and risk appetite. The possibility exists that you could sustain a loss of some or all of your initial investment and therefore you should not invest money that you cannot afford to lose. You should be aware of all the risks associated with trading and seek advice from an independent financial advisor if you have any doubts.