- 精华
- 0
- 在线时间
- 15 小时
- UID
- 274935
- 积分
- 11
- 帖子
- 7
- 阅读权限
- 10
- 注册时间
- 2019-1-19
- 最后登录
- 2021-5-20
- 精华
- 0
- UID
- 274935
- 积分
- 11
- 帖子
- 7
- 主题
- 0
- 阅读权限
- 10
- 注册时间
- 2019-1-19
- 最后登录
- 2021-5-20
|
本帖最后由 t0818h0158q 于 2019-3-10 14:29 编辑
//------------------------------------------------------------------------
// 简称: TB100013
// 名称: 练习3
// 类别: 公式应用
// 类型: 用户应用
// 输出: Void
//------------------------------------------------------------------------
Params
Numeric Length1(5);
Numeric Length2(10);
Numeric Length3(15);
Numeric Length4(20);
Numeric Length5(25);
Numeric Length6(30);
Numeric Length7(35);
Numeric Length8(40);
Numeric Length9(45);
Numeric Length10(50);
Numeric Length11(55);
Numeric Length12(60);
Numeric Lots(1);
Vars
NumericSeries MA1;
NumericSeries MA2;
NumericSeries MA3;
NumericSeries MA4;
NumericSeries MA5;
NumericSeries MA6;
NumericSeries MA7;
NumericSeries MA8;
NumericSeries MA9;
NumericSeries MA10;
NumericSeries MA11;
NumericSeries MA12;
BoolSeries BuyEntry(False);
BoolSeries SellEntry(False);
Begin
//过滤集合竞价
If(BarType==1 && BarStatus==2 && (Time==0.210000||Time==0.090000) && High==Low) return; //分钟周期过滤集合竞价
If(BarType!=1 && !CallAuctionFilter()) return; //其他周期的过滤集合竞价
//MA
MA1 = AverageFC(Close,Length1);
MA2 = AverageFC(Close,Length2);
MA3 = AverageFC(Close,Length3);
MA4 = AverageFC(Close,Length4);
MA5 = AverageFC(Close,Length5);
MA6 = AverageFC(Close,Length6);
MA7 = AverageFC(Close,Length7);
MA8 = AverageFC(Close,Length8);
MA9 = AverageFC(Close,Length9);
MA10 = AverageFC(Close,Length10);
MA11 = AverageFC(Close,Length11);
MA12 = AverageFC(Close,Length12);
PlotNumeric("MA1",MA1);
PlotNumeric("MA2",MA2);
PlotNumeric("MA3",MA3);
PlotNumeric("MA4",MA4);
PlotNumeric("MA5",MA5);
PlotNumeric("MA6",MA6);
PlotNumeric("MA7",MA7);
PlotNumeric("MA8",MA8);
PlotNumeric("MA9",MA9);
PlotNumeric("MA10",MA10);
PlotNumeric("MA11",MA11);
PlotNumeric("MA12",MA12);
//开平仓条件
BuyEntry = MA1[1] > MA2[1] and MA2[1] > MA3[1] and MA3[1] > MA4[1] and MA4[1] > MA5[1] and MA5[1] > MA6[1] and MA6[1] > MA7[1] and MA7[1] > MA8[1] and MA8[1] > MA9[1] and MA9[1] > MA10[1] and MA10[1] > MA11[1] and MA11[1] >MA12[1] ;
SellEntry = MA1[1] < MA2[1] and MA2[1] < MA3[1] and MA3[1] < MA4[1] and MA4[1] < MA5[1] and MA5[1] < MA6[1] and MA6[1] < MA7[1] and MA7[1] < MA8[1] and MA8[1] < MA9[1] and MA9[1] < MA10[1] and MA10[1] < MA11[1] and MA11[1] <MA12[1] ;
//程序主体
If(MarketPosition== 0 and BuyEntry )
{
Buy(Lots,Open);
Commentary("开多");
}
If(MarketPosition==0 and SellEntry )
{
SellShort(Lots,Open);
Commentary("开空");
}
If(MarketPosition==1 AND SellEntry )
{
Sell(0,Open);
Commentary("平多");
}
If(MarketPosition==-1 and BuyEntry )
{
BuyToCover(0,Open);
Commentary("平空");
}
End
//------------------------------------------------------------------------
// 编译版本: 2019/03/10 131716
// 内核版本: V2.8.2.14
// 版权所有 T0818H0158Q
// 更改声明 TradeBlazer Software保留对TradeBlazer平台
// 每一版本的TradeBlazer公式修改和重写的权利
//------------------------------------------------------------------------ |
|