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 Tim-c, Today, 03:54 AM
        0 responses
        3 views
        0 likes
        Last Post Tim-c
        by Tim-c
         
        Started by FrancisMorro, Today, 03:24 AM
        0 responses
        2 views
        0 likes
        Last Post FrancisMorro  
        Started by Segwin, 05-07-2018, 02:15 PM
        10 responses
        1,772 views
        0 likes
        Last Post Leafcutter  
        Started by Rapine Heihei, 04-23-2024, 07:51 PM
        2 responses
        31 views
        0 likes
        Last Post Max238
        by Max238
         
        Started by Shansen, 08-30-2019, 10:18 PM
        24 responses
        945 views
        0 likes
        Last Post spwizard  
        Working...
        X