以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  多仓空仓亏损加一起,达5次---则开仓----点写  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=51129)

--  作者:lyt369
--  发布时间:2013/4/17 16:37:09
--  多仓空仓亏损加一起,达5次---则开仓----点写
多仓空仓亏损加一起,达5次---则开仓----怎样写
--  作者:jinzhe
--  发布时间:2013/4/17 16:38:29
--  
亏损满5次后,在第5次亏损的k线上无条件开仓?
--  作者:lyt369
--  发布时间:2013/4/17 16:40:41
--  
ok


--  作者:lyt369
--  发布时间:2013/4/17 16:41:25
--  

--  作者:lyt369
--  发布时间:2013/4/17 16:42:27
--  
你想想办法实现日内连续亏损5次则开仓----必顺连续亏
--  作者:lyt369
--  发布时间:2013/4/17 16:46:01
--  
连续亏损:NUMSEQLOSS; -----这个不行
--  作者:every
--  发布时间:2013/4/17 16:48:25
--  

//日内连续亏损5次则不开仓

VARIABLE:ks=0;//连续亏损次数

num:=5;

 

buycond:=ref(count(c>o,2)=2,1);
sellcond:=ref(count(c<o,2)=2,1);

 

if holding>0 and sellcond then
 begin
 sell(1,1,market);
  if c<ENTERPRICE then ks:=ks+1;
  else
  if c>ENTERPRICE then ks:=0;//赢利一次,重新计算亏损次数
 end

 

if holding<0 and buycond then
 begin
 sellshort(1,1,market);
  if c>ENTERPRICE then ks:=ks+1;
  else
  if c<ENTERPRICE then ks:=0;//赢利一次,重新计算亏损次数
 end

 

if buycond and holding=0 and ks<=num then
 begin
 buy(1,1,market);
 end
 
if holding=0 and sellcond and ks<=num then buyshort(1,1,market);

 

if time=closetime(0) then ks:=0;//收盘的同时,赋值为0

[此贴子已经被作者于2013-4-17 16:49:05编辑过]

--  作者:lyt369
--  发布时间:2013/4/17 17:09:18
--  
ok


--  作者:chengjun1201
--  发布时间:2013/5/27 14:50:17
--  

if holding=0 and sellcond and ks<=num then

  begin buyshort(1,1,market);

  end

 

if time=closetime(0) then ks:=0;//收盘的同时,赋值为0


--  作者:chengjun1201
--  发布时间:2013/5/27 14:51:06
--  

VARIABLE:ks=0;//连续亏损次数

num:=5;

 

buycond:=ref(count(c>o,2)=2,1);
sellcond:=ref(count(c<o,2)=2,1);

 

if holding>0 and sellcond then
 begin
 sell(1,1,market);
  if c<ENTERPRICE then ks:=ks+1;
  else
  if c>ENTERPRICE then ks:=0;//赢利一次,重新计算亏损次数
 end

 

if holding<0 and buycond then
 begin
 sellshort(1,1,market);
  if c>ENTERPRICE then ks:=ks+1;
  else
  if c<ENTERPRICE then ks:=0;//赢利一次,重新计算亏损次数
 end

 

if buycond and holding=0 and ks<=num then
 begin
 buy(1,1,market);
 end
 
if holding=0 and sellcond and ks<=num then

 begin 

buyshort(1,1,market);

 end

 

if time=closetime(0) then ks:=0;//收盘的同时,赋值为0