This is a 5 minute chart study that uses Heikin Ashi price bars. The background changes when the HMA 5 line changes color. The Bell sounds when the Arrow changes color. The Arrow is supposed to change simultaneously with the background color change and the HMA 5 line color change. It does not, it happens before the colors change, as if it is anticipating the change. As you can see by the inclosed snapshot, uptrend arrow is green but the HMA 5 line and Background color is red.
How do I fix this?
I must have a Second HMA5 study run after this Background change HMA5 study so that I can display the colors change Red to Green based on direction of the HMA 5 line. The Background HMA 5 study just gives a single colored line. I have tried replacing it with the same instructions that are on the HullMovingAvg study but I have been unsuccessful. If you could fix this as well it would also be very appreciated.
input price = close;
input length = 5;
input displace = 0;
input showBreakoutSignals = yes;
plot AvgHull = HullMovingAvg(price[-displace], length);
plot UpSignal = price crosses above AvgHull;
plot DownSignal = price crosses below AvgHull;
Alert(UpSignal, “Trend Up”, Alert.BAR, Sound.DING);
Alert(DownSignal, “Trend Down”, Alert.BAR, Sound.CHIMES);
AssignBackgroundColor(if AvgHull < AvgHull then CreateColor (0, 125, 51) else if AvgHull > AvgHull then CreateColor (125, 50, 51) else Color.CURRENT);