以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  写一组均线交易策略  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=84661)

--  作者:fang圆
--  发布时间:2015/9/1 20:21:31
--  写一组均线交易策略
jinzhe老师 您好    我这里也请你帮个忙:  写一组均线交易策略,两条 均线分别是8日线和80日线,当8日线上穿触碰80日线后买多(如遇多次触碰只能成交一次),买入成交后10个点止盈;当8日线下穿80日线时买空,同样止盈点为10,止损点为30点。
--  作者:jinzhe
--  发布时间:2015/9/2 8:54:15
--  

ma8:=ma(c,8);

ma80:=ma(c,80);

 

if cross(ma8,ma80) then begin

    buy(holding=0,1,market);

end

if cross(ma80,ma8) then begin

    buyshort(holding=0,1,market);

end

 

if holding>0 and h>enterprice+10 then 多止盈:sell(1,0,market);

if holding>0 and l<enterprice-30 then 多止损:sell(1,0,market);

 

 

if holding<0 and h>enterprice+30 then 空止损:sellshort(1,0,market);

if holding<0 and l<enterprice-10 then 空止盈:sellshort(1,0,market);


--  作者:fang圆
--  发布时间:2015/9/2 9:11:55
--  非常感谢
非常感谢jinzhe老师的回复