Good morning all, I'm trying to create a label that shows the volume of the last red candle and the previous red candle but running into an issue. Here's what I've got so far:
Now if the current candle and the previous candle are red, this works.
It also works if the current candle is red and there are some green candles between it and the previous red candle.
Where I'm running into issues if if the current candle is green, the most recent red candle is reported correctly, but it uses that same volume for that red candle as the previous red candle. Any advice?
Code:
def vol = volume;
def RCVol;
if close <= open {
RCVol = vol;
} else {
RCVol = RCVol[1];}
AddLabel(1, "RCVol = " + RCVol + " RCVol2 = " + RCVol[2]);
Now if the current candle and the previous candle are red, this works.
It also works if the current candle is red and there are some green candles between it and the previous red candle.
Where I'm running into issues if if the current candle is green, the most recent red candle is reported correctly, but it uses that same volume for that red candle as the previous red candle. Any advice?
Last edited by a moderator: