Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
The attached example shows how to automagically place indicator properties onto the property tab of the strategy. See attached images as well.
What the code shows is:
1. How to have indicator properties automatically on strategy properties
2. How to delete properties not required at that moment
3. How to update property names
4. How to update property descriptions
Comment: The last three aspects comes from the work discussed in this thread:
Hi to all,
I'm not a programmer and I learned C# only when I switched to NT. I believe only in automatic trading and I developed many strategies.
My strategies have all the bells and whistles except dynamic properties and this bugs me.
So my preposition …
See following posts for more detail on how to use this and the situation within optimizer.
Fair warning: (a) this code is NOT for the faint of heart and (b) it works excellently, but still it is not what NinjaTrader developers might want you to do.
If you only wish to reflect the indicator properties onto your strategy, these are the key things that needs to be done in your strategy. See complete example attached to the first post for reference.
Add the ICustomTypeDescriptor interface onto your class, predefine your indicators so that they are class members and write a class constructor to "register" these indicators:
In your initialize method, just Add these indicators as you normally do:
Add this empty method and cut-and-paste the "black magic" into your code:
If you want to modify properties on the fly, the follow all the instructions above to get the code into your strategy. Thereafter, implement your logic into the method ModifyProperties.
The first is to delete properties which are not relevant at this moment. For example, if you set one property to say do only something simple, then you can dynamically remove the complex properties. It would look like this:
You can also change the name of the property. For example, in the optimizer, it happens sometimes that I need to know the range of values for a specific property. With this approach, I make the range as part of the property name. (The second example is easier achieved by statically setting the Gui.Design.DisplayName attribute.)
Similarly, you could update the property description to contain additional dynamic content:
What still does not work, is to have NinjaTrader step the indicator properties through a range. For the live of me, and after a few zillion hours of mucking around, I still don't understand when NinjaTrader decides that specific properties should have a range attached and when not.
I suspect that this part of the puzzle can only be resolved by having access to that piece of source code from the optimizer. As such, maybe on a rainy day, a developer from NT might give us the hint required.