請教TS語法 - 財經

Table of Contents

※ 引述《chmchm (123)》之銘言:
: 這是寰宇TS程式交易全攻略的例題
: 我覺得怪怪的
: 還請大家不吝指教
: ---------------------------------------------
: Q:買進後以買進價-20點設為停損,
: 若是買進後沒觸及停損而拉開獲利
: 當獲利大於50點時,則將停利設為買進價+20

你說的邏輯,與下面的程式碼有些差異…

If MarketPosition = 1 Then Begin
If Close > (EntryPrice + 50) then
ExitLong Next Bar at EntryPrice + 20 Points Stop
else
ExitLong Next Bar at EntryPrice - 20 Points Stop;
end;
If MarketPosition = - 1 Then Begin
If Close < (EntryPrice - 50) then
ExitShort Next Bar at EntryPrice - 20 Points Stop
else
ExitShort Next Bar at EntryPrice + 20 Points Stop;
end;

: A: If MarketPosition = 1 Then Begin
: ExitLong Next Bar at EntryPrice + 50 Points Stop;
: ExitLong Next Bar at EntryPrice - 20 Points Stop;
: end;
: If MarketPosition = - 1 Then Begin
: ExitShort Next Bar at EntryPrice - 50 Points Stop;
: ExitShort Next Bar at EntryPrice + 20 Points Stop;
: end;

我沒試過這種寫法,不知道結果如何…
按 EL 的說明, STOP 觸發在較指定價位更不好的位置,所以
Buy at 7700 Stop 觸發在7700以上 (和 ExitShort 意同)
Sell at 7700 Stop 觸發在7700以下 (和 ExitLong 意同)

原文如下:
● Stop orders can only be executed on the next bar.

● Stop can be read as "this price or worse", meaning higher for a Long Entry
and Short Exit, lower for a Short Entry and Long Exit.

● Stop orders require a reference price.

希望對你有些幫助。

: 對於他的寫法 我感到有點奇怪與不解
: 請大家不吝指教
: 謝謝

--

All Comments

Ethan avatarEthan2010-08-30
邏輯蠻正確的 感謝^^