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
Delete Strategy from Strategies Tab
Collapse
X
-
Delete Strategy from Strategies Tab
Hi there, I built a service to auto-load and start strategies in NT8 and would like to know if there was a way for me to have it DELETE itself from the strategies tab. As of right now I'm using a timer to auto-terminate if a trade isn't made within 15 minutes(if it doesn't happen within 15, it ain't happening according to my strategy. The issue is that even though the strategy is disabling it's still holding on to a little bit of ram. Unfortunately towards the end of the trading day it actually leaks so badly that NT locks up. Is there a way to stop that leak, or remove the strategy from the list entirely?Tags: None
-
So I did a fair amount of digging and testing.
Long story short, I was able to find the method for removing a strategy from the strategies grid. My question now is how do I tell it which strategy I need to remove. I've gotten as far as adding a new strategy, but that's with me providing all of the NEW information. I now need to find information about strategies that are already enabled and on the grid.
Just as an example, here is a shortened version of how to add a strategy:
try{
NinjaTrader.Gui.NinjaScript.StrategiesGrid sg=new NinjaTrader.Gui.NinjaScript.StrategiesGrid();
System.Reflection.MethodInfo dynMethod = sg.GetType().GetMethod("StrategyAdd",
System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static);
if (dynMethod!=null)
dynMethod.Invoke(sg, new object[] { s });
dynMethod = sg.GetType().GetMethod("StrategyEnable",
System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static);
dynMethod.Invoke(sg, new object[] { s, null, null });
}
s being the strategy and you having set all of its parameters earlier.
Attached is a quick addon I wrote to explore the available methods and how to call them.Attached Files
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by wzgy0920, 04-20-2024, 06:09 PM
|
2 responses
27 views
0 likes
|
Last Post
by wzgy0920
Yesterday, 10:43 PM
|
||
Started by wzgy0920, 02-22-2024, 01:11 AM
|
5 responses
32 views
0 likes
|
Last Post
by wzgy0920
Yesterday, 10:33 PM
|
||
Started by wzgy0920, 04-23-2024, 09:53 PM
|
2 responses
49 views
0 likes
|
Last Post
by wzgy0920
Yesterday, 10:29 PM
|
||
Started by Kensonprib, 04-28-2021, 10:11 AM
|
5 responses
193 views
0 likes
|
Last Post
by Hasadafa
Yesterday, 10:19 PM
|
||
Started by GussJ, 03-04-2020, 03:11 PM
|
11 responses
3,235 views
0 likes
|
Last Post Yesterday, 08:07 PM |
Comment