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

Indicator values

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

    Indicator values

    Hi,

    I would access to my indicator values.
    How can read the indicator plot values?

    Here is where I am right now.

    I can get my indicators:
    Code:
    ChartControl.Indicators[index].Name
    I can get my plots:
    Code:
    ChartControl.Indicators[index].Plots[index].Name
    What is the name of the property or object that store plot values?

    Thanks!

    FA




    #2
    Hello funnyart,

    Welcome to the NinjaTrader forums.

    Are you trying to call an indicator?

    For example if I wanted to print the value of the Avg plot of the MACD indicator I would call:
    Print(MACD(12, 26, 9).Avg[0]);

    Below is a public link to the help guide.
    https://ninjatrader.com/support/help...gence_macd.htm

    If you have a custom indicator with multiple plots, you would use the name of your indicator.
    For example if you have a custom public series named MyCustomPlot returning a public in an indicator called MyCustomIndicator this would be called like:
    Print(MyCustomIndicator().MyCustomPlot[0]);

    Also, below is a link to a forum post with helpful information about getting started with NinjaScript.

    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      I do not want create a new instance from my 3rd party indicator becuse there is no documentacion about parameter list and I do not have .cs file also.
      Is there any way to get the calucalted indicator values from the ChartControl?

      I try this way. The chart indicator list first element is the MACD.
      Code:
                      Print("Indicator: Name " + ChartControl.Indicators[0].Name);                      //
                      Print("Indicator: Value " + ChartControl.Indicators[0].Values[0][0]);
      Output:
      Indicator Name: MACD
      Indicator Value: 0 <-- This Series looks empty :-(


      Comment


        #4
        Hello funnyart,

        Calling the indicator and creating an indicator instance would be the only supported way of getting an indicator value.

        This thread will remain open for any community members that would like to assist with unsupported code.

        You may also find this example linked below that uses unsupported code helpful.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Hi,

          I try to follow what you suggest and invoke directly a 3rd party inidcator as you wrote.
          I attached the screenshot about error. Is there problem with the constructor?
          Is there any workaround? This inicator works with Chart.
          Attached Files

          Comment


            #6
            Hello funnyart,

            The Constructor does not appear to be declared as a method.

            public TTP_VolumeAnalyst();

            vs

            public TTP_VolumeAnalyst() { }

            The error is letting you know that you have added a dot "." after calling TTP_VolumeAnalyst() and it is expecting a property or method that is part of this class to be called.
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Thank you the answer.

              How can use a 3rd party indicator? You have written an example: "Print(MyCustomIndicator().MyCustomPlot[0]);"
              I just tried to follow this syntax.

              Comment


                #8
                Hello funnyart,

                You would write the name of the indicator followed by an opening parenthesis followed by all required parameters separated by commas, followed by a closing parenthesis. If there is only one plot this can be followed by a barsAgo index.

                Print(SMA(14)[0]);

                If the script has muliple plots this can be followed by a dot, the name of the plot and then followed by a barsAgo index.

                Print(MACD(12, 26, 9).Avg[0]);
                Chelsea B.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by junkone, Today, 11:37 AM
                2 responses
                12 views
                0 likes
                Last Post junkone
                by junkone
                 
                Started by frankthearm, Yesterday, 09:08 AM
                12 responses
                43 views
                0 likes
                Last Post NinjaTrader_Clayton  
                Started by quantismo, 04-17-2024, 05:13 PM
                5 responses
                35 views
                0 likes
                Last Post NinjaTrader_Gaby  
                Started by proptrade13, Today, 11:06 AM
                1 response
                7 views
                0 likes
                Last Post NinjaTrader_Clayton  
                Started by love2code2trade, 04-17-2024, 01:45 PM
                4 responses
                35 views
                0 likes
                Last Post love2code2trade  
                Working...
                X