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

Values of another indicator

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

    Values of another indicator

    I'm trying to call the values of another indicator (Opening Range),
    Code:
    double OpenRangeHigh    =  OpeningRange ("1700","0830","1515").RangeHighSeries[0];
    The Intellisense parameters are: ( string openTime, string rangeEndTime, string stopPlotTime )

    Print(OpenRangeHigh); is coming back as "0".

    But when I do a Print (RangeHighSeries[0]) directly from the Opening Range indicator, the output is the correct one.

    Is my syntax wrong as I called the values of the other indicator? Thanks in advance.

    #2
    Hello,

    Thank you for the question.

    Based on the syntax that looks like what the indicator is asking for.

    Is this a free indicator I could download to test this? Because this is not a stock item I cant really say what may be happening, if OpeningRange is an open source indicator we may be able to determine why.

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

    Comment


      #3
      I believe that the reason Print for my indicator is coming back as "0", is because Opening Range indicator is using values of another indicator and these values are not passed on to my final indicator.

      In other words, I have the following situation: Indicator "B (Opening Range)" is calculated by calling the values of indicator "A", so now I need my new indicator "C" to call on the values of the new indicator "B". Do the values of "A" not just "B" have to be passed on to "C"?

      What should be the syntax if this is the case? Thanks again.

      Comment


        #4
        Hello,

        Thank you for the clarification.

        I did a simple test of this and was able to confirm the scenario. What is happening is that the Update of the value is not getting passed down the chain due to the way the scripts work together.

        One way of resolving this is to force the script to Update its values when you try to get the value.

        To do this you would need to modify the scripts A and B so C will get the end value. If you do not have access to the source for A and B, this may prevent this chain from working correctly and you may need to re work the logic.

        What you can do is in the get part of the property you can add Update(); or like the following:

        Code:
        public bool GreaterAgain
        {
        	get {Update(); return greaterAgain; }
        	set { greaterAgain = value; }
        }
        This would need to be changed in A and B, then C should see the updates during OnBarUpdate.

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

        Comment


          #5
          Jesse,
          I was able to get it to work. Thanks for the code and for the help.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by bortz, 11-06-2023, 08:04 AM
          47 responses
          1,602 views
          0 likes
          Last Post aligator  
          Started by jaybedreamin, Today, 05:56 PM
          0 responses
          8 views
          0 likes
          Last Post jaybedreamin  
          Started by DJ888, 04-16-2024, 06:09 PM
          6 responses
          18 views
          0 likes
          Last Post DJ888
          by DJ888
           
          Started by Jon17, Today, 04:33 PM
          0 responses
          4 views
          0 likes
          Last Post Jon17
          by Jon17
           
          Started by Javierw.ok, Today, 04:12 PM
          0 responses
          12 views
          0 likes
          Last Post Javierw.ok  
          Working...
          X