以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  [求助]请教下这样可以实现吗?  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=9004)

--  作者:saintlucifer
--  发布时间:2011/11/17 10:07:44
--  [求助]请教下这样可以实现吗?
请问一下,例如当前K线出现开仓信号,先做一个判断,如果当前K线涨幅大于一定百分比,这里先不进行开仓,然后推迟到下周期收盘(或者下下)才进行开仓,请问可以实现吗?
--  作者:26327756l
--  发布时间:2011/11/17 10:57:50
--  

可以

将下单语句放在IF的条件判断下,满足 当前K线涨幅大于一定百分比

然后在执行下单。


--  作者:saintlucifer
--  发布时间:2011/11/17 11:00:53
--  
呃,具体要怎么写呢
--  作者:26327756l
--  发布时间:2011/11/17 11:14:30
--  
那你具体是什么条件呢?
--  作者:saintlucifer
--  发布时间:2011/11/17 11:19:49
--  
看来你不是很理解我的问题,我的问题是当开仓条件成立时,如果当根k线涨幅超过一定百分比,就把开仓时间推迟到下一根k线才进行开仓,这个就是具体条件啊~ IF Condition and ((close - open) / open >= x%) then xxx,我是问xxx那些内容,不是问condition那个...
--  作者:saintlucifer
--  发布时间:2011/11/17 11:21:07
--  
我是问如何推迟开仓时间,而不是问如何开仓...
--  作者:26327756l
--  发布时间:2011/11/17 11:29:22
--  

这样的话,我想想


--  作者:阿火
--  发布时间:2011/11/17 12:22:28
--  

在强大的金字塔面前,It is so easy !

variable:cc=0;

ma5:=ma(c,5);

ma10:=ma(c,10);

if cc>0 and ma5<ma10 then begin

  sell(1,1,thisclose);

  cc:=0;

end

if cc<0 and ma5>ma10 then begin

  sellshort(1,1,thisclose);

  cc:=0;

end

if cc=0 and ma5>ma10 then begin

  cc:=1;

  kpos:=barpos;

  buy((c-o/o<0.001),1,thisclose);

end

if cc=0 and ma5<ma10 then begin

  cc:=-1;

  kpos:=barpos;

  buyshort((c-o)/o>-0.001,1,thisclose);

end

if holding=0 and cc=1 and barpos-kpos>=1 then buy(1,1,thisclose);//出信号时不符合开仓条件,则推迟1根K线开仓

if holding=0 and cc=-1 and barpos-kpos>=1 then buyshort(1,1,thisclose);


--  作者:saintlucifer
--  发布时间:2011/11/17 14:05:28
--  
真的很强大,十分感谢!!