> For the complete documentation index, see [llms.txt](https://yuting0103.gitbook.io/quantbrains/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://yuting0103.gitbook.io/quantbrains/tu-biao-jiao-yi-qb-ping-tai/yi-dong-ting-sun-zhui-zong.md).

# 移動停損追蹤

圖表交易的出場允許自訂函數來進行出場的設置，我們可以在 @QB\_Custum\_Position\_Control 中來進行自己喜好的移動停損追蹤模式\
\
在@QB\_Custum\_Position\_Control 找中到trailingstoptrack=Average(close,TSMPeriod);這一行，目前預設為使用簡單移動平均線進行移動停損追蹤\
\
亦可以使用其他方式，例如多單使用近期高點的拉回點數進行追蹤，我們只需要把原本的\
trailingstoptrack=Average(close,TSMPeriod);\
改成\
if marketposition>0 then trailingstoptrack=Highest(high,N) - 拉回點數;\
即可
