Rss & SiteMap

金字塔客服中心 - 专业程序化交易软件提供商 http://www.weistock.com/bbs/

专业程序化软件提供商
共37 条记录, 每页显示 10 条, 页签: [1] [2][3][4]
[浏览完整版]

标题:如何改周编周期引用

1楼
cslt 发表于:2020/6/10 9:52:15
如何改周编期引用
金字塔软件\阿火秘笈_编写技巧十九\十、在小周期级别上记录大周期指标的实际走势的方法
\http://www.weistock.com/bbs/dispbbs.asp?boardid=10&id=9439&authorid=0&page=0&star=3
这里以1分钟引用3分钟的macd为例,,常规方法只能在1分钟K线上显示3分钟K线的macd走势,至于3分钟内部每根1分钟K线的macd走势不知道
方法原理:获取上一根3分钟的diff、dea、macd,然后配合1分钟的CLOSE计算出实际的diff、dea、macd

1、如何改为:日线引用周线的macd实际走势;
2、按此方法如何编辑:日线引用周线的kd实际走势。

2楼
FireScript 发表于:2020/6/10 10:11:33
可以改阿火代码里面的参数。

runmode:1;
em1:=stkindi(stklabel,'macd.ema12',0,7,-1);
em2:=stkindi(stklabel,'macd.ema26',0,7,-1);
ema12:=em1*11/13+c*2/13;
ema26:=25/27* em2 +c*2/27;
diff:ema12-ema26;
dea1:=stkindi(stklabel,'macd.dea',0,7,-1);
dea:dea1*4/5+diff/5;


这里改成调用周线周期的  上周期的数据。然后这个指标运行在日线即可。
3楼
weishao 发表于:2020/6/10 23:21:32
那KDJ指标可以改成这样的吗?
4楼
weishao 发表于:2020/6/11 0:13:57
cchhll公式内容如下:
cc:close;
hh:high;
ll:low;

周线KDJ内容如下(参数:N=5,P1=3,P2=3):

KWEEK:STKINDIEX(stklabel ,'KDJ.K(5,3,3)' ,0 ,7 ,0 ,720 ),COLORRED;
DWEEK:STKINDIEX(stklabel ,'KDJ.D(5,3,3)' ,0 ,7 ,0 ,720 ),COLORcyan;
refKWEEK:=STKINDIEX(stklabel ,'KDJ.K(5,3,3)' ,0 ,7 ,-1 ,720 );
refDWEEK:=STKINDIEX(stklabel ,'KDJ.D(5,3,3)' ,0 ,7 ,-1 ,720 );
cweek:=STKINDIEX(stklabel ,'cchhll.cc' ,0 ,7 ,0 ,720 ),linethick0;
hweek:=STKINDIEX(stklabel ,'cchhll.hh' ,0 ,7 ,0 ,720 ),linethick0;
lweek:=STKINDIEX(stklabel ,'cchhll.ll' ,0 ,7 ,0 ,720 ),linethick0;
//cday:=STKINDIEX(stklabel ,'cchhll.cc' ,0 ,6 ,0 ,720 ),linethick0;

//RSV:=(CLOSE-LLV(LOW,N))/(HHV(HIGH,N)-LLV(LOW,N))*100;

RSV:=(close-LLV(lweek,N))/(HHV(hweek,N)-LLV(lweek,N))*100,linethick0;

kday:((RSV+(p1-1)*refkweek))/p1,colormagenta;
dday:((kday+(p2-1)*refdweek))/p2,coloryellow;

计算出来的KDAY值在每周的最后一天不等于KWEEK,哪里出了错?谢谢!
5楼
weishao 发表于:2020/6/11 0:40:35
将kdj指标修改如下:

LLL:LLV(LOW,N),linethick0;
HHH:HHV(HIGH,N),linethick0;
RSV:(CLOSE-LLV(LOW,N))/(HHV(HIGH,N)-LLV(LOW,N))*100,linethick0;
K:SMA(RSV,P1,1),colorred;
D:SMA(K,P2,1);
J:3*K-2*D;
应用在日线的自编周kdj内容如下:
KWEEK:STKINDIEX(stklabel ,'KDJ.K(5,3,3)' ,0 ,7 ,0 ,720 ),COLORRED;
DWEEK:STKINDIEX(stklabel ,'KDJ.D(5,3,3)' ,0 ,7 ,0 ,720 ),COLORcyan;
refKWEEK:=STKINDIEX(stklabel ,'KDJ.K(5,3,3)' ,0 ,7 ,-1 ,720 );
refDWEEK:=STKINDIEX(stklabel ,'KDJ.D(5,3,3)' ,0 ,7 ,-1 ,720 );
cweek:=STKINDIEX(stklabel ,'cchhll.cc' ,0 ,7 ,0 ,720 ),linethick0;
hweek:=STKINDIEX(stklabel ,'cchhll.hh' ,0 ,7 ,0 ,720 ),linethick0;
lweek:=STKINDIEX(stklabel ,'cchhll.ll' ,0 ,7 ,0 ,720 ),linethick0;
//cday:=STKINDIEX(stklabel ,'cchhll.cc' ,0 ,6 ,0 ,720 ),linethick0;

