Quote from comintel:
Where is the money lost? On the put side or the call side? Is it lost on big moves?
Well, it obviously depends which way market moves. In a year I can sell about 52 straddles and in total losses are almost always bigger than total credit. One easy answer would be that I calculate volatility in a wrong way, but I'm getting reasonable results. Here's the code:
double getVolatility(int DaysAhead) {
if (DaysAhead == 0) {
return 0;
}
DoubleArrayList Lns = new DoubleArrayList();
int i;
for (i = 1; i <= DaysAhead; i++) {
if (Day + i - 1 >= DayPricesIVs.size() - 1) {
break;
}
Lns.add(Math.log(DayPricesIVs.get(Day + i).Price / DayPricesIVs.get(Day + i - 1).Price));
}
double StdDev = Lns.NonCenteredVolatility();
double Vol = (StdDev * Math.sqrt(252)* DayPricesIVs.get(Day).Rand);
return Vol;
}
Non-centered vol functions:
double NonCenteredVolatility() {
int i;
double SumSq = 0;
for(i = 0; i < List.size(); i++)
SumSq += List.get(i) * List.get(i);
return Math.sqrt(SumSq / List.size());
}