请问这个循环算法为什么没能求出当天close在周期内的百分位
我知道这个要求有很多其他简单的公式写法,但是我不是单单为了写这个公式,我是为了理解循环算法而求助的,就是理解不够导致其他得写法也有了类似的问题
if barpos>=length+1 then
begin
for i = 1 to length do
begin
a := if(c>c[barpos-i],100,0);
b := b + a/length;
end
end
po:b;
你这个代码是用来做什么的?
“当天close在周期内的百分位” 这个什么意思?
[此贴子已经被作者于2020/3/19 15:18:34编辑过]
就是找出周期内比今天的close低的K线数量M
“当天close在周期内的百分位” 这个什么意思?
就是算出M占周期内K线总量的百分比
length:10;
if barpos>=length+1 then
begin
b:=0;
for i = 1 to length do
begin
a:=if(c>c[barpos-i],1,0);
b:=b+a;
end
end
po:b/length;
太感谢版主了,这段时间搞的头都大了,现在终于理解一些了,知道问题出在那里了