Dynamically Code Change Line Colour

Does anyone have an example of code that can be used to dynamically change a line colour?

ex: change MACD Signal Line Colour (from “white” to “Green”) if the line moves => +/- two of the horizontal Zero line.

Thanks

“Moving Average - w/Trend Color” in Community Indicators has an example of this. I would change the line width:

  • relativeWidth: indicatorInstance.props.lineWidth,
  • width: indicatorInstance.props.lineWidth,
  • lineWidth: predef.paramSpecs.percent(0.4, .1, .1, 1),
  • lineWidth: predef.paramSpecs.number(3, 1, 1),