PureBytes Links
Trading Reference Links
|
Dans un courrier daté du 08/10/98 01:18:22 , vous avez écrit :
<<
Andy - this will do any length and any price input:
input:price(close),len(10);
vars:x(0),sum(0);
sum=0;
for x = 1 to len begin
sum=sum+absvalue(price[x-1] - price[x]);
end;
if sum <> 0 then plot1((absvalue(price-price[len]))/sum,"eff_ratio");
regards,
rich
>>
This one should be faster, because you do not calculate absvalue(price[x-1] -
price[x]) ten times in the loop.
input:price(close),len(10);
vars:x(0),sum(0);
value0=absvalue(price - price[1]);
sum=0;
for x = 0 to len-1 begin
sum=sum+value0[x];
end;
if sum <> 0 then plot1((absvalue(price-price[len]))/sum,"eff_ratio");
Sincerely,
Pierre Orphelin
|