请教!这样编写有什么问题吗?非常感谢!
ParamsNumeric 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+H+L+O)/4;
HHLL= Highest(High,L1) - Lowest(Low,L1);
If(BarsSinceEntry<=1){
Highest_entry = Max(High,High);
Lowest_entry = Min(Low,Low);
}
Else{
If(High>Highest_entry) Highest_entry = High;
Else Highest_entry = Highest_entry;
If(Low<Lowest_entry) Lowest_entry=Low;
Else Lowest_entry =Lowest_entry;
}
Con1 = AvgValue1>=Highest(AvgValue1,Length1) && C>C && C>C;
Con2 = AvgValue1<= Lowest(AvgValue1,Length1) && C<C && C<C;
Con3 = AvgValue1>=Highest(AvgValue1,Length1) && C>C;
Con4 = AvgValue1<= Lowest(AvgValue1,Length1) && C<C;
Con5 = C<=LastEntryPrice - HHLL || C <= Highest_entry - L2*HHLL;
Con6 = C>=LastEntryPrice + HHLL || C >= Lowest_entry + L2*HHLL;
//---------------------------------------------------------------
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
页:
[1]