- 精华
- 0
- 在线时间
- 210 小时
- UID
- 6058
- 积分
- 755
- 帖子
- 143
- 阅读权限
- 60
- 注册时间
- 2009-12-3
- 最后登录
- 2021-8-16
- 精华
- 0
- UID
- 6058
- 积分
- 755
- 帖子
- 143
- 主题
- 56
- 阅读权限
- 60
- 注册时间
- 2009-12-3
- 最后登录
- 2021-8-16
|
这是最简单的均线系统了 这个代码今天有信号的 但模拟交易没有发出指令 我输出liang变量 是正常的 不知道什么原因 请各位高手指导一下
Params
Numeric a(5);
Numeric b(10);
Vars
NumericSeries ma1;
NumericSeries ma2;
NumericSeries md;
NumericSeries mk;
NumericSeries liang;
Begin
md=A_BuyPosition;
mk=A_SellPosition;
liang=IntPart(A_CurrentEquity/(c*0.13*10)*0.4);
Commentary(text(liang));
ma1=Average(c,a);
ma2=Average(c,b);
if(ma1>ma2)
{
BuyToCover(mk,nextopen,true);
Buy(liang,nextopen,true);
}
if(ma2>ma1)
{
sell(md,nextopen,true);
SellShort(liang,nextopen,true);
}
End |
|