Announcement

Collapse
No announcement yet.

Saving lines created in efs

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

  • Saving lines created in efs

    I am writing a script that draws lines on a daily chart based on open(-20) . Naturally that number changes with each new bar since it is based on bars ago. How can I save today's line in its position and so not to be changes as a new bars is generated?

    Thanks

  • #2
    Hello Jeff-b,

    You could accomplish this using the drawLineRelative() function by taking advantage of the tag name parameter. To see a recent example of this based on a similar request, please review this thread.
    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


    • #3
      Thanks

      Thank you I feel like a fool that was to easy. Let me follow up with: Is there a way to have drawLineRelative act like a Ray so that it will extend through the future?

      Comment


      • #4
        Jeff-b
        You could use the LineTool.RAY in the addLineTool() function
        Alex

        Comment


        • #5
          Thanks Alex, but isn't that in contrast to JasonK's advice? Where I need to stick the endpoints as in drawline relative. I currently am using addlinetools, but am in fear that because I have use a reference to bars back my line will be redrawn on each new bar. I need them to stay put.

          In essence when I load up esignal each day I need those lines (Ray) to be in place
          Last edited by Jeff-b; 11-10-2005, 04:07 PM.

          Comment


          • #6
            Jeff-b
            I don't see it being in contrast. You would just apply a different logic depending on the method used.
            If you use drawLineRelative() then you would do something like the following

            PHP Code:
            var numLines 20;//this determines the max number of Lines drawn
            if(getBarState() == BARSTATE_NEWBAR){
                if(
            Counter numLines){//Counter needs to be a global variable set to 0
                    
            Counter++;
                }else{
                    
            Counter 0;
                }
            }
            drawLineRelative(-20,open(-20),(20+numLines),open(-20),PS_SOLID,1,Color.red,"line"+Counter); 
            If instead you used addLineTool() then you would do the following

            PHP Code:
            clearLineTool(LineTool.RAY)
            var 
            numLines 20;//this determines the max number of Rays drawn
            for (var i=0i<=numLinesi++){
                
            addLineTool(LineTool.RAY,-(20+i),open(-(20+i)),1,open(-(20+i)),1,Color.blue,"name"+i)

            The result is essentially the same as you can see in the following two images
            Regardless the easiest solution is to use drawLineRelative() as suggested by Jason and set the end point out in the future a sufficient number of bars .
            Alex

            Comment

            Working...
            X