以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  金字塔软件问题提交  (http://weistock.com/bbs/list.asp?boardid=2)
----  请问高手:我的介入价止损代码对不对,是不是这样写  (http://weistock.com/bbs/dispbbs.asp?boardid=2&id=11580)

--  作者:wphxl
--  发布时间:2012/5/9 10:34:24
--  请问高手:我的介入价止损代码对不对,是不是这样写

//建立多头的进场条件
long :=VBuy and time>=092700 and time<=150000;

if long then
 begin
 sellshort(holding < 0, 0, limitr, open);
 buy(holding = 0, 1, limitr, open);
 Price:=AVGENTERPRICE;//持仓价位
 SELL(HOLDING>0,HOLDING,Stopr,Price*0.9977);//止损
 end
//Price:=AVGENTERPRICE;//持仓价位
//画出多头的止损线
partline(holding>0,Price*0.9977,colorred);

//开空条件
short := VSell and time >= 092700 and time <= 150000;

if short then
 begin
 sell(holding > 0, 0, limitr, open);
 buyshort(holding = 0, 1, limitr, open);
 Price:=AVGENTERPRICE;//持仓价位
 sellshort(holding > 0, 0, Stopr,Price*1.0027);
 end

//画出空头的止损线
partline(holding<0, Price*1.0027, colorgreen);

//收盘前5分钟平仓
if time >= 151200 then
 begin
 sell(holding > 0, 0, limitr, open);
 sellshort(holding < 0, 0, limitr, open);
 end


--  作者:jinzhe
--  发布时间:2012/5/9 10:38:37
--  
把止损单独写出来,和收盘前平仓那样
--  作者:saintlucifer
--  发布时间:2012/5/9 15:34:09
--  
尽量不要用buy跟sell里面的止损指令,这个需要交易所支持的,外盘的大部分支持,但是国内的就大部分不支持,下了指令也没用,单子发不到交易所的,止损最好就像楼上说的,单独写出来作为一个平仓条件用