咨詢內(nèi)容:請(qǐng)問:想分時(shí)段統(tǒng)計(jì)品種振幅,然后把他綜合輸出成一個(gè)指標(biāo),可是無法實(shí)現(xiàn)。aa:VALUEWHEN(todaybar=1,time),nodraw;xx:SUMBARS(time<OPENTIME(2),1)-1,nodraw;zz:sumbars(time<opentime(4),1)-1,nodraw;yy:TODAYBAR,nodraw; if aa>OPENTIME(2) then BEGIN??bb:=yy,nodraw;??endelse BEGIN?bb:=xx,nodraw;endcc:=bb;//日盤K線數(shù)目dd:=zz;//午盤K線數(shù)目ee:=yy;//夜盤K線數(shù)目早盤振幅:(HHV(H,cc)-LLV(L,cc))/REF(C,yy)*100,nodraw;午盤振幅:(HHV(H,dd)-LLV(L,dd))/REF(C,yy)*100,nodraw;夜盤振幅:(HHV(H,ee)-LLV(L,ee))/REF(C,yy)*100,nodraw;fs:=valuewhen((time>opentime(2) and time<opentime(4)),早盤振幅);fs:=valuewhen((time>opentime(4) and time<opentime(1)),午盤振幅);fs:=valuewhen((time>opentime(1) and time<opentime(2)),夜盤振幅); 分時(shí)段振幅:fs; 請(qǐng)幫忙修改
IsNight:=OPENTIME(1)>40000;//判斷是否有夜盤 ,有夜盤返回0,沒有夜盤返回1 d:=STRLEFT(NUMTOSTR(time,0),2);//截取K線字符串前2位 cd1:d='13' and not(ref(d='13',1)) and time>=130000;//白盤開盤位置 cd2:d='17';//下午盤開盤位置判斷 cd3:ref(time,1)=CLOSETIME(4) and time<130000;//夜盤開盤位置判斷
Len:=BARSLAST(cd1 or cd2 or cd3)+1;//最近一個(gè)開盤節(jié)點(diǎn)的距離