编写条件:
编写方法:
网友求助:
公式在同花顺中被四舍五入只显示个位,我想要显示最少小数点后两位数,
我加了 PRECIS2 ,没有作用, *100 的话倒是能显示更多,不过不是原意,
请教各位朋友,
公式如下:
DIFF:EMA(CLOSE,S) - EMA(CLOSE,P);
DEA:EMA(DIFF,M);
macd:2*(DIFF-DEA),COLORSTICK;
MacDHS:=IF(MACD>0 AND MACD>REF(MACD,1),MACD,0);
MACDHX:=IF(MACD>0 AND MACD<REF(MACD,1),MACD,0);
MACDLX:=IF(MACD<0 AND MACD<REF(MACD,1),MACD,0);
MACDLS:=IF(MACD<0 AND MACD>REF(MACD,1),MACD,0);
红柱面积:=IF(MACD>0,SUM(MACD,BArslAST(MACD<0)),0),PRECIS2,COLOR0000FF;
绿柱面积:=IF(MACD<0,SUM(MACD,BARSLAST(MACD>0)),0),PRECIS2,COLOR006000;;
DRAWTEXT(REF(MACD,1)>0 AND MACD<=0 ,HHV(MACD,4),''+REF(红柱面积,1)),colorred;
DRAWTEXT(REF(MACD,1)<0 AND MACD>=0 ,LLV(MACD,4),''+REF(Abs(绿柱面积),1)),Color00ff00;
DRAWTEXT(ISNULL(REFX(&CLOSE,1))=1 AND MACD<0,LLV(MACD,4),''+ABS(绿柱面积)),Color004A00;
DRAWTEXT(ISNULL(REFX(&CLOSE,1))=1 AND MACD>0,HHV(MACD,4),''+ABS(红柱面积)),colorred;
解答如下:
DRAWTEXT(REF(MACD,1)>0 AND MACD<=0 ,HHV(MACD,4),''+TOSTRING(REF(红柱面积,1),2)),colorred;
DRAWTEXT(REF(MACD,1)<0 AND MACD>=0 ,LLV(MACD,4),''+TOSTRING(REF(ABS(绿柱面积),1),2)),Color00ff00;
DRAWTEXT(ISNULL(REFX(&CLOSE,1))=1 AND MACD<0,LLV(MACD,4),''+TOSTRING(ABS(绿柱面积),2)),Color004A00;
DRAWTEXT(ISNULL(REFX(&CLOSE,1))=1 AND MACD>0,HHV(MACD,4),''+TOSTRING(ABS(红柱面积),2)),colorred;