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 judysamnt7, 03-13-2023, 09:11 AM
    4 responses
    59 views
    0 likes
    Last Post DynamicTest  
    Started by ScottWalsh, Today, 06:52 PM
    4 responses
    36 views
    0 likes
    Last Post ScottWalsh  
    Started by olisav57, Today, 07:39 PM
    0 responses
    7 views
    0 likes
    Last Post olisav57  
    Started by trilliantrader, Today, 03:01 PM
    2 responses
    21 views
    0 likes
    Last Post helpwanted  
    Started by cre8able, Today, 07:24 PM
    0 responses
    10 views
    0 likes
    Last Post cre8able  
    Working...
    X