# 8.5. Smart Money Concepts

### 8.**5.1. Fair Value Gap (FVG)**

Là một vùng giá chưa được lấp đầy trên biểu đồ, xuất hiện khi có sự mất cân bằng giữa cung và cầu. · Nếu cây nến hiện tại là nến tăng (bullish), fvg xuất hiện khi đỉnh của nến trước thấp hơn đáy của nến sau. Nếu cây nến hiện tại là nến giảm (bearish), fvg xuất hiện khi đáy của nến trước cao hơn đỉnh của nến sau.

```python
def fvg(self, open: pd.Series, high: pd.Series, low: pd.Series, close: pd.Series, join_consecutive: bool = True) -> pd.Series: ...
    
def fvg_top(self, open: pd.Series, high: pd.Series, low: pd.Series, close: pd.Series, join_consecutive: bool = True) -> pd.Series: ...
    
def fvg_bottom(self, open: pd.Series, high: pd.Series, low: pd.Series, close: pd.Series, join_consecutive: bool = True) -> pd.Series: ...
    
def fvg_mitigatedIndex(self, open: pd.Series, high: pd.Series, low: pd.Series, close: pd.Series, join_consecutive: bool = True) -> pd.Series: ...
```

**Tham số**

| Tên tham số       | Mô tả                                                                                                                         | Kiểu dữ liệu  | Giá trị mặc định |
| ----------------- | ----------------------------------------------------------------------------------------------------------------------------- | ------------- | ---------------- |
| open              | Cột chứa giá mở cửa.                                                                                                          | pandas.Series |                  |
| high              | Cột chứa giá cao nhất.                                                                                                        | pandas.Series |                  |
| low               | Cột chứa giá thấp nhất.                                                                                                       | pandas.Series |                  |
| close             | Cột chứa giá đóng cửa.                                                                                                        | pandas.Series |                  |
| join\_consecutive | Nếu có nhiều khoảng (FVG) liên tiếp, chúng sẽ được gộp lại thành một, sử dụng mức cao nhất làm đỉnh và mức thấp nhất làm đáy. | bool          | True             |

Ví dụ:

```python
fi = client.FiinIndicator()
df['fvg'] = fi.fvg(df['open'],df['high'], df['low'], df['close'],join_consecutive=True)
print(df)
```

### **8.5.2. Swing Highs and Lows**

Đỉnh xoay (Swing High) xảy ra khi giá cao nhất của cây nến hiện tại là mức cao nhất trong một khoảng thời gian xác định trước và sau nó.

Đáy xoay (Swing Low) xảy ra khi giá thấp nhất của cây nến hiện tại là mức thấp nhất trong cùng khoảng thời gian đó.

```python
def swing_HL(self, open: pd.Series, high: pd.Series, low: pd.Series, close: pd.Series, swing_length: int = 50) -> pd.Series: ...
    
def swing_level(self, open: pd.Series, high: pd.Series, low: pd.Series, close: pd.Series, swing_length: int = 50)) -> pd.Series: ...
```

**Tham số**

| Tên tham số   | Mô tả                                                                | Kiểu dữ liệu  |    |
| ------------- | -------------------------------------------------------------------- | ------------- | -- |
| open          | Cột chứa giá mở cửa.                                                 | pandas.Series |    |
| high          | Cột chứa giá cao nhất.                                               | pandas.Series |    |
| low           | Cột chứa giá thấp nhất.                                              | pandas.Series |    |
| close         | Cột chứa giá đóng cửa.                                               | pandas.Series |    |
| swing\_length | Số lượng nến cần xét về trước và sau để xác định đỉnh hoặc đáy xoay. | int           | 50 |

Ví dụ:

```python
fi = client.FiinIndicator()
df['swing_HL'] = fi.swing_HL(df['open'],df['high'], df['low'], df['close'], swing_length = 50)
print(df)
```

### **8.5.3. Break of Structure (BOS) & Change of Character (CHoCH)**

BOS (Break of Structure): Khi giá phá vỡ cấu trúc xu hướng trước đó (tăng hoặc giảm), thể hiện sự thay đổi trong động lực thị trường.

ChoCH (Change of Character): Chỉ báo quan trọng thể hiện sự đảo chiều của xu hướng. CHoCH xảy ra khi xu hướng giảm chuyển sang tăng hoặc ngược lại.

```python
def break_of_structure(self, open: pd.Series, high: pd.Series, low: pd.Series, close: pd.Series, close_break: bool = True, swing_length: int = 50) -> pd.Series: ...
    
def chage_of_charactor(self, open: pd.Series, high: pd.Series, low: pd.Series, close: pd.Series, close_break: bool = True, swing_length: int = 50) -> pd.Series: ...
    
def bos_choch_level(self, open: pd.Series, high: pd.Series, low: pd.Series, close: pd.Series, close_break: bool = True, swing_length: int = 50) -> pd.Series: ...
    
def broken_index(self, open: pd.Series, high: pd.Series, low: pd.Series, close: pd.Series, close_break: bool = True, swing_length: int = 50) -> pd.Series: ...
```

**Tham số**

| Tên tham số   | Mô tả                                                                                               | Kiểu dữ liệu  | Mặc định |
| ------------- | --------------------------------------------------------------------------------------------------- | ------------- | -------- |
| open          | Cột chứa giá mở cửa.                                                                                | pandas.Series |          |
| high          | Cột chứa giá cao nhất.                                                                              | pandas.Series |          |
| low           | Cột chứa giá thấp nhất.                                                                             | pandas.Series |          |
| close         | Cột chứa giá đóng cửa.                                                                              | pandas.Series |          |
| close\_break  | Nếu True, xác nhận dựa trên giá đóng cửa của nến.Nếu False, xác nhận dựa trên mức cao/thấp của nến. | bool          | True     |
| swing\_length | Số lượng nến cần xét về trước và sau để xác định đỉnh hoặc đáy xoay.                                | int           | 50       |

