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

  #1 (permalink)
 baruchs 
Israel
 
Experience: Intermediate
Platform: NinjaTrader
Broker: pfg
Trading: eminis
Posts: 323 since Jun 2009

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 is: If someone can show me how to do it I will post one of my strategies, which is more like a strategy template.
The strategy has:
1. Parameters population from a file
2. Entry restrictions
3. Different Stop Loss types
4. Different Trailing Stop types
5. Different Profit Target types
6. Break Even
7. Time restriction and much more

Baruch

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
ZombieSqueeze
Platforms and Indicators
Are there any eval firms that allow you to sink to your …
Traders Hideout
NexusFi Journal Challenge - April 2024
Feedback and Announcements
Better Renko Gaps
The Elite Circle
Exit Strategy
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
39 thanks
NexusFi site changelog and issues/problem reporting
26 thanks
Battlestations: Show us your trading desks!
24 thanks
The Program
18 thanks
  #3 (permalink)
 
wh's Avatar
 wh 
Neubrandenburg, Germany
 
Experience: Advanced
Platform: R
Trading: Stocks
Posts: 538 since Jun 2009
Thanks Given: 298
Thanks Received: 512


File:

var1="value1"
var2='value2'

 
Code
                            
public static IDictionary ReadDictionaryFile(string fileName)
{
    
Dictionary<stringstringdictionary = new Dictionary<stringstring>();
    foreach (
string line in File.ReadAllLines(fileName))
    {
        if ((!
string.IsNullOrEmpty(line)) &&
            (!
line.StartsWith(";")) &&
            (!
line.StartsWith("#")) &&
            (!
line.StartsWith("'")) &&
            (
line.Contains('=')))
        {
            
int index line.IndexOf('=');
            
string key line.Substring(0index).Trim();
            
string value line.Substring(index 1).Trim();

            if ((
value.StartsWith("\"") && value.EndsWith("\"")) ||
                (
value.StartsWith("'") && value.EndsWith("'")))
            {
                
value value.Substring(1value.Length 2);
            }
            
dictionary.Add(keyvalue);
        }
    }

    return 
dictionary;

then read out dictionary

did not understand too

Causality is the relationship between an event (the cause) and a second event (the effect), where the second event is a consequence of the first.
Reply With Quote
  #4 (permalink)
 baruchs 
Israel
 
Experience: Intermediate
Platform: NinjaTrader
Broker: pfg
Trading: eminis
Posts: 323 since Jun 2009

wh hi,
I didn't understand what your code is supposed to do but I don't think that it answers my request.
What I want is like in zigzag indicator when you change the "use high and low" from true to false new property "price type" appears. Or like in "set order quantity" by changing from "by strategy" to "by default quantity".

Thanks,
Baruch

Started this thread Reply With Quote
  #5 (permalink)
 Prtester 
SE-Asia
 
Experience: Intermediate
Platform: NinjaTrader
Broker: Amp
Trading: ES
Posts: 151 since Jun 2009
Thanks Given: 66
Thanks Received: 124


baruchs View Post
wh hi,
I didn't understand what your code is supposed to do but I don't think that it answers my request.
What I want is like in zigzag indicator when you change the "use high and low" from true to false new property "price type" appears. Or like in "set order quantity" by changing from "by strategy" to "by default quantity".

Thanks,
Baruch

try this

public enum MMType
{
Fix_Percent,
Kelly_F

}

in Vars
private MMType mmtype;

in Properties

[Description("Money Management Type")]
[Category("Parameters")]
[Gui.Design.DisplayNameAttribute("l)Money Management Type")]
public MMType MonMType
{
get { return mmtype; }
set { mmtype = value; }
}

Hope that help

Reply With Quote
  #6 (permalink)
 baruchs 
Israel
 
Experience: Intermediate
Platform: NinjaTrader
Broker: pfg
Trading: eminis
Posts: 323 since Jun 2009

Prtester,
Thanks, but this is not what I want. I have many Enums. What I want is one property to dictate if another property will be shown or hidden, like in the examples I provided.

Baruch

Started this thread Reply With Quote
  #7 (permalink)
 baruchs 
Israel
 
Experience: Intermediate
Platform: NinjaTrader
Broker: pfg
Trading: eminis
Posts: 323 since Jun 2009

I see that from all the c# gurus on this site no one knows how to do it.
Too bad.

Baruch

Started this thread Reply With Quote
  #8 (permalink)
 
sam028's Avatar
 sam028 
Site Moderator
 
Posts: 3,765 since Jun 2009
Thanks Given: 3,825
Thanks Received: 4,629


baruchs View Post
I see that from all the c# gurus on this site no one knows how to do it.
Too bad.

Baruch

If the third answers (mine included) were wrong (ok, nobody had understood correctly the question), maybe the answer is: this is impossible.

If we check how it's done in the original official ZigZag for NT 6.5, we have this:

 
Code
                            
        [Description("If true, high and low instead of selected price type is used to plot indicator.")]
        [
Category("Parameters")]
        [
Gui.Design.DisplayName("Use high and low")]
        [
RefreshProperties(RefreshProperties.All)]
        public 
bool UseHighLow
        
{
            
get { return useHighLow; }
            
set 
            

                
useHighLow            value
                
PriceTypeSupported    = !value;
            }
        } 
The important points are maybe:
RefreshProperties(RefreshProperties.All)
which may refresh all the parameters window, and
PriceTypeSupported = !value;
which set or unset the price type choosen.

Example, when changing 1 parameter modify anther parameter:

 
Code
                            
        [Description("My Param")]
        [
Category("Parameters")]
        [
Gui.Design.DisplayName("Extra Parameter")]
        [
RefreshProperties(RefreshProperties.All)]
        public 
bool MyParam
        
{
            
get { return myParam; }
            
set myParam value; }
        }        
        
        [
Description("If true show extra param.")]
        [
Category("Parameters")]
        [
Gui.Design.DisplayName("Show Extra")]
        [
RefreshProperties(RefreshProperties.All)]
        public 
bool ShowExtraParam
        
{
            
get { return showExtraParam; }
            
set
            
{
                
showExtraParam      value;
                
MyParam                = !value;
            }
        } 

Success requires no deodorant! (Sun Tzu)
Follow me on Twitter Reply With Quote
Thanked by:
  #9 (permalink)
 baruchs 
Israel
 
Experience: Intermediate
Platform: NinjaTrader
Broker: pfg
Trading: eminis
Posts: 323 since Jun 2009

Sam,
Thank you for trying, but this is not working.
I know that its possible but unfortunately its beyond my capabilities.
Please look at this link, maybe you can implement this for NT.
Dynamic Property Attribute Evaluation at Run and Design Time - CodeProject

Regards,
Baruch

Started this thread Reply With Quote
  #10 (permalink)
 davidj777 
Tel Aviv
 
Experience: Beginner
Platform: NinjaTrader
Posts: 1 since Oct 2009
Thanks Given: 1
Thanks Received: 0


Hello Baruch,

I'd like to know if your offer is still valid.
I'm a C# programmer ready for the challenge, and will be happy to cooperate with you.

Thanks,
David

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