編程思路破譯OBV賦值:如果收盤價(jià)>1日前的收盤價(jià),返回成交量(手),否則返回如果收盤價(jià)<1日前的收盤價(jià),返回-成交量(手),否則返回0的歷史累和 DIFF賦值:OBV的12日指數(shù)移動(dòng)平均-OBV的26日指數(shù)移動(dòng)平均 BBDIFF賦值:DIFF-1日前的DIFF DEA賦值:DIFF的9日指數(shù)移動(dòng)平均 BBDEA賦值:DEA-1日前的DEA MACD賦值:2*(DIFF-DEA) PARTLINE(收盤價(jià),0),畫白色 PARTLINE(DIFF,DIFF>=1日前的DIFF AND DEA>1日前的DEA),線寬為4,COLOR0089FF FILLRGN(DIFF,DEA,DIFF>DEA),COLOR0089FF PARTLINE(DIFF,DIFF<1日前的DIFF AND DEA<1日前的DEA),線寬為4,畫藍(lán)色 FILLRGN(DEA,DIFF,DIFF<DEA),畫藍(lán)色 PARTLINE(DIFF,DIFF>=1日前的DIFF AND DEA<1日前的DEA),線寬為4,COLOR00C500 PARTLINE(DIFF,DIFF<1日前的DIFF AND DEA>1日前的DEA),線寬為4,畫黃色 當(dāng)滿足條件MACD>1日前的MACDANDMACD>0時(shí),在0和MACD位置之間畫柱狀線,寬度為2,0不為0則畫空心柱.,畫紅色 當(dāng)滿足條件MACD<1日前的MACDANDMACD>0時(shí),在0和MACD位置之間畫柱狀線,寬度為2,0不為0則畫空心柱.,畫黃色 當(dāng)滿足條件MACD<1日前的MACDANDMACD<0時(shí),在0和MACD位置之間畫柱狀線,寬度為2,0不為0則畫空心柱.,畫青色 當(dāng)滿足條件MACD>1日前的MACDANDMACD<0時(shí),在0和MACD位置之間畫柱狀線,寬度為2,0不為0則畫空心柱.,COLOR0099FF PARTLINE(收盤價(jià),2*(DEA-DIFF)),線寬為2,畫深灰色 程序源碼OBV:=SUM(IF(CLOSE>REF(CLOSE,1),VOL,IF(CLOSE<REF(CLOSE,1),-VOL,0)),0); DIFF:=EMA(OBV,12)-EMA(OBV,26); BBDIFF:=DIFF-REF(DIFF,1); DEA:=EMA(DIFF,9); BBDEA:=DEA-REF(DEA,1); MACD:=2*(DIFF-DEA); PARTLINE(C,0),COLORWHITE; PARTLINE(DIFF,DIFF>=REF(DIFF,1) AND DEA>REF(DEA,1)),LINETHICK4,COLOR0089FF; FILLRGN(DIFF,DEA,DIFF>DEA),COLOR0089FF; PARTLINE(DIFF,DIFF<REF(DIFF,1) AND DEA<REF(DEA,1)),LINETHICK4,COLORBLUE; FILLRGN(DEA,DIFF,DIFF<DEA),COLORBLUE; PARTLINE(DIFF,DIFF>=REF(DIFF,1) AND DEA<REF(DEA,1)),LINETHICK4,COLOR00C500; PARTLINE(DIFF,DIFF<REF(DIFF,1) AND DEA>REF(DEA,1)),LINETHICK4,COLORYELLOW; STICKLINE(MACD>REF(MACD,1) AND MACD>0,0,MACD,2,0),COLORRED; STICKLINE(MACD<REF(MACD,1) AND MACD>0,0,MACD,2,0),COLORYELLOW; STICKLINE(MACD<REF(MACD,1) AND MACD<0,0,MACD,2,0),COLORCYAN; STICKLINE(MACD>REF(MACD,1) AND MACD<0,0,MACD,2,0),COLOR0099FF; PARTLINE(C,2*(DEA-DIFF)),LINETHICK2,COLORGRAY; |
|