Rss & SiteMap

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

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

标题:怎么控制加仓次数

1楼
ericsun1981 发表于:2012/9/9 9:53:03
if long  and cc<=3  then
begin
buy(holding>= 0 , 45%,thisclose);
cc:=cc+1;
end

if LONGSELL then
begin
sell(holding > 0, 0,thisclose);
cc:=0;
end

用CC变量控制加仓次数,好像不能控制,想知道怎么控制加仓次数
2楼
admin 发表于:2012/9/9 19:12:44

将代码发全,我们帮你看看

3楼
董小球 发表于:2012/9/10 9:18:57
用这种普通的变量作为计数是不行的,你要用全局变量才可以,看看下面网址:
http://www.weistock.com/WeisoftHelp/zbgs003.htm
4楼
ericsun1981 发表于:2012/9/10 11:24:22

//画出多头的止损线
partline(holding>0,LL,colorred);
LONGSELL:=C<LL;
if LONGSELL then
begin
sell(holding > 0, 0,thisclose);
cc:=0;
end

DRAWnumber(c>0,c*1.001,cc,0);
//建立多头的进场条件
long :=c>upperband and time>N and time<143000 ;
if long  and cc<=3  then
begin
buy(holding>= 0 , 45%,thisclose);
cc:=cc+1;
end

//画出空头的止损线
partline(holding<0, HH, colorgreen);
SHORTSELL:=C>HH;
if SHORTSELL  then
begin
sellSHORT(holding < 0, 0,thisclose);
dd:=0;
end
DRAWnumber(c>0,c*1.002,dd,0);
//开空条件
short :=c<lowerband and time > N and time <143000;
if short  and dd<=3  then
begin
buyshort(holding <= 0 , 45%, thisclose);
dd:=dd+1;
end
好了,开空和开多分别用CC和DD控制就可以了,如果开空和开多都用CC控制,就会出现问题。
5楼
ericsun1981 发表于:2012/9/10 11:36:30
都用CC控制的时候,把HOLDING条件提上来也没有问题的。
是我模型中开多的时候,平空条件满足了,把CC赋值0的缘故。

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


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