- 精华
- 0
- 在线时间
- 80 小时
- UID
- 1656
- 积分
- 273
- 帖子
- 36
- 阅读权限
- 50
- 注册时间
- 2008-5-24
- 最后登录
- 2019-3-31
- 精华
- 0
- UID
- 1656
- 积分
- 273
- 帖子
- 36
- 主题
- 14
- 阅读权限
- 50
- 注册时间
- 2008-5-24
- 最后登录
- 2019-3-31
|
运用pivot函数还是没有得出正确的效果,请问应如何修改?
Vars
Bool aa1;
Bool aa2;
Bool aa3;
Bool bb1;
Bool bb2;
Bool bb3;
NumericSeries highbar;
NumericSeries hhigh;
NumericSeries risepercent;
NumericSeries risetime;
NumericSeries lowbar;
NumericSeries llow;
NumericSeries droppercent;
NumericSeries droptime;
NumericSeries Abar;
NumericSeries bbar;
NumericSeries length;
Numeric i;
Numeric onoff;
Numeric pivotprice;
Numeric pivotbar;
Begin
aa1=High>High[1] And Low>Low[1];
aa2=High[1]>High[2] And Low[1]>Low[2];
aa3=High[2]>High[3] And Low[2]>Low[3];
bb1=High<High[1] And Low<Low[1];
bb2=High[1]<High[2] And Low[1]<Low[2];
bb3=High[2]<High[3] And Low[2]<Low[3];
If(CurrentBar==0) //起始BAR下给一些变量赋值
{
hhigh=High;
lLow=Low;
highbar=0;
lowbar=0;
onoff=0;
}
Else
If(onoff<>1) //起始或连跌三日情况下
{
If(aa1 And aa2 And aa3) //连涨三日
{
abar=CurrentBar; //至些日(A点)的索引值
length=abar-highbar; //A、highbar点间的天数
For i=0 To length //取A、highbar间的低点及其索引和波动幅度
{
If(lLow>=Low)
{
lLow=Low; //低点低价
i; //A、低点间的素引差
}
}
Pivot(low,length,length-i,i,1,-1,Pivotprice,pivotbar); //转折低点
lowbar=pivotbar; //低点素引
droppercent=Round((hhigh-llow)/hhigh*100,2); //下跌幅度
droptime=lowbar-highbar; //下跌时间
onoff=1; //状态赋值
}
}
If(onoff<>-1) //初始或连涨三日状态成立
{
If(bb1 And bb2 And bb3) //连跌三日
{
bbar=CurrentBar; //些日(B点)的索引值
length=bbar-lowbar; //B、lowbar点的天数
For i=0 To length //取B、lowbar间的高点及其索引和波动幅度
{
If(hhigh<=High)
{
hhigh=High; //高点高价
i; //B、高点间索引差
}
Pivot(High,length,length-i,i,1,1,pivotprice,pivotbar); //转折高点
highbar=pivotbar; //高点索引
risepercent=Round((hhigh-llow)/llow*100,2); //涨幅
risetime=highbar-lowbar; //涨时
onoff=-1; //状态赋值
}
}
}
End |
|