Is there a reliable way to force the color of the current bar (the bar currently being printed on an Advanced Chart)? I have the following code:
But I find that the color is erratic, sometimes the color of the preceding bar, sometimes the default color established in preMain (setDefaultPriceBarColor(Color.khaki)).
It appears that there is some problem recognizing the "current bar", and its associated price (close())? Is this correct?
I find that if I dump the values, getCurrentBarIndex() never goes below -1. I thought from the doco the current bar was always 0?
Note that when the bar is complete, when the next bar comes in, the prior current bar, the one I am having trouble with, gets set to the correct color i.e. as per the code above
What am I missing?
Thanks
George
P.S. I have given setComputeOnClose() both possible values and it does not appear to make a difference.
PHP Code:
if (close() > open()) setPriceBarColor(Color.lime);
else
if (close() < open()) setPriceBarColor(Color.red) ;
It appears that there is some problem recognizing the "current bar", and its associated price (close())? Is this correct?
I find that if I dump the values, getCurrentBarIndex() never goes below -1. I thought from the doco the current bar was always 0?
Note that when the bar is complete, when the next bar comes in, the prior current bar, the one I am having trouble with, gets set to the correct color i.e. as per the code above
What am I missing?
Thanks
George
P.S. I have given setComputeOnClose() both possible values and it does not appear to make a difference.
Comment