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!
See more
See less

Partner 728x90

Collapse

adding parameters in strategy

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    adding parameters in strategy

    Don't Worry I Got it to work sorry.


    Can one add a parameter in a strategy I tried but can not see it when i load the strategy

    #region MarketHours
    //TASK:MARKET OPEN TIME STAMP
    //DEFAULT:
    //VALUE: DATETIME
    // [Browsable(false)]
    [NinjaScriptProperty]
    [PropertyEditor("NinjaTrader.Gui.Tools.TimeEditorKe y")]
    [Display(ResourceType = typeof(Custom.Resource), Name="Market Open", GroupName="Market Hours", Order = 2)]
    public DateTime dMar****pen
    { get; set; }


    //DEFAULT:
    //VALUE: DATETIME
    // [Browsable(false)]
    [NinjaScriptProperty]
    [PropertyEditor("NinjaTrader.Gui.Tools.TimeEditorKe y")]
    [Display(ResourceType = typeof(Custom.Resource), Name="Market Close", GroupName="Market Hours", Order = 3)]
    public DateTime dMarketClose
    { get; set; }
    Last edited by ballboy11; 03-08-2018, 12:22 PM.

    #2
    Hello,

    Thank you for the post.

    Yes, you are able to add parameters, and I do see that what you have provided does work. Can you tell me, have you removed and re-added the strategy to where it was applied after making this change? Also, are you setting a default value in OnStateChange for State.SetDefaults?

    In my test I used the following syntax:

    Code:
    protected override void OnStateChange()
    {
    	if (State == State.SetDefaults)
    	{
    		dMar****pen = NinjaTrader.Core.Globals.Now;
    	}
    }
    
    [NinjaScriptProperty]
    [PropertyEditor("NinjaTrader.Gui.Tools.TimeEditorKey")]
    [Display(Name="Market Open", GroupName="Market Hours", Order = 2)]
    public DateTime dMar****pen 
    { get; set; }
    Which results in: https://www.screencast.com/t/7DgGeTyvrWDR


    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by dustydbayer, Today, 01:59 AM
    0 responses
    1 view
    0 likes
    Last Post dustydbayer  
    Started by inanazsocial, Today, 01:15 AM
    0 responses
    3 views
    0 likes
    Last Post inanazsocial  
    Started by trilliantrader, 04-18-2024, 08:16 AM
    5 responses
    22 views
    0 likes
    Last Post trilliantrader  
    Started by Davidtowleii, Today, 12:15 AM
    0 responses
    3 views
    0 likes
    Last Post Davidtowleii  
    Started by guillembm, Yesterday, 11:25 AM
    2 responses
    10 views
    0 likes
    Last Post guillembm  
    Working...
    X