以文本方式查看主题

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

--  作者:just1
--  发布时间:2013/3/15 17:19:28
--  请教语句编写
我想写两条语言,20日均线上方,14:59分,平空单;20日均线下方,14:59分,开空单。第二条是:20日均线上方,14:59分,开多单;20日均线下方,14:59分,平多单。你能帮我分开写这两条语言吗?

--  作者:just
--  发布时间:2013/3/15 17:26:41
--  
ma20:=ma(c,20);

if c>ma20 and time=145900 then begin
sellshort(holding<0,holding,market);
end

if c<ma20 and time=145900 then begin
sell(holding>0,holding,market);
end

if c>ma20 and time=145900 then begin
buy(holding=0,1,market);
end

if c<ma20 and time=145900 then begin
buyshort(holding=0,1,market);
end