Announcement

Collapse
No announcement yet.

Identifying the 'value' of xSeries

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

  • Identifying the 'value' of xSeries

    Below is a portion of code to draw a horizontal line at the highest close and lowest close of the last 25 bars. This works correctly.

    var xSeriesLow = lowest(25, close());
    var xSeriesHigh = highest(25, close());
    . . . . . .
    if(sInterval == "5") {
    if(getBarState() == BARSTATE_NEWBAR) {
    removeLine(501);
    }
    drawLineRelative(-25, xSeriesHigh.getValue(-1), -1, xSeriesHigh5.getValue(-1), PS_SOLID, 3, Color.blue, 501);

    if(getBarState() == BARSTATE_NEWBAR) {
    removeLine(502);
    }
    drawLineRelative(-25, xSeriesLow.getValue(-1), -1, xSeriesLow5.getValue(-1), PS_SOLID, 3, Color.blue, 502);
    }


    Now, I would like to perform a task if the currently active bar is less than the xSeriesLow line or greater than the xSeriesHigh line.

    What do I put in this IF statement to test the 'value' of xSeries?
    if(close < ????) { /**xSeriesLow
    and
    if(close > ????) { /**xSeriesHigh

    Thanks for the help.
    Phil
    Last edited by pjkowalski; 03-10-2009, 05:53 PM.

  • #2
    Re: Identifying the 'value' of xSeries

    Phil
    You would need to check the value of the series at the prior bar ie
    PHP Code:
    if(close(0) < xSeriesLow.getValue(-1)) //do something
    if(close(0) > xSeriesHigh.getValue(-1)) //do something else 
    since the current Close by definition will never be higher than the current value of xSeriesHigh and will never be lower than the current value of xSeriesLow
    Alex


    Originally posted by pjkowalski
    Below is a portion of code to draw a horizontal line at the highest close and lowest close of the last 25 bars. This works correctly.

    var xSeriesLow = lowest(25, close());
    var xSeriesHigh = highest(25, close());
    . . . . . .
    if(sInterval == "5") {
    if(getBarState() == BARSTATE_NEWBAR) {
    removeLine(501);
    }
    drawLineRelative(-25, xSeriesHigh.getValue(-1), -1, xSeriesHigh5.getValue(-1), PS_SOLID, 3, Color.blue, 501);

    if(getBarState() == BARSTATE_NEWBAR) {
    removeLine(502);
    }
    drawLineRelative(-25, xSeriesLow.getValue(-1), -1, xSeriesLow5.getValue(-1), PS_SOLID, 3, Color.blue, 502);
    }


    Now, I would like to perform a task if the currently active bar is less than the xSeriesLow line or greater than the xSeriesHigh line.

    What do I put in this IF statement to test the 'value' of xSeries?
    if(close < ????) { /**xSeriesLow
    and
    if(close > ????) { /**xSeriesHigh

    Thanks for the help.
    Phil

    Comment

    Working...
    X