以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  怎样实现图表交易  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=10799)

--  作者:lyt369
--  发布时间:2012/3/28 8:55:26
--  怎样实现图表交易
ma10:=ma(c,10);
orderc:=extgbdata(\'1\');

if cross(ma5,ma10) then 
tbuy(tholding=0,100,mkt);//5日均线上穿10日的时候开仓

if c>=TAVGENTERPRICE*1.05 then tsell(tholding>0,0,mkt);//上涨5%后平仓,也就是现价是持仓均价的1.05%时平仓

if topenprofit<0 and cross(ma5,ma10) then begin

 tbuy(tholding>0,100,mkt);
 orderc:=orderc+1;
 extgbdataset(\'orderc\',orderc);
end //当亏损的时候持有接着补,orderc记录补仓次数

msgout(tholding<>ref(tholding,1),orderc)//当仓位发生变化时输出记录的仓位值
-----怎样实现图表交易

--  作者:董小球
--  发布时间:2012/3/28 9:01:31
--  
楼主粘贴这段代码是什么意思,要实现怎样的图表交易?
--  作者:jinzhe
--  发布时间:2012/3/28 9:39:56
--  

if cross(ma5,ma10) and b1=0 then begin
buy(holding=0,1,market);
b1:=1;
end
//5日均线上穿10日的时候开仓

if c>=AVGENTERPRICE*1.05 then sell(holding>0,0,market);//上涨5%后平仓,也就是现价是持仓均价的1.05%时平仓

if openprofit<0 and cross(ma5,ma10) and holding>0 and b1=1 then begin

 buy(1,1,market);
 a1:=a1+1;
end //当亏损的时候持有接着补,记录补仓次数

s1:=numtostr(a1,1);
msgout(islastbar and holding<>ref(holding,1)  ,s1);


--  作者:jinzhe
--  发布时间:2012/3/28 15:52:50
--  

ma5:=ma(c,5);
ma10:=ma(c,10);
variable:a1=0,b1=0;

if cross(ma5,ma10) and b1=0 then begin
buy(holding=0,1,market);
b1:=1;
end
//5日均线上穿10日的时候开仓

if c>=AVGENTERPRICE*1.05 then sell(holding>0,0,market);//上涨5%后平仓,也就是现价是持仓均价的1.05%时平仓

if openprofit<0 and cross(ma5,ma10) and holding>0 and b1=1 then begin

 buy(1,1,market);
 a1:=a1+1;
end //当亏损的时候持有接着补,记录补仓次数

s1:=numtostr(a1,1);
msgout(islastbar and holding<>ref(holding,1)  ,s1);

 

发现少了几句,开头少了。。。