# 快訊設定説明

## 在 TradingView 宣告使用 AlertMessage

{% hint style="info" %}
達錢開發的時候使用的是 PineScript Version 5 的版本，因此建議用 v5 來測試。
{% endhint %}

在你的程式碼加入使用 strategy\_alert message 的宣告

```
//@version=5
//@strategy_alert_message {{strategy.order.alert_message}}
```

<figure><img src="/files/ceMHOMfvSeopXGgJgt56" alt=""><figcaption></figcaption></figure>

## 加入達錢獲取交易資訊需要的格式

達錢定義的交易格式字串如下：

> TOTC.{{timenow}}@account=F2000-8xxxxx,sym=TC.F.TWF.TMF.HOT,side={{strategy.order.action}},qty={{strategy.order.contracts}},p={{strategy.order.price}},ordertype=1,tif=2,ts={{timenow}},tvorderID=stg\_001

{% hint style="danger" %}
交易格式的内容可依據需求變動，調整時請特別注意：

1. TOTC{{timenow}}@ 一定要有。
2. 所有的 Key 值必須要有不能缺少，例如：account, sym,side.....
3. 内容可以變更，例如：account=xxxx-xxxx ，你可以以變數或是 pinescirpt 内建的策略内容取代。
   {% endhint %}

&#x20;請參考下圖，將 AlertMessage 加入你 Script 中的進出場位置。

<figure><img src="/files/uzobcOAxT6EhvWykRvdF" alt=""><figcaption></figcaption></figure>

### 交易格式説明

<table><thead><tr><th width="144">Key</th><th>説明</th><th width="429">説明/範例</th></tr></thead><tbody><tr><td>account</td><td>字串</td><td><ul><li>需要填入真實的交易帳號，可以從交易總管右鍵複製後貼上。</li><li>測試時，可以填入任意字串訊號產生時會產生錯誤訊息。</li></ul></td></tr><tr><td>sym</td><td>字串</td><td><ul><li>需要填入正確的商品代碼才能委託。</li><li><p>交易的商品代規則 <strong>TC.F.TWF.TMF.HOT</strong></p><ul><li>TC 固定</li><li><p>商品類型</p><ul><li>F 代表期貨</li><li>S 代表股票</li><li>O 代表選擇權</li></ul></li><li><p>交易所</p><ul><li>台灣期貨交易所 TWF</li><li>芝加哥商業交易所 CME</li><li>芝加哥商品交易所 CBOT</li><li>紐約期貨交易所 NYBOT</li><li>歐洲期貨交易所 EUREX</li><li>新加坡交易所 SGX</li><li>東工期貨交易所 TOCOM</li><li><p>大阪證券交易所</p><ul><li>OSE</li><li>TSE</li></ul></li><li>洲際 ICE</li></ul></li><li><p>商品代碼</p><ul><li><p>台指期貨 TXF</p><p>商品代碼可以從行情總管查看</p></li><li><p>合約月份</p><ul><li>HOT ，表示下熱門月份</li><li>填入合約月份表示下指定月份，例如 202412</li></ul></li></ul></li></ul></li></ul></td></tr><tr><td>qty</td><td>數字</td><td><ul><li>期貨 1 = 1 口</li><li>範例格式 qty={{strategy.order.contracts}} 表示由 TradingView 設定決定委託數量。</li></ul></td></tr><tr><td>tvorderID</td><td>字串</td><td><ul><li>自定義策略名稱</li><li>個別快訊未設定 tvorderID 時，委託視爲同一策略，系統將會過濾同一時間送來的多個快訊委託，僅送出 1 個委託。</li><li>個別快訊有設定 tvorderID 時，將依據不同 tvorderID 個別執行委託，不受同一時間過濾規則限制。</li><li>同一個 tvorderID 同時間的多個委託，系統將會過濾同一時間送來的快訊委託，僅送出 1 個委託。</li></ul></td></tr></tbody></table>


---

# 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://touchance-1.gitbook.io/touchance/tradingview-kuai-xun-zi-dong-jiao-yi/zi-dong-jiao-yi/kuai-xun-she-ding-yue-ming.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.
