Click here to Login





                                                   Error object assignment

  0

0
QAndi
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
Andi



QuantShare
2013-02-11 11:51:50

  0

Best Answer
Hi,

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

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




QAndi
2013-02-16 16:48:01

  0

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!



QAndi
2013-02-27 01:15:01

  0

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 ?



QuantShare
2013-02-27 12:34:40

  0

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.



QAndi
2013-02-28 02:33:13

  0

Oh - my fault x-/
thanks


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



QuantShare
2013-02-28 10:41:45

  0

Generic collections work in QuantShare
Example:
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.



QAndi
2013-02-28 21:29:03

  0

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 :-)

regards
QAndi



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

  0

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?




QuantShare
2018-04-16 06:27:39

  0

By casting them to double type

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



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
Standard Error of the Estimate of a Regression Line
Standard Error Bands
Chande TrendScore By Symbol
FII & DII - Foreign and Domestic Institutional Investors
Adaptive Trading System - Minimum Percent Winners and Percent Inv...

How-to Lessons
How to automatically start a downloader every few minutes?
How to quickly download the most recent EOD data for your stocks
How to optimize the number of positions in a trading system
How to export trading data to a CSV file
How to add future bars to plan for market scenarios

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

Blog Posts
Organizing Trading Objects
Quantitative Analysis: Price Channels
Custom Indicator: Accumulation Distribution Line
Step by step on how to get free realtime/delayed data for stocks,...
Charting & Scripts - Manage stock charts using the global script









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.