以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://www.weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://www.weistock.com/bbs/list.asp?boardid=4)
----  加入止盈止损后 出现问题  (http://www.weistock.com/bbs/dispbbs.asp?boardid=4&id=8870)

--  作者:tonybig
--  发布时间:2011/11/8 17:12:58
--  加入止盈止损后 出现问题

加入止盈止损后  出现问题

runmode:0;

dayopen:=valuewhen(date>ref(date,1),o);

upperband:dayopen+dayopen*0.005;
dnband:dayopen-dayopen*0.005;
centre:(upperband+dnband)/2;
enterlongcond:=high>=upperband;
entershortcond:=low<=dnband;

atr:=ref(ma(tr,10),1);

exittime:=time>1458;


   if enterlongcond and time<=145800 then begin
   sellshort(holding<0 and enterbars>=1,1,limitr,upperband);
   buy(holding=0,1,limitr,upperband);
   end
  
   if entershortcond and time<=145800 then begin
   sell(holding>0 and enterbars>=1,1,limitr,dnband);
   buyshort(holding=0,1,limitr,dnband);
   end

//止损
if ref(c,1)>centre then sellshort(holding<0,holding,limitr,centre+mindiff);
if ref(c,1)<centre then sell(holding>0,holding,limitr,centre-mindiff);

//止盈
if ref(c,1)>enterprice+atr then sell(holding>0,holding,limitr,thisclose);
if ref(c,1)<enterprice-atr then sellshort(holding<0,holding,limitr,thisclose);


if exittime then begin
   sell(holding>0,1,thisclose);
   sellshort(holding<0,1,thisclose);
end


--  作者:fly
--  发布时间:2011/11/8 17:19:05
--  

1.金字塔的时间,都是6位数

 

2.直接用centre+mindiff去发委托单,centre是最小变动价位的整数倍吗?


--  作者:26327756l
--  发布时间:2011/11/8 17:20:18
--  
什么问题 说明一下.
--  作者:tonybig
--  发布时间:2011/11/8 17:36:10
--  
我换成close发委托  ,依然很多  白色无效信号, 所有问题都是加入止盈控制语句后出现
[此贴子已经被作者于2011-11-8 17:37:45编辑过]

--  作者:tonybig
--  发布时间:2011/11/9 9:20:25
--  

顶一下 请高手们回复


--  作者:fly
--  发布时间:2011/11/9 9:32:38
--  

1.金字塔的时间,都是6位数

2.直接去发委托单的价格,一定要是最小变动价位的整数倍.

   你可以用小数位为奇数的去手工下个个IF的单子,看看效果如果

3.注意看BUY等下单函数及其各个参数.

 

runmode:0;

dayopen:=valuewhen(date>ref(date,1),o);

upperband:dayopen+dayopen*0.005;
dnband:dayopen-dayopen*0.005;
centre:(upperband+dnband)/2;
enterlongcond:=high>=upperband;
entershortcond:=low<=dnband;

atr:=ref(ma(tr,10),1);


   if enterlongcond and time<=145800 then begin
   sellshort(holding<0 and enterbars>=1,1,limitr,c+2*mindiff);
   buy(holding=0,1,limitr,c+2*mindiff);
   end
  
   if entershortcond and time<=145800 then begin
   sell(holding>0 and enterbars>=1,1,limitr,c-2*mindiff);
   buyshort(holding=0,1,limitr,c-2*mindiff);
   end

//止损
if ref(c,1)>centre then sellshort(holding<0,holding,limitr,c+2*mindiff);
if ref(c,1)<centre then sell(holding>0,holding,limitr,c-2*mindiff);

//止盈
if ref(c,1)>enterprice+atr then sell(holding>0,holding,market);
if ref(c,1)<enterprice-atr then sellshort(holding<0,holding,market);


if time>=145800 then begin
   sell(holding>0,1,thisclose);
   sellshort(holding<0,1,thisclose);
end


--  作者:tonybig
--  发布时间:2011/11/9 14:58:06
--  
我想确认一下我的模型逻辑是没问题的?     先是两个正反手指令,然后加入止损,再加入入止盈指令。     是否止盈止损指令可以加入到正反手的指令里?
--  作者:fly
--  发布时间:2011/11/9 15:24:18
--  

模型逻辑是没问题的.

 

 是否止盈止损指令可以加入到正反手的指令里?

 加入进去干什么,难道你的止盈止损指令也要满足你正反手指令的条件.