Announcement

Collapse
No announcement yet.

setColorPriceBars not working properly Please Help

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

  • setColorPriceBars not working properly Please Help

    I have created an efs to change the bar color when certain indicator criteria are met. The conditions allow for white, liime, red, light lime and light red, but some bars are being colored black. Why? How do I fix this? See the attached chart and code.

    Thanks in advance.
    Attached Files

  • #2
    ...but some bars are being colored black. Why?
    This is caused by the code:
    PHP Code:
        if (saved==close()) { 
            return ; 
    // until price has changed
        

    Bars are colored black for bars where the above condition is true since the code to color the bars is after that return statement and nothing after a return statement is executed.

    Try:
    PHP Code:
        if (saved==close()) { 
            
    setPriceBarColor(Color.white);
            return ; 
    // until price has changed
        

    Just a couple of notes in case they are of use to you:

    1- "macd" is a function in eSignal, I would rename that variable to avoid conflicts, though in this case it doesn't appear to cause problems since it's not followed by ().
    2- Since you are just coloring price bars and there is no return value, the use of setDefaultBarFgColor() and setDefaultBarThickness() in preMain() have no effect.

    Wayne
    Last edited by waynecd; 12-24-2012, 05:26 AM.

    Comment

    Working...
    X