Hello- So after much trial and error I have come up with a study that finds unfilled gaps on the daily timeframe. It works exactly how I want it to. However the next step I was trying to do but can't is create a cloud that extends to the right until the gap gets filled. If you see in the picture, the 2 violet lines are defining the gap ups and the green lines are the gap downs. What I would like it to do is create a cloud that extends to the right which is represented by the yellow lines and grey box (which I drew by hand). I want the cloud to continue to the right every day until the gap is completely filled at which point it would end as shown in the picture. I would like this for all gaps but I just drew the one as an example. Is this possible? I saw in one gap study here that there was a similar effect as shown in the second picture, but this does not work on the daily timeframe and the cloud does not extend continuously until filled. But the visual effect of the example is what I am looking for. I included the picture for reference. Any help would be greatly appreciated. Thanks in advance.
My study:
Visual example of what I am trying to do:
My code:
My study:
Visual example of what I am trying to do:
My code:
Code:
#Daily Gap Plot
input aggregationPeriod = AggregationPeriod.DAY;
def prevClose = close(period = aggregationPeriod)[1];
def curHigh = high(period = aggregationPeriod);
def curLow = low(period = aggregationPeriod);
def gapDown = if prevClose > curHigh then 1 else 0;
def gapUp = if prevClose < curLow then 1 else 0;
plot gU = if gapUp then curLow else if gapDown then prevClose else double.nan;
plot gD = if gapUp then prevClose else if gapDown then curHigh else double.nan;
gU.SetPaintingStrategy(PaintingStrategy.DASHES);
gU.AssignValueColor(if gapDown then Color.light_green else Color.violet);
gD.SetPaintingStrategy(PaintingStrategy.DASHES);
gD.AssignValueColor(if gapDown then Color.light_green else Color.violet);
gU.HideBubble();
gD.HideBubble();