Announcement

Collapse
No announcement yet.

Bar Color Change

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

  • Bar Color Change

    Is it possible to have yesterday's bars a different color from today's?

    As an example, I would like yesterday to print black...

  • #2
    lassiter
    I do not believe that is possible.
    The setBar() function which allows to modify the value and properties of a previously returned 'bar', applies only to studies and/or indicators as far as I know.
    Never the less you may want to have eSignal confirm this.
    Alex

    Comment


    • #3
      hmmm...thanx...

      Is there a way to change the backjground color for yesterday (or today)?

      Comment


      • #4
        Re: Reply to post 'Bar Color Change'

        lassiter
        I would think yes as the background color is one of the properties of
        studies/indicators.
        Alex

        Comment


        • #5
          See setBar() function in the EFS Help Center & Library under Function Reference/Data Access Functions.
          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


          • #6
            Ok, so I am a dummy...the explaination is Greek to me...i.e. I need help.

            All I want to do is either change yesterday's bar color, or yesterday's background color - and I simply do not know how to do it...

            Comment


            • #7
              Hello Lassiter,

              Here's an example for you that might work better than using setBar(). I left an example of how to use the setBar() function. The problem with setBar() for your request requires us to create a more complicated routine for setting the color of all the previous day's bars after the chart has loaded. With the code example below, the previous day's background color will be set to grey as the chart loads until we reach today's bars.



              PHP Code:
              function preMain() {
                  
              setPriceStudy(true);
                  
              setShowCursorLabel(false);
              }

              var 
              CurDay null;

              function 
              main() {
                  
              //if (getBarState() == BARSTATE_NEWBAR && getCurrentBarIndex() == 0) {
                  //    setBar(Bar.BgColor, -1, Color.grey);
                  //}
                  
                  
              if (CurDay == null) {
                      var 
              vDate = new Date();
                      
              CurDay vDate.getDate();
                  }

                  if (
              getBarState() == BARSTATE_NEWBAR && getDay() != CurDay) {
                      
              setBarBgColor(Color.grey);
                  }
                  
                  return;

              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


              • #8
                Fantastic - just what I wanted...THANX, big time!

                Comment

                Working...
                X