 function [ON,CN,HN]=boot2(S0,O,C,H)
 %bootstraps to generate new values of High, open close.
 %everthing is in log scale 
 %allows for persistent volatility- only uses high, open, close.
m=length(O);
Z=(H-C).*(H-O);
W=Z/mean(Z);
beta=(mean(W(2:m).*W(1:m-1))-1)/var(W);
night=O(2:m)-C(1:m-1);
mu1=mean(night);
eps=(night-mu1)./sqrt(1+beta*(W(1:m-1)-1));
e=sample(eps,m-1);
eps1=W(2:m)./(1+beta*(W(1:m-1)-1));
e1=sample(eps1,m-1);
day=C-O;
mu2=mean(day);
eps2=(day(2:m)-mu2)./sqrt(1+beta*(W(2:m)-1));
e2=sample(eps2,m-1);
CN=S0+C(1)-O(1);
ON=S0;
ZN=Z(1);
WN=W(1);
for i=2:m;
   ON=[ON mu1+CN(i-1)+e(i-1)*sqrt(1+beta*(WN(i-1)-1))];
   WN=[WN e1(i-1)*(1+beta*(WN(i-1)-1))];
   CN=[CN ON(i)+ mu2+e2(i-1)*sqrt(1+beta*(WN(i)-1))];
end
ZN=WN*mean(Z);
HN=.5*(CN+ON+sqrt((CN-ON).^2 + 4*ZN));

   
   