請教TS語法 - 財經

By Hedda
at 2010-08-26T13:50
at 2010-08-26T13:50
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.
希望對你有些幫助。
: 對於他的寫法 我感到有點奇怪與不解
: 請大家不吝指教
: 謝謝
--
: 這是寰宇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.
希望對你有些幫助。
: 對於他的寫法 我感到有點奇怪與不解
: 請大家不吝指教
: 謝謝
--
Tags:
財經
All Comments

By Ethan
at 2010-08-30T11:25
at 2010-08-30T11:25
Related Posts
請教TS語法

By Yuri
at 2010-08-25T23:42
at 2010-08-25T23:42
各位大大的電腦配置

By Carolina Franco
at 2010-08-25T19:52
at 2010-08-25T19:52
各位大大的電腦配置

By Edwina
at 2010-08-25T19:31
at 2010-08-25T19:31
各位大大的電腦配置

By Joseph
at 2010-08-25T19:01
at 2010-08-25T19:01
AlgoStars策略星徵求程式交易系統工程師

By Isla
at 2010-08-16T14:35
at 2010-08-16T14:35