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

Calling one Indicator from another

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

    Calling one Indicator from another

    I've attached a simple Indicator that I am trying to call from another Indicator using the following:

    Code:
    Print(Rv().Test[0]);
    I cannot understand why it is not working. Any help would be greatly appreciated. Here is the Indicator:
    Rv.zip

    #2
    Hello swcooke,

    Thank you for your post.

    I see you have used a series<double> rather than a plot here, was the intention to use a plot or specifically a series<double>? If your intention is to use a series instead of a plot and also expose the value, you will likely need to call Update in the property.

    Code:
    [Browsable(false)]
    [XmlIgnore]
    public Series<double> Test
    {
         get { 
             Update();
             return test; 
         }
    }
    What is currently happening in your test? Are you getting 0 values or an error?


    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      It is returning 0 for me. I did not use a Plot for this since this technically has no brushes, etc. So I did intend to just use a Series.

      I have another one of these that works just fine below without calling Update(). What is the difference? This code calls the attached Indicator from any other Indicator without using Update(). How?
      Code:
      Print(tNonVisual().Test[0]);
      tNonVisual.zip
      Attached Files
      Last edited by swcooke; 04-15-2019, 12:52 PM.

      Comment


        #4
        Hello swcooke,

        In this case, if you already have a working example then I would really just suggest to compare and contrast to find what is different between those two samples. Comparing the files I can see you used different syntax.

        In the working file you used :

        Code:
        test = new Series<double>(this);
        wherein the non-working file you used:

        Code:
        test = new Series<double>(BarsArray[0]);
        This looks like it is the only difference, however rather than debugging the problem further you could just replace what you have now with the working syntax to continue past this point.

        The only difference I see is that the working file defines the series like it is suggested in the help guide where the non-working series instead uses BarsArray https://ninjatrader.com/support/help...us/seriest.htm

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

        Comment


          #5
          I realize what you are saying but I am trying to learn whether Update() is required or not. It seems that in two different examples, one works and one does not. I don't believe the way the Series is defined is the actual issue here. I guess my main question at this point is, should calling Update() be required or is it intended to work without that?

          Comment


            #6
            Hello swcooke,

            I don't believe the way the Series is defined is the actual issue here
            Actually, in this case, that was the specific problem.

            You can learn more about the Update() method in the help guide to understand when this may be needed. In this case, there was not enough context provided with the original question to know if Update was needed or not so this was a test to see if that helped or not. The problem was not that the script needed to use Update but how the series was defined which we can now see between your samples.




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

            Comment


              #7
              Thank you!

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Aviram Y, Today, 05:29 AM
              0 responses
              1 view
              0 likes
              Last Post Aviram Y  
              Started by quantismo, 04-17-2024, 05:13 PM
              3 responses
              25 views
              0 likes
              Last Post NinjaTrader_Gaby  
              Started by ScottWalsh, 04-16-2024, 04:29 PM
              7 responses
              34 views
              0 likes
              Last Post NinjaTrader_Gaby  
              Started by cls71, Today, 04:45 AM
              0 responses
              6 views
              0 likes
              Last Post cls71
              by cls71
               
              Started by mjairg, 07-20-2023, 11:57 PM
              3 responses
              216 views
              1 like
              Last Post PaulMohn  
              Working...
              X