以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  信号过滤  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=144260)

--  作者:曹晓东
--  发布时间:2016/12/7 15:31:35
--  信号过滤

STICKLINE(uu3,C,O,7.5,0),COLORgreen;
STICKLINE((ref(c,1)>ref(o,1) and h>ref(h,1) and c<ref(l,1)),C,O,7.5,0),COLORgreen;
STICKLINe (ref(h,1)=hhv(h,3) and c<ref(l,1),C,O,7.5,0),COLORgreen;
STICKLINe (ref(l,1)=llv(l,3) and c>ref(h,1),C,O,7.5,0),COLORred;
STICKLINE(uu4,C,O,7.5,0),COLORred;
STICKLINE((ref(o,1)>ref(c,1) and l<ref(l,1) and c>ref(h,1)),C,O,7.5,0),COLORred;

帮忙做一个信号过滤,当绿色信号出现之后,就不在出现第二个绿色信号了。直到出现红色,红色出现又要过滤,只出现一次就好,直到出现任意一个绿色。
[此贴子已经被作者于2016-12-7 15:31:49编辑过]

--  作者:jinzhe
--  发布时间:2016/12/7 15:35:27
--  
麻烦把代码贴全
--  作者:曹晓东
--  发布时间:2016/12/7 15:36:59
--  
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);


STICKLINE(uu3,C,O,7.5,0),COLORgreen;
STICKLINE((ref(c,1)>ref(o,1) and h>ref(h,1) and c<ref(l,1)),C,O,7.5,0),COLORgreen;
STICKLINe (ref(h,1)=hhv(h,3) and c<ref(l,1),C,O,7.5,0),COLORgreen;
STICKLINe (ref(l,1)=llv(l,3) and c>ref(h,1),C,O,7.5,0),COLORred;
STICKLINE(uu4,C,O,7.5,0),COLORred;
STICKLINE((ref(o,1)>ref(c,1) and l<ref(l,1) and c>ref(h,1)),C,O,7.5,0),COLORred;

[此贴子已经被作者于2016-12-7 15:37:51编辑过]

--  作者:jinzhe
--  发布时间:2016/12/7 15:51:12
--  

variable:n=0,m=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)) 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))) then begin
 n:=n+1;
 m:=0;
end
//n为红色

STICKLINE(cross(m,0.5),h,l,7.5,0),COLORgreen;

STICKLINE(cross(n,0.5),h,l,7.5,0),COLORred;


--  作者:曹晓东
--  发布时间:2016/12/7 16:46:37
--  
如图:箭头所指的位置应该变色   但不会变,不知为什么    怎样改呢?
图片点击可在新窗口打开查看此主题相关图片如下:qq图片20161207164552.png
图片点击可在新窗口打开查看

--  作者:jinzhe
--  发布时间:2016/12/7 16:51:02
--  
你先用的我代码再截个图
--  作者:曹晓东
--  发布时间:2016/12/7 16:52:28
--  
这就是用的你上面写的代码的主图。
--  作者:jinzhe
--  发布时间:2016/12/7 16:57:14
--  
不是,我的代码的柱子是从最高到最低的,不是常规的从开盘到收盘,你先用的代码截个图,我分析下问题
--  作者:曹晓东
--  发布时间:2016/12/7 17:00:54
--  
我就不标记了   就是这样的   刚才我改成了收盘价和开盘价,现在的是你的
图片点击可在新窗口打开查看此主题相关图片如下:qq图片20161207170003.png
图片点击可在新窗口打开查看

--  作者:jinzhe
--  发布时间:2016/12/7 17:22:43
--  

因为你不讲你的代码要实现什么功能,所以就按照你的要求改柱子的形成,也没看代码是什么意思。

根据你上面讲的定义,发现你这一段代码不知道要做什么,又是I又是BJ的,所以做了一个修改

variable:n=0,m=0;
mm:=ref(h,1)=hhv(h,3);
nn:=ref(l,1)=llv(l,3);


variable:bj=0;


nn1:=barslast(mm);
nn2:=barslast(nn);
if c<ref(l,nn1+1)  then bj:=1;
if c>ref(h,nn2+1)  then bj:=-1;


uu3:=cross(bj=1,0.5);
uu4:=cross(bj=-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)) 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))) then begin
 n:=n+1;
 m:=0;
end
//n为红色

STICKLINE(cross(m,0.5),h,l,7.5,0),COLORgreen;

STICKLINE(cross(n,0.5),h,l,7.5,0),COLORred;


此主题相关图片如下:3.png
按此在新窗口浏览图片