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

trouble with input conversion

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

    trouble with input conversion

    I am having a bit of trouble figuring out what I am doing wrong with an input conversion. Basically, I am using a string collection and type conversion to create a list of options the user can select. In Ninja 7 it works exactly as expected.

    This is the code I am using in Ninja 7
    Code:
    internal class CLM : StringConverter
                {
                    public override bool GetStandardValuesSupported(ITypeDescriptorContext itdc) {return true;}
                    public override bool GetStandardValuesExclusive(ITypeDescriptorContext itdc) {return true;}
                    public override System.ComponentModel.TypeConverter.StandardValuesCollection GetStandardValues(ITypeDescriptorContext itdc)
                    {
                        return(new StandardValuesCollection(new String[] {"XC", "XA"}));
                    }
                }
    
    private int clm = -1;
                    private string cyphIGL = "XC";
                    [Description("")]
                    [GridCategory("10 - Manual Drawing Parameters")]
                    [Gui.Design.DisplayName ("2-2: Inverted Graystone Leg")]
                    [TypeConverter(typeof(CLM))]
                    public string Clm
                    {
                        get { return cyphIGL; }
                        set { cyphIGL = value; }
                    }
    I have tried something similar in Ninja 8, but I keep getting this error message
    Value of property 'cslt' of NinjaScript 'TE_ConstellationPro_v111_N8' is Fixed_Pip and not in valid range between 0 and 1.7976931348623157E+308.
    Here is the code from ninja 8 that isn't identical
    Code:
    [NinjaScriptProperty]
                    [Display(Name="Drawn Cypher: Stoploss Type", Description="Manual Drawn Cypher: Stoploss Type", Order=13, GroupName="10) Manual Drawing Inputs")]
                    [TypeConverter(typeof(SLT))]
                    public string cslt
                    { get; set; }
    Anyone have any idea why I keep getting this error message and how to fix it... without being forced to declare public enums? I tried using public enums, but then every time I started working on a new version, I had to remove the old version to get rid of the conflict.

    #2
    Hello Antny, and thank you for your question. Could you send us a picture of the GUI settings you are passing to this NinjaScript file?

    To send a screenshot with Windows 7 or newer I would recommend using Window's Snipping Tool.
    Click here for instructions
    Alternatively to send a screenshot press Alt + PRINT SCREEN to take a screenshot of the selected window. Then go to Start--> Accessories--> Paint, and press CTRL + V to paste the image. Lastly, save as a jpeg file and send the file as an attachment.
    Click here for detailed instruction
    Jessica P.NinjaTrader Customer Service

    Comment


      #3
      I just wanted to follow up on this post...apparently, I have a typo somewhere. I just slapped together a couple of rudimentary example indicators to provide relevant code examples, but there is no error in Ninja 8. Thus, I must have a typo in my indicator. lol

      Regardless, I am going to post the code examples just in case someone else needs something similar to this type of input, but cannot use an enum for whatever reason.
      Attached Files

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by bsbisme, Yesterday, 02:08 PM
      1 response
      15 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Started by prdecast, Today, 06:07 AM
      0 responses
      3 views
      0 likes
      Last Post prdecast  
      Started by i019945nj, 12-14-2023, 06:41 AM
      3 responses
      60 views
      0 likes
      Last Post i019945nj  
      Started by TraderBCL, Today, 04:38 AM
      2 responses
      18 views
      0 likes
      Last Post TraderBCL  
      Started by martin70, 03-24-2023, 04:58 AM
      14 responses
      106 views
      0 likes
      Last Post martin70  
      Working...
      X