Announcement

Collapse
No announcement yet.

Draw lines not appearing on chart

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

  • Draw lines not appearing on chart

    Hi,

    Quick question to see if anyone has dealt with this issue.

    Using drawLineXXX() I draw lines on the chart to indicate signals and potential trend changes. Works great, but the issue is that sometimes due to the way the chart is scaled a line will be drawn "off screen", and I will not see it unless I turn off scaling and scroll the chart (which of course I wouldn't normally do...so in effect I never see the signal).

    So, is there a method people have used to keep lines in the viewable chart?

    This is similar to the AGET bug where lines that AGET draws are not visible on the chart...so even advanced studies have this problem...but it seems this should be able to be worked around.

    Thanks for any ideas.

    G
    Garth

  • #2
    Garth
    I don't know of a way to show them since they don't return a value to the chart.
    The solution I implemented is to have an efs that does either of two things
    a) find the highest lowest value in the chart and return these values
    b) allow me to manually insert the highest/lowest value I want on the chart
    Alex

    Comment


    • #3
      Hi Garth,

      Here's another idea for you to try. Add another item to your return array and set it to return null except on the bar where one of your anchor points for the line is drawn. Use that item to return the same data point and set that item to be PLOTTYPE_DOT with the same color as your line. This will force the chart to include the anchor points of the line so they will be visible when you scroll back and forth etc. Try this example below on IBM.

      PHP Code:
      function preMain() {
          
      setPriceStudy(true);
          
      setStudyTitle("test");
          
      setCursorLabelName("Line anchor");
          
      setPlotType(PLOTTYPE_DOT);
          
      setDefaultBarFgColor(Color.red);
      }

      function 
      main() {
          var 
      nNum null;
          if (
      getCurrentBarIndex() == -10) {
              
      drawLineRelative(0close(0)-1010close(0)-10PS_SOLID2Color.red"line");
              
      nNum close(0)-10;
          }
          return 
      nNum;

      Before the line:


      Scroll forward to include the line:
      Jason K.
      Project Manager
      eSignal - an Interactive Data company

      EFS KnowledgeBase
      JavaScript for EFS Video Series
      EFS Beginner Tutorial Series
      EFS Glossary
      Custom EFS Development Policy

      New User Orientation

      Comment


      • #4
        Jason,

        That's a great trick! Thanks!

        Garth
        Garth

        Comment

        Working...
        X