Announcement

Collapse
No announcement yet.

xSeries = highest(25, close())

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

  • xSeries = highest(25, close())

    I am using the following code to draw a horizontal line at the hightest close over the last 25 candles.

    var xSeries = highest(25, close());
    drawLineRelative(-25, xSeries, 0, xSeries, . . . . );

    This logic does draw the line but it includes the current and active candle, so if the current candle is making new highs, then the horizontal line is continually adjusted on each tick.

    I do not want the current candle to be included until that period closes and the next candle begins.

    So, basically, I would like the xSeries value to contain the highest high from candles -26 thru -1.

    Thank you for your assistance.

  • #2
    Re: xSeries = highest(25, close())

    pjkowalski
    Replace xSeries with xSeries.getValue(-1) in your drawLineRelative command which will offset the values forward by 1 bar
    Alex


    Originally posted by pjkowalski
    I am using the following code to draw a horizontal line at the hightest close over the last 25 candles.

    var xSeries = highest(25, close());
    drawLineRelative(-25, xSeries, 0, xSeries, . . . . );

    This logic does draw the line but it includes the current and active candle, so if the current candle is making new highs, then the horizontal line is continually adjusted on each tick.

    I do not want the current candle to be included until that period closes and the next candle begins.

    So, basically, I would like the xSeries value to contain the highest high from candles -26 thru -1.

    Thank you for your assistance.

    Comment


    • #3
      Thank you Alex. Helpful and accurate as always.
      Phil

      Comment


      • #4
        Phil
        You are most welcome
        Alex


        Originally posted by pjkowalski
        Thank you Alex. Helpful and accurate as always.
        Phil

        Comment

        Working...
        X