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 Mizzouman1, Today, 07:35 AM
        3 responses
        17 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by RubenCazorla, Today, 09:07 AM
        2 responses
        13 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by i019945nj, 12-14-2023, 06:41 AM
        7 responses
        82 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by timmbbo, 07-05-2023, 10:21 PM
        4 responses
        158 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by tkaboris, Today, 08:01 AM
        1 response
        8 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Working...
        X