Re: [問題] 請教TS語法
※ 引述《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.
希望對你有些幫助。
: 對於他的寫法 我感到有點奇怪與不解
: 請大家不吝指教
: 謝謝
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 219.85.209.218
推
08/26 14:52, , 1F
08/26 14:52, 1F
討論串 (同標題文章)
Trading 近期熱門文章
57
160
PTT職涯區 即時熱門文章