分析家公式网,提供指标公式,股票软件 用户登录  |  用户 注册
当前位置:分析家公式网股票公式大智慧L2公式 → 一键转帖:DDY修正

软件名称:[B]DDY修正[/B]
软件类型:国产软件
运行环境:Win9X/Win2000/WinXP/Win2003/
软件语言:简体中文
授权方式:免费版
软件大小:4.00 KB
官方主页:Home Page
更新时间:2010-04-15 07:34:24
软件简介:

DDY修正
{DDY}
INPUT: P1(60,0,100),P2(3,0,100),P3(10,0,100);
REFLINE:0;
TODAY:=DYNAINFO(7)=CLOSE and DYNAINFO(10)=AMOUNT and (ORDER(1)=0 and ORDER(2)=0);
RDDY1:=IF(TODAY,"DDEDATA@BIGORDER"(1),bigorder(1));
RDDY2:=IF(TODAY,"DDEDATA@BIGORDER"(2),bigorder(2));
FDDY1:=IF(TODAY,"DDEDATA@ORDER"(1),ORDER(1));
FDDY2:=IF(TODAY,"DDEDATA@ORDER"(2),ORDER(2));
VAR0:=MIN(COUNT(ORDER(2),0),P1);
VAR1:=EMA((2 - BIGORDER(1) - BIGORDER(2)) * VOL/(ORDER(1) + ORDER(2)),P1);
VAR2:=(2*(2 - BIGORDER(1) - BIGORDER(2)) * VOL/(ORDER(1) + ORDER(2))+(p1-1)*ref(VAR1,1))/(p1+1);
VAR11:=if(TODAY,VAR2,VAR1);
DDY:if(TODAY,("DDEDATA@ORDER"(2) - "DDEDATA@ORDER"(1))/CAPITAL ,(ORDER(2) - ORDER(1))/CAPITAL) * VAR11 * 100,COLOR3D;
DDY1:EMA((FDDY2 - FDDY1)/CAPITAL * VAR11* 100,VAR0) * VAR0;
DDY2:MA(DDY1,P2);
DDY3:MA(DDY1,P3);
DRAWTEXTABS(0,0,'涨跌动因');
1,DOTLINE;



DDY中用了ema算法,但是理想数据是单个数据(只有当日数据,没有ema可言)。这就需要把ema解析后改写。
原公式:{lx-ddy}
INPUT: P1(60,0,100),P2(5,0,100),P3(10,0,100);
REFLINE:0;
TODAY:=DYNAINFO(7)=CLOSE and DYNAINFO(10)=AMOUNT  and (ORDER(1)=0 and ORDER(2)=0);
{判断是否有理想数据}
RDDY1:=IF(TODAY,"DDEDATA@BIGORDER"(1),bigorder(1));
RDDY2:=IF(TODAY,"DDEDATA@BIGORDER"(2),bigorder(2));
FDDY1:=IF(TODAY,"DDEDATA@ORDER"(1),ORDER(1));
FDDY2:=IF(TODAY,"DDEDATA@ORDER"(2),ORDER(2));
VAR0:=MIN(COUNT(FDDY2,0),P1);
VAR1:=EMA((2 - RDDY1 - RDDY2) * VOL/(FDDY1 + FDDY2),p1);
DDY:(FDDY2 - FDDY1)/CAPITAL * VAR1 * 100,COLOR3D;
DDY1:EMA((FDDY2 - FDDY1)/CAPITAL * VAR1 * 100,VAR0) * VAR0;
DDY2:MA(DDY1,P2);
DDY3:MA(DDY1,P3);
DRAWTEXTABS(0,0,'涨跌动因');
1,DOTLINE;

注意这句:
VAR1:=EMA((2 - RDDY1 - RDDY2) * VOL/(FDDY1 + FDDY2),p1);

变成-----(用法:EMA(X,N),算法:若Y=EMA(X,N)则Y=[2*X+(N-1)*Y']/(N+1),其中Y'表示上一周期Y值):
VAR1:=EMA((2 - BIGORDER(1) - BIGORDER(2)) * VOL/(ORDER(1) + ORDER(2)),P1);
VAR2:=(2*(2 - BIGORDER(1) - BIGORDER(2)) * VOL/(ORDER(1) + ORDER(2))+(p1-1)*ref(VAR1,1))/(p1+1);
VAR11:=if(TODAY,VAR2,VAR1);
 

修正ema后的公式:
{DDY}
INPUT: P1(60,0,100),P2(3,0,100),P3(10,0,100);
REFLINE:0;
TODAY:=DYNAINFO(7)=CLOSE and DYNAINFO(10)=AMOUNT and (ORDER(1)=0 and ORDER(2)=0);
VAR0:=MIN(COUNT(ORDER(2),0),P1);
VAR1:=EMA((2 - BIGORDER(1) - BIGORDER(2)) * VOL/(ORDER(1) + ORDER(2)),P1);
VAR2:=(2*(2 - BIGORDER(1) - BIGORDER(2)) * VOL/(ORDER(1) + ORDER(2))+(p1-1)*ref(VAR1,1))/(p1+1);
VAR11:=if(TODAY,VAR2,VAR1);
DDY:if(TODAY,("DDEDATA@ORDER"(2) - "DDEDATA@ORDER"(1))/CAPITAL ,(ORDER(2) - ORDER(1))/CAPITAL) * VAR11 * 100,COLOR3D;
DDY1:EMA(DDY,VAR0) * VAR0;
DDY2:MA(DDY1,P2);
DDY3:MA(DDY1,P3);
DRAWTEXTABS(0,0,'涨跌动因');
1,DOTLINE;

数据的差异就是ema的算法造成的。举一反三,遇到这类问题,就这样处理就是了。
 


[url=http://www.70822.com/soft/sort013/sort03/down-18760.html]DDY修正[/url]

关于本站 | 网站帮助 | 广告合作 | 声明 | 友情连接 | 网站地图 |
分析家公式网声明:本站所有股票公式软件资料均网上公开收集,如侵权请联系删帖。站内所有广告,均与本站无关!
Copyright © 2003-2024 70822.Com. All Rights Reserved .
页面执行时间:46.87500 毫秒