Hi there,
I'm new to Matlab language and I need some help to complete one script. It's about computing continuous compounded returns from data as:
Code:
function z=brm(x)
[n,m]=size(x);
c=m-1;
for l=0:c
for k=l+1:m-1
z((l+1),k)=log(x(m-l))-log(x(m-k))
end
end
My problem is that i need to constrain it to compute returns only within selected period of time. I have dada matrix arranged as(Date format=d.m):
Code:
Date, Time, Value
1.1, 1430, 1
1.1, 1431, 2
1.1, 1432, 5
...
1.1, 2259, 3
2.1, 1430, 8
2.1, 1431, 4
...
I do not know how to set condition such will constrain it to prevent compute returns from lag higher than highest possible remaining lag within current day.
Can someone help and show me way?
Thanks for reading,
Tom.