I am having difficulty with the color of the line as it is being painted during the current bar. I want the line to be red if it ends below a certain level and green if it ends above that level.
I have defined the line type as:
setPlotType(PLOTTYPE_INSTANTCOLORLINE,4)
In the
if (getBarState() == BARSTATE_NEWBAR){
section of the code, I define the line color by:
if(Stoch1<=R201 && Stoch>R20 || Stoch1<=R801 && Stoch>R80){setDefaultBarFgColor(Color.green,4)}
if(Stoch1>=R201 && Stoch<R20 || Stoch1>=R801 && Stoch<R80){setDefaultBarFgColor(Color.red,4)}
On the current bar, the color is sometimes misassigned, I suppose due to the end point moving back and forth across the trigger level. Reloading the indicator fixes the problem.
How can I get the color to be assigned correctly?
I have defined the line type as:
setPlotType(PLOTTYPE_INSTANTCOLORLINE,4)
In the
if (getBarState() == BARSTATE_NEWBAR){
section of the code, I define the line color by:
if(Stoch1<=R201 && Stoch>R20 || Stoch1<=R801 && Stoch>R80){setDefaultBarFgColor(Color.green,4)}
if(Stoch1>=R201 && Stoch<R20 || Stoch1>=R801 && Stoch<R80){setDefaultBarFgColor(Color.red,4)}
On the current bar, the color is sometimes misassigned, I suppose due to the end point moving back and forth across the trigger level. Reloading the indicator fixes the problem.
How can I get the color to be assigned correctly?
Comment