- 精华
- 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
|
Params
numeric Length(30);
Vars
NumericSeries OBVValue;
NumericSeries highestValue(0);
NumericSeries LowestValue(999999);
Numeric i;
Numeric Maxlimit;
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);
}
If( CrossOver(obvValue,highestValue[1]))
{
Buy(1,NextOpen,True);
}
if(CrossUnder(LowestValue[1],obvvalue))
{
Sell(1,NextOpen,True); // 空头建仓
}
if(CrossUnder(LowestValue[1],obvvalue))
{
SellShort(1,NextOpen,True); // 空头建仓
}
if(CrossOver(obvValue,highestValue[1]))
{
BuyToCover(1,NextOpen,True); // 多头建仓
}
//FileAppend("d:\\b.log",Text(highestvalue));
//FileAppend("d:\\b.log",Text(Lowestvalue));
End
取得了阶段性进步,感觉区间的OBV最大值和最小值是正确的,我用
//FileAppend("d:\\b.log",Text(highestvalue));
//FileAppend("d:\\b.log",Text(Lowestvalue));
测试过的,
问题是怎么没有下蛋的成果。
有点困惑。
请大家帮忙指点下,看问题在哪里!
[ 本帖最后由 深蓝魔力 于 2009-7-10 20:43 编辑 ] |
|