WJTIME:=timetot0(opentime(0))-timetot0(closetime(1)),linethick0;
QTRADETIME:=timetot0(closetime(0))-timetot0(opentime(1))-WJTIME,linethick0;
if dynainfo(207)>opentime(1)and dynainfo(207)<=closetime(0)then TRADETIME:=timetot0(dynainfo(207))-timetot0(opentime(1)),linethick0;
if dynainfo(207)>opentime(1)and dynainfo(207)<=closetime(1)then IFTRADETIME:=TRADETIME;
if dynainfo(207)>=opentime(0)and dynainfo(207)<=closetime(0) then IFTRADETIME:=TRADETIME-WJTIME;
显示IFTRADETIME:IFTRADETIME,linethick0;
交易时间:dynainfo(207),linethick0;
IFVOL:QTRADETIME/IFTRADETIME*VOL,PRECISION1;
STICKLINE(Close-ref(close,1)>=0,0,IFVOL,10,1),COLORRED;
STICKLINE(Close-ref(close,1)<0,0,IFVOL,10,0),ColorCyan;
另外还发现历史的被校正的成交量Ifvol在交易时间也会变的!要使历史的ifvol与常规的成交易量vol一样不变,请问老师上述公式该怎样修改?(是日K线上的公式)。
WJTIME:=timetot0(opentime(0))-timetot0(closetime(1)),linethick0;
QTRADETIME:=timetot0(closetime(0))-timetot0(opentime(1))-WJTIME,linethick0;
if dynainfo(207)>opentime(1)and dynainfo(207)<=closetime(0)then TRADETIME:=timetot0(dynainfo(207))-timetot0(opentime(1)),linethick0;
if dynainfo(207)>opentime(1)and dynainfo(207)<=closetime(1)then IFTRADETIME:=TRADETIME;
if dynainfo(207)>=opentime(0)and dynainfo(207)<=closetime(0) then IFTRADETIME:=TRADETIME-WJTIME;
显示IFTRADETIME:IFTRADETIME,linethick0;
交易时间:dynainfo(207),linethick0;
IFVOL:QTRADETIME/IFTRADETIME*VOL,PRECISION1;
STICKLINE(islastbar and Close-ref(close,1)>=0,0,IFVOL,10,1),COLORRED;
STICKLINE(islastbar and Close-ref(close,1)<0,0,IFVOL,10,0),ColorCyan;
STICKLINE(not(islastbar) and Close-ref(close,1)>=0,0,vOL,10,1),COLORRED;
STICKLINE(not(islastbar) and Close-ref(close,1)<0,0,VOL,10,0),ColorCyan;
这个就是开盘前历史k线是历史VOL,开盘后的vol按照既定的代码算
WJTIME:=timetot0(opentime(0))-timetot0(closetime(1)),linethick0;
QTRADETIME:=timetot0(closetime(0))-timetot0(opentime(1))-WJTIME,linethick0;
if dynainfo(207)>opentime(1)and dynainfo(207)<=closetime(0)then TRADETIME:=timetot0(dynainfo(207))-timetot0(opentime(1)),linethick0;
if dynainfo(207)>opentime(1)and dynainfo(207)<=closetime(1)then IFTRADETIME:=TRADETIME;
if dynainfo(207)>=opentime(0)and dynainfo(207)<=closetime(0) then IFTRADETIME:=TRADETIME-WJTIME;
显示IFTRADETIME:IFTRADETIME,linethick0;
交易时间:dynainfo(207),linethick0;
IFVOL:QTRADETIME/IFTRADETIME*VOL,PRECISION1;
STICKLINE(islastbar and Close-ref(close,1)>=0,0,IFVOL,10,1),COLORRED;
STICKLINE(islastbar and Close-ref(close,1)<0,0,IFVOL,10,0),ColorCyan;
STICKLINE(not(islastbar) and Close-ref(close,1)>=0,0,vOL,10,1),COLORRED;
STICKLINE(not(islastbar) and Close-ref(close,1)<0,0,VOL,10,0),ColorCyan;
这个就是开盘前历史k线是历史VOL,开盘后的vol按照既定的代码算
您的这段代码是用在日K线上的吗?
dynainfo(207)是只在最后一根K线上有效的
因:dynainfo(207)是只在最后一根K线上有效
重点处理最后一根K线和非最后一根K线
以下为修改后代码,你试试吧
wjtime:=timetot0(opentime(2))-timetot0(closetime(1));//第一节休盘时间秒数
qtradetime:=timetot0(closetime(0))-timetot0(opentime(1))-wjtime;//一天的交易时间秒数
//如果是历史k线,则交易时间就固定了
if not(islastbar) then iftradetime:=qtradetime;
//处理如果是最后一根k线但第二天没开盘(新的一根k线又没生成)的情况,此时最后一根k线的交易时间也已固定
if islastbar and dynainfo(207)<opentime(1) then iftradetime:=qtradetime;
//以下重点处理,最后一根k线,且已开盘(交易所已有数据)的情况
//如果交易时间大于第一节开盘时间91500,小于第1节收盘时间113000
if islastbar and dynainfo(207)>opentime(1) and dynainfo(207)<=closetime(1)
then iftradetime:=timetot0(dynainfo(207))-timetot0(opentime(1));//开盘后交易秒数
//如果交易时间大于第二节开盘时间130000,小于最后一节收盘时间151500
if islastbar and dynainfo(207)>=opentime(2) and dynainfo(207)<=closetime(0)
then iftradetime:=timetot0(dynainfo(207))-timetot0(opentime(1))-wjtime;//开盘后交易秒数
ifvol:qtradetime/iftradetime*vol,precision1;
stickline(close-ref(close,1)>=0,0,ifvol,10,1),colorred;
stickline(close-ref(close,1)<0,0,ifvol,10,0),colorcyan;