> For the complete documentation index, see [llms.txt](https://docs.fiinquant.vn/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.fiinquant.vn/ham-va-cong-thuc/8.-danh-sach-chi-so-ta/8.8.-price-level-indicators-chi-bao-bien-dong-gia.md).

# 8.8. Price Level Indicators (Chỉ báo biến động giá)

### 8.8.1. Fibonacci Retracement

Fibonacci Retracement là một công cụ phân tích kỹ thuật dùng để xác định các vùng giá có khả năng trở thành:

* Hỗ trợ (Support) trong xu hướng tăng
* Kháng cự (Resistance) trong xu hướng giảm

Chỉ báo dựa trên tỷ lệ vàng Fibonacci: 23.6%, 38.2%, 50.0%, 61.8%, 78.6%.

```python
def fib_retracement_uptrend(high: pd.Series, low: pd.Series) -> dict: ...
def fib_retracement_downtrend(high: pd.Series, low: pd.Series) -> dict: ...
```

**Tham số**

| Tên tham số | Mô tả                       | Kiểu dữ liệu | Giá trị mặc định |
| ----------- | --------------------------- | ------------ | ---------------- |
| high        | Swing High (đỉnh gần nhất). | float        |                  |
| low         | Swing Low (đáy gần nhất).   | float        |                  |

Ví dụ:

```python
fi = client.FiinIndicator()
fib_uptrend = fi.fib_retracement_uptrend(data["high"], data["low"])
fib_downtrend = fi.fib_retracement_downtrend(data["high"], data["low"])
print(fib_uptrend)
print(fib_downtrend)
```

Dữ liệu trả ra là dictionary chứa các cặp key - value sau:

* SwingHigh: Mức giá tương ứng điểm cao nhất
* SwingLow: Mức giá tương ứng điểm thấp nhất
* Các mức giá dựa trên tỷ lệ vàng Fibonacci: 23.6%, 38.2%, 50.0%, 61.8%, 78.6% (dùng hàm fib\_retracement\_uptrend sẽ là mức giá trên, fib\_retracement\_downtrend sẽ là mức giá dưới):
  * 0.236: Mức giá tương ứng tỷ lệ 23.6%
  * 0.382: Mức giá tương ứng tỷ lệ 38.2%
  * 0.500: Mức giá tương ứng tỷ lệ 50.0%
  * 0.618: Mức giá tương ứng tỷ lệ 61.8%
  * 0.786: Mức giá tương ứng tỷ lệ 78.6%
