> For the complete documentation index, see [llms.txt](https://touchance-1.gitbook.io/touchance/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://touchance-1.gitbook.io/touchance/touchance-jie-mian-1/faq/tradingview-zi-dong-jiao-yi-xiang-guan/tradingview-tong-yi-ge-ce-le-tong-yi-ge-shi-jian-fa-chu-kuai-xun-di-er-bi-wei-tuo-bu-xia-dan.md).

# TradingView 同一個策略同一個時間發出快訊，第二筆委託不下單？

客戶反應在同一策略，同一根 Bar 停損後立刻就送出反向的委託，這個時候兩個快訊同時從 TradingView 的雲端洗價主機發出，因爲是停損與反向的委託，所以兩個快訊長得一模一樣，結果造成第二筆委託沒有送送出。

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

這個狀況是因爲達錢爲了避免用戶不小心發生錯誤的時候，同一時間大量送出錯誤委託的預防機制，所以當一段時間内出現相同的訊息時，只會送出第一個，後面的就不予處理。

那根據用戶反應的狀況，也是正確的做法要如何解決問題呢？請參考我們的整理。

### TC 使用快訊下單的方式

{% hint style="info" %}
TC 使用 Alert Message 的方式來進行委託，預設的字串如下。
{% endhint %}

alertEntryMessage = "TOTC.{{timenow}}@account="+ ta +",sym="+ ts +",side={{strategy.order.action}},qty={{strategy.order.contracts}},p={{strategy.order.price}},ordertype=1,tif=2,ts={{timenow}},tvorderID="+ SN

&#x20;上面的字串是我們預設的字串，除了下面整理必須保留的必要下單參數，其他的字串或是資訊用戶可以自己組合使用。

{% hint style="danger" %}
必要而且不能動的參數，請務必保留。

* account
* sym
* side
* qty
* ordertype
* tif
  {% endhint %}

要解決問題，我們可以從 TradingView 提供的佔位符來讓字串變得不同。

alertEntryMessage = "TOTC.{{timenow}}@account="+ ta +",sym="+ ts +",side={{strategy.order.action}},qty={{strategy.order.contracts}},p={{strategy.order.price}},ordertype=1,tif=2,ts={{timenow}},tvorderID="+ SN + "\_{{strategy.order.id}}"

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

{% hint style="info" %}
我們通過在 SN  的後面再加上 + "*{{strategy.order.id}}"，就可以組合出 “策略名稱*\_strategy.order.id"，如此一來，兩個快訊的内容就會變成不相同，即使同時出現也能夠順利下單委託。
{% endhint %}

### TradingView 佔位符整理

{% hint style="warning" %}

### 請特別注意你使用的 pineScript 版本，V5 與 V6 可能有差異。

{% endhint %}

### 通用市場數據佔位符&#xD;

這些佔位符主要用於獲取觸發警報時的價格或商品資訊：

* {{close}}：觸發警報時的收盤價。
* {{open}}、{{high}}、{{low}}：觸發時的開盤價、最高價或最低價。
* {{volume}}：觸發時的成交量。
* {{ticker}}：商品的交易代碼（例如 BTCUSDT）。
* {{exchange}}：商品所屬的交易所。
* {{interval}}：當前圖表的時間週期（例如 5, 1h）。
* {{time}}：警報觸發的精確時間戳記。

### 在開發 「策略 (Strategies)」 腳本進行回測與實時下單時，這些佔位符至關重要：

* &#x20;{{strategy.order.action}}：傳回訂單動作，例如 "buy" 或 "sell"。
* &#x20;{{strategy.order.contracts}}：傳回成交的合約數量或股數。
* &#x20;{{strategy.order.price}}：訂單執行的價格。
* {{strategy.order.id}}：您在 `strategy.order` 或 `strategy.entry` 中指定的訂單標識符（ID）。
* &#x20;{{strategy.position\_size}}：目前持倉的大小。• {{strategy.market\_position}}：目前的市場部位（如 long, short, 或 flat）。
