MS1:=BACKSET(BARSTATUS=2,BARSLAST(TROUGHBARS(4,20,1)=0)+1);
MS2:=BACKSET(MS1>ref(MS1,1),BARSLAST(PEAKBARS(1,10,1)=0)+1);
顶部价:REF(H,BARSLAST(MS2>ref(MS2,1))),PRECIS2,DOTLINE,COLOR0000ff;
起步价:ref(l,BARSLAST(MS1>ref(MS1,1))),PRECIS2,DOTLINE,COLORffffff;
DRAWTEXT(BARSTATUS=2,起步价,' 0%' ),VALIGN2,COLORffffff;
if BARSTATUS=2 Then 涨幅:=(顶部价-起步价)/起步价*100;
if BARSTATUS=2 Then 收盘:=(c-起步价)/起步价*100;
DRAWTEXT(BARSTATUS=2,顶部价,' '+NUMTOSTRN(涨幅,2)+'%' ),VALIGN2,COLOR0000ff;
DRAWTEXT(BARSTATUS=2,c,' '+NUMTOSTRN(收盘,2)+'%' ),VALIGN2,COLOR0000ff;