NexusFi: Find Your Edge


Home Menu

 





Dynamic Properties


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one baruchs with 6 posts (0 thanks)
    2. looks_two grankus with 3 posts (0 thanks)
    3. looks_3 zr6bcm with 3 posts (6 thanks)
    4. looks_4 sam028 with 2 posts (3 thanks)
      Best Posters
    1. looks_one jeremytang with 10 thanks per post
    2. looks_two zr6bcm with 2 thanks per post
    3. looks_3 Tasker_182 with 2 thanks per post
    4. looks_4 sam028 with 1.5 thanks per post
    1. trending_up 14,971 views
    2. thumb_up 31 thanks given
    3. group 16 followers
    1. forum 23 posts
    2. attach_file 4 attachments




 
Search this Thread

Dynamic Properties

  #21 (permalink)
 zr6bcm 
Heidelberg, Germany
 
Experience: Intermediate
Platform: NinjaTrader
Trading: Stocks
Posts: 12 since Jun 2014
Thanks Given: 9
Thanks Received: 12

Succeeded in updating the description as well. As a final step have gathered all the code into cut-and-paste sections with three utility methods for deleting a property, updating the name and updating the description. From the (attached!) example:

 
Code
private void ModifyProperties(PropertyDescriptor[] properties)
{
  if (deleteAnotherProperty)
    DeleteProperty(properties, "DeletePropertyIfTrue");

  UpdateDisplayName(properties, "PropertyWithChangedName", "Property NEW Name");
			
  UpdateDescription(properties, "PropertyWithUpdatedDescription", "New property description.");
}
All the relevant code is boiler plate sections that can just be copied into a strategy. Commented to explain what everything does.

Caveat emptor: code tested, but I am not C# expert galore, it could be that I overlooked something somewhere.
But for now it works beautifully.

In the attached strategy is the complete example, with all of the code ready for cut and paste.

Attached Thumbnails
Click image for larger version

Name:	ExampleDynamicProperties.JPG
Views:	215
Size:	61.8 KB
ID:	160865  
Attached Files
Elite Membership required to download: ExampleDynamicProperties.zip
Reply With Quote
Thanked by:

Can you help answer these questions
from other members on NexusFi?
Futures True Range Report
The Elite Circle
NexusFi Journal Challenge - April 2024
Feedback and Announcements
The space time continuum and the dynamics of a financial …
Emini and Emicro Index
Exit Strategy
NinjaTrader
My NT8 Volume Profile Split by Asian/Euro/Open
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Get funded firms 2023/2024 - Any recommendations or word …
61 thanks
Funded Trader platforms
38 thanks
NexusFi site changelog and issues/problem reporting
26 thanks
GFIs1 1 DAX trade per day journal
19 thanks
The Program
18 thanks
  #22 (permalink)
 
grankus's Avatar
 grankus 
Barcelona
 
Experience: Beginner
Platform: NinjaTrader 7
Trading: CL, TF
Posts: 8 since Aug 2012
Thanks Given: 5
Thanks Received: 0

Thank you very much for all zr6bcm!

I think it's crystal clear now. I really appreciate your effort and thanks for the attached file with all the annotations.

Jairo.

Reply With Quote
  #23 (permalink)
 DoctorDirty 
Fukuoka-shi, Fukuoka-ken, Japan
 
Experience: None
Platform: NinjaTrader
Trading: Futures
Posts: 46 since Sep 2013
Thanks Given: 43
Thanks Received: 20


I've been trying to implement this type of code in my strategy, but I've been trying to base it off the code found in this NinjaWorkShop strategy. It seems to be based off of the code in this thread by @jeremytang and @zr6bcm, but it is able to dynamically remove properties without cluttering the properties section with many additional 'trigger' properties. The actual strategy is quite complex as far as NT strategies go, so if someone could make a simple sample code for how this works I would really appreciate it.

For those interested, the strategy was found on the [AUTOLINK]ninjatrader[/AUTOLINK] website here.

For a simple and a practical context, I think the sample should include a dropdown menu enabling an EMA crossover strategy, a MACD cross strategy, or both.

In this case the variables would be ema fast, ema slow, macdfast, macdslow, and macd smooth.

and should look something like this:

 
Code
if ema cross is enabled then remove macdfast, macdslow, and macd smooth
if macd cross is enabled them remove ema fast and ema slow
if ema cross and macd is enabled then remove none

Attached Files
Elite Membership required to download: NinjaWorkShop1.0.zip
Reply With Quote
  #24 (permalink)
 DoctorDirty 
Fukuoka-shi, Fukuoka-ken, Japan
 
Experience: None
Platform: NinjaTrader
Trading: Futures
Posts: 46 since Sep 2013
Thanks Given: 43
Thanks Received: 20

I've found the answer to my own question. I did not add the ICustomTypeDescriptor class! After many hours of looking it over and retyping everything multiple times, it all came down to this. So if you're looking to add this to your strategy be sure to change this:
 
Code
public class ShortTermPullback : Strategy

to this:
 
Code
public class ShortTermPullback : Strategy, ICustomTypeDescriptor

Reply With Quote




Last Updated on March 18, 2017


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts