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
Constant Variable between sessions
Collapse
X
-
Constant Variable between sessions
Is it possible to have a custom variable that updates and stays active between sessions? For instance, let's say I have a counter that counts the number of trades made, I close that session. When I open the next session I want that counter to pick up where it left off previously. As in if it ends with a value of 2, I want it to start with a value of 2 the next session.Tags: None
-
Hi tatir, thanks for writing in.
This can be done using an addon style Account object and monitoring the OnExecutionUpdate event to increment the counter. The sessions can be counted using the SessionIterator IsNewSession() method
Please let me know if you have any questions on this material.Chris L.NinjaTrader Customer Service
-
Thanks for the information!
Another related question: If I am using a program such as Visual Studio, can I make trades through Visual Studio, using the Ninja Trader functions while maintaining my custom variables/arrays in it.
I know you can update and create strategies in Visual Studio which can/will be updated in Ninja Script, but I want to treat them as separate.
Comment
-
Hi tatir, thanks for your reply.
The code can be edited from Visual Studio but trades can not be made through VS. We use the .NET codeDOM to compile all the scripts into a DLL then the NinjaTrader core handles the loading and object creation (e.g. when you add a strategy to a chart and enable it).
Best regards,
-ChrisLChris L.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by judysamnt7, 03-13-2023, 09:11 AM
|
4 responses
57 views
0 likes
|
Last Post
by DynamicTest
Today, 08:25 PM
|
||
Started by ScottWalsh, Today, 06:52 PM
|
4 responses
36 views
0 likes
|
Last Post
by ScottWalsh
Today, 07:40 PM
|
||
Started by olisav57, Today, 07:39 PM
|
0 responses
7 views
0 likes
|
Last Post
by olisav57
Today, 07:39 PM
|
||
Started by trilliantrader, Today, 03:01 PM
|
2 responses
19 views
0 likes
|
Last Post
by helpwanted
Today, 07:25 PM
|
||
Started by cre8able, Today, 07:24 PM
|
0 responses
9 views
0 likes
|
Last Post
by cre8able
Today, 07:24 PM
|
Comment