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

Exposing Indicator Parameter for Strategy Development

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

    Exposing Indicator Parameter for Strategy Development

    Is there a specific tag/decoration that needs to be added to an input parameter to expose it to Strategy Builder? It seems what Strategy Builder sees is defined by what is auto generated in the "Ninjascript generated code", which only allows the "ISeries<double> input" as a parameter.

    I'd hate to modify this auto-generated code, obviously, but a customer wants to call an indicator of ours in Strategy Builder and needs to set an input parameter.

    Is there a trick that I am missing to set one of the parameters to the indicator, within Strategy Builder? In this case, it's an enum parameter.

    This is an example of how the parameter is defined within the indicator that needs to be set within Strategy Builder:

    Code:
    public enum enumMode { ValA, ValB, ValC };
    [Display(ResourceType = typeof(Custom.Resource), Name = "Mode", GroupName = "02. Alerts", Description = "", Order = 99)]
    [Browsable(true)]
    public enumMode AnalyzerMode
    { get; set; }
    Thank you for any help you can provide!

    #2
    Hello neoikon,

    The NinjaScriptProperty attribute would allow the input to be shown in the Strategy Builder or Strategies window.

    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thank you for the reply. Being that this is an enum, is there a better way to handle this than making the definition for the enum at the top NinjaTrader.NinjaScript namespace?

      Putting it within NinjaTrader.NinjaScript.Indicators, it's not found by the auto-generated code.

      Comment


        #4
        Hello neoikon,

        I generally recommend creating a custom namespace for custom enum or class declarations that are specific to an indicator.

        However, to share an enum with all indicators, the enum declaration could be in the NinjaTrader.NinjaScript.Indicators namespace if you wanted. You just need to be absolutely sure that no other script made by anyone else will have the same name of your enum or class.

        The public input that uses NinjaScriptProperty attribute must be within the scope of the class of the indicator or strategy. When using this attribute, it will be included with the auto generated code.

        Below is a link to the reference sample that demonstrates.
        https://ninjatrader.com/support/help...ned_parame.htm
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Waxavi, Today, 02:10 AM
        0 responses
        6 views
        0 likes
        Last Post Waxavi
        by Waxavi
         
        Started by TradeForge, Today, 02:09 AM
        0 responses
        11 views
        0 likes
        Last Post TradeForge  
        Started by Waxavi, Today, 02:00 AM
        0 responses
        2 views
        0 likes
        Last Post Waxavi
        by Waxavi
         
        Started by elirion, Today, 01:36 AM
        0 responses
        4 views
        0 likes
        Last Post elirion
        by elirion
         
        Started by gentlebenthebear, Today, 01:30 AM
        0 responses
        5 views
        0 likes
        Last Post gentlebenthebear  
        Working...
        X