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()); }
Depending on which years you tested, it may just be right. The market has been trending up for the past few years overall.......
It's a simulation with artificial prices with changes normally distributed. 1 simulation = 365 days. What I meant was "It makes money almost on every simulation". Strange.
Oh I thought you were using real prices. If they are simulated, it may be pretty hard to untangle idiosyncrasies of the simulation or model from idiosyncrasies of the market. It is still a very commendable endeavor though......I am trying simulations / back-testing also in R.
Part of bigger simulation, I wanted to make sure first step is right. I expected, that over large number of simulations net result would about 0.
Just a random thought: Did you get the rounding right? Some languages have idiosyncratic ways of using floats/integers etc.