#### Topic: Gap Indicator

Gap indicator measures the gap between current open price and previous bar close price.

If the gap is greater than a Minimum Gap, the indicator rises a signal.

There are two logical rules.

- "Positive Gap" - rises buy signal if the gap is positive and sell signal if the gap is negative.

- "Negative Gap" - rises sell signal if the gap is positive and buy signal if the gap is negative.

Formula:

```
// Positive Gap logic
if (Open[bar] > Close[bar - 1] + minGap)
longSignals[bar] = 1;
if (Open[bar] < Close[bar - 1] - minGap)
shortSignals[bar] = 1;
// Negative Gap logic
if (Open[bar] < Close[bar - 1] - minGap)
longSignals[bar] = 1;
if (Open[bar] > Close[bar - 1] + minGap)
shortSignals[bar] = 1;
```

Screenshot:

Possible use:

Indicator is attached below: