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
Gloabal Variables?
Collapse
X
-
Ray,
that's great news, any hints on how it can be done please, just a couple of lines will do...as long as I get a lead on what needs to be studied.
I'm familiar with the OnMarketData() part just need the hints on the "drive data to your application" part.
thanks
Originally posted by NinjaTrader_Ray View PostBest approach is to use the OnMarketData() method of an indicator and use this to drive data to your application.
Comment
-
Yes, I was aware of that interface possibilities, although the question was about how to write directly to some form of Global variables that could have been both approached by NT and the 3rd. party app. which would also NOT be limited to just the VERY limited Methods available by the NT DLL interface.
Originally posted by NinjaTrader_Ray View PostLikely you would need to provide an interface (DLL) from your application that will allow you to push the data through.
Comment
-
hmmm..., are you sure though?!
I'm thinking maybe the storage location can be a physical file, database or ASP.NET Cache, utilizing Serialization technology that enables an object to be converted into a linear stream of data that can be easily passed across process boundaries and machines, hence what is stopping us in the case of the NT?
Originally posted by NinjaTrader_Ray View PostThere are no global variables.
Comment
-
Let me approach this from a different perspective.
NinjaTrader uses C# thus the capability of the entire C# language and Microsoft .NET framework is available to you. We only provide support in the context of NinjaScript methods and properties. We do not provide support or guidance on capabilities outside that which falls into general C# programming. Anything can be done for sure.RayNinjaTrader Customer Service
Comment
-
Yes exactly, I understand and there indeed exists various options that I am already looking into.
Originally posted by NinjaTrader_Ray View PostLet me approach this from a different perspective.
NinjaTrader uses C# thus the capability of the entire C# language and Microsoft .NET framework is available to you. We only provide support in the context of NinjaScript methods and properties. We do not provide support or guidance on capabilities outside that which falls into general C# programming. Anything can be done for sure.
Comment
-
Originally posted by mktrend View PostIs there a way making the feed data received through NT available to third party programs, other than the txt file approach? Is there such a thing as the say Global Variables, whereby NT could read from or place to?
thanks
Comment
-
You mean actually using the Global variables DLL supplied by TS?! How can that be done, it should be very interesting though.
I have found a few ways of achieving this by involving the shared memory or the WM_COPY but this is very interesting what you say and it makes lots of sense too, you would have C# read write to that DLL and have whatever else 3rd. party program do the same...hmmm, very clever.
I'll Pm you my email to please send me a sample code.
thanks
Originally posted by SystemTrading View PostYou can use Global Variable, which I believe was originally written for TS but works fine with NinjaTrader as well. It is simply a DLL that allows you to store/access values at your pleasure. You can communicate between charts etc. utilizing the program. If you don't have it, you should be able to find from google search, or I can email to you.
Comment
-
mktrend,
As far as I understand it the DLL was not supplied by TS; someone made it.
In order to use it you will need to write some code in NT to interface to it, and its methods, and some code on the 3rd party side to do the same. I have actually done this with C++ and TS; the TS portion was already written for me.
mrlogik
Comment
-
mrlogik,
Yes this idea makes perfect sense, since the DLL resides in all desired processes and interfaces them through a Mapped-File, hence has nothing to do with TS and it can be used by any application.
I used to think that TS mad it since they supported it, but thanks to whomever did it.
I've read that under certain conditions it could even improve performance and retard it heavily in certain others. I wish NT would step in and comment on the potential performance effect and yes I know this subject is NOT supported.
I guess the C# load lib model should look similar to below after replacing the below with the GV prototype? I'll look into it.
[DllImport("user32.dll", SetLastError = true)]
static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string lpszClass, string lpszWindow);
I wish someone would show us how to directly write to a Mapped-File though, that must be faster and it can be used to accumulate data into it before witting it to HDD and also make the data available to all other apps.
Comment
-
In my MFC program this is part of what I had.
First, the extern prototypes
Code:HINSTANCE hDll; extern "C" __declspec(dllexport) int __stdcall GV_GetInteger(int location); extern "C" __declspec(dllexport) int __stdcall GV_SetInteger(int location, int value);
Code:/***********************************************************************/ /***************** GetGVInteger ******************************/ /***********************************************************************/ int getGvInteger(int location) { typedef int (__stdcall*getIntegerPtr)(int); getIntegerPtr func; func = (getIntegerPtr)GetProcAddress(hDll, "GV_GetInteger"); int i = -1; if ( func ) i = func(location); return i; } /***********************************************************************/ /***************** SetGVInteger ******************************/ /***********************************************************************/ int setGvInteger(int location, int value) { typedef int (__stdcall*getIntegerPtr)(int, int); getIntegerPtr func; func = (getIntegerPtr)GetProcAddress(hDll, "GV_SetInteger"); int i = -1; if ( func ) i = func(location, value); return i; }
Code:hDll = LoadLibrary("the dlls location");
This was in MFC, I haven't looked into how to use a DLL with NT yet.
I hope this is a little helpful
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by Jonker, 04-27-2024, 01:19 PM
|
3 responses
22 views
0 likes
|
Last Post Today, 05:45 PM | ||
Started by businessman1929, 04-29-2024, 01:28 PM
|
2 responses
21 views
0 likes
|
Last Post Today, 05:38 PM | ||
Started by bltdavid, 03-27-2023, 05:32 AM
|
18 responses
347 views
0 likes
|
Last Post
by ETFVoyageur
Today, 05:28 PM
|
||
Started by NM_eFe, Today, 05:15 PM
|
0 responses
4 views
0 likes
|
Last Post
by NM_eFe
Today, 05:15 PM
|
||
Started by vitaly_p, Today, 05:09 PM
|
0 responses
4 views
0 likes
|
Last Post
by vitaly_p
Today, 05:09 PM
|
Comment