Click here to Login





                                                   Adding symbols and changing properties from script

  0

0
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 ...
{
symbols1.AddSymbol(txt);

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



QuantShare
2014-10-02 02:40:53

  0

Best Answer
Hi Alex,

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

Symbols.AddSymbol(txt);

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



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

  0

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
0




Reply:

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"










QuantShare

Trading Items
Market cap, ROE, ROA and Forward PE for U.S. Stocks - Fundamental...
Futures, Forex and Indices Symbols
Stock News from Articles, Bloggers, Columnists, Traders and Analy...
Historical EOD data for LSE-listed Stocks and ETFs
Identify Spilts Screener Script

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 plot support and resistance lines automatically

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
Money Management Script variables and more

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 ...









QuantShare
Product
QuantShare
Features
Create an account
Affiliate Program
Support
Contact Us
Trading Forum
How-to Lessons
Manual
Company
About Us
Privacy
Terms of Use

Copyright © 2024 QuantShare.com
Social Media
Follow us on Facebook
Twitter Follow us on Twitter
Google+
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.