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 AttiM, 02-14-2024, 05:20 PM
        12 responses
        213 views
        0 likes
        Last Post DrakeiJosh  
        Started by cre8able, 02-11-2023, 05:43 PM
        3 responses
        237 views
        0 likes
        Last Post rhubear
        by rhubear
         
        Started by frslvr, 04-11-2024, 07:26 AM
        8 responses
        116 views
        1 like
        Last Post NinjaTrader_BrandonH  
        Started by stafe, 04-15-2024, 08:34 PM
        10 responses
        47 views
        0 likes
        Last Post stafe
        by stafe
         
        Started by rocketman7, Today, 09:41 AM
        3 responses
        12 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Working...
        X