//RSV:=(CLOSE-LLV(LOW,N))/(HHV(HIGH,N)-LLV(LOW,N))*100;

OHHH:STKINDIEX(stklabel ,'KDJ.HHH(5,3,3)' ,0 ,7 ,0 ,720 );
WHHH:HHV(hweek,5);
OLLL:STKINDIEX(stklabel ,'KDJ.LLL(5,3,3)' ,0 ,7 ,0 ,720 );
WLLL:LLV(lweek,5);
ORSV:STKINDIEX(stklabel ,'KDJ.RSV(5,3,3)' ,0 ,7 ,0 ,720 );
RSV:(close-LLV(lweek,5))/(HHV(hweek,5)-LLV(lweek,5))*100,linethick0;

kday:((RSV+(3-1)*refkweek))/3,colormagenta;
dday:((kday+(3-1)*refdweek))/3,coloryellow;
结果是:OLLL不等于WLLL,OHHH=WHHH,不知什么原因?

谢谢!
6楼
weishao 发表于:2020/6/11 10:21:49
但是在周k线图中,数据都是对的.
7楼
weishao 发表于:2020/6/11 10:38:16
直接引用KDJ里的hhh和lll后正确了,不知道为什么?难道是hweek和lweek的数据不对?
//hweek:=STKINDI(stklabel ,'cchhll.hh' ,0 ,7 ,0),linethick0;
//lweek:=STKINDI(stklabel ,'cchhll.ll' ,0 ,7 ,0),linethick0;


refKWEEK:=STKINDI(stklabel ,'KDJ.K(5,3,3)' ,0 ,7 ,-1 );
refDWEEK:=STKINDI(stklabel ,'KDJ.D(5,3,3)' ,0 ,7 ,-1 );
//cweek:=STKINDI(stklabel ,'cchhll.cc' ,0 ,7 ,0),linethick0;
//hweek:=STKINDI(stklabel ,'cchhll.hh' ,0 ,7 ,0),linethick0;
//lweek:=STKINDI(stklabel ,'cchhll.ll' ,0 ,7 ,0),linethick0;
//cday:=STKINDI(stklabel ,'cchhll.cc' ,0 ,6 ,0),linethick0;



OHHH:=STKINDI(stklabel ,'KDJ.HHH(5,3,3)' ,0 ,7 ,0);
//WHHH:HHV(hweek,5);
OLLL:=STKINDI(stklabel ,'KDJ.LLL(5,3,3)' ,0 ,7 ,0);
//WLLL:LLV(lweek,5);

//RSV:(close-LLV(lweek,5))/(HHV(hweek,5)-LLV(lweek,5))*100,linethick0;
RSV:=(close-LLV(OLLL,n))/(HHV(OHHH,5)-LLV(OLLL,n))*100,linethick0;
KWEEK:STKINDI(stklabel ,'KDJ.K(5,3,3)' ,0 ,7 ,0),COLORRED;
kday:((RSV+(p1-1)*refkweek))/p1,colormagenta;
DWEEK:STKINDI(stklabel ,'KDJ.D(5,3,3)' ,0 ,7 ,0),COLORcyan;
dday:((kday+(p2-1)*refdweek))/p2,coloryellow;
8楼
FireScript 发表于:2020/6/11 10:41:38
以日线调用周线为例
周线被引用指标XZ:
input:n(9,1,100,10),p1(3,2,40,4),p2(3,2,40,4);//参数设置
RSV:=(CLOSE-LLV(LOW,N))/(HHV(HIGH,N)-LLV(LOW,N))*100;
K:SMA(RSV,P1,1);
D:SMA(K,P2,1);
J:3*K-2*D,NODRAW;

llv1:llv(l,N-1);
hhv1:hhv(h,N-1);


当前日线指标:
input:n(9,1,100,10),p1(3,2,40,4),p2(3,2,40,4);//参数设置
k1:=STKINDI('','XZ.K',0,7,-1);
d1:=STKINDI('','XZ.D',0,7,-1);
llv1:=STKINDI('','XZ.llv1',0,7,-1);
hhv1:=STKINDI('','XZ.hhv1',0,7,-1);
rsv2:=(c-min(llv1,l))/(max(h,hhv1)-min(llv1,l))*100;

k2:(rsv2+(P1-1)*k1)/P1;
D2:(k2+(P2-1)*d1)/P2;


实际效果:

图片点击可在新窗口打开查看此主题相关图片如下:temp.png
图片点击可在新窗口打开查看


j值根据k,d计算下。其他周期改下跨周期函数参数即可。
9楼
weishao 发表于:2020/6/11 12:40:02
谢谢

10楼
weishao 发表于:2020/6/11 22:32:00
llv1:=STKINDI('','XZ.llv1',0,7,-1);
hhv1:=STKINDI('','XZ.hhv1',0,7,-1);
rsv2:=(c-min(llv1,l))/(max(h,hhv1)-min(llv1,l))*100;//可能有问题,因为L不一定是本周的最低值,h也不一定是本周的最高值.
共37 条记录, 每页显示 10 条, 页签: [1] [2][3][4]


Powered By Dvbbs Version 8.3.0
Processed in .50000 s, 3 queries.