# InsideBarsMT

**The installation of the Technical Analysis Package is required in order to access this indicator.**

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

InsideBarsMT displays inside bars as defined by Michael Voigt in his book. The settings can be modified, and additional adjustments are also possible. Furthermore, there are several data series used in stop calculations for self-developed indicators and strategies.

#### Interpretation <a href="#interpretation_21" id="interpretation_21"></a>

Inside bars are bars whose body (open-close) are located within the high-low span of the previous bar. The previous bar is generally called an outside bar. Inside bars will sometimes reflect sideways phases, and will also display trend corrections of lower timeframes. When trading inside bars, the stop is placed at the high or low of the previous period. If the high or low of the previous candle is unsuitable, then the high or low of an older candle is used.

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

```csharp
InsideBarsMT().isInsideBar[int barsAgo]
InsideBarsMT().isOutsideBar[int barsAgo]
InsideBarsMT().HighBeforeOutsideBar[int barsAgo]
InsideBarsMT().LowBeforeOutsideBar[int barsAgo]
```

#### Settings <a href="#settings" id="settings"></a>

* **InsideBarsMT**().isInsideBar\[**int** barsAgo]

Will return “true” if the referenced bar is an inside bar, otherwise “false”

* **InsideBarsMT**().isOutsideBar\[**int** barsAgo]

Will return “true” if the previous bar is an outside bar

* **InsideBarsMT**().HighBeforeOutsideBar\[**int** barsAgo]

Will output the high of the bar preceding the outside bar

* **InsideBarsMT**().LowBeforeOutsideBar\[**int** barsAgo]

Will return the low of the bar preceding the outside bar

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

![InsideBarsMT](https://agenatrader.github.io/AgenaIndicator-documentation/media/image34.png)

#### Tolerance parameter <a href="#tolerance-parameter" id="tolerance-parameter"></a>

In the image below you will see a longer “phase” where the market is within an inside bar. The bar marked with the arrow opens the low of the outside bar. If the open of the green candle had been a tick lower, then the marked bar would not be an inside bar and the red bar would clearly not be an outside bar. The tolerance parameter defines the number of ticks by which the inside bars may “breach” the high-low span of the outside bar and still be recognized as an inside bar.

Tolerance default setting = 0.

![InsideBarsMT](https://agenatrader.github.io/AgenaIndicator-documentation/media/InsideBarsMT.jpg)

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

```csharp
double StopPrice;
protected override void OnCalculate()
{
// Open position when SMAs cross
if (CrossAbove(SMA(10),SMA(20),1) && Position.PositionType == PositionType.Flat)
OpenLong();
// If the current bar is an inside bar, modify the stop
if (InsideBarsMT().isInsideBar[0])
StopPrice = InsideBarsMT().LowBeforeOutsideBar[0];
else
// Use different stop method
}
```


---

# 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/premium-indicators/dowtheory-addon/insidebarsmt.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.
