Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
NT as a Black Box Development System
Collapse
X
-
Now that I have more clarity of thought let me describe it in a different way.
(A) INTEGRATING CUSTOM LIBRARIES:
As a programmer trying to develop complex strategies, I would like to be able to modularize my code into different components which represent different aspects of the strategy. For that I need to be able to break down the project into different sub-projects for all the standard reasons (testing, version control, etc.). Essentially I want to refer to create and use custom code libraries.
The Question. How do I do that? I do not care about security/protection right now. What are the
(a) Visual Studio Compiler/Code generation options to use to make sure it works with NT. I am an experienced developer but not a .NET/C# guru. Perhaps the answer is obvious but what is it??
(b) Continuing on (a), is it possible to use other languages and compile the code into an NT compatible format. I do not want to use a garbage collecting/memory managing language for some of my work so if I could write some portions in in C/C++ it will be great.
(c) I presume once the dlls are available the documented ways of referencing them will work.
An example where you create a custom library, compile it in VS project, and then use it in a NinjaScript file would be great. I could just reuse the VS project settings and get going.
(B) SHARING COMPUTATION BETWEEN STRATEGIES
There are some generic computation I would like to share across strategies. These may not be instrument specific.
I think it will be as simple as creating a singleton type, creating an instance of it and then making the exported methods accessible to other clients.
For example, a class which provides a method which returns a number calculated based on the current value of the major market indices.
What I think I need to do is to create an indicator which subscribes to the relevant market data (say SPY, IWM, DIA etc.) using the multi-instrument methodology and performs the relevant calculations which are then available to other clients.
Internally, will NT share the same instance of the indicator for all the charts, or will it create a new instance of the class for every chart which references it. This is important since some of these global methods may do a significant amount of computation and as such are not meant to be duplicated. The computation is truly designed to be shared. Think in terms of a server providing information to a client.
-
aviat72,
If you mean exporting it as a DLL you can do so by going to File>Utilties>Export NinjaScript and selecting "compiled assembly" instead of "source codes". Is that what you were referring to?
Leave a comment:
-
I tested that last night and it seemed to work fine.Originally posted by NinjaTrader_Bertrand View Postaviat72,
3. You can't compile NS scripts in VS, but debug their values through breakpoints -
http://www.ninjatrader-support.com/H...ualStudio.html
I am a bit confused about #2 above. The documentation talks about converting Indicators/Strategies written using the NT template which is based on C# into dlls for export.Originally posted by NinjaTrader_Bertrand1. You can create DLL's externally and then reference those for access in the NinjaScript editor (right click in the code > References > Add)
2. Those can be written in any language - unfortunately we don't have examples here as it's outside of what we support.
I am not sure what you mean by "can be written in any language" above since the documentation only talks about indicators written using the NT template.
(a) Do you imply that you create an NT indicator/strategy based on NT template, which will LOAD another dll created out of whatever language you chose? What are the compiler options to be used in Visual Studio to create a dll which will work in the NT environment?
(b) When it comes to code execution, I presume that NT always has control. i.e. NT will call the overloaded OnBarUpdate, OnMarketData methods in the new class, but there is no way for the code to interrupt NT (say to place an order or to update a chart). Any action initiated by the new code has to be contained in those derived methods and is executed synchronously when NT makes the OnBarUpdate or OnMarketData call.
(c) The reason I ask the above question, is that I expect my processing engine to work in a separate thread/process since I do not want it to block NT's execution in case it takes a lot of time during computation.
(d) Related to (c), does NT start separate threads for different charts and relies on the OS to time-share? So an infinite loop in one indicator will not put the entire system on hold (though it might hog most of the compute resources).
(e) Related to (d): On multi-core machines does NT distribute different charts to different cores just in case one chart has an indicator which hogs CPU (an infinite loop).
(f) In terms of programing limitations, what should and should not be done in the Initialize() method of the custom strat/indicator?
Working examples which show how the entire setup works (compiler options etc.) will of course be very useful, even if they are not supported (i.e. no follow-up questions are entertained).
Leave a comment:
-
aviat72,
1. You can create DLL's externally and then reference those for access in the NinjaScript editor (right click in the code > References > Add)
2. Those can be written in any language - unfortunately we don't have examples here as it's outside of what we support.
3. You can't compile NS scripts in VS, but debug their values through breakpoints -
Leave a comment:
-
NT as a Black Box Development System
I am investigating whether NT can be used to develop black box trading systems. I like NT's charting, back-testing, data-vendor interface, and data storage features.
However, I am not sure how well it can adapt to more complex trading systems which perform statistical analysis on multiple kinds of data aggregated together.
I have searched through the archives, but am not sure how the NT framework can be used to integrate more complex strategies. I have seen references to the DLL interface and COM interface and .NET/C# but am not sure how they work.
On a very general level, what I need is a mechanism where NT can communicate with code developed outside the NT Indicator/Strategy setup.
Is there any documentation/examples available which guides how NT can be instrumented to allow more complex usage of C#/.NET? Does NT7 have some extra features which facilitate this?
I do want to be able to develop the complex code outside the NinjaScript editor using Visual Studio (Express perhaps). I want to be able to call functions and libraries in my own code, and make it work with NT as a front-end for charting, back-testing, data-management and eventually order management.
Indepdendent of NT, I have coded up a basic interface to the IB C++ API which can get market data and also have linked in a library of technical indicators. However my current set-up does not have any charting capability and the data management capabilities are primitive. However, I do not want to reinvent the wheel!
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by kinfxhk, 07-14-2026, 09:39 AM
|
0 responses
128 views
0 likes
|
Last Post
by kinfxhk
07-14-2026, 09:39 AM
|
||
|
Started by kinfxhk, 07-13-2026, 10:18 AM
|
0 responses
105 views
0 likes
|
Last Post
by kinfxhk
07-13-2026, 10:18 AM
|
||
|
Started by kinfxhk, 07-13-2026, 09:50 AM
|
0 responses
87 views
0 likes
|
Last Post
by kinfxhk
07-13-2026, 09:50 AM
|
||
|
Started by kinfxhk, 07-13-2026, 07:21 AM
|
0 responses
105 views
0 likes
|
Last Post
by kinfxhk
07-13-2026, 07:21 AM
|
||
|
Started by kinfxhk, 07-11-2026, 02:11 AM
|
0 responses
86 views
0 likes
|
Last Post
by kinfxhk
07-11-2026, 02:11 AM
|

Leave a comment: