Rss & SiteMap

金字塔客服中心 - 专业程序化交易软件提供商 http://www.weistock.com/bbs/

专业程序化软件提供商
共5 条记录, 每页显示 10 条, 页签: [1]
[浏览完整版]

标题:不会玩啊

1楼
北极熊 发表于:2011/4/14 14:15:07

 

各位老师请教了:文华刚转到金字塔玩不转啊,(头寸函数和全局变量)

目的:当日亏损达到某数目(1000)停止交易。想通过下面小程序学习TACCOUNT函数和全局变量的使用:variable:t=0;
tt:=taccount(4)+taccount(30)<=-1000;
a:=ma(c,3);
sj:=time>009000 and time <145500;
if c>=a and t=1 and sj then
    begin
 buy(holding=0,1,market);
 end
if c<a then
 begin
 sell(1,0,market);
 end
if tt then
 begin
 sell(holding>0,0,market);
 t:=1;
 end 
if time=closetime(0) then
  begin
 sell(holding>0,0,market);
 t:=0;
 end

当全局变量为1时,照样开仓,当亏损达到一定数时,只出现平仓信号,但是不发指令。

2楼
北极熊 发表于:2011/4/14 14:20:13

应当是

if c>=a and t=0 and sj 在开仓,上面写成了t=1了。更正

3楼
fly 发表于:2011/4/14 15:06:11
不要在图表程序化交易中,把taccount做开/平仓条件
4楼
北极熊 发表于:2011/4/14 15:41:51

 

日内累计亏损,上次董小球老师让我用TACCOUNT(4)http://www.weistock.com/bbs/dispbbs.asp?boardid=4&Id=5861,这次fly老师建议我图表交易不用,我初学搞不明白,金字塔有没有各个函数文字说明我们初学者好学习呀

5楼
阿火 发表于:2011/4/14 16:11:34

你的目的无须用到taccount函数

用全局变量即可

variable:kuisun=0;//该变量记录亏损

entertime:=time<closetime(0);

buycond:=ref(c>o,1) and c>o;

sellcond:=reef(c<o,1) and c<o;

 

if holding>0 and sellcond then begin

  kuisun:=kuisun+min(0,c-enterprice);//平仓之后,把盈亏点数累加到变量kuisun上

  sell(1,1,limitr,c);

end

 

if holding<0 and buycond then begin

  kuisun:=kuisun+min(o,enterprice-c););//平仓之后,把盈亏点数累加到变量kuisun上

  sellshort(1,1,limitr,c);

end

 

if holding=0 and entertime and kuisun<100 and buycond then buy(1,1,limitr,c);

 

if holding=0 and entertime and kuisun<100 and sellcond then buyshort(1,1,limitr,c);

 

//收盘平仓

if time=closetime(0) then begin

  sell(holding>0,1,limitr,o);

  sellshort(holding<0,1,limitr,o);

  kuisun:=0;  //收盘时,要亏损这个变量重新 归零

end

共5 条记录, 每页显示 10 条, 页签: [1]


Powered By Dvbbs Version 8.3.0
Processed in 0.02930 s, 3 queries.