全部 智大领峰 TBQuant功能 TBL语言 TB开户 问答专区 高手圈 其他
AVPRICE 取得K线图的均价
2024-05-06 10:23

Params

Numeric LOTS(1);

Vars


NumericSeries MA3;

NumericSeries MA4;

NumericSeries MA5;

NumericSeries MA6;

NumericSeries VAR1;

NumericSeries VAR2;

NumericSeries VAR3;

NumericSeries VAR4;

NumericSeries VAR5;

NumericSeries RSV;

NumericSeries FASTK;

NumericSeries K1;

NumericSeries D1;

NumericSeries AA1;

Begin


MA3=Average(Close,20);

MA4=Average(Close,40);

MA5=Average(Close,120);

MA6=Average(Close,240);

PlotNumeric(\"MA3\",MA3);

PlotNumeric(\"MA4\",MA4);

PlotNumeric(\"MA5\",MA5);

PlotNumeric(\"MA6\",MA6);

VAR1=(2*CLOSE+HIGH+LOW)/4;

VAR2=LowestFC(LOW,26);

VAR3=HighestFC(HIGH,26);

VAR4=XAverage((VAR1-VAR2)/(VAR3-VAR2)*100,26);

VAR5=XAverage(0.667*VAR4[1]+0.333*VAR4,4);

RSV= (CLOSE-LowestFC(LOW,120))/(HighestFC(HIGH,120)-LowestFC(LOW,120))*100;

FASTK=SMA(RSV,30,1);

K1=SMA(FASTK,10,1);

D1=SMA(K1,10,1);

AA1=K1-K1[2];

//系统出场

//系统出场

If(marketposition == 1  And  L<MA4 And VAR4<VAR5)

{

Sell(LOTS,Open);

}

If(marketposition == -1 And  H>MA4 And VAR4>VAR5)

{

BuyToCover(LOTS,Open);

}

//系统入场

If(Marketposition == 0 And Currentbar >= 100)  

{

If( H>MA5  And AA1>0 And VAR4>VAR5 )

{

Buy(LOTS,Open);

}

}

If(Marketposition == 0 And Currentbar >= 100) {

If( L<MA5  And AA1<0 And VAR4<VAR5 )

{

SellShort(LOTS,Open);

}

}

End

老师。测试通不过请帮助


kyover

什么测试不通过?

你这个代码编译没什么问题

另外现在基本不用旗舰版了,你这个是旗舰版语法。建议直接用quant

2024-05-06 10:49
您未登录,请先 登录注册 后发表评论
顶部