Announcement

Collapse
No announcement yet.

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.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    90 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    137 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    68 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    120 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    71 views
    0 likes
    Last Post PaulMohn  
    Working...
    X