A math problem
N is the number of intervals in a time period (for example 10 bars in 60 days).
It gets used in calculating s from volatility, ie. the stddev for that period.
s is one of the parameters for a generator function (see below St=...).
The results of the generator function are off by a varying percent value (depending on N; column "yOffPct" in table below).
To fix this, the D term of the generator function must be set to a correct value (>= 1.0):
St = S * D * exp(s * rndSND)
where St is the generated new value, S is the initial value, D is the sought value >= 1.0,
s is the said stddev for the period, rndSND is a random value from a standard normal distribution (mu=0, s=1).
The values of S, s, and rndSND, as well St, are irrelevant to know (one can use some constants for testing).
A formula for D is sought: how to define a correct value for D (depending on N, ie. as a function of N), to bring yOffPct down to 0.0 for each N ?
N is the number of intervals in a time period (for example 10 bars in 60 days).
It gets used in calculating s from volatility, ie. the stddev for that period.
s is one of the parameters for a generator function (see below St=...).
The results of the generator function are off by a varying percent value (depending on N; column "yOffPct" in table below).
To fix this, the D term of the generator function must be set to a correct value (>= 1.0):
St = S * D * exp(s * rndSND)
where St is the generated new value, S is the initial value, D is the sought value >= 1.0,
s is the said stddev for the period, rndSND is a random value from a standard normal distribution (mu=0, s=1).
The values of S, s, and rndSND, as well St, are irrelevant to know (one can use some constants for testing).
A formula for D is sought: how to define a correct value for D (depending on N, ie. as a function of N), to bring yOffPct down to 0.0 for each N ?
Code:
N yOffPct
1 0.00 (N=1 is correct, N>1 is off by that pct)
2 20.58
3 31.58
4 38.91
5 44.11
6 48.08
7 51.45
8 54.15
9 56.32
10 58.19
15 64.89
20 69.23
25 71.94
30 74.09
35 75.58
40 76.88
45 78.10
50 79.01
60 80.63
70 81.77
80 82.40
90 83.30
100 83.84
125 85.28
150 86.28
175 86.81
200 87.38
225 88.00
250 87.92
300 88.63
350 89.24
400 89.35
450 89.78
500 89.93
600 90.11
700 90.39
800 90.61
900 90.76
1000 90.70
Last edited: