Announcement

Collapse
No announcement yet.

Color Bars on C of G

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

  • Color Bars on C of G

    Hello,
    I'm trying to color only the bars that show up between the sqh & the sql of the attached C of G study. However, all the bars end up painted, even those of the previous days. I've obviously missed a step. Can someone help, please?
    Thank you-
    Diane
    Attached Files

  • #2
    Re: Color Bars on C of G

    Diane
    I do not see it being possible to color the price bars inside sqh and sql because at this time an efs cannot retroactively paint historical price bars which is what would be required in this case.
    What you could do is draw a shape or text or paint the background of those bars that are inside sqh and sql. To do this you need to use a for loop such as the one enclosed below that you insert just above the return statement in line 400
    For the description and syntax of the ref() and setBar() functions used in the routine see the Function Reference in the EFS KnowledgeBase
    Note that the drawn objects or background color will be applied only to those bars inside the channel and not on previous historical bars because the efs is reloaded at every bar thereby recalculating a new channel every time
    Alex

    PHP Code:
    var myRef ref(-1,-fBarsBack);
        for(var 
    j=1;j<fBarsBack;j++){
            if(
    high(-j)<myRef[j-1][1]&&low(-j)>myRef[j-1][3]){
                 
    drawShapeRelative(-j,AboveBar1,Shape.CIRCLE,null,Color.red,Shape.PRESET,"Shape"+rawtime(-j));
                 
    setBar(Bar.BgColor,-j,Color.yellow)
            }
        } 

    Originally posted by Diane P
    Hello,
    I'm trying to color only the bars that show up between the sqh & the sql of the attached C of G study. However, all the bars end up painted, even those of the previous days. I've obviously missed a step. Can someone help, please?
    Thank you-
    Diane

    Comment


    • #3
      Alex,
      Thanks for your reply. Your answer is a great solution to my problem! As always, thanks so much for your help.

      Diane

      Comment


      • #4
        Diane
        You are most welcome
        Alex


        Originally posted by Diane P
        Alex,
        Thanks for your reply. Your answer is a great solution to my problem! As always, thanks so much for your help.

        Diane

        Comment

        Working...
        X