分析家公式网,提供指标公式,股票软件 用户登录  |  用户 注册

软件名称:[B]反映指标状态的趋势K线(源码)[/B]
软件类型:国产软件
运行环境:Win2000/WinXP/Win2003/WinVista
软件语言:简体中文
授权方式:共享软件
软件大小:2.00 KB
官方主页:Home Page
更新时间:2010-08-10 08:52:39
软件简介:

行情分为操作与观望,这里以周MACD从金叉到死叉区间为可操作区间为例,做一个K线反映这种趋势.这段源码包含了周线MACD 及不定周期K线的写法,匆忙之中肯定有瑕疵,也望各位指正

趋势K线
input:long(26,20,100),short(12,5,40),m(9,2,60);
m60:ma(c,60);
wtj1:=datediff(ref(date,1),date)<>weekday-ref(weekday,1) or barpos=1;
wtj:=refx(wtj1,1) or weekday=5;
fc:=close;
start:=barpos-barssince(wtj);
diff:=0*close;
dea:=0*close;
tmp:=setlbound(diff,start[datacount]);
tmp:=setlbound(dea,start[datacount]);
d1:=fc[start[datacount]];d2:=d1;wdea:=0;
for i=start[datacount]+1 to datacount do begin
  if wtj[i] then begin
    d1:=(2*fc[i]+(short-1)*d1)/(short+1);
    d2:=(2*fc[i]+(long-1)*d2)/(long+1);
    wdiff:=d1-d2;
    wdea:=(2*wdiff+(m-1)*wdea)/(m+1);
    diff[i]:=wdiff;
    dea[i]:=wdea;
  end else begin
    diff[i]:=(2*fc[i]+(short-1)*d1)/(short+1)-
             (2*fc[i]+(long-1)*d2)/(long+1);
    dea[i]:=(2*diff[i]+(m-1)*wdea)/(m+1);
  end;
end;
macd:=2*(diff-dea),colorstick;
jc:=cross(DIFF,DEA);scc:=cross(DEA,DIFF);
DT:=DIFF>DEA;
Sed:=refx(scc,1) or barpos=datacount ;
Sp:=BARSLAST(jc)+1;wse:=barslast(scc);ts:=Sp-wse-1;
SO:ref(O,BARSLAST(jc)) LINETHICK colorred;
SH:HHV(H,Sp) LINETHICK colorred;
SH:=SETVAL(Sed,SH,-BARSLAST(jc),SH);
SL:LLV(L,Sp) LINETHICK colorred;
SL:=SETVAL(Sed,SL,-BARSLAST(jc),SL);
SC:SETVAL(Sed,C,-BARSLAST(jc),C) LINETHICK colorred;
SV:=SETVAL(Sed,0,-FLOOR(BARSLAST(jc)/2),1);
SV:=SETVAL(Sed,SV,-FLOOR(BARSLAST(jc)/2)+1,0);
Spk:=barslast(jc);
SPKM:=SPK and SV and dt;
SPKL:=jc AND NOT(Sed) and dt;
SPKR:=SPK and Sed and dt;
PARTLINE(Spk and DT,SO) coloryellow;
PARTLINE(Spk>0 and DT,SC) coloryellow;
STICKLINE(SPKM,SH,MAX(SC,SO),0,0) coloryellow;
STICKLINE(SPKM,SL,MIN(SC,SO),0,0) coloryellow;
STICKLINE(SPKL,SC,SO,0,0) coloryellow;
STICKLINE(SPKR and DT,SC,SO,0,0) coloryellow;


[url=http://www.70822.com/soft/sort013/sort02/down-23541.html]反映指标状态的趋势K线(源码)[/url]

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