Announcement

Collapse
No announcement yet.

Countdown Clock

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

  • Countdown Clock

    We are looking for a count down clock to display on advanced charts. It would indicate the time remaining in the current candle or bar until it is closed. This would enable more precise analysis of chart indicators.

  • #2
    This will show the % of the bar yet to be completed in the cursor window.

    Needs some sprucing up, but seems to work for all intervals that are non tick or non volume, ie 15 min. 500tand 500v etc will not work.

    function preMain(){
    setPriceStudy(true);
    }

    function main(){
    today =new Date;
    CurHr =today.getHours();
    CurMin =today.getMinutes();
    CurSec =today.getSeconds();
    curTime=CurHr*3600+CurMin*60+CurSec;
    start=9*3600+30*60;
    pctRemain=((curTime-start))%(getInterval()*60);
    pctRemain=(100*(1-pctRemain/(getInterval()*60))).toFixed(0);
    return pctRemain;
    }

    Comment


    • #3
      Thanks, I will give it a try. Still looking for actual time remaining.

      Comment


      • #4
        this should show the seconds remaining in the current bar

        function preMain(){
        setPriceStudy(true);
        }

        function main(){
        today =new Date;
        CurHr =today.getHours();
        CurMin =today.getMinutes();
        CurSec =today.getSeconds();
        curTime=CurHr*3600+CurMin*60+CurSec;
        start=9*3600+30*60;
        pctRemain=((curTime-start))%(getInterval()*60)*1;
        //pctRemain=(pctRemain*(getInterval()*60)).toFixed(0 );
        return pctRemain;
        }

        Comment


        • #5
          Count Down Clock

          Thanks. I tried the last version. It appears to be counting elapsed seconds rather than remaining time. Would it be hard to adjust?

          Thanks

          Comment


          • #6
            This will count the number of seconds remaining in the current bar and report the results in the Formula Output window.

            I forget how to report the answer in the cursor window, perhaps some one else will remind us.

            function preMain(){
            setPriceStudy(true);
            }

            function main(){
            today =new Date;
            CurHr =today.getHours();
            CurMin =today.getMinutes();
            CurSec =today.getSeconds();
            curTime=CurHr*3600+CurMin*60+CurSec;
            Start=9*3600+30*60;
            pctRemain=(getInterval()*60)-((curTime-Start))%(getInterval()*60)*1;
            debugPrintln(pctRemain);
            return pctRemain;
            }

            Comment


            • #7
              Countdown Test

              Works fine. Thank you very much.

              Comment

              Working...
              X