This commit is contained in:
jl777
2019-04-02 10:53:33 -11:00
parent 6d8250fc6a
commit 82c5f08851

View File

@@ -2339,7 +2339,7 @@ int64_t komodo_pricecorrelated(uint64_t seed,int32_t ind,uint32_t *rawprices,int
int64_t komodo_pricesmoothed(int64_t *correlated,int32_t daywindow,int64_t *nonzprices,int32_t smoothwidth)
{
const int64_t coeffs[7] = { 7, 7, 7, 7, 7, 7, 7 };
const int64_t coeffs[7] = { -1, 9, -45, 0, 45, -9, 1 }; // / 60
int32_t i,iter; int64_t smoothedden,smoothedsum,sum,den,smoothed[7],firstprice = correlated[0];
if ( daywindow < 2 )
return(0);
@@ -2377,12 +2377,13 @@ int64_t komodo_pricesmoothed(int64_t *correlated,int32_t daywindow,int64_t *nonz
}
smoothed[iter] = (sum / den);
}
smoothedsum = smoothedden = 0;
smoothedsum = 0;
smoothedden = 60;
for (i=0; i<7; i++)
{
fprintf(stderr,"%.4f ",(double)smoothed[i]/10000);
smoothedsum += (7-i) * smoothed[i];
smoothedden += (7-i);
smoothedsum += coeffs[i] * smoothed[i];
//smoothedden += (7-i);
}
fprintf(stderr,"-> %.4f\n",(double)(smoothedsum/smoothedden)/10000);
return(smoothedsum/smoothedden);