Announcement

Collapse
No announcement yet.

Multiple "setBarBgColor" on the same bar index but at different y coordinates

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

  • Multiple "setBarBgColor" on the same bar index but at different y coordinates

    Hi,

    Multiple "setBarBgColor" on the same bar index but at different y coordinates do not plot when coded within the same efs study.

    Say, setBarBgColor that colors bkgd green 1 point above the high and 1 point below the low. Then a second setBarBgColor that plots above the high plus 1 point that colors bkgd yellow above the green bkgrd colored first so both show, the green below the yellow bkgd.

    The problem is that only one plots as shown in the attached image.

    This is the code I've tried (I've also changed the order of setBarBgColor() but the results don't change):

    PHP Code:
    //Should color bkgd from 1 point below low to 1 point above high.
        
    if (nRes == 1
            
    setBarBgColor(Color.RGB(160255160),0,low(0)-BgOffset,high(0)+BgOffset);    
        else 
            if (
    nRes == 0)
                
    setBarBgColor(Color.RGB(255,160,160),0,low(0)-BgOffset,high(0)+BgOffset);    

    //Below should color starting at the high plus 1 point (so starts above the above codes bkgd color)
        
    if(vMA_Avg1Diff && vStrengthPlot0 vMA_Avg0){
    //        setBarBgColor(RGB(219,253,193),0,low(0)-(ColorOffset*1),high(0)+(ColorOffset*1));
            
    setBarBgColor(RGB(219,253,193),0,high(0)+BgOffset,high(0)+BgOffset+5);
        }else if(
    vMA_Avg1Diff && vStrengthPlot0 vMA_Avg0){
    //        setBarBgColor(Color.RGB(255,230,195),0,low(0)-(ColorOffset*1),high(0)+(ColorOffset*1));
            
    setBarBgColor(Color.RGB(255,230,195),0,high(0)+BgOffset,high(0)+BgOffset+5);
        } 
    Is there a way to have different background colors on the same bar index where on plots above or below the other?

    I can do this with different efs studies on the same chart but can it be done with code within only one efs study?

    Thanks in advance.

    wayne
    Attached Files
    Last edited by waynecd; 03-11-2009, 09:58 PM.

  • #2
    Try changing the "series" value for each set of draws..

    All of the series values are 0 for each call to setbarBgColor(). Try setting the first draw set to 0, then second to 1, the third to 2.

    See if it helps (I'm guessing it might).
    Brad Matheny
    eSignal Solution Provider since 2000

    Comment


    • #3
      just a little more...

      Hi waynecd,
      Very important to me, your question and the solution from Doji3333.
      But would you, please, write the modification of your code which works great, because I don't understand very well this solution.
      It would be nice to me, to obtain a relative rectangle (with a specific color!) draw on the chart.
      thanks in advance,
      Mermoz

      Comment


      • #4
        Hi Mermoz_2et,

        Just chage the series value from all set to 0 to a sequential one(i.e., 1,2,3,4). In the eSignal EFS Developer's Reference under setBarBgcolor() the syntax is: setBarBgColor( color [, series] [, yMin] [, yMax] )


        PHP Code:
        //Should color bkgd from 1 point below low to 1 point above high.
            
        if (nRes == 1
                
        setBarBgColor(Color.RGB(160255160),1,low(0)-BgOffset,high(0)+BgOffset);    
            else 
                if (
        nRes == 0)
                    
        setBarBgColor(Color.RGB(255,160,160),2,low(0)-BgOffset,high(0)+BgOffset);    

        //Below should color starting at the high plus 1 point (so starts above the above codes bkgd color)
            
        if(vMA_Avg1Diff && vStrengthPlot0 vMA_Avg0){
                 
        setBarBgColor(RGB(219,253,193),3,high(0)+BgOffset,high(0)+BgOffset+5);
            }else if(
        vMA_Avg1Diff && vStrengthPlot0 vMA_Avg0){
                
        setBarBgColor(ColorRGB(255,230,195),4,high(0)+BgOffset,high(0)+BgOffset+5);
            } 
        wayne
        Last edited by waynecd; 03-13-2009, 07:11 AM.

        Comment

        Working...
        X