Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Y coordinates for values plotted ScaleJustification.Left

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

    Y coordinates for values plotted ScaleJustification.Left

    I have an indicator with two series plotted. Primary series is plotted with ScaleJustification.Right, and second series is plotted with ScaleJustification.Left. In Ninjascript how can I get Y coordinates for the second series values plotted with ScaleJustification.Left?

    #2
    I should note that I do have a workaround, which is to create a second indicator running on my second series and assigned to the same panel but with output to the left scale. OnRender for this second indicator operates with ScaleJustification.Left where I can get the Y coordinates for my second series and communicate those values to the other indicator as static or common variables through an Add-On. This works. It is clumsy. It may not be the most efficient approach.

    Comment


      #3
      HI jvanelli, thanks for posting. ScaleJustification is a property of the indicator and not the Plot objects. To access data from each Plot you can use the Values[][] array. e.g. Values[0][0] for the first plot and Values[1][0] for the second plot.

      Kind regards,
      -ChrisL
      Chris L.NinjaTrader Customer Service

      Comment


        #4
        Of course, but getting the values is not my question. What I need to obtain is the Y (pixel) coordinate for the second series, such as would be returned by GetYByValue().

        Comment


          #5
          HI jvanelli, GetYByValue() is a method of the ChartScale object, so GetYByValue will use the respective ChartScale of the indicator you are working with. This can be tested in OnRender by printing the value of GetYByValue(Value[0]);

          Kind regards,
          -ChrisL
          Chris L.NinjaTrader Customer Service

          Comment


            #6
            So if I understand what you are saying, there is no direct way to plot a primary series on right scale, a secondary series on left scale, and then access pixel coords for both from the same indicator script.
            Last edited by jvanelli; 05-26-2022, 11:29 AM.

            Comment


              #7
              Hi jvanelli, An indicator can access all Scales on the chart, see here:

              https://ninjatrader.com/support/help...chartpanel.htm

              One indicator can create an object of the other indicator to get its Series values, and use GetYByValue() for the chart scale in the above collection. That would be the best way to get the y coordinate without directly accessing it or sharing it through an addon.
              Chris L.NinjaTrader Customer Service

              Comment


                #8
                This looks promising. Thank you.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by BartMan, Today, 06:49 PM
                0 responses
                3 views
                0 likes
                Last Post BartMan
                by BartMan
                 
                Started by Alley93, Today, 04:20 PM
                0 responses
                1 view
                0 likes
                Last Post Alley93
                by Alley93
                 
                Started by joselube001, Today, 02:49 PM
                1 response
                7 views
                0 likes
                Last Post NinjaTrader_ChrisL  
                Started by TheFil, Today, 06:20 AM
                1 response
                11 views
                0 likes
                Last Post NinjaTrader_Clayton  
                Started by WalterSkinner, Today, 03:14 PM
                0 responses
                12 views
                0 likes
                Last Post WalterSkinner  
                Working...
                X