- 精华
- 0
- 在线时间
- 9 小时
- UID
- 243364
- 积分
- 16
- 帖子
- 8
- 阅读权限
- 10
- 注册时间
- 2016-11-19
- 最后登录
- 2021-8-31
- 精华
- 0
- UID
- 243364
- 积分
- 16
- 帖子
- 8
- 主题
- 4
- 阅读权限
- 10
- 注册时间
- 2016-11-19
- 最后登录
- 2021-8-31
|
加载后刚开始一切正常,随着不断切换周期逐渐开始死机。
Params
Numeric FastLength(5); //短周期参数
Numeric N(2); //止赢跳数
Numeric L(1); //止损跳数
Vars
Numeric MinPoint; //最小变动单位
NumericSeries AvgValue; //移动平均
NumericSeries myEntryPrice; //开仓价格
NumericSeries myLastPrice; //我的最新价
Numeric i; //循环参数
Begin
If(!CallAuctionFilter()) Return; //集合竞价过滤
MinPoint = MinMove*PriceScale;
AvgValue = AverageFC(Close,FastLength);
If(BarStatus == 2&&High >= AvgValue[1])
{ For i = 0 to 1;
Buy(1,High);
myEntryPrice = High;
myLastPrice = myEntryPrice + N*MinPoint;
i = i+1;
SetGlobalVar(0,myLastPrice);
myLastPrice = GetGlobalVar(0);
If(MarketPosition == 1)
{If( Close >= myLastPrice or Close <= myEntryPrice - L*MinPoint);
{
Sell(1,Close);
}
}
}
While (BarStatus == 2 && High >= myLastPrice + MinPoint)
{ If(MarketPosition == 0 && Close >= myLastPrice)
{ Buy(1, Close);
myEntryPrice = Close;
myLastPrice = myEntryPrice + N*MinPoint;
SetGlobalVar(0, myLastPrice);
}
If(Close >= myLastPrice or Close <= myEntryPrice - L*MinPoint);
{
Sell(1,Close);
}
}
If(BarStatus == 2 && Low <= AvgValue[1]-3*MinPoint)
{ For i = 0 to 1;
SellShort(1,Low);
myEntryPrice = Low;
myLastPrice = myEntryPrice - N*MinPoint;
i = i+1;
SetGlobalVar(1,myLastPrice);
myLastPrice = GetGlobalVar(1);
If(MarketPosition == -1)
{If( Close <= myLastPrice or Close >= myEntryPrice + L*MinPoint);
{
BuyToCover(1,Close);
}
}
}
While (BarStatus == 2 && Low <= myLastPrice - MinPoint)
{ If(MarketPosition == 0 && Close <= myLastPrice)
{ SellShort(1, Close);
myEntryPrice = Close;
myLastPrice = myEntryPrice - N*MinPoint;
SetGlobalVar(1, myLastPrice);
}
If(Close <= myLastPrice or Close >= myEntryPrice + L*MinPoint);
{
BuyToCover(1,Close);
}
}
End
|
|