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

Unable to see exposed variables and plots of custom indicator

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

    Unable to see exposed variables and plots of custom indicator

    I have my AddPlots Properties as follows:

    Code:
            [Browsable(false), XmlIgnore]
            public Series<double> longVix
            {
                get { return Values[0]; }
            }
    
            [Browsable(false), XmlIgnore]
            public Series<double> upperBB
            {
                get { return Values[1]; }
            }
    
            [Browsable(false), XmlIgnore]
            public Series<double> shortVix
            {
                get { return Values[2]; }
            }
    
            [Browsable(false), XmlIgnore]
            public Series<double> lowerBB
            {
                get { return Values[3]; }
            }
    They are plotted as follows:

    Code:
                    AddPlot(Brushes.Orange, "Long Vix");
                    Plots[0].PlotStyle = PlotStyle.Bar;
                    Plots[0].Width = 12;
    
                    AddPlot(Brushes.Gray, "Long BB");
                    Plots[1].PlotStyle = PlotStyle.Dot;
                    Plots[1].Width = 2;
    
                    AddPlot(Brushes.Bisque, "Short Vix");
                    Plots[2].PlotStyle = PlotStyle.Bar;
                    Plots[2].Width = 12;
    
                    AddPlot(Brushes.Gray, "Short BB");
                    Plots[3].PlotStyle = PlotStyle.Dot;
                    Plots[3].Width = 2;[FONT="Arial"]​[/FONT]

    I have two exposed values coded as follows:

    Code:
            [Browsable(false), XmlIgnore]
            public Series<int> vixDirection
            {
                get { return _dirVix;  }
            }
    
    
            [Browsable(false), XmlIgnore]
            public int vixCurrentValue
            {
                get { return _dirVix[0]; }
            }​
    And I have setting properties as follows:

    Code:
    [Browsable(true), XmlIgnore]
    [Display(ResourceType = typeof(Custom.Resource), Name = "vixPeriod", GroupName = "Settings Vix", Order = 0)]
    public int Period
    {
    get { return _vixPeriod; }
    set { _vixPeriod = Math.Max(1, value); }
    }
    
    [Browsable(true), XmlIgnore]
    [Display(ResourceType = typeof(Custom.Resource), Name = "BB Period", GroupName = "Settings Vix", Order = 1)]
    public int bbPeriod
    {
    get { return _bbPeriod; }
    set { _bbPeriod = Math.Max(1, value); }
    }
    
    [Browsable(true), XmlIgnore]
    [Display(ResourceType = typeof(Custom.Resource), Name = "BB Std", GroupName = "Settings Vix", Order = 2)]
    public double std
    {
    get { return _vixStd; }
    set { _vixStd = Math.Max(1.0, value); }
    }
    ​
    On its own the indicator plots exactly as expected.

    However, when I attempt to obtain its exposed values in either a strategy or other indicator, I don't see them. Neither am I able to pass variables to control the settings properties.

    I am looking to do something like this:

    Code:
         int vixDir;
         vixDir = jelTTVix(15,9,2).vixDirection;
    However, jelTTVix. does not show the plots nor the exposed variables and jelTTVix() does not show the settings properties in either another indicator or a strategy.

    #2
    Hello jeliner,

    longVix is public and is exposed.

    To confirm, does the code below in another script cause an error?
    Print(elTTVix(15,9,2).longVix[0])

    May I have a screenshot of the error message?
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_ChelseaB View Post
      Hello jeliner,

      longVix is public and is exposed.

      To confirm, does the code below in another script cause an error?
      Print(elTTVix(15,9,2).longVix[0])

      May I have a screenshot of the error message?
      Thank you for you quick reply.

      I added your statement and I received the following error when I attempted to compile:

      Click image for larger version  Name:	image.png Views:	0 Size:	15.7 KB ID:	1292634
      Last edited by jeliner; 02-22-2024, 02:25 PM.

      Comment


        #4
        Hello jeliner,

        The issue is not with exposed properties, but an issue with the overload parameters.

        What is the overload signature of this method?
        (Place the cursor after the opening curly brace and press Ctrl + Shift + space bar)

        Note, anything using the Browsable(false) parameter will not be included with the overload parameters.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_ChelseaB View Post
          Hello jeliner,

          The issue is not with exposed properties, but an issue with the overload parameters.

          What is the overload signature of this method?
          (Place the cursor after the opening curly brace and press Ctrl + Shift + space bar)

          Note, anything using the Browsable(false) parameter will not be included with the overload parameters.
          The settings Parameters are setup as follows:
          Code:
                  #region SettingsProperties
                  [Browsable(true), XmlIgnore]
                  [Display(ResourceType = typeof(Custom.Resource), Name = "vixPeriod", GroupName = "Settings Vix", Order = 0)]
                  public int Period
                  {
                      get { return _vixPeriod; }
                      set { _vixPeriod = Math.Max(1, value); }
                  }
          
                  [Browsable(true), XmlIgnore]
                  [Display(ResourceType = typeof(Custom.Resource), Name = "BB Period", GroupName = "Settings Vix", Order = 1)]
                  public int bbPeriod
                  {
                      get { return _bbPeriod; }
                      set { _bbPeriod = Math.Max(1, value); }
                  }
          
                  [Browsable(true), XmlIgnore]
                  [Display(ResourceType = typeof(Custom.Resource), Name = "BB Std", GroupName = "Settings Vix", Order = 2)]
                  public double std
                  {
                      get { return _vixStd; }
                      set { _vixStd = Math.Max(1.0, value); }
                  }
                  #endregion​
          Here are the screen shots.



          Namespace, class, and inheritance also seem correct.
          Do I need to create a custom constructor?



          I commented out the Color Properties, just on case that was causing the issue, but i receive the same error. The color properties are the only ones with Browsable(false)

          Code:
                  [Display(ResourceType = typeof(Custom.Resource), Name = "Up Highlight Color", GroupName = "Settings Color", Order = 0), XmlIgnore]
                  public Brush UpHighlightPlotColor
                  {
                      get { return _uphighlightPlotColor; }
                      set { _uphighlightPlotColor = value; }
                  }
          
                  [Browsable(false), XmlIgnore]
                  public string UpHighlightPlotColorSerialize
                  {
                      get { return Serialize.BrushToString(_uphighlightPlotColor); }
                      set { this._uphighlightPlotColor = Serialize.StringToBrush(value); }
                  }
          
                  //**************
          
                  [Display(ResourceType = typeof(Custom.Resource), Name = "Down Highlight Color", GroupName = "Settings Color", Order = 1), XmlIgnore]
                  public Brush DownHighlightPlotColor
                  {
                      get { return this._dwnhighlightPlotColor; }
                      set { this._dwnhighlightPlotColor = value; }
                  }
          
                  [Browsable(false), XmlIgnore]
                  public string DownHighlightPlotColorSerialize
                  {
                      get { return Serialize.BrushToString(_dwnhighlightPlotColor); }
                      set { _dwnhighlightPlotColor = Serialize.StringToBrush(value); }
                  }​
          Last edited by jeliner; 02-22-2024, 02:39 PM.

          Comment


            #6
            Hello jeliner,

            May I also confirm you have compiled the script using the NinjaScript Editor so that the overload methods are autogenerated?

            May I have an export of the script to test on my end?

            To export a NinjaTrader 8 NinjaScript so this can be shared and imported by the recipient do the following:
            1. Click Tools -> Export -> NinjaScript Add-on...
            2. Click the 'add' link -> check the box(es) for the script(s) and reference(s) you want to include
            3. Click the 'Export' button
            4. Enter the script name in the value for 'File name:'
            5. Choose a save location -> click Save
            6. Click OK to clear the export location message
            By default your exported file will be in the following location:
            • (My) Documents/NinjaTrader 8/bin/Custom/ExportNinjaScript/<export_file_name.zip>
            Below is a link to the help guide on Exporting NinjaScripts.


            Once exported, please attach the file as an attachment to your reply.​
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              I think I see the issue, It appears that the NinjaScript compiler is not creating the correct constructors??
              What would keep that from happening?
              I write the code in Visual Studio and compile it in the Ninja Editor.

              Click image for larger version  Name:	image.png Views:	0 Size:	294.5 KB ID:	1292681​​

              Comment


                #8
                Hello jeliner,

                Thank you for providing the export.

                Please also add the [NinjaScriptProperty] attribute to all properties you want in the in the overload signature.
                Chelsea B.NinjaTrader Customer Service

                Comment


                  #9
                  Originally posted by NinjaTrader_ChelseaB View Post
                  Hello jeliner,

                  Thank you for providing the export.

                  Please also add the [NinjaScriptProperty] attribute to all properties you want in the in the overload signature.
                  https://ninjatrader.com/support/help...yattribute.htm
                  that fixed it.
                  Thank you for your help.

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by lightsun47, Today, 03:51 PM
                  0 responses
                  5 views
                  0 likes
                  Last Post lightsun47  
                  Started by 00nevest, Today, 02:27 PM
                  1 response
                  10 views
                  0 likes
                  Last Post 00nevest  
                  Started by futtrader, 04-21-2024, 01:50 AM
                  4 responses
                  46 views
                  0 likes
                  Last Post futtrader  
                  Started by Option Whisperer, Today, 09:55 AM
                  1 response
                  14 views
                  0 likes
                  Last Post bltdavid  
                  Started by port119, Today, 02:43 PM
                  0 responses
                  10 views
                  0 likes
                  Last Post port119
                  by port119
                   
                  Working...
                  X