以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  金字塔软件问题提交  (http://weistock.com/bbs/list.asp?boardid=2)
----  如何在一条均线上显示不同的颜色  (http://weistock.com/bbs/dispbbs.asp?boardid=2&id=8004)

--  作者:donlee88
--  发布时间:2011/9/14 8:50:27
--  如何在一条均线上显示不同的颜色

很简单的问题,但是想不出来,请各位大大帮忙

 

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);

 

结果却不合人意,请各位大大指教

 


--  作者:26327756l
--  发布时间:2011/9/14 10:51:20
--  

那个函数我使用了也不行,那就给你一个这种方法吧,看看可行不,小问题自己改改。


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


--  作者:26327756l
--  发布时间:2011/9/14 13:33:59
--  
这个也行
w1:c;
partline(W1>ref(W1,1) and ref(w1,1)>ref(W1,2) and ref(W1,2)>ref(W1,3),w1,COLORred,3);
 

--  作者:devypeng
--  发布时间:2011/9/14 21:27:32
--  

用partline语句:

 

mc:ma(close,5),colorwhite;
rmc:=ref(mc,1);
partline(all(mc>=rmc,3),mc,colorred);
partline(all(mc<=rmc,3),mc,colorgreen);