- 精华
- 0
- 在线时间
- 41 小时
- UID
- 171598
- 积分
- 10
- 帖子
- 7
- 阅读权限
- 10
- 注册时间
- 1970-1-1
- 最后登录
- 2019-7-8
- 精华
- 0
- UID
- 171598
- 积分
- 10
- 帖子
- 7
- 主题
- 3
- 阅读权限
- 10
- 注册时间
- 1970-1-1
- 最后登录
- 2019-7-8
|
发表于 2017-6-26 16:21:16
|显示全部楼层
Params
Numeric Length1(20);
Numeric L1(10);
Numeric L2(2.5);
Numeric Lots(1);
Vars
NumericSeries AvgValue1;
NumericSeries HHLL;
NumericSeries Highest_entry;
NumericSeries Lowest_entry;
BoolSeries Con1;
BoolSeries Con2;
BoolSeries Con3;
BoolSeries Con4;
BoolSeries Con5;
BoolSeries Con6;
Begin
If(!CallAuctionFilter()) Return;
AvgValue1 = (C[1]+H[1]+L[1]+O[1])/4;
HHLL= Highest(High[1],L1) - Lowest(Low[1],L1);
If(BarsSinceEntry<=1){
Highest_entry = Max(High,High[1]);
Lowest_entry = Min(Low,Low[1]);
}
Else{
If(High>Highest_entry) Highest_entry = High;
Else Highest_entry = Highest_entry[1];
If(Low<Lowest_entry) Lowest_entry=Low;
Else Lowest_entry =Lowest_entry[1];
}
Con1 = AvgValue1>=Highest(AvgValue1,Length1) && C[1]>C[2] && C[2]>C[3];
Con2 = AvgValue1<= Lowest(AvgValue1,Length1) && C[1]<C[2] && C[2]<C[3];
Con3 = AvgValue1>=Highest(AvgValue1,Length1) && C[1]>C[2];
Con4 = AvgValue1<= Lowest(AvgValue1,Length1) && C[1]<C[2];
Con5 = C[1]<=LastEntryPrice - HHLL[1] || C[1] <= Highest_entry - L2*HHLL[1];
Con6 = C[1]>=LastEntryPrice + HHLL[1] || C[1] >= Lowest_entry + L2*HHLL[1];
//---------------------------------------------------------------
If(MarketPosition==0 And CurrentBar>60)
{
If(Con1 And Vol>0 And !Con2)
{
Buy(lots, Open);
Return;
}
If(Con2 And Vol>0 And !Con1)
{
SellShort(lots,Open);
Return;
}
}
//---------------------------------------------------------------
If(MarketPosition == -1)
{
If(BarsSinceEntry>0 And Vol>0 And (Con1 Or Con3 Or Con6))
{
BuyToCover(lots,Open);
Commentary("平空");
Return;
}
}
If(MarketPosition == 1)
{
If(BarsSinceEntry>0 And Vol>0 And (Con2 Or Con4 Or Con5))
{
Sell(lots,Open);
Commentary("平多");
Return;
}
}
End |
|