# GapSMA - Gap Simple Moving Average

#### Description <a href="#description_67" id="description_67"></a>

The SimpleSMA has the Issue, that in case of an big opening Gap, the SMA takes very long to adjust to the candles. The GapSMA ignores the Gaps and ends calculating on the Market Close and starts calculating on the Market Open again.

If there is a Gap between the Market Close and the Market Open it will not be taken into account.

#### Usage <a href="#usage_68" id="usage_68"></a>

```csharp
GapSMA(int period)
GapSMA(IDataSeries InSeries, int period)
GapSMA(int period)[int barsAgo]
GapSMA(IDataSeries InSeries, int period)[int barsAgo]
```

#### Return value <a href="#return-value_65" id="return-value_65"></a>

**double**

When using this method with an index (e.g. **GapSMA**(14)\[**int** barsAgo] ), the value of the indicator will be issued for the referenced bar.

#### Parameters <a href="#parameters_58" id="parameters_58"></a>

InSeries Input data series for the indicator

period Number of bars included in the calculations

#### Visualization <a href="#visualization_62" id="visualization_62"></a>

![GapSMA - Simple Moving Average](https://agenatrader.github.io/AgenaIndicator-documentation/media/GapSma.png)

#### Example <a href="#example_64" id="example_64"></a>

```csharp
//Output of the SMA value
Print("The current GapSMA value is " + GapSMA(14)[0]);
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://indicators.agenatrader.com/standard-indicators/moving-averages/gapsma-gap-simple-moving-average.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
