Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
NT as a Black Box Development System
Collapse
X
-
Andreas, your work is amazing.
I looked at your site and found that you have developed some pretty neat apps!!!
-
This is my own interface, it is just a spin off of my NTMT application and the necessary libraries are included with NTMT (not free)
I have done several backtesting tests with this interface and the interesting feature is that you can call it from a simple console app, (outside of the NinjaTrader process)
bool rv=ninjaserver.Instance.StrategyAnalyzerTestDialog ("LongStrat1",StrategyAnalyzerTestType.btnRunBackTest);
// BackTestFrom
// BackTestTo
// BackTestMode
ninjaserver.Instance.SetTestParameter("Instrument","FDAX 12-09");
DateTime from = DateTime.Now.Date.AddDays(-3);
DateTime to = DateTime.Now.Date.AddDays(-2);
ninjaserver.Instance.SetTestParameter("BackTestFrom", from.ToString());
ninjaserver.Instance.SetTestParameter("BackTestTo", to.ToString());
ninjaserver.Instance.RunTest(ninjaserver.TimeOut);
object results = ninjaserver.Instance.TestResult("Performance.AllTrades.TradesPerformance.Currency. CumProfit");
As I see it writing a good documentation and then explaining my interface to others will be too time consuming for me, so I will not give much support here on the forum.
I hope that the idea behind is clear to you.
regards
Andreas
www.zweisteintrading.eu
Leave a comment:
-
Excellent questions and I have to add one more:
# Does any one know if it is possible to control the backtesting using some form of API (by using an external application )?
Thanks in advance
Leave a comment:
-
I would love to find a way to do that, but unfortunately...Originally posted by BooDoo View PostThanks a lot roonius! You rock!
My question is: Is there any way to update/reload my custom dll when Ninja is still running? Right now I have to close and restart Ninja every time after I change/compile my code in order to replace the dll in bin\Custom folder.
Thanks,
Boo.
Maybe somebody else knows...
Leave a comment:
-
Thanks a lot roonius! You rock!Originally posted by roonius View PostAttached is a sample Visual Studio Solution which can be used to create custom indicators and/or strategies, compiled into dll which can be dropped into bin/Custom folder
My question is: Is there any way to update/reload my custom dll when Ninja is still running? Right now I have to close and restart Ninja every time after I change/compile my code in order to replace the dll in bin\Custom folder.
Thanks,
Boo.
Leave a comment:
-
I've compiled this DLL and dropped it into the bin/Custom folder, but the indicator is not listed. Is there anything that has to be done to make this visible or am I misinterpreting your post and you must still use Ninja Script in order to make the indicator visible.Originally posted by roonius View PostAttached is a sample Visual Studio Solution which can be used to create custom indicators and/or strategies, compiled into dll which can be dropped into bin/Custom folder
Leave a comment:
-
Yep, who knows. At least it works with my application, although it is not tested comprehensively because I don't know how to cover every condition possible. There is one hint in the NT documentation, that such kind of operation is supported: TriggerCustomEventOriginally posted by aviat72 View PostI am concerned that the behavior might be different with a live data-feed.
Leave a comment:
-
Hi Ralph:
Thanks for your message.
I am concerned that the behavior might be different with a live data-feed.
In general, a "DOs and DONTs with C#/.NET with NT" document will be a great help. In can understand why NT does not want to support extensive C# coding outside their framework. However, they can certainly assist power users in expanding the scope of NT by providing guidelines for best practices to use when using the expanded feature set of C#/.NET.
Leave a comment:
-
aviat72,
A comment to your topic 1.(1)
An event will not be delayed until one of the NT standard calls is executed (OnBarUpdate). It can be verified by trigger a custom event on a chart with no data feed connected (no OnBarUpdate is activated). Custom events would be executed in such a situation.
Regards
Ralph
Leave a comment:
-
Hi Bertrand:
Thanks for the message. It answers a lot of questions.
(0) I would like to get access to NT7 because I do need multi-time frame and multi-indicator. I am not placing real trades right now so can live with a Beta; I am more interested in exploring the capabilities and tool-set than anything else.
(1) Regarding the asynchronous calls: I am not interested in opening forms etc. What I want is to trigger the call back from my library code without having to WAIT for an even triggered by the NT executable.
Are there any restriction imposed by NT when it comes to handling asynchronous EventDriven callbacks. For example, a restriction could be that order handling HAS to be restricted to NT initiated methods (OnBarUpdate, OnMarketData etc.) or that any chart update or a plot has to be called within these functions.
(2) Plot Function: I also wanted to know what specific events trigger NT to call the Plot function in a custom indicator/strategy.
Leave a comment:
-
aviat72,
1. Unfortunately this is outside of our supported scope.
2. Correct, MultiSeries indicators are not supported with 6.5, we add this for 7 - http://www.ninjatrader.com/webnew/NT7/NinjaTrader7.html
To plot from NS strategy, please see this - http://www.ninjatrader-support2.com/...ead.php?t=6651
3. Plots would be exposed per se, other variables and series can be exposed with this approach - http://www.ninjatrader-support2.com/...ead.php?t=4991
4. It depends if you're in realtime or backtesting mode, you can work with Update() in backtesting to update embedded values - http://www.ninjatrader-support.com/H...V6/Update.html
Correct, no cross communication of indicators or strategies.
The .NET framework would manage duplicate class calls in the internal cache, so if you call the same indicator on the same chart again using same paramters, it would be cached.
Leave a comment:
-
Questions about Multi-Instrument, Event handling
1. Asynchronous Event Handling
One of the features I am looking for in the black box is asynchronous event handling capability where my external code can ask Ninja Trader to respond to an event while not waiting for the OnBarUpdate/OnMarketData to occur.
I noticed that Folls has created a project which has an event handler to respond to an input generated from a custom form.
I wanted to understand how the event handlers are processed by Ninja Trader.
(1) I presume Ninja Trader will trigger the execution of code registered as the event handler once the event is triggered (with the delay associated with OS/MS implementation of even handlers). It will not wait for any of the standard calls (OnBarUpdate, OnMarketData etc.) to activate before checking for the event and executing the callback function.
(2) I presume the callback can be used to call all other NT functions, including functions related to order handling.
Any other information which is of relevance?
2. Multi-Instrument/Multi-TimeFrame Indicator
I noticed that I could not use the default Add Function to add a new data input apart from the default when creating an indicator. The IndicatorBase.Add function creates a new line object; there does not seem to be a function similar to StrategyBase.Add visible in the default configuration for an indicator.
So to create a multi-timeframe or multi-instrument indicator, I will have to create a dummy strategy which does not have any order handling feature but can be used to calculate certain values?
(a) If I need to draw something on the chart based on this strategy, what method do I use?
The StrategyBase.Add has 3 variants, two for adding data-series (periodType, period) and (Instrument, periodType, period) and the third one which accepts an Indicator Type. However, none of these will work if I want to plot the values of a DataSeries calculated in the strategy.
3. Exporting Indicator Values and Calculated Variables
I will appreciate if you could point me to documentation/examples on how to create variables which can be accessed by other indicators/strategies (export/public).
4. NT Run Time Handling of different Indicator/Strategy Objects
I am trying to develop a better understanding of how NT puts everything together.
From what I understand so far:
For EVERY Chart currently Open:NT will create a NEW Instance of the Indicator Class Object or Strategy Class Object which is active for the Chart.For EVERY Indicator/Strategy which refers to another Indicator:NT will create another NEW Instance of the Indicator Class Object which will provide values to the calling indicator Class Object.
Questions:
(1) I presume NT will ensure that the methods OnBarUpdate, OnMarketData are called in the proper recursive manner.
i.e. If IndictorA, calls IndicatorB, then prior to calling the OnBarUpdate method of IndicatorA, it will call the onBarUpdate method of IndicatorB to ensure that the values supplied by IndicatorB to IndicatorA are fresh.
(2) There is no sharing of Indicator class objects between charts. i.e. if Chart1 plots IndicatorA on 1 min bars for InstrumentX, and Chart2 also plots the same (IndicatorA on 1 min bars for InstrumentX), then two separate objects of type IndicatorA will be created internally and there will be no sharing of computation/data-structures
(3) If the user desires the reuse of computation across different instances of objects of the indicator class, they will have to explicitly manage it.
Leave a comment:
-
roonius:
Thank you for the project. I will try it out.
zweistein:
Thanks for the tips and how they work.
I guess I still have some reservation about letting go of memory control having spent a decade optimizing complex programs solving NP complete problems.
I am planning to stick to C# in the short term. However, there is another part of me which wants to keep the code as general and portable as possible so that I can reuse whatever I have developed here in not MS environments.
Leave a comment:
-
concering (B):
You can use a static class as a container for your globally acessible parameters. In every place of your code where you access that class you will retrieve the same value.
You need however a server-indicator-or-strategy-or-marketanalyzercolumn that must be always running and fill/update the static class.
This is all C#, so you better study well msdn and the C# docu.
You can interface with C++ also, but my advice is to convert to C# as much as you can (I did so with my code).
Comment:
I just read now that you are interested in a background calculation engine. I have done this for 2 of my projects, one is a clustering algorithm and the other is download of COTReport web pages.
Both these tasks are run as a Thread that is put into the application ThreadPool for execution.
This is all advanced C# , look for the MSDN docu on this, and I am glad it exists in C# as I find it so much easier to implement threads than in C++ (and i developped multithreading programms wiih my students in C,C++ in the 90s on a dual pentium pro). OK, I am not making my living from coding, but I advice you to just forget the old stuff and start fresh with C#)Last edited by zweistein; 12-03-2009, 03:30 AM.
Leave a comment:
-
Attached is a sample Visual Studio Solution which can be used to create custom indicators and/or strategies, compiled into dll which can be dropped into bin/Custom folderAttached Files
Leave a comment:
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: