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

dropdown list and selected Items on startup

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

    dropdown list and selected Items on startup

    I created a custom typeconverter dropdownlist

    [GridCategory("Parameters")]
    [TypeConverter(typeof(FileNameList))]
    public string TradeFiles
    {get;set;}


    It load but the error is
    Failed to get property 'TradeFiles' for indicator 'myindicator': Object reference not set to an instance of an object.

    the issue is the dropdownlist is initially blank when i select the name in in the dropdownlist and press apply it will then work.

    all i want to do is choose the first item in my dropdown list upon initialization

    #2
    Hello,

    Thank you for the post.

    I wanted to check, could you provide an export of the type converter/property into a sample script?

    A string would not be null in this situation so this is very likely something in the TypeConverter is not being initialized. If you could provide a sample I would be able to review that further to see if I can find anything else.

    You may also try supplying a default string if you are not already from SetDefaults:

    Code:
    TradeFiles = "whatever the default should be";
    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Thanks Last question how to I get the value of the dropdown list?

      Comment


        #4
        Hello,

        The TypeConverter is only used to change how the property is displayed/selected, you still access the property if you want its value:

        Print(TradeFiles);

        You have defined a string property so it could be used anywhere a string is used.

        Please let me know if I may be of further assistance.
        JesseNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by jpapa, Today, 07:22 AM
        1 response
        4 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by kevinenergy, 02-17-2023, 12:42 PM
        116 responses
        2,757 views
        1 like
        Last Post kevinenergy  
        Started by franatas, 12-04-2023, 03:43 AM
        7 responses
        106 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by Jltarrau, Today, 05:57 AM
        3 responses
        8 views
        0 likes
        Last Post Jltarrau  
        Started by f.saeidi, Today, 05:56 AM
        2 responses
        8 views
        0 likes
        Last Post NinjaTrader_Erick  
        Working...
        X