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

N/A Values

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

    N/A Values

    Consider a custom indicator that exposes a data series thru property the same thing also plots a shape (a dot or triangle) at few important candles. Databox confirms that value exists in data series whenever a shape is plotted on chart.

    What is the best way to detect whenever that indicator has value? Following function based on IsNan does not work.

    Code:
    Dummy  customIndicator = Dummy();
    if (Double.IsNaN(customIndicator.dataSeriesProperty[1]) &&
       !Double.IsNaN(customIndicator.dataSeriesProperty[0]) )
    Indicator code looks like this

    Code:
    namespace NinjaTrader.Indicator
    {
      public class Dummy : Indicator
      { ...
    
        [XmlIgnore]
        [Browsable(false)]
        public DataSeries dataSeriesProperty
        {
          get
          {
            ....
          }
        }
        .....
      } 
    }
    Last edited by cdjindia; 01-11-2014, 10:28 AM.

    #2
    140 Views and no reply? Is it really that complicated?

    Comment


      #3
      From the NinjaTrader Help File for "Data Series Class":

      Checking for Valid Values

      It is possible that you may use a DataSeries object but decide not to set a value for a specific bar. However, you should not try to access a DataSeries value that has not been set. Internally, a dummy value does exist, but you want to check to see if it was a valid value that you set before trying to access it for use in your calculations.


      DataSeries.ContainsValue(int barsAgo)
      Returns a true or false value.

      Comment


        #4
        Hello cdjindia,

        Thank you for your post.

        Harry's post is correct. You will need to use DataSeries.ContainsValue(int barsAgo) to check the value first. For information on the DataSeries Class please visit the following link: http://www.ninjatrader.com/support/h...ries_class.htm

        Please let me know if I may be of further assistance.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Javierw.ok, Today, 04:12 PM
        0 responses
        4 views
        0 likes
        Last Post Javierw.ok  
        Started by timmbbo, Today, 08:59 AM
        2 responses
        10 views
        0 likes
        Last Post bltdavid  
        Started by alifarahani, Today, 09:40 AM
        6 responses
        40 views
        0 likes
        Last Post alifarahani  
        Started by Waxavi, Today, 02:10 AM
        1 response
        18 views
        0 likes
        Last Post NinjaTrader_LuisH  
        Started by Kaledus, Today, 01:29 PM
        5 responses
        15 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Working...
        X