# Open

Returns the opening price for a specific bar.

## Syntax

```typescript
Open(shift: number): number
```

## Parameters

* `shift`: A number representing the shift from the current bar

## Return Value

Returns a `number` representing the opening price of the specified bar.

## Description

The `Open` method returns the opening price of a bar at the specified shift from the current bar. The shift parameter determines which bar's opening price to return:

* 0: Current bar
* 1: Previous bar
* 2: Two bars ago
* And so on

## Example

```typescript
// Get current bar's opening price
const currentOpen = this.api.Open(0);

// Get previous bar's opening price
const previousOpen = this.api.Open(1);

// Compare current and previous opening prices
const openDiff = this.api.Open(0) - this.api.Open(1);
console.log(
  `Price opened ${openDiff > 0 ? "higher" : "lower"} than previous bar`
);

// Get opening prices for last 3 bars
for (let i = 0; i < 3; i++) {
  const openPrice = this.api.Open(i);
  console.log(`Bar -${i} open price: ${openPrice}`);
}
```


---

# 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://fto-2.gitbook.io/fto-indicators-docs/access-to-bar-arrays/open.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.
