Click here to Login

                                                   Error object assignment


2013-02-10 21:52:49

Hi there,

I'm starting a script in the Tools/Script Editor:

HistoricalQuotes quotes = Quotes.GetHistoricalQuotes("NameOfAnySymbol");

Just with this one Line I got at Execution time' an error-messagebox telling me:
(translated:) 'The object reference was not [assigned|defined] to an object instance"

It sounds to me, as I'm used a type, instead an instance. But the object Quotes is already an instance by default (?)
Sadly, the error message does not define more clearly what it mean (The object Quotes? The result of its function?)

Any Ideas?
Thanks in advance

2013-02-11 11:51:50


Best Answer

You should type a symbol name that already exists in your database.

HistoricalQuotes quotes = Quotes.GetHistoricalQuotes("GOOG");

2013-02-16 16:48:01


Hi QS, sry for the delayed response.
Your're right! I missed the Yahoo suffix for the symbols, so from the scripts point of view, the symbol(s) wasn't there.

So the Error regards to to the resulting Object. Feature Request: It would be greate, if error messages tells also the instance name, they are depending on.

Thanks for your help!

2013-02-27 01:15:01


Hi there,

I've less time, so I'm slow on the way ...

I want to get EoD Data from my Intraday Data. My Function already walks from the last EoD Date over the Intraday Data and summarizes the Intraday to EoD Data - so far so good.
Now I want to write the EoD Data into the Quotes Database.

Question 1:
I haven't found any Add Method or similar, so I have to create a very new Array with additional length, put the old current Array-Data into and fill the additional Elements with the new EoD Elements. And this I have to do with every Field in the Database (Open, Close, High, Low, Volume, Date). Is this really the one and only way?

Question 2: I get again the Error ''The object reference was not [assigned|defined] to an object instance", this time because my DatabasesData object is still null after creation.
My code looks like this:

DatabasesData dbOpen = Databases.GetDatabasesData("ALV.DE", "Quotes", "Open"); // This line ist executed without errors
int length = dbOpen.Value.Length // Here I get the Error

ALV.DE exists in My Database Quotes.

Any Ideas ?

2013-02-27 12:34:40


Question 1:

Yes. You have to update every Array (OHLCV and Date).

Question 2:

The function "Databases.GetDatabasesData" gets custom data. To get quotes, you have to use the "Quotes.GetHistoricalQuotes" function.

2013-02-28 02:33:13


Oh - my fault x-/

I have a difference between last EoD Date (say 22.01.) and last intraday (say 27.02). So I'm walking throu the intraday data and summarizing EoD Data at Date change.
I don't know how many days it will be.
It's fine to use ArrayList's for this Job, because of the available Add method. Unfortunality I can't write them back to HistoricalQuotes because of no ability of autoboxing.
The better way would be to use generics, e.g. List<T>, but System.Collections.Generic Objects doesn't work. Is this a limitation of QS ?

For now I do the basic job with a for loop ...

2013-02-28 10:41:45


Generic collections work in QuantShare
System.Collections.Generic.List<double> list = new System.Collections.Generic.List<double>();

Once done, you can convert the list to "double[]" using "list.ToArray()"

You can also use "ArrayList" to add values then convert that array list into "double[]" at the end.

2013-02-28 21:29:03


Oh - great! :-)

I used the dot notation: Sys<STRG>+<SPACE>-<dot>Coll<ENTER>-<dot>Gen<ENTER>-<dot>Lis<ENTER> ...
and got "System.Collections.Generic.List`1"
This threw an Error at usage.

So may only the ui component of Gerneric-Selection is broken.

I tried it now with the right names: it works :-)


Alpha Trader
2018-04-14 20:41:12


Hi there, I'm working our similar issues.

Pulling Quotes from Quotes database and trying to muliply them by values in a custom database.

Whats the best way to convert the DatabasesData.Value object to a double?

2018-04-16 06:27:39


By casting them to double type

double a = (double)......;

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
Standard Error Bands
Standard Error of the Estimate of a Regression Line
Chande TrendScore By Symbol
Copenhagen stock exchange Danish Stocks April 2012
Historical Earnings Calendar for Major Stock Exchanges

How-to Lessons
What is the Bookmark Panel?
How to filter stocks in a market composite
How to debug a trading system using the money management tool
How to optimize the number of positions in a trading system
How to optimize a neural network using a genetic algorithm

Related Forum Threads
NaN error in Dynamic Position Sizing MM object
Question about an object
Unable to open trading object
MM Error report
Error in formula

Blog Posts
Automatically create historical quotes charts
QuantShare Programming Language Tutorial
Display several stock market charts with one click
How to create buy and sell trading rules based on News Data
Basic trading system implemented using the money management tool

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

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