- 精华
- 0
- 在线时间
- 63 小时
- UID
- 275910
- 积分
- 54
- 帖子
- 34
- 阅读权限
- 30
- 注册时间
- 2019-2-22
- 最后登录
- 2020-4-7
- 精华
- 0
- UID
- 275910
- 积分
- 54
- 帖子
- 34
- 主题
- 16
- 阅读权限
- 30
- 注册时间
- 2019-2-22
- 最后登录
- 2020-4-7
|
Params
Numeric n1(10);
Numeric n2(20);
Vars
NumericSeries ma1;
NumericSeries ma2;
BoolSeries golden;//金叉
BoolSeries ending;//死叉
numeric myhigh;
numeric mylow;
Begin
ma1 = Average(c,n1);
ma2 = Average(c,n2);
golden = CrossOver(ma1,ma2);
//ending = CrossOver(ma2,ma1);
ending = CrossOver(ma1,ma2);
myhigh = highest(h,10);
mylow = lowest(l,10);
/* If(golden[1])
{
Buy(0,o);
}
Else If(ending[1])
{
SellShort(0,o);
} */
If(ma1 != 0)
PlotNumeric("MA_1",ma1);//连线显示
If(ma2 != 0)
PlotNumeric("MA_2",ma2);
/* If(ma1>ma2)
{ PlotNumeric("MA1",ma1,ma2);}//柱状图显示,从ma1画到ma2
If(ma1<ma2)
{ PlotNumeric("MA2",ma2,ma1);} */
If(golden == true)
{
Buy(1,o);
If(MarketPosition == 1 && low <= mylow)
{
sell(1,mylow-minmove*pricescale);
}
}
If(ending == true)
{
SellShort(1,o);
If(MarketPosition == -1 && high >= myhigh)
{
BuyToCover(1,myhigh+minmove*pricescale);
}
}
End |
附件: 你需要登录才可以下载或查看附件。没有帐号?注册
|