很简单的问题,但是想不出来,请各位大大帮忙
1条均线,比如是5天线,要求在连续3个向上后(即今天的数值大于明天的,连续3个),均线用红色显示,连续3个向下后,用绿色显示,如果数值有上有下,用白色显示。
我用POLYLINE做的,语句如下:
POLYLINE(wma11=1,w1,COLORred,3,VTSOLID);
POLYLINE(wma22=1,w1,COLORgreen,3,VTSOLID);
POLYLINE(wma11+wma22=0,w1,COLORwhite,3,VTSOLID);
结果却不合人意,请各位大大指教
那个函数我使用了也不行,那就给你一个这种方法吧,看看可行不,小问题自己改改。
s:=3;
m1:ma(c,5),COLORwhite;
if m1>ref(m1,3) and m1>ref(m1,2) and m1>ref(m1,1)then s:=1;
if m1<ref(m1,3) and m1<ref(m1,2) and m1<ref(m1,1) then s:=2;
m2:ma(c,5),COLORred;
m3:ma(c,5),COLORgreen;
if s=1 then begin m3:=DRAWNULL; end
if s=2 then begin m2:=DRAWNULL; end
if s=3 then begin m2:=DRAWNULL; m3:=DRAWNULL; end
用partline语句:
mc:ma(close,5),colorwhite;
rmc:=ref(mc,1);
partline(all(mc>=rmc,3),mc,colorred);
partline(all(mc<=rmc,3),mc,colorgreen);