测试按照香农的思路。把本金分成两部分,各百分之五十。一部分用于买股票,一部分作为现金。在开盘的每天中午操作一次,如果跌了则买入;如果盈利则卖出,保证股票的价值与现金各占一半。
例如有10000块钱,第一天5000块钱买入股票,留下5000块钱现金。
如果第二天,跌了10%,那么股票价值=5000+(5000*(-10%))=4500,则需要买入250块钱(5000-(4500+5000)/2)保证股票价值与本金价值相同,也就是4750。
如果第二天,涨了10%,那么股票的价值=5000+(5000*10%)=5500,则需要卖出250,保证股票价值与本金价值相同,也就是5250。
我写了一个程序模拟A股市场,因为每天涨跌幅限制10%,我也做了判断,每年大概250天的交易日,模拟了100次。
那么结果如何呢?
j:代表试验的次数序号;
x:代表按香农的方式买卖股票;
y:代表买入不动。
j:0,x:8901.7515404453,y:6476.00878635139
j:1,x:9372.86586032244,y:7306.53268308113
j:2,x:7074.5881293484,y:4005.39844041141
j:3,x:8490.44550750539,y:5843.74088103297
j:4,x:9414.81581294706,y:7271.49896838451
j:5,x:3580.25081140142,y:1025.31521658837
j:6,x:4583.46609723548,y:1714.44155418629
j:7,x:11965.3713668873,y:11682.5881992198
j:8,x:8090.9696430265,y:5334.61573834045
j:9,x:7600.82254066534,y:4681.34958292132
j:10,x:9592.60012934543,y:7325.25343231113
j:11,x:8386.16715748631,y:5701.79043244907
j:12,x:11373.1643290056,y:10383.9599766802
j:13,x:8482.96356010641,y:5846.57722020578
j:14,x:10989.8446323164,y:9953.54280966812
j:15,x:7679.40157092343,y:4829.55952737077
j:16,x:14873.4009564974,y:18142.1764196036
j:17,x:9316.62380581913,y:7098.43865355632
j:18,x:8970.04557005043,y:6545.2596885157
j:19,x:12792.3781939832,y:13403.4490328714
j:20,x:11658.9978283627,y:10991.1758134883
j:21,x:21578.4801844629,y:38457.4071152422
j:22,x:15139.0208454107,y:19190.0490051499
j:23,x:5653.66921472015,y:2595.5330123173
j:24,x:5907.23268034089,y:2815.66122719361
j:25,x:8352.33711056709,y:5679.97413483198
j:26,x:16592.8830088132,y:22467.1525910238
j:27,x:7803.00117422154,y:4955.33154650651
j:28,x:7969.1345352585,y:5240.25467125404
j:29,x:7582.93400145807,y:4650.74954939619
j:30,x:9040.8547005753,y:6773.84961251603
j:31,x:6906.9615307259,y:3831.81009491816
j:32,x:8993.1677380032,y:6576.90723199173
j:33,x:6876.00964332175,y:3699.12453021623
j:34,x:7044.45813886828,y:3961.58100037
j:35,x:10786.5864486123,y:9478.1508218632
j:36,x:11705.3130963283,y:11059.3082216228
j:37,x:3652.61946703549,y:1094.95356133927
j:38,x:17536.9113389688,y:24906.8908290797
j:39,x:8690.28551090403,y:6104.22133030706
j:40,x:9508.23666623105,y:7188.76858243539
j:41,x:24017.0019590599,y:47147.9506593506
j:42,x:18761.5285540891,y:28155.2442316205
j:43,x:19209.6289398166,y:29535.2334839369
j:44,x:9422.51712744138,y:7358.35561487623
j:45,x:7820.46066360863,y:4996.95767041441
j:46,x:6377.96431289128,y:3330.72486158648
j:47,x:8414.00729731854,y:5733.24294278083
j:48,x:13395.2441510298,y:14531.7640640732
j:49,x:10072.4555486018,y:8199.29513825378
j:50,x:13750.2448518878,y:15521.9369843315
j:51,x:10296.0827362852,y:8527.0639982858
j:52,x:6507.02628556282,y:3461.09753342201
j:53,x:8783.9344786703,y:6310.14409308786
j:54,x:9003.78542793557,y:6601.38959238604
j:55,x:20813.7448800034,y:35592.3147671153
j:56,x:5289.09278243139,y:2226.73471576616
j:57,x:8532.85929960131,y:5819.49411800463
j:58,x:11348.6675835491,y:10574.8631913055
j:59,x:8551.27928165767,y:5930.94436891762
j:60,x:15244.634068412,y:18905.0582843398
j:61,x:7618.05512742265,y:4646.39531649985
j:62,x:12939.1731576921,y:13768.752109996
j:63,x:8706.35996409801,y:6224.75260598408
j:64,x:3637.09351150946,y:1074.01454136598
j:65,x:10530.206755182,y:8813.34893063552
j:66,x:12583.1457254382,y:12734.3930571511
j:67,x:6482.90715272305,y:3395.00737962906
j:68,x:8643.42669722401,y:6049.67470862014
j:69,x:11755.5839875219,y:11122.7483849584
j:70,x:10756.8488991996,y:9350.06615221574
j:71,x:9806.83380002661,y:7845.96093035565
j:72,x:4453.69715385594,y:1600.99996477854
j:73,x:10687.2359405596,y:9360.37079919075
j:74,x:11335.8302658389,y:10280.9817336157
j:75,x:9996.41627738755,y:8088.22097907952
j:76,x:14429.5163037377,y:16717.7633770721
j:77,x:5630.91049833958,y:2544.14838939453
j:78,x:4495.81509706488,y:1641.61674603476
j:79,x:16594.6246153476,y:22377.2043298192
j:80,x:15222.2235469985,y:19235.2778083789
j:81,x:12654.1839168235,y:13048.8185451231
j:82,x:4698.04960978896,y:1807.8133778561
j:83,x:10900.2334278784,y:9524.2746579917
j:84,x:11005.9144385577,y:9926.58149624517
j:85,x:5587.52540961584,y:2509.65611637126
j:86,x:9206.1477079121,y:6914.10350195407
j:87,x:11435.8943487277,y:10709.323765601
j:88,x:12729.9209686692,y:13311.7215007109
j:89,x:12042.1820112473,y:11841.7985273985
j:90,x:17316.7799188574,y:24097.6664362849
j:91,x:8052.13666803274,y:5308.68702420624
j:92,x:9811.27001366608,y:7933.17368273974
j:93,x:11353.5015689548,y:10276.9039601661
j:94,x:6825.17773478968,y:3786.48441404862
j:95,x:8924.74803769424,y:6453.12618672194
j:96,x:14696.7590326342,y:17733.8633036821
j:97,x:9433.38534715269,y:7210.45616818636
j:98,x:8014.57245836483,y:5278.36447650352
j:99,x:3271.33462852333,y:865.803344652903
从结果看,其实并不美好!
有一点可以高兴的是,如果跌了,那么比全仓买入跌的少,如果涨了有可能涨的比买入不动好,也有可能比买入不动差。
做事情我喜欢all in,要么干,要么不干,要干就大力的干,大力才能出奇迹。
炒股这件事情还是交给专业的人去做吧,股票市场上没有稳赚的事情。
最后附上代码:
static void Main2( )
{
Random r = new Random();//产生随机数
for (int j = 0; j < 100; j++)//测试100次
{
List<double> changes = new List<double>();
double ini = 1;
changes.Add(ini);
for (int i = 1; i < 250; i++)//一年大概250个交易日,随机游走的上下波动数值
{
string s ="j:"+j+","+ ini + ",";
var c = r.Next();
var num = r.NextDouble()/10;
if (c % 2 == 0)//随机涨跌
{
s += "+";
ini +=ini* num;
}
else
{
s += "-";
ini -= ini * num;
}
s += num;
s += "," + ini;
Console.WriteLine(s);
changes.Add(ini);
}
double buy = 5000;//初始值10000,一部分买入,一部分作为现金;
double cash = 5000;
for (int i = 1; i < changes.Count; i++)
{
var change = (changes[i] - changes[i - 1]);
buy = buy + buy * (change / changes[i - 1]);
cash = buy = (buy + cash) / 2;
}
Console.WriteLine("j:{2},x:{0},y:{1}", buy + cash, 10000 + 10000 * (changes[changes.Count - 1] - 1) / 1, j);
}
Console.WriteLine();
}
网友评论