- 精华
- 0
- 在线时间
- 840 小时
- UID
- 2688
- 积分
- 1440
- 帖子
- 33
- 阅读权限
- 60
- 注册时间
- 2008-10-30
- 最后登录
- 2019-3-30
- 精华
- 0
- UID
- 2688
- 积分
- 1440
- 帖子
- 33
- 主题
- 11
- 阅读权限
- 60
- 注册时间
- 2008-10-30
- 最后登录
- 2019-3-30
|
代码如下:
If(maxhigh!=InvalidNumeric) maxhigh=max(high,maxhigh[1]);
If(minlow!=InvalidNumeric) minlow=min(low,minlow[1]);
Commentary("开仓后最高"+text(maxhigh));
Commentary("开仓后最低"+text(minlow));
If(CrossOver(High,longline) And MarketPosition<=0)
{
Buy(alots*TN,longline+3);
maxhigh=high;
minlow=InvalidNumeric;
}
If(CrossUnder(Low,shortline) And MarketPosition>=0)
{
SellShort(alots*TN,shortline-3);
maxhigh=InvalidNumeric;
minlow=Low;
}
目的是做开仓后记录达到的最高价(多单)、最低价(空单),然后做回落跟踪止损。
现在发现交易指令发出正常,做多时最高价(maxhigh)正常,但做空时最低价(minlow)始终是N/A无效值。
请帮我查一下原因,谢谢! |
|