Announcement

Collapse
No announcement yet.

Bar Background Colour

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

  • Bar Background Colour

    Hi

    Is there a way to use TAG ID with setbarbackgroundcolor please ?

    I would like to use 2 colours on same bar, say 1 from high to close and other from low to open etc etc. Without TAG ID, to my understanding, I only get the colour which I use last or when one condition isn't true then the 2nd colour appears which is not ideal for me.

    Many Thanks

    Rana

  • #2
    Rana
    A tag ID has nothing to do with the setBarBgColor() function. It is only used in functions that draw (text, images and/or shapes).
    That said the setBarBgColor() function has two optional parameters (yMin and yMax) to limit the coloring between two values. For more information see this article in the EFS KnowledgeBase
    Technically this allows you to have multiple background colors on each bar however note that for this to work each background color needs to be assigned to a separate item returned to the chart.
    Search the forums and you will find examples of the use of setBarBgColor() with the yMin and yMax parameters
    Alex


    Originally posted by Rana View Post
    Hi

    Is there a way to use TAG ID with setbarbackgroundcolor please ?

    I would like to use 2 colours on same bar, say 1 from high to close and other from low to open etc etc. Without TAG ID, to my understanding, I only get the colour which I use last or when one condition isn't true then the 2nd colour appears which is not ideal for me.

    Many Thanks

    Rana

    Comment


    • #3
      I would like to plot a colourful weekly interval from minimum to maximum(open to close) and similar bar is part of monthly interval with a different minimum to maximum interval(monthly low to monthly open). When I use the minimum and maximum values it only plots one time frame whichever I use last.
      How can I plot both of them on same bar when weekly open to weekly close are higher than monthly low to monthly open ?

      { setBarBgColor( Color.RGB(0,120,0),0,close(inv("W")), open(inv("W")) ) ; }

      { setBarBgColor( Color.RGB(255,255,0),0,low(inv("M")), open(inv("M")) ) ; }


      As you said " This allows you to have multiple background colors on each bar however note that each background color needs to be assigned to a separate item returned to the chart. "

      I am using them as two separate conditions(if's ), a weekly bar is also part of monthly bar on smaller time frames. so, it should plot one background(weekly) where the bar is and one below it(monthly). Shouldn't it ?


      I think I am missing what you are explaining to me.

      Thank you.

      Comment


      • #4
        Rana
        As I said in order to paint the background of a bar with two or more colors (using the yMin, yMax parameters for each setBarBgColor() function) you need to return to the chart two or more plots NOT conditional statements. Once you are returning two or more plots then you can assign a background color to each plot using the optional index parameter of the setBarBgColor() function
        As I also said try searching the forum (for example for keywords like ymin or ymax etc) as this topic has already been covered.
        Lastly as I also suggested to you in a prior post if you are unfamiliar with programming in EFS it would benefit you if you take some time to learn a bit more about it.
        To this effect I would suggest that you review the JavaScript for EFS videos and the Core JavaScript Reference Guide. Those will provide you with a thorough introduction to programming in JavaScript which is at the foundation of EFS. Then go through the EFS KnowledgeBase and study the Help Guides and Tutorials which will provide you with the specifics of EFS. Also search the forums as they are an invaluable resource in as much as many of the things you are trying to do have been discussed before (and in many cases at length)
        Alex


        Originally posted by Rana View Post
        I would like to plot a colourful weekly interval from minimum to maximum(open to close) and similar bar is part of monthly interval with a different minimum to maximum interval(monthly low to monthly open). When I use the minimum and maximum values it only plots one time frame whichever I use last.
        How can I plot both of them on same bar when weekly open to weekly close are higher than monthly low to monthly open ?

        { setBarBgColor( Color.RGB(0,120,0),0,close(inv("W")), open(inv("W")) ) ; }

        { setBarBgColor( Color.RGB(255,255,0),0,low(inv("M")), open(inv("M")) ) ; }


        As you said " This allows you to have multiple background colors on each bar however note that each background color needs to be assigned to a separate item returned to the chart. "

        I am using them as two separate conditions(if's ), a weekly bar is also part of monthly bar on smaller time frames. so, it should plot one background(weekly) where the bar is and one below it(monthly). Shouldn't it ?


        I think I am missing what you are explaining to me.

        Thank you.

        Comment


        • #5
          Hi Alex

          It took me a while to understand but I got it now what you explained.

          Thank you.

          Comment


          • #6
            Rana
            You are welcome
            Alex


            Originally posted by Rana View Post
            Hi Alex

            It took me a while to understand but I got it now what you explained.

            Thank you.

            Comment

            Working...
            X