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

Reading price value of a line drawn with plot

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

    Reading price value of a line drawn with plot

    I'm currently working to make the Linear Regression channel indicator to function like the linear regression channel indicator that TOS has.

    I've programmed the center line to function properly however its the outer lines that I'm having an issue with. In order for me to properly plot them I need a way to read the line value X bars ago.

    For example: I have a linRegChan that spans 50 bars. The line is then plotted in the center as it should. I want to be able to read the value of that line at any given point.

    I originally created an array to store the previous values, but this will not work because the line value changes with each bar and thus will not be the same value that is seen visually.


    Basically, I have a line that's drawn over 50 bars. I have access to the most current lines value, Is there a function to get the value the line passes over X bars ago?

    #2
    If it's a plot or data series, you access prior values with [ ]. Help for working with brackets to reference prior values is available here:

    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Thank you for the quick reply, Unfortunately this is just a faster way to access the values I'm already getting.

      In other words I don't want the value that was there X bars ago. I want the value that I'm seeing X bars ago currently.

      I've attached two images to better illustrate.

      Image 1 shows the chart how it currently is. Notice how the cross hairs are on the 15:19 bar on the Middle Grey line. It currently has a value of 39.50.

      Image 2 shows how the chart looked at 15:19. Notice how the value is 39.71

      The second value is the one that will be obtained when accessing the value in the data series. However I'm looking for a way to access the 39.50 value as is shown in the first picture.
      Attached Files

      Comment


        #4
        I've gone ahead an made a functions which loops through the first and last point subtracting out the slope each time. This seems to be off by a penny here and there but works well enough so if there isn't an easier way to access this Y value don't worry about it.

        Comment


          #5
          You may be able to expose through the IRegressionChannel Y value:


          There are values for the start and end point and you then have to code when exactly to capture its value.
          Ryan M.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by knowmad, Today, 03:52 AM
          0 responses
          17 views
          0 likes
          Last Post knowmad
          by knowmad
           
          Started by tradingnasdaqprueba, Today, 03:42 AM
          0 responses
          13 views
          0 likes
          Last Post tradingnasdaqprueba  
          Started by Haiasi, 04-25-2024, 06:53 PM
          4 responses
          63 views
          0 likes
          Last Post effraenk  
          Started by ccbiasi, 11-23-2017, 06:06 AM
          5 responses
          2,213 views
          0 likes
          Last Post leodavis  
          Started by kujista, Yesterday, 12:39 AM
          2 responses
          14 views
          0 likes
          Last Post kujista
          by kujista
           
          Working...
          X