Announcement

Collapse
No announcement yet.

Horizonal lines off the chart

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

  • Horizonal lines off the chart

    Hi

    I have the following code that plots the monlthy high on a chart

    if(isMonthly() )
    return;

    if(bInit == false){
    xHigh = high(inv("M"));
    bInit = true;
    }

    var vHigh = getSeries(xHigh);

    return (vHigh);


    Two questions:

    1) how can I prevent the chart from using this level to scale ... sometimes this is so much higher than the current price action that when the chart scales the price bars are tiny ... can I override that so scale normally and plot this line 'off the chart'

    2) how could I also plot last month's high as a horizontal line in the current month ... the above code plots each month's high within the month it occurred

    Thanks again

    Paul

  • #2
    Paul
    1) Right click the Advanced Chart and select Scaling-> Scale Price Data Only
    2) In the line after var vHigh = getSeries(xHigh); create a new variable called for example vHigh_1 and assign to it the value of the xHigh series at the prior bar eg
    PHP Code:
    var vHigh_1 xHigh.getValue(-1); 
    After that run a check for null on the variable eg
    PHP Code:
    if(vHigh_1 == null) return; 
    At this point you can add the variable to your return statement eg
    PHP Code:
    return new Array (vHighvHigh_1); 
    Once you have done that you will need to add the required statements in preMain to set the Cursor Label name, plot type, color, etc
    Alex

    Comment


    • #3
      Alex

      Thanks again

      Paul

      Comment

      Working...
      X