Announcement

Collapse
No announcement yet.

getBarBgColor() and getBarFgColor()

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

  • getBarBgColor() and getBarFgColor()

    There are times when the following functions would be very helpful. Like trying to create a below the chart study using price bars created with a histogram. Seems that this processes faster than drawLineRelative().

    getBarBgColor( [nBarIndx] [, nCount] )

    getBarFgColor( [nBarIndx] [, nCount] )

    nBarIndx: Optional. Same as value returned from getCurrentBarIndex(). Default to current bar.

    nCount: Optional. If your study returns multiple values, the position in array being returned.

  • #2
    On the same subject it would also be helpful to have getPriceBarColor() with the same parameters as suggested by Gavishti. This would allow for conditionals based on bar color.
    Alex

    Comment


    • #3
      Yes, I agree. I just ran into this problem this morning.

      I took the EFS2 custom MA script and wanted to add a simple "label" to the right column, so I can identify what my MA's are. For example, I use the 200MA and the 34ema from different time frames and overlay them on my charts. I use different colors to separate them from each other, but would like (color-coded) labels on each, so I can remember which is which. This is espeically important when they are close to overlapping or crossing. Currently , there seems to be no way to figure out what the color of the MA has been set to by the user (using Edit Studies) so I can have my label print the same color.

      A getBarFGcolor function would be very handy for me, too.

      Please do consider adding it in the future.

      JOHN

      Comment


      • #4
        John
        If I understood correctly what you are trying to do you can easily resolve that by adding a Function Parameter that sets the color of the plot rather than using the native color selector. The Function Parameter would also be used to define the color of the label.
        Alex

        PHP Code:
        var fpXX = new FunctionParameter("LineColor"FunctionParameter.COLOR);
            
        fpXX.setDefault(Color.blue); 

        Comment

        Working...
        X