I have an EFS question relating to painting of chart bars.
I have an EFS which invokes a callFunction which paints the bars one color if the trend is up (trend as I define it) and another color if down. Otherwise, there is a default bar color (setDefaultPriceBarColor) in preMain. This is done for all bars except the current (last) bar...tested with isLastBarOnChart().
The current(last) bar is treated differently (green if open > close, red otherwise, using candlestick theory logic)). I think you can see the problem here. When it is time to paint a new bar, the prior bar remains as is i.e. green or red, and I lose my uptrend/downtrend coloring, so I am forced to manually reload the EFS, for a number of charts.
I would like to resolve this with EFS. I don't think reloadEFS() is the answer, and I am not sure of how -or if - to use repaintChart().
Thanks
George
function PriceBarColorsTrend(UpTrend,DownTrend) {
if(!isLastBarOnChart()) {
if (UpTrend==t) {setPriceBarColor(Color.RGB(0x00, 0x00, 0xFF));}//blue
else
if (DownTrend==t) {setPriceBarColor(Color.RGB(0xFF, 0x00, 0x00));}//red
}
else {callFunction("FunctionLib.efs", "PriceBarColors", open(), close() );}
return null
} //END FUNCTION PriceBarColorsTrend*****
I have an EFS which invokes a callFunction which paints the bars one color if the trend is up (trend as I define it) and another color if down. Otherwise, there is a default bar color (setDefaultPriceBarColor) in preMain. This is done for all bars except the current (last) bar...tested with isLastBarOnChart().
The current(last) bar is treated differently (green if open > close, red otherwise, using candlestick theory logic)). I think you can see the problem here. When it is time to paint a new bar, the prior bar remains as is i.e. green or red, and I lose my uptrend/downtrend coloring, so I am forced to manually reload the EFS, for a number of charts.
I would like to resolve this with EFS. I don't think reloadEFS() is the answer, and I am not sure of how -or if - to use repaintChart().
Thanks
George
function PriceBarColorsTrend(UpTrend,DownTrend) {
if(!isLastBarOnChart()) {
if (UpTrend==t) {setPriceBarColor(Color.RGB(0x00, 0x00, 0xFF));}//blue
else
if (DownTrend==t) {setPriceBarColor(Color.RGB(0xFF, 0x00, 0x00));}//red
}
else {callFunction("FunctionLib.efs", "PriceBarColors", open(), close() );}
return null
} //END FUNCTION PriceBarColorsTrend*****
Comment