- 精华
- 0
- 在线时间
- 481 小时
- UID
- 175193
- 积分
- 122
- 帖子
- 90
- 阅读权限
- 40
- 注册时间
- 2013-11-6
- 最后登录
- 2023-8-13
- 精华
- 0
- UID
- 175193
- 积分
- 122
- 帖子
- 90
- 主题
- 22
- 阅读权限
- 40
- 注册时间
- 2013-11-6
- 最后登录
- 2023-8-13
|
if(反手条件)
{
If(marketposition == -1 )
{
If( BarStatus != 2) // 持空仓且 Bar 不是实时行情,平空仓,买多仓
{
Buy(1,Open+i_offset);
Return;
}
else// 持空仓,Bar实时行情,平空仓,通过TickCounter计数,延迟反手
{
BuyToCover(1,Max(Open,High)+i_offset);
If(TickCounter == 0)
{
TickCounter = 1;
}Else If(TickCounter < DelayTicks )
{
TickCounter = TickCounter + 1;
}Else
{
Buy(1,max(Open,High)+i_offset);
}
Return;
}
}
If(marketposition == 1 )
{
If( BarStatus != 2) // 持多仓且 Bar 不是实时行情,平多仓,买空仓
{
SellShort(1,Open-i_offset);
Return;
}
else
{
Sell(1,Min(open,Low)-i_offset);
If(TickCounter == 0)
{
TickCounter = 1;
}Else If(TickCounter < DelayTicks)
{
TickCounter = TickCounter + 1;
}Else
{
SellShort(1,min(Open,low)-i_offset);
}
Return;
}
SetGlobalVar(3,LastBarTime);
SetGlobalVar(4,TickCounter);
}
}
Commentary("LastBarTime: "+Text(GetGlobalVar(3)));
Commentary("tickcounter: "+Text(GetGlobalVar(4)));
这里的tickcounter 不是5 呀?
|
|