I would like to manage my strategy from custom UI or AddOn. I would like to change the params / enable / disable / add strategy from this custom UI or add-on. Is that possible ? if so how to achieve this ?
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Managing Strategy from Custom UI or Add On
Collapse
X
-
Managing Strategy from Custom UI or Add On
Hi,
I would like to manage my strategy from custom UI or AddOn. I would like to change the params / enable / disable / add strategy from this custom UI or add-on. Is that possible ? if so how to achieve this ?Tags: None
-
Hello nandhumca,
Yes that is possible, the most simple way would be to add UI elements to the chart window. You can find some samples of modifying the window in the link below. Another approach would be to design your own custom window using an NTWindow and then have the strategy launch the window. That is a little more complex and assumes you have some background in WPF development and object oriented programming as you would need to design the window and its controls/events yourself and also pass an instance of the strategy to the window when it is launched. If you wanted more details about a custom window I can try to locate some relevant resources on that and provide a more detailed description in a follow up post.
Hello All, Moving forward this will be maintained in the help guide reference samples and no longer maintained on the forum. Creating Chart WPF (UI) Modifications from an Indicator - https://ninjatrader.com/support/help...ui)-modifi.htm (https://ninjatrader.com/support/helpGuides/nt8/creating-chart-wpf-(ui)-modifi.htm) I've
As a side note you wouldn't be able to physically enable a strategy using an addon or custom controls but you can enable/disable the strategies trading logic while leaving it running to accomplish that type of task. Another option is to not use a strategy and instead use an indicator which stays applied to a chart, an indicator can also place trades in realtime using the addon framework but that type of script cannot be backtested.
Last edited by NinjaTrader_Jesse; 04-05-2024, 12:12 PM.
-
Thanks for the reply. So from UI , I can add an strategy to control pane strategy window, right. What Api needs to be called add or remove a strategy instance to and from strategy panel? If there are any references code, it will be helpful.
Kindly share more details and resources for WPF also. I have used oops.
Comment
-
Hello nandhumca,
There is no APi to add or remove strategy instances, that is a manual step. You can have a strategy terminate based on conditions by using CloseStrategy
For WPF we suggest using external WPF tutorials for C# WPF development. The samples that I had linked to show how to integrate WPF controls with NinjaTrader, beyond that all that would be required is learning about the WPF framework which there are many tutorials for online.
Comment
-
In my use case, i have added 40+ strategy instance of same strategy in control panel directly without chart. When I want to change the instrument while do playback or change one property value in all 40+ strategies, it is very time consuming and there is a high possibilities for me to miss to set the value. Is there any way to change access all the strategies added in control panel and change the property of each ?
Comment
-
Hello nandhumca,
Are all of the strategies running on the same account? If so you could use the addon account class strategies collection. If the strategies are on different accounts it would require using different code to find the accounts. You would need to have 40 account variables and find 40 accounts if you were using 40 different accounts as an example.
You could make a public property or method in the strategy and then cast the strategy in the strategies collection to your custom strategies type to use that property or method.
Then in the addon using the sample from the help guide link:Code:[XmlIgnore] [Browsable(false)] public int MyPublicProperty { get; set; }
Code:MyCustomStrategiesType variableName = strategy as MyCustomStrategiesType; variableName.MyPublicProperty = 1; or variableName.MyCustomMethod();
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by NullPointStrategies, Today, 05:17 AM
|
0 responses
53 views
0 likes
|
Last Post
|
||
|
Started by argusthome, 03-08-2026, 10:06 AM
|
0 responses
130 views
0 likes
|
Last Post
by argusthome
03-08-2026, 10:06 AM
|
||
|
Started by NabilKhattabi, 03-06-2026, 11:18 AM
|
0 responses
70 views
0 likes
|
Last Post
|
||
|
Started by Deep42, 03-06-2026, 12:28 AM
|
0 responses
44 views
0 likes
|
Last Post
by Deep42
03-06-2026, 12:28 AM
|
||
|
Started by TheRealMorford, 03-05-2026, 06:15 PM
|
0 responses
49 views
0 likes
|
Last Post
|
Comment