I have a fairly simple problem: I am working with a plot that sometimes has multiple consecutive bars where the value of the plot is 0. For this reason, using "if plot==1 then plot[1] else plot" doesn't solve the problem.
Can anyone advise how to write code that says (translated from plain English): "plot MyPlot = if MyPlot == 0 then use the most recent value that is not 0"*
*(even if any number of previous bars may consecutively have a value of 0, before you finally find a bar for which MyPlot doesn't have a value of 0)
Seems like it shouldn't be that hard but I can't figure it out. Thanks so much to anyone that can advise a solution.
Can anyone advise how to write code that says (translated from plain English): "plot MyPlot = if MyPlot == 0 then use the most recent value that is not 0"*
*(even if any number of previous bars may consecutively have a value of 0, before you finally find a bar for which MyPlot doesn't have a value of 0)
Seems like it shouldn't be that hard but I can't figure it out. Thanks so much to anyone that can advise a solution.