Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
Validate symbol/instrument before using it in NinjaTrader
is there a function which checks if a symbol is valid? I need it for this situation:
For my strategy the symbols are stored in a text file. While the initialization I call for each symbol in the text file the Add() function.
When the symbol is not correct [for example $GPBUSD – a classic mistyping] then nothing happens except of a message in the log section of NT Control Center..
A “normal” user does not check the Log section and therefore it would be very nice if the program can check in advance if the symbol is valid and shows another message to inform the user.
Otherwise the user really does not know what is going on…
How can I achieve this?
Can you help answer these questions from other members on NexusFi?
This depends on the user who is working with the indicator. It can be between 1 and 30
Short version: No
Long Version:
As programmer I have the Log section open. But I am used to write software which informs the user in a proper way without bothering him with some logs.
It is definitely easier to write this few lines of code to make it more comfortable.
The indicator is supposed to run "unattended" and therefore an email should be sent. In this case for example the futures expire and with this functionality I can send an email to inform the user the symbol list must be updated OR I can update/correct the future symbol automatically when I know it is not correct when it was the last time correct. This is simpler than write an algorithm which considers the futures expiry dates...
other....
Due the fact NT works internal with some kind of this function it is the same like with other functions: There is an undocumented function. This is the reason why I think to write my own heavy personalized version of a chart program. There are some nice libraries which will do the whole chart rendering and I have to do the same wrapper as I do now in NT.
this is beyond unsupported and will probably break something, you've been warned!
foreach (Cbi.Instrument instrument in Cbi.Instrument.GetObjects())
Print(instrument.FullName);
I can write a function which reads all instruments. With some logic I can remove automatically the expired contracts; then I have more or less exactly what I wanted.