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
-
This WORKS:
[DllImport("GlobalVariable.dll")]
public static extern int GV_SetInteger(int iLocation, int iVal);
[DllImport("GlobalVariable.dll")]
public static extern int GV_GetInteger( int iLocation) ;
int GV1 = GV_SetInteger(1, 33);
int GV2 = GV_GetInteger(1);
Comment
-
Could you show a bit more?
mktrend,
I am trying to understand how to use the code snipet you showed.
For example, on these two lines of code:
[DllImport("GlobalVariable.dll")]
public static extern int GV_SetInteger(int iLocation, int iVal);
Is that the EXACT syntax?
Do they go before the Using Declarations?
Do they go after the brace of the 'namespace NinjaTrader.Indicator' statement?
I have tried several combinations and keep getting compiler errors.
I assume the GlobalVariables.dll should go in:
C:\Program Files\NinjaTrader 6.5\bin right?
I appreciate any direction you can provide. Perhaps a link that I can refer to?
Thanks,
Gary
Comment
-
Originally posted by GaryAlbers View Postmktrend,
I am trying to understand how to use the code snipet you showed.
For example, on these two lines of code:
[DllImport("GlobalVariable.dll")]
public static extern int GV_SetInteger(int iLocation, int iVal);
Is that the EXACT syntax?
Do they go before the Using Declarations?
Do they go after the brace of the 'namespace NinjaTrader.Indicator' statement?
I have tried several combinations and keep getting compiler errors.
I assume the GlobalVariables.dll should go in:
C:\Program Files\NinjaTrader 6.5\bin right?
I appreciate any direction you can provide. Perhaps a link that I can refer to?
Thanks,
Gary
Comment
-
Originally posted by GATT1 View PostCan somebody please provide a download link for GlobalVariable.dll?
Please don't post the TS link, I have no access to the TS forum!
Thank you
I found the GV file that people are looking for here and I'm attaching it to this message.
I will try it out and report back. It may take me a few days, I have a lot of work this week.
Thank you to everyone in this thread for sharing this idea and for posting the code examples. It's very helpful to me.Attached Files
Comment
-
Originally posted by cunparis View PostThe problem is once a strategy enters a long position, I don't want the other strategies to enter any positions. My account size won't allow it. I can't figure out how to do this.
The solution of just trading one strategy doesn't work for me because I don't get many trades so I like to trade ES & NQ so that I get more trades.
A bit more sophisticated approach would be to make a custom event as in any strategy entering and exiting a trade would inform the others about it by raising a custom event.
I had a thread on this a few days ago!
here:
Last edited by mktrend; 01-13-2009, 06:55 AM.
Comment
-
Originally posted by mktrend View PostThis WORKS:
[DllImport("GlobalVariable.dll")]
public static extern int GV_SetInteger(int iLocation, int iVal);
[DllImport("GlobalVariable.dll")]
public static extern int GV_GetInteger( int iLocation) ;
int GV1 = GV_SetInteger(1, 33);
int GV2 = GV_GetInteger(1);
Comment
-
Originally posted by bridenour View PostHi,
Did using this DLL actually work out for you guys? Do you think it would be appropriate/effective for storing an "available balance" variable across multiple live executing strategies?
Thanks,
Brandon
This GV is to communicate between different applications, not to communicate inside the same application when other methods (static variable) are possible.
Comment
-
Originally posted by bridenour View Postcunparis,
i thought you had said you tried with a static variable but were not successful? thanks for the input!
br
It didn't take long to program but testing it took a long time. So my advice is re-examine your need for this and avoid it if possible. If you just want to communicate a msg between two strategies it's easy. but if you want to use some kind of lock where one strategy gets the lock and another strategy waits for it, then this is where it gets hard..
Comment
-
I just want to share an available balance among strategies. I have several distinct systems that trade reasonably infrequently, and to efficiently use my available funds I need it to be available cross strategy.
Unlike yours, mine is not all of none, so I need to recalculate and update the "available balance" each time an entry or exit occurs.
The odds of entries and exits happening simultaneously is rather low, so I think I might just give the static a shot and see how it plays out. Worst case it will try to open too many positions and likely get rejected due to margin limits.
Thanks for your feedback!
Comment
-
Originally posted by bridenour View PostI just want to share an available balance among strategies. I have several distinct systems that trade reasonably infrequently, and to efficiently use my available funds I need it to be available cross strategy.
Unlike yours, mine is not all of none, so I need to recalculate and update the "available balance" each time an entry or exit occurs.
The odds of entries and exits happening simultaneously is rather low, so I think I might just give the static a shot and see how it plays out. Worst case it will try to open too many positions and likely get rejected due to margin limits.
Thanks for your feedback!
If you are trading a small account size then you could re-examine the % risk you're taking.
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by Enkidu, Yesterday, 06:40 AM
|
9 responses
34 views
0 likes
|
Last Post
by Enkidu
Yesterday, 01:11 PM
|
||
Started by Mestor, 03-10-2023, 01:50 AM
|
12 responses
307 views
0 likes
|
Last Post
by z.franck
Today, 04:29 AM
|
||
Started by AgriTrdr, 07-16-2023, 12:54 PM
|
32 responses
267 views
0 likes
|
Last Post
by f.saeidi
Yesterday, 06:49 AM
|
||
Started by Mestor, Today, 03:15 AM
|
0 responses
2 views
0 likes
|
Last Post
by Mestor
Today, 03:15 AM
|
||
Started by Padan, Today, 02:02 AM
|
0 responses
6 views
0 likes
|
Last Post
by Padan
Today, 02:02 AM
|
Comment