[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SetPlotColor() of previous indicator segment?



PureBytes Links

Trading Reference Links

How can one SetPlotColor() of the previous segment of an indicator, please?

I have added this simple code to the ADX indicator, trying to set a different color when the ADX is increasing:

if plot1 > plot1[1] and plot1 > 15 then
setplotcolor(1, green);

However, the color change is "after the fact" (applied to the starting point of any current indicator segment based on the previous), so that the indicator segment of increase isn't colored green, but the next segment is. It's often observed that the first increasing segment is (default) red and a first decreasing segment of the ADX indicator is green.

Subscripting "[1]" doesn't work with the setplotcolor() reserved word.