Rss & SiteMap

金字塔客服中心 - 专业程序化交易软件提供商 http://www.weistock.com/bbs/

专业程序化软件提供商
共22 条记录, 每页显示 10 条, 页签: [1] [2][3]
[浏览完整版]

标题:限价止盈止损的问题

1楼
kingmoonwang 发表于:2012/4/5 17:33:37

K线走完模式下。可否实现限价止盈止损。

比如盈利200点以后,回撤到只有50点盈利的时候止盈。到50点的时候马上止盈,而不是等K线结束。

2楼
admin 发表于:2012/4/5 17:56:16

软件自带的止赢止损功能就可以实现吧

3楼
kingmoonwang 发表于:2012/4/5 18:23:34

是想实现固定点位的分级止盈。软件功能只能固定一个点位。

 

比如 止盈1:盈利到200点,然后回撤到盈利50点。立即止盈。

       止盈2:盈利到500点,回撤到盈利200点。立即止盈。

       止盈3:盈利到800点,回撤到盈利500点。立即止盈。

 

哪位大侠如果能帮忙写一下更加感激不尽。

4楼
kingmoonwang 发表于:2012/4/5 22:23:27

自己写了一下。好像实现不了。不管是LIMITR,还是MARKET,都是以最优价和市价成交的吧?也就是说,只要到目标点位,因为一定优于回撤止盈价,所以就止盈了,实现不了回撤止盈。是这样么?

 

只能再向各位大侠请教了。

 

5楼
just 发表于:2012/4/6 9:06:24
参考http://www.weistock.com/bbs/dispbbs.asp?boardid=11&Id=9053 
6楼
rushtaotao 发表于:2012/4/6 9:08:22
或者你可以把你写的代码发出来哦
7楼
kingmoonwang 发表于:2012/4/6 9:11:59

空头部分如下:

 

if holding<0 and l<=lprice then begin
 
lprice:=l;

end

if holding<0 then begin
if enterprice-lprice>200 then begin

 空止盈1: sellshort(1,holding,limitr,enterprice-50);
 KZY1:=0;
end

if enterprice-lprice>500 then begin

 空止盈2: sellshort(1,holding,limitr,enterprice-200);
 KZY1:=0;
end

if enterprice-lprice>800 then begin

 空止盈3: sellshort(1,holding,limitr,enterprice-500);
 KZY1:=0;
end

end

8楼
rushtaotao 发表于:2012/4/6 9:52:15

是不是因为您的lprice没有定义全局变量的原因

您尝试下添加以下代码

variable:lprice=o;

 

9楼
kingmoonwang 发表于:2012/4/6 10:01:54

To rushtaotao大侠:

 

在策略最前面已经声明了全局变量了。

 

另外,看了火哥写的那个,感觉火哥的可以实现是通过提高止损位实现的。求证。

 

10楼
just 发表于:2012/4/6 10:33:28

variable: lprice=0, KZY1=0;
if cond then begin

buyshort();

lprice:=l;

KZY1:=1;

end

if enterprice-lprice>200 AND KZY1=1 then begin

 空止盈1: sellshort(HOLDING<0,holding,limitr,enterprice-50);
 KZY1:=0;
end

if enterprice-lprice>500  AND KZY1=1 then begin

 空止盈2: sellshort(HOLDING<0,holding,limitr,enterprice-200);
 KZY1:=0;
end

if enterprice-lprice>800 AND KZY1=1 then begin

 空止盈3: sellshort(HOLDING<0,holding,limitr,enterprice-500);
 KZY1:=0;
end

end

共22 条记录, 每页显示 10 条, 页签: [1] [2][3]


Powered By Dvbbs Version 8.3.0
Processed in 0.01953 s, 3 queries.