-- 作者:曹晓东
-- 发布时间:2017/1/9 9:51:23
-- 主图标记文字
variable:n=0,m=0; mm:=ref(h,1)=hhv(h,3); nn:=ref(l,1)=llv(l,3);
variable:bj=0; variable:dt=0,kt=0; mm:=ref(h,1)=hhv(h,3); nn:=ref(l,1)=llv(l,3);
if mm then bj:=1; if nn then bj:=-1; nn1:=barslast(mm); nn2:=barslast(nn); if c<ref(l,nn1+1) and bj=1 then i:=1; if c>ref(h,nn2+1) and bj=-1 then i:=-1;
uu3:=cross(i=1,0.5); uu4:=cross(i=-1,0.5); if uu3 or ((ref(c,1)>ref(o,1) and h>ref(h,1) and c<ref(l,1))) or (ref(h,1)=hhv(h,3) and c<ref(l,1)) or c<ref(l,barslast(c>o)) then begin n:=0; m:=m+1; end
//m为绿色 if uu4 or (ref(l,1)=llv(l,3) and c>ref(h,1)) or ((ref(o,1)>ref(c,1) and l<ref(l,1) and c>ref(h,1))) or c>ref(h,barslast(c<o)) then begin n:=n+1; m:=0; end //n为红色 STICKLINE(cross(m,0.5),o,CLOSE,7.5,0),COLORgreen; STICKLINE(cross(n,0.5),o,c,7.5,0),COLORred;
这是变色的提交。帮忙把15分钟,30分钟,1小时,日线的上一次变色的价格都标记在我现在看的主图上。我看五分钟的。然后,上一次是红色标记红色字,上一次是绿色标记绿色字。在屏幕左上角吧。
|
-- 作者:jinzhe
-- 发布时间:2017/1/9 11:21:40
--
原来的代码做这样改:
variable:n=0,m=0; mm:=ref(h,1)=hhv(h,3); nn:=ref(l,1)=llv(l,3);
variable:bj=0; variable:dt=0,kt=0; mm:=ref(h,1)=hhv(h,3); nn:=ref(l,1)=llv(l,3);
if mm then bj:=1; if nn then bj:=-1; nn1:=barslast(mm); nn2:=barslast(nn); if c<ref(l,nn1+1) and bj=1 then i:=1; if c>ref(h,nn2+1) and bj=-1 then i:=-1;
uu3:=cross(i=1,0.5); uu4:=cross(i=-1,0.5); if uu3 or ((ref(c,1)>ref(o,1) and h>ref(h,1) and c<ref(l,1))) or (ref(h,1)=hhv(h,3) and c<ref(l,1)) or c<ref(l,barslast(c>o)) then begin n:=0; m:=m+1; end
//m为绿色 if uu4 or (ref(l,1)=llv(l,3) and c>ref(h,1)) or ((ref(o,1)>ref(c,1) and l<ref(l,1) and c>ref(h,1))) or c>ref(h,barslast(c<o)) then begin n:=n+1; m:=0; end //n为红色 STICKLINE(cross(m,0.5),o,CLOSE,7.5,0),COLORgreen; STICKLINE(cross(n,0.5),o,c,7.5,0),COLORred; variable:ss=0;
if cross(m,0.5) then ss:=1;//ss=1为绿色
if cross(n,0.5) then ss:=-1;//ss=-1为红色
sss:ss;
c1:valuewhen(cross(m,0.5),c);
c2:valuewhen(cross(n,0.5),c);
|
-- 作者:jinzhe
-- 发布时间:2017/1/9 11:23:50
--
然后引用
ss:stkindi(\'\',\'YY.sss\',0,3);//yy为上面公式的名字,3为15分钟周期
c1:stkindi(\'\',\'yy.c1\',0,3);
c2:stkindi(\'\',\'yy.c2\',0,3);
if ss=1 then 价格:c1,colorgreen;
if ss=-1 then 价位:c2,colorred;
其他周期的只要改下上面引用的周期参数即可
|