E

#### Enable

##### New member

Code:

```
input AvgType = AverageType.EXPONENTIAL;
input Length = 8;
def avg;
def newDay = GetYYYYMMDD() <> GetYYYYMMDD()[1];
def todaysOpen = open(period = AggregationPeriod.DAY);
def yesterdaysClose = close(period = AggregationPeriod.DAY)[1];
def gapCount = gapCount[1] + newDay;
def gap = if newDay and gapCount > 1 then todaysOpen - yesterdaysClose else gap[1];
def accum = if newDay then accum[1] + gap else accum[1];
def relC = close - accum;
avg = MovingAverage(AvgType, relC, Length);
plot avg_gl = avg + accum;
```