Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

GetYByValue returning unexpected values

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

    GetYByValue returning unexpected values

    i have two indicators MyRegressionChannelIndicator (RCI) and MyRegressionFramesIndicator (RFI). RCI is a modified version of the RegressionChannel indicator by NT. An RCI instance is referenced in RFI. When rendered RCI functions on its own correctly when added to the chart. However, the RFI does not render due to wierd values coming from the call to GetYByValue() which is executed in both RCI and RFI when called from OnRender. The core logic of RCI has to be separated from the presentation logic in both indicators, hence each has a similar implementation of the OnRender method. My goal is to have multiple instances of the RCI within the RFI each corresponding to a different data series type/period. I have attached my scripts. Any help is appreciated!
    Attached Files

    #2
    Hello love2code2trade,

    Are the values in the script which is not working valid and within the visible range on the chart? To use GetYByValue the price needs to be a valid price which you can see within the chart panel, if you are using a value which is outside the panel that may be why the values are not as expected.

    Comment


      #3
      hi Jesse,
      Thanks for the prompt reply. Below is a sample of the debug output. The prices are all within the visible range. However, for the same price that is correctly being passed to RCI and the correct y-value returned from GetYPos, that is not the case for the RFI.

      RCI GetYPos price: 5544.8880952381
      RCI GetYPos price: 5547.76904761905
      RCI OnRender bi: 9869 startVector: X:1303 Y:634 endVector: X:1823 Y:595 Width: 2
      RFI GetYPos price: 5544.8880952381
      RFI GetYPos price: 5547.76904761905
      RFI OnRender bi: 9869 startVector: X:1303 Y:-3326048 endVector: X:1823 Y:-3327776 Width: 2
      RCI GetYPos price: 5544.875
      RCI GetYPos price: 5547.79642857143
      RCI OnRender bi: 9869 startVector: X:959 Y:652 endVector: X:1479 Y:612 Width: 2
      RFI GetYPos price: 5544.875
      RFI GetYPos price: 5547.79642857143
      RFI OnRender bi: 9869 startVector: X:959 Y:-3425030 endVector: X:1479 Y:-3426835 Width: 2

      Comment


        #4
        Hello love2code2trade,

        From the output al that I can see is that the calculated value is a unrounded value, potentially that is causing the issue. Please try using the RoundToTickSize method to round the value to the instruments tick size and see if that allows it to work correctly.

        Comment


          #5
          That did not work.

          Comment


            #6
            It seems to be an issue with using the RCI as an instance within the RFI i.e.

            else if (State == State.Configure) {
            ClearOutputWindow();

            _10s = MyRegressionChannelIndicator(Period);
            }​

            Comment


              #7
              Hello love2code2trade,

              When you say it seems to be an issue with that indicator instance, what specifically do you mean?

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
              0 responses
              581 views
              0 likes
              Last Post Geovanny Suaza  
              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
              0 responses
              338 views
              1 like
              Last Post Geovanny Suaza  
              Started by Mindset, 02-09-2026, 11:44 AM
              0 responses
              103 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
              0 responses
              554 views
              1 like
              Last Post Geovanny Suaza  
              Started by RFrosty, 01-28-2026, 06:49 PM
              0 responses
              552 views
              1 like
              Last Post RFrosty
              by RFrosty
               
              Working...
              X