Thanks
Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
Partner 728x90
Collapse
NinjaTrader
Using DLL's in NinjaScript
Collapse
X
-
Using DLL's in NinjaScript
Would someone please provide a simple example of using a dll in calculating an indicator. For example, where in the code are they defined and located? I am familiar with how they are used in the TradeStation easylanguage, but Ninjascript is new to me and i would like to attempt to convert some of my TS code that usesdll's. I've searched this forums posts and haven't found any examples.
Thanks
Tags: None
-
imported post
NinjaScript basically just is .NET C# plus a lot of convenience methods.
-> you can access any DLL as you do it by regular C# coding. I suggest browsing the relevent MS documentation (just scan e.g. www.msdn.com for ".net interop").
-
imported post
Thankyou, Dierk, doing a scan on .net interop is like jumping into another universe for me as I know nothing about C+. I am starting from ground zero with Ninjascript and eventually will learn coding with C+, but for now, all i want to know for example, is when i run Ninjascript to create a new indicator where in the coding and formatting process wouldI place the pushpop dll which in TS EasyLanguage is not an Input: or Variable: . Since Ninjasript is designed for making it quick and easy to define Inputs and Variables and Plots, it would be very helpful if there were a step in the process where it says to define dll's. For example in TS EasyLnguage after the inputs and variablesthe code says
Inputs:
Variables:
DefineDLLFunc: "PUSHPOPDLL", DOUBLE, "POPLAST", LONG, LONG, LONG
Comment
-
imported post
Sorry, there is no NinjaScript support for calling DLLs. You have to go through the regular .NET interop. There is no way to get around, since you have to make sure e.g. you type matching is set up correctly.
Here is quick hint (no guarantee, that his works as expected):
[System.Runtime.InteropServices.DllImportAttribute( "PUSHPOPDLL.dll")] internal static extern double POPLAST(int par1, int par2, int par3);
Comment
-
imported post
Thanks, that is getting there. I spent some time on the w.msdn.com and related url's searching on ".net interop" and C# "sharp" and found pieces of code that gave some clues, but no complete examples that fit what i want to do. It looks like what has to be doneis a new #region above the Variables in the NinjaScript editor has to be created and then within that the dll import info is defined, followed by #endregion. Somehow the code has to know where the dll is located and thenfurther downin the code the information it returns has to be identified and operated on, then finally the plot is created.
#regionefine Dll
[dll import info here]
#endregion
I have a feeling this is an extremely easy task, but getting past the first few steps in selftutoring is time consuming. It would be extremely helpful to the TS user migrating to NinjaT if it had a built in compiler similar to the one MultiCharts has that will take TS EasyLanguage .ela or .els or .eld text file and compile it into a functioning indicator or strategy. Lots of traders don't want to be programmers.....
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by jaybedreamin, Today, 05:56 PM
|
0 responses
2 views
0 likes
|
Last Post
by jaybedreamin
Today, 05:56 PM
|
||
Started by DJ888, 04-16-2024, 06:09 PM
|
6 responses
18 views
0 likes
|
Last Post
by DJ888
Today, 05:12 PM
|
||
Started by Jon17, Today, 04:33 PM
|
0 responses
1 view
0 likes
|
Last Post
by Jon17
Today, 04:33 PM
|
||
Started by Javierw.ok, Today, 04:12 PM
|
0 responses
6 views
0 likes
|
Last Post
by Javierw.ok
Today, 04:12 PM
|
||
Started by timmbbo, Today, 08:59 AM
|
2 responses
10 views
0 likes
|
Last Post
by bltdavid
Today, 04:10 PM
|
Comment