Announcement

Collapse
No announcement yet.

Modify today's high formula

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

  • Modify today's high formula

    Can someone tell me how to show the high and low for the first hour only?

    Thanks!
    Mike

  • #2
    For what timeframe chart? Intraday, daily?

    G
    Garth

    Comment


    • #3
      I would watch the time and if time>1030, then save the high and low for the day. Set a flag at 1030 to prevent the values from getting over written

      Comment


      • #4
        var flag=0;
        function preMain()
        {
        setPriceStudy(true);
        setStudyTitle("hi-lo");
        setPlotType(PLOTTYPE_DOT,0);
        setDefaultBarThickness(2,0);
        setPlotType(PLOTTYPE_DOT,1);
        setDefaultBarThickness(3,1);
        }

        function main()
        {
        var myhour = getValue("Hour")*100;
        var mymin = getValue("Minute")*1;
        var hrmin=myhour+mymin;

        if(hrmin>=1030&&falg==0)
        {

        var L =low();
        var H =high();

        flag=1;
        }

        return new Array(L,H);

        //probably needs some work, but it is close

        Comment


        • #5
          Thanks Dave, I will give yours a try. I am looking at intraday, hence the first hour high and low.

          thanks

          Comment


          • #6
            Dave's method should work for intraday...
            Garth

            Comment


            • #7
              Can not get it to work. Will it show after that time? In other words since it is Sunday late in the day, will it still show the lines from friday? In any case, I cut and pasted the formula. There was one minor error with flag being falg. But even when changed it nothing shows. I also changed them to flat lines to show up easier.

              Any thoughts?

              Comment


              • #8
                If you want to see the lines from Friday, I think you need to figure out how many bars ago the data resides and then H=getValue("High",-xx) etc.

                Figure out the current time, figure out the length of the current bars, figure out what time the current day started at, figure out what time the prior day ended.

                If this sounds like a pain in the arse, you are right.

                Just had another idea, run a loop backwards and check the time of each bar. When you get to 1030 start saving the high and low til you get to 930. Probably a cpu hog, though

                Comment


                • #9
                  So Dave, are you saying that tomorrow, I shoud see it show up throughout the day?

                  Comment


                  • #10
                    The first hour high and low

                    Was anyone ever able to solve this?

                    This is something I would definitely use. I watch today's first hour high and low (and yesterday's last hour high and low) and would love to be able to draw extended horizontal lines on intraday charts to show these values.
                    Tom

                    Comment

                    Working...
                    X