Loading ...

手写TV版KDJ指标、这个指标TV和FMZ完全不一致

Author: 老胡, Created: 2021-09-11 22:27:33, Updated:

KDJ这个常用的指标,不知道为何TV和FMZ完全不一致,也许2者思路是一致的,但具体算法不同,出于方便,我按TV中的介绍,手写了下这个指标,然后对比,就完全一致了,如果有需要的朋友可以复制过去,有定制开发策略的需求,也请联系我。laohuo1379

function KDJ(rds, n, smoothK, smoothD) { var rsi = []; for(var i in rds){ var rd = rds[i]; var lowest = rd.Low; var highest = rd.High; for(var j=i; j>i-n && j>=0; j–){ if(rds[j].Low < lowest) lowest = rds[j].Low; if(rds[j].High > highest) highest = rds[j].High; } rsi[i] = 100*(rd.Close-lowest)/(highest-lowest); } var k = TA.MA(rsi, smoothK); var d = TA.MA(k, smoothD); return [k,d]; }


More

轻轻的云 是不是也会晚一根K线

小草 感谢分享