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

Bar Score Over N Bars

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

    #16
    Originally posted by aventeren View Post
    So I think I need to work on this step wise.

    1st: Can someone please confirm that if I place this code:

    [Browsable(false)]
    [XmlIgnore()]
    public double Seriessum
    {
    get { return seriessum; }
    }

    In the Properties section of the IndicatorSource code, that other indicators will be able to access the IndicatorSource's Seriessum values?

    Before I get into adding an indicator to another indicator, I first want to make sure that I have properly revealed the Seriessum values for use.

    Thanks,

    Aventeren
    We need to be sure of what you want to do.

    Are you sure that you want to expose a double, rather than a DataSeries. The code that you have posted exposes a double.

    Comment


      #17
      2nd: Can someone please confirm that the proper way to make an indicator's values available within a new indicator, that the following line of code is the correct way to initialize and add an indicator to a new indicator:

      //Iniitalize()
      Add(IndicatorSource()); // Adds the IndicatorSource

      The above assumes that the name of the indicator that I am trying to call is named "IndicatorSource"--and it also assumes that the IndicatorSource indicator does not have any overloads, which it doesn't.

      I am getting the following error when I try and add IndicatorSource into the indicator:

      CS1502: The best overload method match for 'Ninjatrader.Indicator.IndicatorBase.Add(NinjaTrad er.Gui.Chart.Line)' has some invalid arguments.

      CS1501: Argument '1': cannot convert from 'NinjaTrader.Indicator.IndicatorSource' to 'NinjaTrader.Gui.Chart.Line'

      Can someone please help me determine what might be causing this error and what the proper way to add an existing indicator to a new indicator so that the existing indicator's values can be plotted?

      Thanks,

      Aventeren

      Comment


        #18
        Originally posted by koganam View Post
        We need to be sure of what you want to do.

        Are you sure that you want to expose a double, rather than a DataSeries. The code that you have posted exposes a double.
        Thanks, Koganam;

        The values that I want to expose from the IndicatorSource are double values, which in the IndicatorSource indicator were:

        //Variables
        private double seriessum = 0; // Variable to store the series sum over N bars

        //OnBarUpdate
        series.Set(score); //Where "score" is a type int value that represents the current bar's score and "series" is a DataSeries.
        seriessum = SUM(series, serieslength)[0]; // This is where the seriessum variable received its values, which are of type double--AND MOST IMPORTANTLY, THESE ARE THE VALUES THAT I AM LOOKING TO PLOT. seriessum is simply a score count of n bars. Again, these are the values that I am looking to plot.

        //Properties
        //This is where I publicly exposed the seriessum values as a type double called Seriessum
        [Browsable(false)]
        [XmlIgnore()]
        public double Seriessum
        {
        get { return seriessum; }
        }

        Would you concur that my logic (above) is correct?

        Thanks, Koganam--I REALLY appreciate your help.

        Aventeren
        Last edited by aventeren; 06-20-2013, 05:40 PM.

        Comment


          #19
          Originally posted by aventeren View Post
          Thanks, Koganam;

          The values that I want to expose from the IndicatorSource are double values, which in the IndicatorSource indicator were:

          //Variables
          private double seriessum = 0; // Variable to store the series sum over N bars

          //OnBarUpdate
          series.Set(score); //Where "score" is a type int value that represents the current bar's score and "series" is a DataSeries.
          seriessum = SUM(series, serieslength)[0]; // This is where the seriessum variable received its values, which are of type double--AND MOST IMPORTANTLY, THESE ARE THE VALUES THAT I AM LOOKING TO PLOT. seriessum is simply a score count of n bars. Again, these are the values that I am looking to plot.

          //Properties
          //This is where I publicly exposed the seriessum values as a type double called Seriessum
          [Browsable(false)]
          [XmlIgnore()]
          public double Seriessum
          {
          get { return seriessum; }
          }

          Would you concur that my logic (above) is correct?

          Thanks, Koganam--I REALLY appreciate your help.

          Aventeren
          Not quite. If you expose anything other than a Plot, you need to run Update() in the getter.

          Here is a reference sample that might get you going much faster. http://www.ninjatrader.com/support/f...ead.php?t=4991

          Comment


            #20
            Originally posted by koganam View Post
            Not quite. If you expose anything other than a Plot, you need to run Update() in the getter.

            Here is a reference sample that might get you going much faster. http://www.ninjatrader.com/support/f...ead.php?t=4991
            Okay, thanks Koganam; I'll take a look at this either later tonight (after NBA Finals Game 7) or in the AM.


            So basically I'm thinking that I'll need to create a new DataSeries in the "source" indicator (which we're calling IndicatorSource here), and then .Set the new DataSeries values to populate the new DataSeries values. Then under Properties expose a new public DataSeries instead of the current double that I am trying to expose now. So that's where my mind is currently at while sitting in front of the TV without having my computer in front of me.


            I guess one basic question I have: it is possible to grab a publicly exposed indicator value (ie, the new DataSeries above) and then use that in another indicator, right? Or can you only pull a publicly exposed DataSeries into a strategy (ie, not an indicator).


            Thanks for your help, Koganam. You're an all star!


            Aventeren

            Comment


              #21
              Originally posted by aventeren View Post
              Okay, thanks Koganam; I'll take a look at this either later tonight (after NBA Finals Game 7) or in the AM.


              So basically I'm thinking that I'll need to create a new DataSeries in the "source" indicator (which we're calling IndicatorSource here), and then .Set the new DataSeries values to populate the new DataSeries values. Then under Properties expose a new public DataSeries instead of the current double that I am trying to expose now. So that's where my mind is currently at while sitting in front of the TV without having my computer in front of me.


              I guess one basic question I have: it is possible to grab a publicly exposed indicator value (ie, the new DataSeries above) and then use that in another indicator, right? Or can you only pull a publicly exposed DataSeries into a strategy (ie, not an indicator).


              Thanks for your help, Koganam. You're an all star!


              Aventeren
              Any object that is public in a namespace can be accessed by any other object that uses the namespace.

              Comment


                #22
                Originally posted by koganam View Post
                Any object that is public in a namespace can be accessed by any other object that uses the namespace.
                Thanks; so I'll assume that your very precise answer means that yes, an indicator or a strategy can access a publicly exposed DataSeries.


                Thanks!

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by love2code2trade, 04-17-2024, 01:45 PM
                4 responses
                36 views
                0 likes
                Last Post love2code2trade  
                Started by alifarahani, Today, 09:40 AM
                2 responses
                13 views
                0 likes
                Last Post alifarahani  
                Started by junkone, Today, 11:37 AM
                3 responses
                15 views
                0 likes
                Last Post NinjaTrader_ChelseaB  
                Started by pickmyonlineclass, Today, 12:23 PM
                0 responses
                1 view
                0 likes
                Last Post pickmyonlineclass  
                Started by frankthearm, Yesterday, 09:08 AM
                12 responses
                44 views
                0 likes
                Last Post NinjaTrader_Clayton  
                Working...
                X