---
id: "M:cAlgo.API.ChartArea.DrawFibonacciExpansion(System.String,System.DateTime,System.Double,System.DateTime,System.Double,System.DateTime,System.Double,cAlgo.API.Color)"
kind: "method"
type: "T:cAlgo.API.ChartArea"
url: "https://help.ctrader.com/ctrader-algo/references/Chart/ChartArea/DrawFibonacciExpansion/"
---

> Documentation index for agents: https://help.ctrader.com/ctrader-algo/llms.txt · machine index: https://help.ctrader.com/ctrader-algo/api.json

# ChartArea.DrawFibonacciExpansion

Member of [ChartArea](https://help.ctrader.com/ctrader-algo/references/Chart/ChartArea/index.md).

## DrawFibonacciExpansion(string name, DateTime time1, double y1, DateTime time2, double y2, DateTime time3, double y3, Color color)

Draws a Fibonacci expansion.

Environments: Desktop supported · CLI works differently · Cloud works differently.

- CLI: The object is created and returned, but never drawn: the CLI displays no chart.
- Cloud: The object is created and returned, but never drawn: the cloud displays no chart.

C#:

```csharp
ChartFibonacciExpansion DrawFibonacciExpansion(string name, DateTime time1, double y1, DateTime time2, double y2, DateTime time3, double y3, Color color)
```

Python:

```python
chartArea.DrawFibonacciExpansion(name: str, time1: DateTime, y1: float, time2: DateTime, y2: float, time3: DateTime, y3: float, color: Color) -> ChartFibonacciExpansion
```

### Parameters

- `name` (`string`, Python `str`): The chart object name - a unique name that can be only used once for a chart area. If duplicated, the chart object will be replaced with a new one of the same name.
- `time1` (`DateTime`, Python `DateTime`): The time value of the Fibonacci expansion start point location on the X-axis.
- `y1` (`double`, Python `float`): The Y-axis value of the Fibonacci expansion start point location.
- `time2` (`DateTime`, Python `DateTime`): The time value of the Fibonacci expansion central point location on the X-axis.
- `y2` (`double`, Python `float`): The Y-axis value of the Fibonacci expansion central point location.
- `time3` (`DateTime`, Python `DateTime`): The time value of the Fibonacci expansion end point location on the X-axis.
- `y3` (`double`, Python `float`): The Y-axis value of the Fibonacci expansion end point location.
- `color` (`Color`, Python `Color`): The Fibonacci expansion lines color.

### Returns

`ChartFibonacciExpansion` — ChartFibonacciExpansion.

### Examples

C#:

```csharp
var expansion = Chart.DrawFibonacciExpansion("expansion", Bars.OpenTimes.Last(30), Bars.LowPrices.Last(30), Bars.OpenTimes.Last(20), Bars.HighPrices.Last(20), Bars.OpenTimes.Last(10), Bars.LowPrices.Last(10), Color.Red);
Print("Fibonacci expansion levels: {0}", expansion.FibonacciLevels.Count);
```

Python:

```python
expansion = api.Chart.DrawFibonacciExpansion("expansion", api.Bars.OpenTimes.Last(30), api.Bars.LowPrices.Last(30), api.Bars.OpenTimes.Last(20), api.Bars.HighPrices.Last(20), api.Bars.OpenTimes.Last(10), api.Bars.LowPrices.Last(10), Color.Red)
api.Print(f"Fibonacci expansion levels: {expansion.FibonacciLevels.Count}")
```

## DrawFibonacciExpansion(string name, DateTime time1, double y1, DateTime time2, double y2, DateTime time3, double y3, Color color, int thickness)

Draws a Fibonacci expansion.

Environments: Desktop supported · CLI works differently · Cloud works differently.

- CLI: The object is created and returned, but never drawn: the CLI displays no chart.
- Cloud: The object is created and returned, but never drawn: the cloud displays no chart.

C#:

```csharp
ChartFibonacciExpansion DrawFibonacciExpansion(string name, DateTime time1, double y1, DateTime time2, double y2, DateTime time3, double y3, Color color, int thickness)
```

Python:

```python
chartArea.DrawFibonacciExpansion(name: str, time1: DateTime, y1: float, time2: DateTime, y2: float, time3: DateTime, y3: float, color: Color, thickness: int) -> ChartFibonacciExpansion
```

### Parameters

- `name` (`string`, Python `str`): The chart object name - a unique name that can be only used once for a chart area. If duplicated, the chart object will be replaced with a new one of the same name.
- `time1` (`DateTime`, Python `DateTime`): The time value of the Fibonacci expansion start point location on the X-axis.
- `y1` (`double`, Python `float`): The Y-axis value of the Fibonacci expansion start point location.
- `time2` (`DateTime`, Python `DateTime`): The time value of the Fibonacci expansion central point location on the X-axis.
- `y2` (`double`, Python `float`): The Y-axis value of the Fibonacci expansion central point location.
- `time3` (`DateTime`, Python `DateTime`): The time value of the Fibonacci expansion end point location on the X-axis.
- `y3` (`double`, Python `float`): The Y-axis value of the Fibonacci expansion end point location.
- `color` (`Color`, Python `Color`): The Fibonacci expansion lines color.
- `thickness` (`int`, Python `int`): The Fibonacci expansion lines thickness.

### Returns

`ChartFibonacciExpansion` — ChartFibonacciExpansion.

### Examples

C#:

```csharp
var expansion = Chart.DrawFibonacciExpansion("expansion", Bars.OpenTimes.Last(30), Bars.LowPrices.Last(30), Bars.OpenTimes.Last(20), Bars.HighPrices.Last(20), Bars.OpenTimes.Last(10), Bars.LowPrices.Last(10), Color.Red, 2);
Print("Fibonacci expansion thickness: {0}", expansion.Thickness);
```

Python:

```python
expansion = api.Chart.DrawFibonacciExpansion("expansion", api.Bars.OpenTimes.Last(30), api.Bars.LowPrices.Last(30), api.Bars.OpenTimes.Last(20), api.Bars.HighPrices.Last(20), api.Bars.OpenTimes.Last(10), api.Bars.LowPrices.Last(10), Color.Red, 2)
api.Print(f"Fibonacci expansion thickness: {expansion.Thickness}")
```

## DrawFibonacciExpansion(string name, DateTime time1, double y1, DateTime time2, double y2, DateTime time3, double y3, Color color, int thickness, LineStyle lineStyle)

Draws a Fibonacci expansion.

Environments: Desktop supported · CLI works differently · Cloud works differently.

- CLI: The object is created and returned, but never drawn: the CLI displays no chart.
- Cloud: The object is created and returned, but never drawn: the cloud displays no chart.

C#:

```csharp
ChartFibonacciExpansion DrawFibonacciExpansion(string name, DateTime time1, double y1, DateTime time2, double y2, DateTime time3, double y3, Color color, int thickness, LineStyle lineStyle)
```

Python:

```python
chartArea.DrawFibonacciExpansion(name: str, time1: DateTime, y1: float, time2: DateTime, y2: float, time3: DateTime, y3: float, color: Color, thickness: int, lineStyle: LineStyle) -> ChartFibonacciExpansion
```

### Parameters

- `name` (`string`, Python `str`): The chart object name - a unique name that can be only used once for a chart area. If duplicated, the chart object will be replaced with a new one of the same name.
- `time1` (`DateTime`, Python `DateTime`): The time value of the Fibonacci expansion start point location on the X-axis.
- `y1` (`double`, Python `float`): The Y-axis value of the Fibonacci expansion start point location.
- `time2` (`DateTime`, Python `DateTime`): The time value of the Fibonacci expansion central point location on the X-axis.
- `y2` (`double`, Python `float`): The Y-axis value of the Fibonacci expansion central point location.
- `time3` (`DateTime`, Python `DateTime`): The time value of the Fibonacci expansion end point location on the X-axis.
- `y3` (`double`, Python `float`): The Y-axis value of the Fibonacci expansion end point location.
- `color` (`Color`, Python `Color`): The Fibonacci expansion lines color.
- `thickness` (`int`, Python `int`): The Fibonacci expansion lines thickness.
- `lineStyle` (`LineStyle`, Python `LineStyle`): The Fibonacci expansion lines style.

### Returns

`ChartFibonacciExpansion` — ChartFibonacciExpansion.

### Examples

C#:

```csharp
var expansion = Chart.DrawFibonacciExpansion("expansion", Bars.OpenTimes.Last(30), Bars.LowPrices.Last(30), Bars.OpenTimes.Last(20), Bars.HighPrices.Last(20), Bars.OpenTimes.Last(10), Bars.LowPrices.Last(10), Color.Red, 2, LineStyle.Dots);
Print("Fibonacci expansion style: {0}", expansion.LineStyle);
```

Python:

```python
expansion = api.Chart.DrawFibonacciExpansion("expansion", api.Bars.OpenTimes.Last(30), api.Bars.LowPrices.Last(30), api.Bars.OpenTimes.Last(20), api.Bars.HighPrices.Last(20), api.Bars.OpenTimes.Last(10), api.Bars.LowPrices.Last(10), Color.Red, 2, LineStyle.Dots)
api.Print(f"Fibonacci expansion style: {expansion.LineStyle}")
```

## DrawFibonacciExpansion(string name, int barIndex1, double y1, int barIndex2, double y2, int barIndex3, double y3, Color color)

Draws a Fibonacci expansion.

Environments: Desktop supported · CLI works differently · Cloud works differently.

- CLI: The object is created and returned, but never drawn: the CLI displays no chart.
- Cloud: The object is created and returned, but never drawn: the cloud displays no chart.

C#:

```csharp
ChartFibonacciExpansion DrawFibonacciExpansion(string name, int barIndex1, double y1, int barIndex2, double y2, int barIndex3, double y3, Color color)
```

Python:

```python
chartArea.DrawFibonacciExpansion(name: str, barIndex1: int, y1: float, barIndex2: int, y2: float, barIndex3: int, y3: float, color: Color) -> ChartFibonacciExpansion
```

### Parameters

- `name` (`string`, Python `str`): The chart object name - a unique name that can be only used once for a chart area. If duplicated, the chart object will be replaced with a new one of the same name.
- `barIndex1` (`int`, Python `int`): The bar index of the Fibonacci expansion start point location on the X-axis.
- `y1` (`double`, Python `float`): The Y-axis value of the Fibonacci expansion start point location.
- `barIndex2` (`int`, Python `int`): The bar index of the Fibonacci expansion central point location on the X-axis.
- `y2` (`double`, Python `float`): The Y-axis value of the Fibonacci expansion central point location.
- `barIndex3` (`int`, Python `int`): The bar index of the Fibonacci expansion end point location on the X-axis.
- `y3` (`double`, Python `float`): The Y-axis value of the Fibonacci expansion end point location.
- `color` (`Color`, Python `Color`): The Fibonacci expansion lines color.

### Returns

`ChartFibonacciExpansion` — ChartFibonacciExpansion.

### Examples

C#:

```csharp
var index = Bars.Count - 1;
var expansion = Chart.DrawFibonacciExpansion("expansion", index - 30, Bars.LowPrices[index - 30], index - 20, Bars.HighPrices[index - 20], index - 10, Bars.LowPrices[index - 10], Color.Red);
Print("Fibonacci expansion levels: {0}", expansion.FibonacciLevels.Count);
```

Python:

```python
index = api.Bars.Count - 1
expansion = api.Chart.DrawFibonacciExpansion("expansion", index - 30, api.Bars.LowPrices[index - 30], index - 20, api.Bars.HighPrices[index - 20], index - 10, api.Bars.LowPrices[index - 10], Color.Red)
api.Print(f"Fibonacci expansion levels: {expansion.FibonacciLevels.Count}")
```

## DrawFibonacciExpansion(string name, int barIndex1, double y1, int barIndex2, double y2, int barIndex3, double y3, Color color, int thickness)

Draws a Fibonacci expansion.

Environments: Desktop supported · CLI works differently · Cloud works differently.

- CLI: The object is created and returned, but never drawn: the CLI displays no chart.
- Cloud: The object is created and returned, but never drawn: the cloud displays no chart.

C#:

```csharp
ChartFibonacciExpansion DrawFibonacciExpansion(string name, int barIndex1, double y1, int barIndex2, double y2, int barIndex3, double y3, Color color, int thickness)
```

Python:

```python
chartArea.DrawFibonacciExpansion(name: str, barIndex1: int, y1: float, barIndex2: int, y2: float, barIndex3: int, y3: float, color: Color, thickness: int) -> ChartFibonacciExpansion
```

### Parameters

- `name` (`string`, Python `str`): The chart object name - a unique name that can be only used once for a chart area. If duplicated, the chart object will be replaced with a new one of the same name.
- `barIndex1` (`int`, Python `int`): The bar index of the Fibonacci expansion start point location on the X-axis.
- `y1` (`double`, Python `float`): The Y-axis value of the Fibonacci expansion start point location.
- `barIndex2` (`int`, Python `int`): The bar index of the Fibonacci expansion central point location on the X-axis.
- `y2` (`double`, Python `float`): The Y-axis value of the Fibonacci expansion central point location.
- `barIndex3` (`int`, Python `int`): The bar index of the Fibonacci expansion end point location on the X-axis.
- `y3` (`double`, Python `float`): The Y-axis value of the Fibonacci expansion end point location.
- `color` (`Color`, Python `Color`): The Fibonacci expansion lines color.
- `thickness` (`int`, Python `int`): The Fibonacci expansion lines thickness.

### Returns

`ChartFibonacciExpansion` — ChartFibonacciExpansion.

### Examples

C#:

```csharp
var index = Bars.Count - 1;
var expansion = Chart.DrawFibonacciExpansion("expansion", index - 30, Bars.LowPrices[index - 30], index - 20, Bars.HighPrices[index - 20], index - 10, Bars.LowPrices[index - 10], Color.Red, 2);
Print("Fibonacci expansion thickness: {0}", expansion.Thickness);
```

Python:

```python
index = api.Bars.Count - 1
expansion = api.Chart.DrawFibonacciExpansion("expansion", index - 30, api.Bars.LowPrices[index - 30], index - 20, api.Bars.HighPrices[index - 20], index - 10, api.Bars.LowPrices[index - 10], Color.Red, 2)
api.Print(f"Fibonacci expansion thickness: {expansion.Thickness}")
```

## DrawFibonacciExpansion(string name, int barIndex1, double y1, int barIndex2, double y2, int barIndex3, double y3, Color color, int thickness, LineStyle lineStyle)

Draws a Fibonacci expansion.

Environments: Desktop supported · CLI works differently · Cloud works differently.

- CLI: The object is created and returned, but never drawn: the CLI displays no chart.
- Cloud: The object is created and returned, but never drawn: the cloud displays no chart.

C#:

```csharp
ChartFibonacciExpansion DrawFibonacciExpansion(string name, int barIndex1, double y1, int barIndex2, double y2, int barIndex3, double y3, Color color, int thickness, LineStyle lineStyle)
```

Python:

```python
chartArea.DrawFibonacciExpansion(name: str, barIndex1: int, y1: float, barIndex2: int, y2: float, barIndex3: int, y3: float, color: Color, thickness: int, lineStyle: LineStyle) -> ChartFibonacciExpansion
```

### Parameters

- `name` (`string`, Python `str`): The chart object name - a unique name that can be only used once for a chart area. If duplicated, the chart object will be replaced with a new one of the same name.
- `barIndex1` (`int`, Python `int`): The bar index of the Fibonacci expansion start point location on the X-axis.
- `y1` (`double`, Python `float`): The Y-axis value of the Fibonacci expansion start point location.
- `barIndex2` (`int`, Python `int`): The bar index of the Fibonacci expansion central point location on the X-axis.
- `y2` (`double`, Python `float`): The Y-axis value of the Fibonacci expansion central point location.
- `barIndex3` (`int`, Python `int`): The bar index of the Fibonacci expansion end point location on the X-axis.
- `y3` (`double`, Python `float`): The Y-axis value of the Fibonacci expansion end point location.
- `color` (`Color`, Python `Color`): The Fibonacci expansion lines color.
- `thickness` (`int`, Python `int`): The Fibonacci expansion lines thickness.
- `lineStyle` (`LineStyle`, Python `LineStyle`): The Fibonacci expansion lines style.

### Returns

`ChartFibonacciExpansion` — ChartFibonacciExpansion.

### Examples

C#:

```csharp
var index = Bars.Count - 1;
var expansion = Chart.DrawFibonacciExpansion("expansion", index - 30, Bars.LowPrices[index - 30], index - 20, Bars.HighPrices[index - 20], index - 10, Bars.LowPrices[index - 10], Color.Red, 2, LineStyle.Dots);
Print("Fibonacci expansion style: {0}", expansion.LineStyle);
```

Python:

```python
index = api.Bars.Count - 1
expansion = api.Chart.DrawFibonacciExpansion("expansion", index - 30, api.Bars.LowPrices[index - 30], index - 20, api.Bars.HighPrices[index - 20], index - 10, api.Bars.LowPrices[index - 10], Color.Red, 2, LineStyle.Dots)
api.Print(f"Fibonacci expansion style: {expansion.LineStyle}")
```

