以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  无法加仓的问题  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=169975)

--  作者:tp2019
--  发布时间:2019/5/18 20:31:42
--  无法加仓的问题
请问为什么写,为什么加不了仓
bb:=cross(c,ma(c,300));
ss:=cross(ma(c,300),c);


trrr:if(holding>0,h-enterprice,0),noaxis;

if bb then 
begin
sellshort(holding<0,0,limitr,ht+1*mindiff);
 buy(holding=0,1,limitr,ht+1*mindiff);
end


if  trrr>20 and holding>0 then
begin
buy(1,1,market);
end



if ss  then 
begin
sell(holding>0,0,limitr,lt-1*mindiff);
buyshort(holding=0,1,limitr,lt-1*mindiff);
end

--  作者:tp2019
--  发布时间:2019/5/18 21:33:27
--  
为什么我写这种语句,系统为什么不出信号??


if  openprofit>500  then
begin
sell(1,1,market);
sellshort(1,1,market);
end

if  openprofit<-200  then
begin
sell(1,1,market);
sellshort(1,1,market);
end

--  作者:wenarm
--  发布时间:2019/5/20 8:43:37
--  

1楼,肯定是你加仓条件不成立。你在即在策略中输出显示

例如:  cond:trrr>20 and holding>0;

 

2楼:图表信号的平仓信号必须依赖于持有虚拟持仓。你只有平仓,没有开仓,平仓语句自然被过滤掉(无仓可平)。