Announcement

Collapse
No announcement yet.

How to draw horizontal lines marking price

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

  • How to draw horizontal lines marking price

    I'm trying to write an EFS that will draw horizontal lines marking prices at regular intervals. For instance, if I were trading ES and I wanted to mark point intervals, i'd get lines at 850, 851, 852, etc.

    Before I started on it I thought i'd ask if anyone knew if an EFS that did this already existed. I'm not sure how long it will take me to stumble through EFS code till I get something that works!

    Of course I won't decline any code that someone can whip up on the spot. =)

    Thanks for any help.

  • #2
    Hi Freeman,
    I created this .efs study in the Formula Wizard to use with the Dow - simply change the price levels / lines colors etc for your requirements (important - change the price levels in both the DATA PLOTS SECTION AND RETURNED DATA POINTS SECTION.)

    Paul
    Attached Files

    Comment


    • #3
      Freeman
      You may find something that fits your needs in this thread and specifically the sr lines.efs and sr lines-2.efs.
      These scripts will plot lines based on a number of pre-calculated values or based on a typed-in value.
      Even if not quite what you want it should still give you an idea as to how to create an efs that can plot these lines automatically.
      Alex

      Comment


      • #4
        Thank you both for your help. It can't be said enough: users of this BBS add a lot of value.

        I used the examples to create an efs that will draw lines between defined price points. It's sloppy but it's robust enough for my needs.



        function preMain()
        {
        setPriceStudy(true);
        }

        // globals
        var nID = 0;
        var timedist = -404; // length of line
        var startprice = 870; // price to start drawing at
        var endprice = 885; // price to stop drawing at
        var x;

        function preMain()

        {
        setPriceStudy(true);
        }

        function main()
        {

        // make sure bars are done drawing before drawing lines
        if ( getCurrentBarIndex() < -1 )
        {
        return;
        }


        for (x=startprice; x<=endprice; x++)
        {
        drawLineAbsolute(timedist, x, 10, x, PS_DASH, 1, Color.blue, ID());
        }

        return;
        }


        // function assigns unique identifier to line drawing
        function ID()
        {
        nID ++;
        return( nID );
        }

        Comment

        Working...
        X