For those interested in the recent subtopic of "GBM in QuantLib" under this very thread here: QuantLib experts are now discussing this theme (ie. the GBM discrepancy observed by me) in the QuantLib mailing list. The archives of the postings can be read on the web. The current status is: The tested GBM method using the BoxMullerGaussianRng class first failed to pass the test (s.a.), then a bug in the test program was found --> fixed in v1.1, see above posting. Now the tested GBM method using the BoxMullerGaussianRng class passes the test. I believe it passes the test b/c it internally seems not to make use of the suspected (by me) culprit "Ito's lemma". But some QuantLib experts say different. And some of the experts say BoxMullerGaussianRng is very old code and is even after 10 years or so still in experimental status (I'm not sure whether that's really the case), and one better shall use some other classes (unfortunately nobody till now came up with a sample code of these alternatives). The verdict is still out(standing)/due, the discussion and debates still continuing...
2 GBM generated test files in CSV format (with header line; see there), with 1,000,000 generated stock prices (S0=100, IV=30, t=1y, timeSteps=1, r=0, q=0), each about 29 MB uncompressed (about 12 MB zip-compressed). This GBM generator does not use Ito's lemma. Files: GBM_ts1_A.zip, GBM_ts1_B.zip (currently "http" only, not "https") One of the QuantLib experts wanted to see these data. The first flie looks like so: Code: RunNum,GenNumInTS,cGenAll,GenValue 1,1,1,82.9918250872 2,1,2,97.9213648676 3,1,3,89.0761870567 4,1,4,247.5566474873 5,1,5,84.9883415598 6,1,6,100.7593212350 7,1,7,156.0151605429 8,1,8,119.5338621902 9,1,9,202.1903865199 10,1,10,135.4589761498 ... 999995,1,999995,115.5128367665 999996,1,999996,87.7254406708 999997,1,999997,105.1272681215 999998,1,999998,112.5599376921 999999,1,999999,126.0603568634 1000000,1,1000000,128.5004456723 Ie. the column GenValue contains the generated stock prices. These are just random possible stock prices after a year (initial stock price was 100; cf. the other params above). My GBM generator and test program (not using QuantLib) gets these results for the above data, respectively: A: cRuns=1000000 cGenTotal=1000000 cInside=682647(68.2647%) B: cRuns=1000000 cGenTotal=1000000 cInside=682717(68.2717%)
This means annual stock price data of 1,000,000 years! (each year independent of each other year, ie. not continous).. And not 1,000,000 bars (datapoints) in 1 year
This is an extended version of the above table, but covers only the timeSteps 1 to 32. It consists of "cumulative" results covering all from beginning till the end of each interval: Code: timeSteps=1 0.6826894921 (68.2689%) : 1 0.6826894921 (68.2689%) timeSteps=2 0.7626951425 (76.2695%) : 1 0.8427007929 (84.2701%) 2 0.7626951425 (76.2695%) timeSteps=3 0.7929178712 (79.2918%) : 1 0.9167354833 (91.6735%) 2 0.8480320607 (84.8032%) 3 0.7929178712 (79.2918%) timeSteps=4 0.8079192356 (80.7919%) : 1 0.9544997361 (95.4500%) 2 0.8986002645 (89.8600%) 3 0.8496624834 (84.9662%) 4 0.8079192356 (80.7919%) timeSteps=5 0.8166475591 (81.6648%) : 1 0.9746526813 (97.4653%) 2 0.9304031917 (93.0403%) 3 0.8880335936 (88.8034%) 4 0.8501370759 (85.0137%) 5 0.8166475591 (81.6648%) timeSteps=6 0.8223044750 (82.2304%) : 1 0.9856941216 (98.5694%) 2 0.9512148025 (95.1215%) 3 0.9150434660 (91.5043%) 4 0.8811147590 (88.1115%) 5 0.8502274715 (85.0227%) 6 0.8223044750 (82.2304%) timeSteps=7 0.8262645314 (82.6265%) : 1 0.9918490284 (99.1849%) 2 0.9652400996 (96.5240%) 3 0.9346165804 (93.4617%) 4 0.9044932522 (90.4493%) 5 0.8762498877 (87.6250%) 6 0.8501937046 (85.0194%) 7 0.8262645314 (82.6265%) timeSteps=8 0.8291970193 (82.9197%) : 1 0.9953222650 (99.5322%) 2 0.9749110006 (97.4911%) 3 0.9491171888 (94.9117%) 4 0.9225130898 (92.2513%) 5 0.8968298297 (89.6830%) 6 0.8726560116 (87.2656%) 7 0.8501266660 (85.0127%) 8 0.8291970193 (82.9197%) timeSteps=9 0.8314609380 (83.1461%) : 1 0.9973002039 (99.7300%) 2 0.9817026752 (98.1703%) 3 0.9600469446 (96.0047%) 4 0.9366316078 (93.6632%) 5 0.9133627873 (91.3363%) 6 0.8910237624 (89.1024%) 7 0.8699004738 (86.9900%) 8 0.8500573688 (85.0057%) 9 0.8314609380 (83.1461%) timeSteps=10 0.8332645763 (83.3265%) : 1 0.9984345977 (99.8435%) 2 0.9865436395 (98.6544%) 3 0.9683993747 (96.8399%) 4 0.9478379565 (94.7838%) 5 0.9268105238 (92.6811%) 6 0.9062245028 (90.6225%) 7 0.8864784704 (88.6478%) 8 0.8677246020 (86.7725%) 9 0.8499951412 (84.9995%) 10 0.8332645763 (83.3265%) timeSteps=11 0.8347368977 (83.4737%) : 1 0.9990888811 (99.9089%) 2 0.9900362037 (99.0036%) 3 0.9748537698 (97.4854%) 4 0.9568267202 (95.6827%) 5 0.9378592287 (93.7859%) 6 0.9189269680 (91.8927%) 7 0.9005088766 (90.0509%) 8 0.8828259334 (88.2826%) 9 0.8659647207 (86.5965%) 10 0.8499416382 (84.9942%) 11 0.8347368977 (83.4737%) timeSteps=12 0.8359621763 (83.5962%) : 1 0.9994679945 (99.9468%) 2 0.9925810580 (99.2581%) 3 0.9798872841 (97.9887%) 4 0.9640993339 (96.4099%) 5 0.9470124170 (94.7012%) 6 0.9296271463 (92.9627%) 7 0.9124760878 (91.2476%) 8 0.8958326565 (89.5833%) 9 0.8798275748 (87.9828%) 10 0.8645126495 (86.4513%) 11 0.8498960567 (84.9896%) 12 0.8359621763 (83.5962%) timeSteps=13 0.8369979912 (83.6998%) : 1 0.9996885090 (99.9689%) 2 0.9944505299 (99.4451%) 3 0.9838426905 (98.3843%) 4 0.9700261534 (97.0026%) 5 0.9546481797 (95.4648%) 6 0.9387015430 (93.8702%) 7 0.9227506200 (92.2751%) 8 0.9071072905 (90.7107%) 9 0.8919374266 (89.1937%) 10 0.8773223616 (87.7322%) 11 0.8632943141 (86.3294%) 12 0.8498570328 (84.9857%) 13 0.8369979912 (83.6998%) timeSteps=14 0.8378851499 (83.7885%) : 1 0.9998171894 (99.9817%) 2 0.9958331089 (99.5833%) 3 0.9869708855 (98.6971%) 4 0.9748859568 (97.4886%) 5 0.9610559041 (96.1056%) 6 0.9464415104 (94.6442%) 7 0.9316214079 (93.1621%) 8 0.9169341404 (91.6934%) 9 0.9025728847 (90.2573%) 10 0.8886432392 (88.8643%) 11 0.8751978840 (87.5198%) 12 0.8622574594 (86.2257%) 13 0.8498232775 (84.9823%) 14 0.8378851499 (83.7885%) timeSteps=15 0.8386534572 (83.8653%) : 1 0.9998924888 (99.9892%) 2 0.9968612948 (99.6861%) 3 0.9894584236 (98.9458%) 4 0.9788919399 (97.8892%) 5 0.9664606485 (96.6461%) 6 0.9530761575 (95.3076%) 7 0.9393174339 (93.9317%) 8 0.9255398146 (92.5540%) 9 0.9119569905 (91.1957%) 10 0.8986941553 (89.8694%) 11 0.8858212083 (88.5821%) 12 0.8733734012 (87.3373%) 13 0.8613642580 (86.1364%) 14 0.8497937404 (84.9794%) 15 0.8386534572 (83.8653%) timeSteps=16 0.8393252299 (83.9325%) : 1 0.9999366575 (99.9937%) 2 0.9976294613 (99.7629%) 3 0.9914458624 (99.1446%) 4 0.9822093308 (98.2209%) 5 0.9710398106 (97.1040%) 6 0.9587881031 (95.8788%) 7 0.9460226572 (94.6023%) 8 0.9331074241 (93.3107%) 9 0.9202707726 (92.0271%) 10 0.9076533743 (90.7653%) 11 0.8953394317 (89.5339%) 12 0.8833767225 (88.3377%) 13 0.8717894751 (87.1789%) 14 0.8605866978 (86.0587%) 15 0.8497676125 (84.9768%) 16 0.8393252299 (83.9325%) timeSteps=17 0.8399175284 (83.9918%) : 1 0.9999626202 (99.9963%) 2 0.9982055777 (99.8206%) 3 0.9930402916 (99.3040%) 4 0.9849676361 (98.4968%) 5 0.9749348250 (97.4935%) 6 0.9637245965 (96.3725%) 7 0.9518865926 (95.1887%) 8 0.9397866709 (93.9787%) 9 0.9276628967 (92.7663%) 10 0.9156678093 (91.5668%) 11 0.9038973058 (90.3897%) 12 0.8924097942 (89.2410%) 13 0.8812388176 (88.1239%) 14 0.8704014017 (87.0401%) 15 0.8599036117 (85.9904%) 16 0.8497442807 (84.9744%) 17 0.8399175284 (83.9918%) timeSteps=18 0.8404436255 (84.0444%) : 1 0.9999779095 (99.9978%) 2 0.9986390567 (99.8639%) 3 0.9943240783 (99.4324%) 4 0.9872693454 (98.7269%) 5 0.9782595621 (97.8260%) 6 0.9680055489 (96.8006%) 7 0.9570319805 (95.7032%) 8 0.9457011826 (94.5701%) 9 0.9342566949 (93.4257%) 10 0.9228597759 (92.2860%) 11 0.9116156942 (91.1616%) 12 0.9005917729 (90.0592%) 13 0.8898295949 (88.9830%) 14 0.8793532482 (87.9353%) 15 0.8691749198 (86.9175%) 16 0.8592987144 (85.9299%) 17 0.8497232804 (84.9723%) 18 0.8404436255 (84.0444%) timeSteps=19 0.8409140040 (84.0914%) : 1 0.9999869282 (99.9987%) 2 0.9989661046 (99.8966%) 3 0.9953610894 (99.5361%) 4 0.9891962435 (98.9196%) 5 0.9811064782 (98.1106%) 6 0.9717294504 (97.1729%) 7 0.9615604604 (96.1560%) 8 0.9509539531 (95.0954%) 9 0.9401553908 (94.0155%) 10 0.9293320199 (92.9332%) 11 0.9185964207 (91.8596%) 12 0.9080232851 (90.8023%) 13 0.8976610714 (89.7661%) 14 0.8875400474 (88.7540%) 15 0.8776778480 (87.7678%) 16 0.8680833315 (86.8083%) 17 0.8587592727 (85.8759%) 18 0.8497042546 (84.9704%) 19 0.8409140040 (84.0914%) timeSteps=20 0.8413370525 (84.1337%) : 1 0.9999922558 (99.9992%) 2 0.9992134268 (99.9213%) 3 0.9962011930 (99.6201%) 4 0.9908140651 (99.0814%) 5 0.9835511993 (98.3551%) 6 0.9749778069 (97.4978%) 7 0.9655568419 (96.5557%) 8 0.9556314495 (95.5631%) 9 0.9454460519 (94.5446%) 10 0.9351715260 (93.5172%) 11 0.9249259462 (92.4926%) 12 0.9147899838 (91.4790%) 13 0.9048179122 (90.4818%) 14 0.8950453668 (89.5045%) 15 0.8854948037 (88.5495%) 16 0.8761793486 (87.6179%) 17 0.8671055230 (86.7106%) 18 0.8582751859 (85.8275%) 19 0.8496869241 (84.9687%) 20 0.8413370525 (84.1337%) timeSteps=21 0.8417195624 (84.1720%) : 1 0.9999954072 (99.9995%) 2 0.9994008309 (99.9401%) 3 0.9968835634 (99.6884%) 4 0.9921759798 (99.2176%) 5 0.9856559880 (98.5656%) 6 0.9778185184 (97.7819%) 7 0.9690923706 (96.9092%) 8 0.9598067611 (95.9807%) 9 0.9502026257 (95.0203%) 10 0.9404524492 (94.0452%) 11 0.9306782014 (93.0678%) 12 0.9209652903 (92.0965%) 13 0.9113728418 (91.1373%) 14 0.9019411129 (90.1941%) 15 0.8926968007 (89.2697%) 16 0.8836568435 (88.3657%) 17 0.8748311513 (87.4831%) 18 0.8662245756 (86.6225%) 19 0.8578383371 (85.7838%) 20 0.8496710659 (84.9671%) 21 0.8417195624 (84.1720%) timeSteps=22 0.8420670890 (84.2067%) : 1 0.9999972735 (99.9997%) 2 0.9995430773 (99.9543%) 3 0.9974391378 (99.7439%) 4 0.9933252349 (99.3325%) 5 0.9874724018 (98.7472%) 6 0.9803084852 (98.0308%) 7 0.9722272574 (97.2227%) 8 0.9635420467 (96.3542%) 9 0.9544883042 (95.4488%) 10 0.9452384000 (94.5238%) 11 0.9359167994 (93.5917%) 12 0.9266125381 (92.6613%) 13 0.9173887241 (91.7389%) 14 0.9082895530 (90.8290%) 15 0.8993454257 (89.9345%) 16 0.8905766698 (89.0577%) 17 0.8819962478 (88.1996%) 18 0.8736117351 (87.3612%) 19 0.8654267711 (86.5427%) 20 0.8574421273 (85.7442%) 21 0.8496564984 (84.9656%) 22 0.8420670890 (84.2067%) timeSteps=23 0.8423842195 (84.2384%) : 1 0.9999983800 (99.9998%) 2 0.9996512090 (99.9651%) 3 0.9978924635 (99.7892%) 4 0.9942971834 (99.4297%) 5 0.9890433555 (98.9043%) 6 0.9824956431 (98.2496%) 7 0.9750126635 (97.5013%) 8 0.9668904587 (96.6890%) 9 0.9583573885 (95.8357%) 10 0.9495842497 (94.9584%) 11 0.9406967841 (94.0697%) 12 0.9317866695 (93.1787%) 13 0.9229202099 (92.2920%) 14 0.9141449158 (91.4145%) 15 0.9054943975 (90.5494%) 16 0.8969919774 (89.6992%) 17 0.8886533556 (88.8653%) 18 0.8804885786 (88.0489%) 19 0.8725035002 (87.2504%) 20 0.8647008677 (86.4701%) 21 0.8570811348 (85.7081%) 22 0.8496430708 (84.9643%) 23 0.8423842195 (84.2384%) timeSteps=24 0.8426747743 (84.2675%) : 1 0.9999990366 (99.9999%) 2 0.9997335156 (99.9734%) 3 0.9982630987 (99.8263%) 4 0.9951208544 (99.5121%) 5 0.9904047362 (99.0405%) 6 0.9844205695 (98.4421%) 7 0.9774922729 (97.7492%) 8 0.9698976742 (96.9898%) 9 0.9618567732 (96.1857%) 10 0.9535375709 (95.3538%) 11 0.9450660282 (94.5066%) 12 0.9365355919 (93.6536%) 13 0.9280150550 (92.8015%) 14 0.9195546751 (91.9555%) 15 0.9111908160 (91.1191%) 16 0.9029494299 (90.2949%) 17 0.8948486597 (89.4849%) 18 0.8869007854 (88.6901%) 19 0.8791136814 (87.9114%) 20 0.8714919134 (87.1492%) 21 0.8640375648 (86.4038%) 22 0.8567508632 (85.6751%) 23 0.8496306562 (84.9631%) 24 0.8426747743 (84.2675%) timeSteps=25 0.8429419600 (84.2942%) : 1 0.9999994267 (99.9999%) 2 0.9997962373 (99.9796%) 3 0.9985666859 (99.8567%) 4 0.9958201817 (99.5820%) 5 0.9915866816 (99.1587%) 6 0.9861177625 (98.6118%) 7 0.9797035505 (97.9704%) 8 0.9726031227 (97.2603%) 9 0.9650271419 (96.5027%) 10 0.9571397979 (95.7140%) 11 0.9490663603 (94.9066%) 12 0.9409012742 (94.0901%) 13 0.9327151870 (93.2715%) 14 0.9245605874 (92.4561%) 15 0.9164761747 (91.6476%) 16 0.9084901921 (90.8490%) 17 0.9006229510 (90.0623%) 18 0.8928887410 (89.2889%) 19 0.8852972752 (88.5297%) 20 0.8778547876 (87.7855%) 21 0.8705648680 (87.0565%) 22 0.8634291002 (86.3429%) 23 0.8564475511 (85.6448%) 24 0.8496191462 (84.9619%) 25 0.8429419600 (84.2942%) timeSteps=26 0.8431884878 (84.3188%) : 1 0.9999996586 (100.0000%) 2 0.9998440838 (99.9844%) 3 0.9988157777 (99.8816%) 4 0.9964149709 (99.6415%) 5 0.9926145991 (99.2615%) 6 0.9876166679 (98.7617%) 7 0.9816787578 (98.1679%) 8 0.9750409808 (97.5041%) 9 0.9679039365 (96.7904%) 10 0.9604271713 (96.0427%) 11 0.9527344836 (95.2734%) 12 0.9449206399 (94.4921%) 13 0.9370575748 (93.7058%) 14 0.9291995396 (92.9200%) 15 0.9213871863 (92.1387%) 16 0.9136507362 (91.3651%) 17 0.9060124135 (90.6012%) 18 0.8984883080 (89.8488%) 19 0.8910897995 (89.1090%) 20 0.8838246483 (88.3825%) 21 0.8766978335 (87.6698%) 22 0.8697121974 (86.9712%) 23 0.8628689445 (86.2869%) 24 0.8561680276 (85.6168%) 25 0.8496084476 (84.9608%) 26 0.8431884878 (84.3188%) timeSteps=27 0.8434166651 (84.3417%) : 1 0.9999997965 (100.0000%) 2 0.9998806165 (99.9881%) 3 0.9990204790 (99.9020%) 4 0.9969216671 (99.6922%) 5 0.9935099834 (99.3510%) 6 0.9889425106 (98.8943%) 7 0.9834457786 (98.3446%) 8 0.9772409838 (97.7241%) 9 0.9705181504 (97.0518%) 10 0.9634315107 (96.3432%) 11 0.9561027291 (95.6103%) 12 0.9486263015 (94.8626%) 13 0.9410749433 (94.1075%) 14 0.9335042457 (93.3504%) 15 0.9259564630 (92.5956%) 16 0.9184635058 (91.8464%) 17 0.9110492736 (91.1049%) 18 0.9037314605 (90.3731%) 19 0.8965229508 (89.6523%) 20 0.8894328975 (88.9433%) 21 0.8824675567 (88.2468%) 22 0.8756309367 (87.5631%) 23 0.8689253015 (86.8925%) 24 0.8623515654 (86.2352%) 25 0.8559096005 (85.5910%) 26 0.8495984794 (84.9598%) 27 0.8434166651 (84.3417%) timeSteps=28 0.8436284681 (84.3628%) : 1 0.9999998787 (100.0000%) 2 0.9999085340 (99.9909%) 3 0.9991889472 (99.9189%) 4 0.9973539675 (99.7354%) 5 0.9942910785 (99.4291%) 6 0.9901169719 (99.0117%) 7 0.9850287953 (98.5029%) 8 0.9792290923 (97.9229%) 9 0.9728969824 (97.2897%) 10 0.9661808535 (96.6181%) 11 0.9591996783 (95.9200%) 12 0.9520471669 (95.2047%) 13 0.9447963662 (94.4796%) 14 0.9375038253 (93.7504%) 15 0.9302130810 (93.0213%) 16 0.9229574677 (92.2957%) 17 0.9157623393 (91.5762%) 18 0.9086468115 (90.8647%) 19 0.9016251211 (90.1625%) 20 0.8947076865 (89.4708%) 21 0.8879019358 (88.7902%) 22 0.8812129538 (88.1213%) 23 0.8746439898 (87.4644%) 24 0.8681968564 (86.8197%) 25 0.8618722440 (86.1872%) 26 0.8556699690 (85.5670%) 27 0.8495891709 (84.9589%) 28 0.8436284681 (84.3628%) timeSteps=29 0.8438255988 (84.3826%) : 1 0.9999999276 (100.0000%) 2 0.9999298840 (99.9930%) 3 0.9993277845 (99.9328%) 4 0.9977233131 (99.7723%) 5 0.9949734156 (99.4973%) 6 0.9911587446 (99.1159%) 7 0.9864488464 (98.6449%) 8 0.9810280441 (98.1028%) 9 0.9750643783 (97.5064%) 10 0.9686999852 (96.8700%) 11 0.9620506817 (96.2051%) 12 0.9552089466 (95.5209%) 13 0.9482477600 (94.8248%) 14 0.9412242854 (94.1224%) 15 0.9341830516 (93.4183%) 16 0.9271585720 (92.7159%) 17 0.9201774509 (92.0177%) 18 0.9132600545 (91.3260%) 19 0.9064218294 (90.6422%) 20 0.8996743403 (89.9674%) 21 0.8930260865 (89.3026%) 22 0.8864831454 (88.6483%) 23 0.8800496800 (88.0050%) 24 0.8737283412 (87.3728%) 25 0.8675205859 (86.7521%) 26 0.8614269310 (86.1427%) 27 0.8554471551 (85.5447%) 28 0.8495804598 (84.9580%) 29 0.8438255988 (84.3826%) timeSteps=30 0.8440095314 (84.4010%) : 1 0.9999999568 (100.0000%) 2 0.9999462228 (99.9946%) 3 0.9994423478 (99.9442%) 4 0.9980392860 (99.8039%) 5 0.9955702531 (99.5570%) 6 0.9920839912 (99.2084%) 7 0.9877242881 (98.7724%) 8 0.9826578132 (98.2658%) 9 0.9770414834 (97.7041%) 10 0.9710108834 (97.1011%) 11 0.9646782930 (96.4678%) 12 0.9581345771 (95.8135%) 13 0.9514522982 (95.1452%) 14 0.9446889263 (94.4689%) 15 0.9378897175 (93.7890%) 16 0.9310901401 (93.1090%) 17 0.9243178597 (92.4318%) 18 0.9175943340 (91.7594%) 19 0.9109360858 (91.0936%) 20 0.9043557134 (90.4356%) 21 0.8978626926 (89.7863%) 22 0.8914640129 (89.1464%) 23 0.8851646833 (88.5165%) 24 0.8789681349 (87.8968%) 25 0.8728765424 (87.2877%) 26 0.8668910808 (86.6891%) 27 0.8610121317 (86.1012%) 28 0.8552394488 (85.5239%) 29 0.8495722914 (84.9572%) 30 0.8440095314 (84.4010%) timeSteps=31 0.8441815487 (84.4182%) : 1 0.9999999742 (100.0000%) 2 0.9999587345 (99.9959%) 3 0.9995369928 (99.9537%) 4 0.9983099311 (99.8310%) 5 0.9960929386 (99.6093%) 6 0.9929067230 (99.2907%) 7 0.9888711801 (98.8871%) 8 0.9841359939 (98.4136%) 9 0.9788470218 (97.8847%) 10 0.9731330902 (97.3133%) 11 0.9671026345 (96.7103%) 12 0.9608445792 (96.0845%) 13 0.9544307618 (95.4431%) 14 0.9479186834 (94.7919%) 15 0.9413540874 (94.1354%) 16 0.9347731921 (93.4773%) 17 0.9282045494 (92.8205%) 18 0.9216705607 (92.1671%) 19 0.9151886997 (91.5189%) 20 0.9087724927 (90.8772%) 21 0.9024323021 (90.2432%) 22 0.8961759535 (89.6176%) 23 0.8900092372 (89.0009%) 24 0.8839363093 (88.3936%) 25 0.8779600147 (87.7960%) 26 0.8720821464 (87.2082%) 27 0.8663036542 (86.6304%) 28 0.8606248140 (86.0625%) 29 0.8550453643 (85.5045%) 30 0.8495646172 (84.9565%) 31 0.8441815487 (84.4182%) timeSteps=32 0.8443427724 (84.4343%) : 1 0.9999999846 (100.0000%) 2 0.9999683210 (99.9968%) 3 0.9996152690 (99.9615%) 4 0.9985420180 (99.8542%) 5 0.9965512071 (99.6551%) 6 0.9936391167 (99.3639%) 7 0.9899036079 (98.9904%) 8 0.9854781240 (98.5478%) 9 0.9804976170 (98.0498%) 10 0.9750840283 (97.5084%) 11 0.9693417065 (96.9342%) 12 0.9633573614 (96.3357%) 13 0.9572018363 (95.7202%) 14 0.9509324181 (95.0932%) 15 0.9445951212 (94.4595%) 16 0.9382267257 (93.8227%) 17 0.9318565088 (93.1857%) 18 0.9255076784 (92.5508%) 19 0.9191985421 (91.9199%) 20 0.9129434545 (91.2943%) 21 0.9067535801 (90.6754%) 22 0.9006375085 (90.0638%) 23 0.8946017494 (89.4602%) 24 0.8886511316 (88.8651%) 25 0.8827891249 (88.2789%) 26 0.8770181011 (87.7018%) 27 0.8713395449 (87.1340%) 28 0.8657542252 (86.5754%) 29 0.8602623348 (86.0262%) 30 0.8548636042 (85.4864%) 31 0.8495573943 (84.9557%) 32 0.8443427724 (84.4343%)
Sorry I'm responding to this thread late, but earth_imperator is right, this model assumes price is pink noise and not GBM. That is ok, as I prefer the pink noise model for the TA I do.
Have you looked into Mandlebrot's fractal method of simulating returns. It's probably the best way to produce prices from thin air. If not, lmk and I'll dig it up. Easy to find. My personal favorite method is actually just resampling old returns, theoretically speaking it is the most elegant and accurate way to do it. You may already know that GBM is actually a terrible simulation of any kind of price, regardless of the asset class. So a simple sampling algo, which is way easier, would be a better choice. A little trick i picked up to make the sampling method better is to run a autocorrelation test on the original price series, and then if there is some autocorrelation, preserve that structure in the sampling algo. So for example, you have signifcant acf at the 2nd lag, when you sample the original price series, you take the 2nd lag with it, and fit it with another sample and it's 2nd lag, to create a mini series with 4 prices. Now do that again and again, etc. n times, string it all together for the length of series you want. Repeat that process N times and you'll have N price series of length n with a preserved correlation structure. Works great. Way better than BM. Also, sampling from a mixture of normals and a poisson. The normal mixture being your everyday happy go lucky returns and the poisson being some crazy jump. Set some probability p that you draw from the normals mixture, and then 1-p is a draw from the poisson. p would be rather larger, since you don't want tons of jumping, but you want it to be realistic and also depends on what timeframe you are trying to emulate. etc. can also help you find that if you need. just lmk. At least take away from this long as post, don't use GBM. Hides risk.
there's only one way to do it. you draw from the distribution with a random number generator and plug it into a formula. phil above did it perfectly far as i can tell.