- 精华
- 0
- 在线时间
- 46 小时
- UID
- 4284
- 积分
- 174
- 帖子
- 36
- 阅读权限
- 40
- 注册时间
- 2009-5-2
- 最后登录
- 2013-3-16
- 精华
- 0
- UID
- 4284
- 积分
- 174
- 帖子
- 36
- 主题
- 2
- 阅读权限
- 40
- 注册时间
- 2009-5-2
- 最后登录
- 2013-3-16
|
谢谢!在nopain的指导下,终于看到了交易指令。
现在把改好的公式贴出来。
Params
numeric Length(30);
Vars
NumericSeries OBVValue;
NumericSeries highestValue(0);
NumericSeries LowestValue(999999);
Numeric i;
Numeric Maxlimit;
NumericSeries prehh;
NumericSeries prell;
Begin
If(CurrentBar == 0)
{
OBVValue = 0;
}Else
{
If(Close>Close[1])
{
OBVValue = OBVValue[1]+Vol;
}Else If(Close<Close[1])
{
OBVValue = OBVValue[1]-Vol;
}Else
{
OBVValue = OBVValue[1];
}
}
Maxlimit = Min(Length-1,CurrentBar);
for i=0 to Maxlimit
{
highestValue=Max(highestValue,ObvValue);
}
Maxlimit = Min(Length-1,CurrentBar);
for i=0 to Maxlimit
{
LowestValue=Min(LowestValue,obvvalue);
}
prehh=highestValue[1];
prell=LowestValue[1];
If( Crosshigh(obvValue,prehh))
{
Buy(1,NextOpen,True);
}
if(CrossUnder(prell,obvvalue))
{
Sell(1,NextOpen,True); // 空头建仓
}
if(CrossUnder(prell,obvvalue))
{
SellShort(1,NextOpen,True); // 空头建仓
}
if(CrossOver(obvValue,prehh))
{
BuyToCover(1,NextOpen,True); // 多头建仓-
}
//FileAppend("d:\\b.log",Text(highestvalue));
//FileAppend("d:\\b.log",Text(Lowestvalue));
End |
|