View Full Version : Check Ninja Version in NinjaScript
aslane
12-16-2009, 07:21 AM
I there a way to check the current version of NinjaTrader from within NinjaScript?
I would like to be able to limit a version that an indicator can run on (i.e. only runs on version 7.XX or higher). Looking for a method or set of vars that can be used in Initialize().
It would also be helpful to add this info in log info that gets printed out.
NinjaTrader_Dierk
12-16-2009, 07:37 AM
We have this code in our standard indicators:
#if NT7
...
#endif
Effective at compile time, obviously. There is no equivalent for runtime checks.
roonius
12-19-2009, 11:09 AM
We have this code in our standard indicators:
#if NT7
...
#endif
Effective at compile time, obviously. There is no equivalent for runtime checks.
Just for your information:
if you put some parameter between this preprocessor directive it will not work with NT 6.5
For example:
#if NT7
[Description("")]
[Category("Parameters")]
public int SomeKindNT7RelatedParameter
{
get { return _something; }
set { _something = Math.Max(1, value); }
}
#endif
the NT6.5 wrapper still puts this parameter into it's code and throws errors.
I don't know if need to address this, but just wanted to let you know.
NinjaTrader_Ray
12-19-2009, 03:34 PM
Thanks, will send this up to development to take a look.
NinjaTrader_Dierk
12-20-2009, 03:37 AM
Expected, since the wrapper generator does not reflect on pre-processor directives.