Ví dụ:

<pre class="language-python"><code class="lang-python">fi = client.FiinIndicator()
df['break_of_structure'] = fi.break_of_structure(df['open'],df['high'], df['low'],df['close'],swing_length=50)
<strong>df['chage_of_charactor'] = fi.chage_of_charactor(df['open'],df['high'], df['low'],df['close'])
</strong>print(df)
</code></pre>

### **8.5.4. Order Blocks**

Vùng giá mà các tổ chức lớn đã đặt lệnh giao dịch, tạo ra những cú đẩy mạnh về giá. Khi giá quay lại vùng OB, đây thường là điểm vào lệnh tiềm năng.

```python
def ob(self, open: pd.Series, high: pd.Series, low: pd.Series, close: pd.Series, volume: pd.Series, close_mitigation: bool = False, swing_length: int = 50) -> pd.Series: ...
    
def ob_top(self, open: pd.Series, high: pd.Series, low: pd.Series, close: pd.Series, volume: pd.Series, close_mitigation: bool = False, swing_length: int = 50) -> pd.Series: ...
    
def ob_bottom(self, open: pd.Series, high: pd.Series, low: pd.Series, close: pd.Series, volume: pd.Series, close_mitigation: bool = False, swing_length: int = 50) -> pd.Series: ...
    
def ob_volume(self, open: pd.Series, high: pd.Series, low: pd.Series, close: pd.Series, volume: pd.Series, close_mitigation: bool = False, swing_length: int = 50) -> pd.Series: ...
    
def ob_mitigated_index(self, open: pd.Series, high: pd.Series, low: pd.Series, close: pd.Series, volume: pd.Series, close_mitigation: bool = False, swing_length: int = 50) -> pd.Series: ...
    
def ob_percetage(self, open: pd.Series, high: pd.Series, low: pd.Series, close: pd.Series, volume: pd.Series, close_mitigation: bool = False, swing_length: int = 50) -> pd.Series: ...
```

**Tham số**

| Tên tham số       | Mô tả                                                                                               | Kiểu dữ liệu  | Mặc định |
| ----------------- | --------------------------------------------------------------------------------------------------- | ------------- | -------- |
| open              | Cột chứa giá mở cửa.                                                                                | pandas.Series |          |
| high              | Cột chứa giá cao nhất.                                                                              | pandas.Series |          |
| low               | Cột chứa giá thấp nhất.                                                                             | pandas.Series |          |
| close             | Cột chứa giá đóng cửa.                                                                              | pandas.Series |          |
| volume            | Cột chứa khối lượng giao dịch.                                                                      | pandas.Series |          |
| close\_mitigation | Nếu True, xác nhận dựa trên giá đóng cửa của nến.Nếu False, xác nhận dựa trên mức cao/thấp của nến. | bool          | False    |
| swing\_length     | Số lượng nến cần xét.                                                                               | int           | 50       |

Ví dụ:

```python
fi = client.Indicator()
df['ob'] = fi.ob(df['open'],df['high'], df['low'],df['close'],df['volume'], close_mitigation = False, swing_length = 40)
df['ob_volume'] = fi.ob_volume(df['open'],df['high'], df['low'],df['close'],df['volume'])
print(df)
```

### **8.5.5. Liquidity**

Thanh khoản (Liquidity) xuất hiện khi có nhiều mức cao (highs) hoặc nhiều mức thấp (lows) nằm trong một phạm vi nhỏ, cho thấy sự tích lũy lệnh trong khu vực đó.

```python
def liquidity(self, open: pd.Series, high: pd.Series, low: pd.Series, close: pd.Series, range_percent: float = 0.01, swing_length: int = 50) -> pd.Series: ...
    
def liquidity_level(self, open: pd.Series, high: pd.Series, low: pd.Series, close: pd.Series, range_percent: float = 0.01, swing_length: int = 50) -> pd.Series: ...
    
def liquidity_end(self, open: pd.Series, high: pd.Series, low: pd.Series, close: pd.Series, range_percent: float = 0.01, swing_length: int = 50) -> pd.Series: ...
    
def liquidity_swept(self, open: pd.Series, high: pd.Series, low: pd.Series, close: pd.Series, range_percent: float = 0.01, swing_length: int = 50) -> pd.Series: ...
```

**Tham số**

| Tên tham số    | Mô tả                                                                | Kiểu dữ liệu  | Mặc định |
| -------------- | -------------------------------------------------------------------- | ------------- | -------- |
| open           | Cột chứa giá mở cửa.                                                 | pandas.Series |          |
| high           | Cột chứa giá cao nhất.                                               | pandas.Series |          |
| low            | Cột chứa giá thấp nhất.                                              | pandas.Series |          |
| close          | Cột chứa giá đóng cửa.                                               | pandas.Series |          |
| range\_percent | Phần trăm phạm vi giá được sử dụng để xác định thanh khoản.          | float         | 0.01     |
| swing\_length  | Số lượng nến cần xét về trước và sau để xác định đỉnh hoặc đáy xoay. | int           | 50       |

Ví dụ:

```python
// Some codepy

fi = client.FiinIndicator()
df['liquidity'] = fi.liquidity(df['open'],df['high'], df['low'],df['close'])
print(df)
```


---

# 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://docs.fiinquant.vn/ham-va-cong-thuc/8.-danh-sach-chi-so-ta/8.5.-smart-money-concepts.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.
