作者Anselw (爱情 VS 人生)
看板Trading
标题Re: [问题] 请教TS语法
时间Thu Aug 26 13:50:56 2010
※ 引述《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
1F:推 chmchm:逻辑蛮正确的 感谢^^ 08/26 14:52