Announcement

Collapse
No announcement yet.

Draw a vertical line in the future

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Draw a vertical line in the future

    I've been digging around the forums with some searches but this is about as close as I can get to what I'm thiking about. It's almost what I want, but with 1 caveat.

    I would like to be able to draw a vertical line on the chart at a specified time, before that time is reached. As an example, a big fat red line at 2:15, since I never can tell what is going to happen when a Fed announcement is made.

    This efs is simple and perfect for drawing vertical lines in the past, can I "anchor" a vertical line in the future ? ( and yes I know it can be done manually, I am using this as just an example for another purpose )

    Best Regards,
    Glenn

    function preMain() {

    setPriceStudy(true);
    setStudyTitle("Time Bars");
    }

    function main() {

    if ( hour(0) == 10 && minute(0) == 0 )
    drawLineRelative(0, high(0)+1000, 0, 0, PS_DASHDOT, 1, Color.blue, "line"+getCurrentBarCount());

    if ( hour(0) == 12 && minute(0) == 0 )
    drawLineRelative(0, high(0)+1000, 0, 0, PS_DASHDOT, 1, Color.blue, "line"+getCurrentBarCount());

    if ( hour(0) == 14 && minute(0) == 0 )
    drawLineRelative(0, high(0)+1000, 0, 0, PS_DASHDOT, 1, Color.blue, "line"+getCurrentBarCount());

    return null;
    }

  • #2
    this isn't the answer your looking for, but I use a product that pops up important market events at 30, 5 , 1 minutes before fed announcements and many other things. Take a look. No cost, no ads and its all done for you.

    http://www.it-lyse.com/site/indexV2.jsp?menu=products
    Todd P Horton

    Comment


    • #3
      Re: Draw a vertical line in the future

      fastflyer
      You may want to see the example posted in this thread in response to a similar request
      Alex


      Originally posted by fastflyer
      I've been digging around the forums with some searches but this is about as close as I can get to what I'm thiking about. It's almost what I want, but with 1 caveat.

      I would like to be able to draw a vertical line on the chart at a specified time, before that time is reached. As an example, a big fat red line at 2:15, since I never can tell what is going to happen when a Fed announcement is made.

      This efs is simple and perfect for drawing vertical lines in the past, can I "anchor" a vertical line in the future ? ( and yes I know it can be done manually, I am using this as just an example for another purpose )

      Best Regards,
      Glenn

      function preMain() {

      setPriceStudy(true);
      setStudyTitle("Time Bars");
      }

      function main() {

      if ( hour(0) == 10 && minute(0) == 0 )
      drawLineRelative(0, high(0)+1000, 0, 0, PS_DASHDOT, 1, Color.blue, "line"+getCurrentBarCount());

      if ( hour(0) == 12 && minute(0) == 0 )
      drawLineRelative(0, high(0)+1000, 0, 0, PS_DASHDOT, 1, Color.blue, "line"+getCurrentBarCount());

      if ( hour(0) == 14 && minute(0) == 0 )
      drawLineRelative(0, high(0)+1000, 0, 0, PS_DASHDOT, 1, Color.blue, "line"+getCurrentBarCount());

      return null;
      }

      Comment


      • #4
        Thanks Again

        Thanks for the web site referral, Todd. And you are correct ...

        I went to the thread you suggested Alexis ( impressive how you recall them so accurately ). Steve "Meyer55" mentioned there, "Drawing a line at a future date will present numerous problems, which is probably why no one has responded. " He went through an explanation as well.

        The two code examples were done nicely, as usual and that's always impressive. But they only drew the features when the time had occured, not before. I was wondering if there was an efs feature similar to addband that instead worked on the vertical.

        So I'm guessing I should do as a tough guy once astutely noted, " fugggettaboutit " ?

        Best Regards All,

        Glenn

        Comment


        • #5
          Hi,

          Something to try:

          Instead of doing it via a specific time, create a routine that, first identifies and processes only on the current day and not on past days for intraday intervals such as 3 min, etc., then saves the interval to a variable and the time to a second variable.

          Now create a routine that calculates the number of bars that will fit between the current time and your time in the future.

          Finally use this number in the -drawLineRelative(x1, y1, x2, y2, Style, Thickness, Color, TagName)- for the x1 and x2 values.

          drawLineRelative will plot into the future but only based on the bar index (positive numbers extent into the future, negative ones into the past) and not based on time.

          An example that plots lines into the future is attached but it doesn't use any time calculations, just x bars into the future selected by the "nOffset" menu option. The drawLineRelative is found on line 214 of the efs.

          This will only work on charts that plot bars based on a time interval such as 3 min, 60 min, Day, etc., so it will not work on volume, range, tick, etc charts.

          You can find how to get the current system time at: http://forum.esignalcentral.com/show...hlight=rawtime

          and the link to DateObject: http://kb.esignalcentral.com/display...42149341106415

          Wayne
          Attached Files
          Last edited by waynecd; 05-15-2010, 06:03 PM.

          Comment


          • #6
            Hi,

            I haven't tested this efs in real time but it should work fine if you start the script each day (doesn't run overnight).

            Otherwise I think you will need to code for the time transition at hour 24:00 to hour 00:01 so that the formula -vETotalMin-barTotalMin- calculates correctly.

            Anyone who can improve on this is welcome to do so.

            Wayne
            Attached Files
            Last edited by waynecd; 05-16-2010, 12:49 AM.

            Comment


            • #7
              I made some corrections to the time logic, etc.

              The previous version was done when the market was closed so I couldn't test properly.

              Note that it won't draw the line if the Hour and Minute values selected in the menu are earlier than the current system time.

              I set it to only work on minute charts since I'm just testing out my idea below. It can be modified to also work on second charts by using rawtime conversions.

              Some examples for rawtime can be found at:
              http://forum.esignal.com/showthread....onvert+rawtime
              and
              http://forum.esignal.com/showthread....onvert+rawtime

              Wayne
              Attached Files
              Last edited by waynecd; 05-16-2010, 07:39 PM.

              Comment


              • #8
                Thanks Wayne,

                I was very successful at my goal of not turning on the 'puter
                this weekend. For me, weekends are for activities that have no reset buttons. Been looking at your code, tried it, trying to work with it a little. There are really some folks here that know their Java inside out, you're one of those guys. In a few days I might be able to come up with a question worthy of your consideration ... until then -

                Best Regards,
                Glenn

                Comment


                • #9
                  Moderator, please delete the link posted by toddao.

                  Avast Antivirus is reporting that there is a virus on that web page.

                  Thanks.

                  Comment


                  • #10
                    Panda anti virus says no problems,

                    there is a large group on esignal using this product for some time
                    Todd P Horton

                    Comment


                    • #11
                      Avast Antivirus is reporting that the Malware type on that web link is HTML:Script-inf.

                      toddao, I don't care how legit you think that website is. That web page has either been hacked or the company behind that web page is doing something they shouldn't be doing.

                      Comment

                      Working...
                      X