diff --git a/data/Finance/DaxHistoricalData.dat b/data/Finance/DaxHistoricalData.dat
new file mode 100644
index 00000000..61e03ecb
--- /dev/null
+++ b/data/Finance/DaxHistoricalData.dat
@@ -0,0 +1,253 @@
+Date;Open;High;Low;Close;Volume;Adj Close
+02.01.2014;9598.25;9620.93;9394.21;9400.04;90956900;9400.04
+03.01.2014;9409.66;9453.48;9367.99;9435.15;58772900;9435.15
+06.01.2014;9419.44;9468.80;9399.81;9428.00;53653700;9428.00
+07.01.2014;9446.25;9518.72;9416.86;9506.20;79946800;9506.20
+08.01.2014;9512.79;9516.26;9467.95;9497.84;90140400;9497.84
+09.01.2014;9492.24;9549.50;9402.80;9421.61;98917000;9421.61
+10.01.2014;9473.87;9529.70;9441.25;9473.24;96130400;9473.24
+13.01.2014;9497.92;9519.30;9457.31;9510.17;85787700;9510.17
+14.01.2014;9391.46;9540.51;9381.94;9540.51;104777800;9540.51
+15.01.2014;9590.57;9747.40;9582.10;9733.81;120099000;9733.81
+16.01.2014;9742.21;9747.37;9702.97;9717.71;87811900;9717.71
+17.01.2014;9718.20;9789.89;9709.14;9742.96;131098100;9742.96
+20.01.2014;9713.20;9733.40;9672.32;9715.90;78126100;9715.90
+21.01.2014;9751.98;9794.05;9714.02;9730.12;80839600;9730.12
+22.01.2014;9752.11;9765.63;9677.14;9720.11;84234100;9720.11
+23.01.2014;9690.51;9728.78;9596.49;9631.04;98660400;9631.04
+24.01.2014;9646.65;9664.24;9374.08;9392.02;125916200;9392.02
+27.01.2014;9389.17;9402.72;9310.99;9349.22;112554100;9349.22
+28.01.2014;9405.53;9427.59;9345.76;9406.91;99322000;9406.91
+29.01.2014;9507.35;9537.63;9221.30;9336.73;126384200;9336.73
+30.01.2014;9343.51;9415.48;9266.95;9373.48;97748700;9373.48
+31.01.2014;9339.84;9346.79;9166.05;9306.48;126856500;9306.48
+03.02.2014;9318.77;9357.58;9173.56;9186.52;105545400;9186.52
+04.02.2014;9126.46;9166.98;9071.25;9127.91;114598200;9127.91
+05.02.2014;9105.28;9154.72;9080.87;9116.32;95608700;9116.32
+06.02.2014;9166.46;9274.46;9128.97;9256.58;122685200;9256.58
+07.02.2014;9275.38;9323.24;9223.21;9301.92;89003400;9301.92
+10.02.2014;9331.71;9346.13;9280.18;9289.86;59599900;9289.86
+11.02.2014;9338.80;9478.77;9338.01;9478.77;76248400;9478.77
+12.02.2014;9505.12;9594.85;9501.96;9540.00;85292300;9540.00
+13.02.2014;9522.66;9600.64;9479.86;9596.77;93209100;9596.77
+14.02.2014;9615.52;9677.53;9593.37;9662.40;91504800;9662.40
+17.02.2014;9661.80;9682.19;9645.51;9656.76;45850100;9656.76
+18.02.2014;9674.80;9690.97;9614.40;9659.78;58827300;9659.78
+19.02.2014;9641.45;9695.86;9596.42;9660.05;72892900;9660.05
+20.02.2014;9524.58;9618.85;9504.18;9618.85;88676900;9618.85
+21.02.2014;9665.08;9666.15;9598.03;9656.95;78587700;9656.95
+24.02.2014;9619.64;9708.94;9602.95;9708.94;67953500;9708.94
+25.02.2014;9676.56;9710.95;9628.72;9699.35;90676100;9699.35
+26.02.2014;9708.50;9720.66;9612.52;9661.73;87277200;9661.73
+27.02.2014;9660.55;9672.82;9497.78;9588.33;86422200;9588.33
+28.02.2014;9592.90;9692.08;9566.04;9692.08;83200800;9692.08
+03.03.2014;9553.08;9554.17;9358.73;9358.89;118040200;9358.89
+04.03.2014;9453.77;9590.11;9421.16;9589.15;95630200;9589.15
+05.03.2014;9562.39;9599.00;9534.43;9542.02;73341700;9542.02
+06.03.2014;9577.35;9587.44;9505.32;9542.87;103682600;9542.87
+07.03.2014;9538.45;9543.24;9346.82;9350.75;103246700;9350.75
+10.03.2014;9305.51;9382.98;9216.07;9265.50;84875400;9265.50
+11.03.2014;9295.32;9375.29;9259.18;9307.79;72300800;9307.79
+12.03.2014;9257.13;9267.10;9142.54;9188.69;107430600;9188.69
+13.03.2014;9200.12;9226.96;9017.35;9017.79;113773100;9017.79
+14.03.2014;8939.18;9094.24;8913.27;9056.41;141175500;9056.41
+17.03.2014;9047.49;9197.81;9047.49;9180.89;86964500;9180.89
+18.03.2014;9172.05;9315.07;9105.69;9242.55;99301200;9242.55
+19.03.2014;9262.71;9325.93;9221.59;9277.05;89476800;9277.05
+20.03.2014;9215.70;9296.90;9156.63;9296.12;96945700;9296.12
+21.03.2014;9300.66;9376.94;9288.15;9342.94;198583500;9342.94
+24.03.2014;9349.52;9358.95;9181.37;9188.77;86790900;9188.77
+25.03.2014;9223.92;9372.07;9223.90;9338.40;82230600;9338.40
+26.03.2014;9367.53;9488.74;9360.30;9448.58;75841600;9448.58
+27.03.2014;9428.91;9469.39;9397.98;9451.21;66826100;9451.21
+28.03.2014;9487.12;9587.19;9484.90;9587.19;70498400;9587.19
+31.03.2014;9621.92;9634.82;9543.09;9555.91;68772900;9555.91
+01.04.2014;9601.96;9631.06;9574.63;9603.71;72835100;9603.71
+02.04.2014;9628.76;9645.60;9608.46;9623.36;73976000;9623.36
+03.04.2014;9620.87;9689.52;9591.89;9628.82;76385800;9628.82
+04.04.2014;9641.96;9721.50;9627.74;9695.77;75314000;9695.77
+07.04.2014;9585.52;9608.20;9496.67;9510.85;78800000;9510.85
+08.04.2014;9525.07;9525.94;9391.86;9490.79;86190900;9490.79
+09.04.2014;9506.75;9542.31;9480.96;9506.35;69917100;9506.35
+10.04.2014;9556.70;9581.48;9440.99;9454.54;77873700;9454.54
+11.04.2014;9351.20;9390.44;9259.43;9315.29;100489700;9315.29
+14.04.2014;9248.86;9339.17;9214.18;9339.17;90916500;9339.17
+15.04.2014;9324.84;9344.85;9166.53;9173.71;88156800;9173.71
+16.04.2014;9252.30;9318.97;9221.48;9317.82;78803200;9317.82
+17.04.2014;9311.03;9417.82;9277.36;9409.71;86295200;9409.71
+22.04.2014;9455.52;9602.57;9439.66;9600.09;70194100;9600.09
+23.04.2014;9602.12;9607.84;9539.62;9544.19;61216900;9544.19
+24.04.2014;9597.07;9645.06;9410.33;9548.68;87813900;9548.68
+25.04.2014;9474.79;9501.91;9367.42;9401.55;79230200;9401.55
+28.04.2014;9454.84;9496.84;9407.65;9446.36;67539100;9446.36
+29.04.2014;9521.65;9596.42;9480.57;9584.12;91467900;9584.12
+30.04.2014;9576.93;9618.98;9561.06;9603.23;90290900;9603.23
+02.05.2014;9611.79;9627.38;9533.30;9556.02;88062300;9556.02
+05.05.2014;9536.38;9548.17;9407.09;9529.50;61911600;9529.50
+06.05.2014;9570.25;9571.63;9440.47;9467.53;82062900;9467.53
+07.05.2014;9418.50;9554.35;9410.08;9521.30;92732600;9521.30
+08.05.2014;9547.27;9622.30;9487.57;9607.40;102022500;9607.40
+09.05.2014;9591.32;9602.86;9558.11;9581.45;80084100;9581.45
+12.05.2014;9608.93;9710.34;9587.14;9702.46;87508500;9702.46
+13.05.2014;9751.05;9783.72;9732.34;9754.43;96844100;9754.43
+14.05.2014;9765.62;9772.09;9733.21;9754.39;76079000;9754.39
+15.05.2014;9741.25;9810.29;9631.57;9656.05;133897400;9656.05
+16.05.2014;9646.56;9670.90;9577.90;9629.10;113085400;9629.10
+19.05.2014;9607.32;9676.52;9534.56;9659.39;97857300;9659.39
+20.05.2014;9644.80;9685.56;9613.91;9639.08;67588400;9639.08
+21.05.2014;9615.86;9709.91;9583.56;9697.87;86239200;9697.87
+22.05.2014;9731.45;9734.14;9689.13;9720.91;63696000;9720.91
+23.05.2014;9722.63;9779.59;9704.75;9768.01;65280800;9768.01
+26.05.2014;9826.91;9893.81;9821.68;9892.82;53846400;9892.82
+27.05.2014;9893.33;9951.90;9879.64;9940.82;79797700;9940.82
+28.05.2014;9950.74;9957.87;9898.26;9939.17;72748500;9939.17
+29.05.2014;9937.66;9956.24;9917.97;9938.90;65743400;9938.90
+30.05.2014;9926.73;9970.77;9924.63;9943.27;103680100;9943.27
+02.06.2014;9986.86;9992.33;9907.77;9950.12;57920300;9950.12
+03.06.2014;9949.96;9954.78;9887.01;9919.74;71968600;9919.74
+04.06.2014;9903.82;9928.96;9866.97;9926.67;66442200;9926.67
+05.06.2014;9929.41;10013.69;9896.09;9947.83;129942500;9947.83
+06.06.2014;9954.01;10000.92;9941.65;9987.19;92994900;9987.19
+09.06.2014;9994.40;10009.60;9985.87;10008.63;43200400;10008.63
+10.06.2014;9998.51;10033.74;9987.69;10028.80;64853100;10028.80
+11.06.2014;10022.99;10024.84;9921.26;9949.81;96286500;9949.81
+12.06.2014;9950.52;9970.38;9917.61;9938.70;68482900;9938.70
+13.06.2014;9920.49;9944.57;9829.09;9912.87;79417700;9912.87
+16.06.2014;9885.97;9925.85;9872.77;9883.98;64029200;9883.98
+17.06.2014;9915.20;9982.89;9861.29;9920.32;72084200;9920.32
+18.06.2014;9932.04;9964.02;9922.07;9930.33;72976800;9930.33
+19.06.2014;10018.91;10023.55;9993.03;10004.00;86693500;10004.00
+20.06.2014;9995.50;10050.98;9987.24;9987.24;209559600;9987.24
+23.06.2014;9991.40;9993.02;9885.96;9920.92;68730100;9920.92
+24.06.2014;9938.64;9948.59;9899.47;9938.08;61266100;9938.08
+25.06.2014;9883.78;9914.12;9836.46;9867.75;82312000;9867.75
+26.06.2014;9894.55;9898.38;9749.75;9804.90;94925000;9804.90
+27.06.2014;9818.46;9836.68;9791.13;9815.17;63248900;9815.17
+30.06.2014;9833.85;9889.49;9800.08;9833.07;66649700;9833.07
+01.07.2014;9853.74;9902.41;9835.74;9902.41;54519000;9902.41
+02.07.2014;9913.00;9936.39;9890.11;9911.27;70229500;9911.27
+03.07.2014;9910.47;10032.28;9907.01;10029.43;78288000;10029.43
+04.07.2014;10028.71;10030.81;10007.40;10009.08;52046500;10009.08
+07.07.2014;9992.13;10015.36;9905.60;9906.07;60506300;9906.07
+08.07.2014;9918.27;9920.78;9772.14;9772.67;85865100;9772.67
+09.07.2014;9789.05;9817.47;9752.79;9808.20;73589700;9808.20
+10.07.2014;9807.25;9807.25;9617.59;9659.13;96879100;9659.13
+11.07.2014;9672.17;9708.43;9623.36;9666.34;62278400;9666.34
+14.07.2014;9710.92;9793.78;9693.89;9783.01;56259600;9783.01
+15.07.2014;9764.69;9788.71;9711.86;9719.41;72125500;9719.41
+16.07.2014;9747.88;9871.58;9747.52;9859.27;69460000;9859.27
+17.07.2014;9819.45;9845.85;9743.62;9753.88;76538100;9753.88
+18.07.2014;9703.67;9721.08;9655.51;9720.02;118113800;9720.02
+21.07.2014;9711.68;9717.70;9597.62;9612.05;65236500;9612.05
+22.07.2014;9682.21;9735.71;9647.74;9734.33;62368600;9734.33
+23.07.2014;9727.43;9802.06;9723.98;9753.56;64736900;9753.56
+24.07.2014;9772.15;9810.47;9674.68;9794.06;70366600;9794.06
+25.07.2014;9770.24;9794.85;9620.58;9644.01;73401600;9644.01
+28.07.2014;9660.71;9665.05;9527.59;9598.17;71997100;9598.17
+29.07.2014;9607.10;9692.33;9573.48;9653.63;66002300;9653.63
+30.07.2014;9646.43;9704.01;9572.90;9593.68;79991300;9593.68
+31.07.2014;9576.16;9582.74;9395.35;9407.48;131077400;9407.48
+01.08.2014;9379.74;9394.48;9185.41;9210.08;141582500;9210.08
+04.08.2014;9222.05;9243.23;9130.34;9154.14;85304300;9154.14
+05.08.2014;9186.03;9237.14;9152.38;9189.74;80560700;9189.74
+06.08.2014;9084.52;9166.21;9030.72;9130.04;98898300;9130.04
+07.08.2014;9081.29;9166.04;9025.82;9038.97;97954700;9038.97
+08.08.2014;8928.19;9061.00;8903.49;9009.32;102515800;9009.32
+11.08.2014;9106.67;9199.00;9089.31;9180.74;81228900;9180.74
+12.08.2014;9166.92;9171.94;9050.00;9069.47;74774600;9069.47
+13.08.2014;9133.84;9213.61;9118.15;9198.88;82251600;9198.88
+14.08.2014;9161.81;9265.92;9149.41;9225.10;80394300;9225.10
+15.08.2014;9239.00;9324.57;9067.58;9092.60;110261800;9092.60
+18.08.2014;9220.99;9261.65;9195.11;9245.33;63822100;9245.33
+19.08.2014;9276.19;9350.27;9276.18;9334.28;57793200;9334.28
+20.08.2014;9329.89;9333.68;9247.84;9314.57;63229700;9314.57
+21.08.2014;9328.71;9405.93;9278.86;9401.53;67874900;9401.53
+22.08.2014;9390.29;9414.39;9291.93;9339.17;70036600;9339.17
+25.08.2014;9456.67;9510.14;9424.11;9510.14;53554100;9510.14
+26.08.2014;9481.56;9591.72;9446.37;9588.15;66737100;9588.15
+27.08.2014;9583.98;9600.85;9546.55;9569.71;69031300;9569.71
+28.08.2014;9545.21;9546.81;9417.16;9462.56;72124500;9462.56
+29.08.2014;9483.42;9517.95;9369.40;9470.17;68471200;9470.17
+01.09.2014;9484.53;9500.20;9424.78;9479.03;43071900;9479.03
+02.09.2014;9525.15;9578.50;9485.24;9507.02;55157400;9507.02
+03.09.2014;9541.02;9683.10;9528.72;9626.49;90121000;9626.49
+04.09.2014;9591.43;9732.78;9539.92;9724.26;106652400;9724.26
+05.09.2014;9714.24;9774.65;9691.44;9747.02;77345000;9747.02
+08.09.2014;9767.90;9773.70;9721.71;9758.03;53013300;9758.03
+09.09.2014;9737.56;9769.21;9695.44;9710.70;57197900;9710.70
+10.09.2014;9672.45;9723.08;9635.50;9700.17;62415400;9700.17
+11.09.2014;9729.89;9732.83;9630.67;9691.28;62050300;9691.28
+12.09.2014;9706.59;9706.59;9617.70;9651.13;52625100;9651.13
+15.09.2014;9603.97;9682.46;9600.15;9659.63;55750900;9659.63
+16.09.2014;9644.28;9644.88;9588.65;9632.93;62265100;9632.93
+17.09.2014;9672.98;9695.44;9649.99;9661.50;67216900;9661.50
+18.09.2014;9703.10;9798.13;9686.43;9798.13;81235700;9798.13
+19.09.2014;9849.43;9891.20;9799.24;9799.26;195350400;9799.26
+22.09.2014;9748.53;9812.77;9735.69;9749.54;73981000;9749.54
+23.09.2014;9713.40;9719.66;9589.03;9595.03;88196000;9595.03
+24.09.2014;9598.77;9669.45;9534.77;9661.97;85850600;9661.97
+25.09.2014;9644.36;9718.11;9482.54;9510.01;97697000;9510.01
+26.09.2014;9500.55;9545.34;9454.88;9490.55;83499600;9490.55
+29.09.2014;9495.58;9504.98;9369.62;9422.91;77424800;9422.91
+30.09.2014;9446.81;9495.00;9404.89;9474.30;89859600;9474.30
+01.10.2014;9454.04;9520.97;9357.55;9382.03;83526600;9382.03
+02.10.2014;9363.28;9412.62;9195.68;9195.68;122375300;9195.68
+06.10.2014;9341.05;9343.65;9185.86;9209.51;103676300;9209.51
+07.10.2014;9164.77;9170.24;9080.35;9086.21;105001700;9086.21
+08.10.2014;9027.90;9064.88;8960.43;8995.33;112047000;8995.33
+09.10.2014;9082.66;9140.29;8975.06;9005.02;104101300;9005.02
+10.10.2014;8924.58;8958.66;8788.21;8788.81;162566100;8788.81
+13.10.2014;8703.85;8872.40;8699.60;8812.43;112875000;8812.43
+14.10.2014;8765.36;8854.39;8701.44;8825.21;116078300;8825.21
+15.10.2014;8838.68;8847.85;8555.73;8571.95;153532200;8571.95
+16.10.2014;8623.28;8662.86;8354.97;8582.90;224468500;8582.90
+17.10.2014;8629.16;8850.27;8588.42;8850.27;181971200;8850.27
+20.10.2014;8819.26;8834.73;8682.59;8717.76;103016000;8717.76
+21.10.2014;8693.06;8889.78;8644.71;8886.96;118317300;8886.96
+22.10.2014;8934.54;8957.16;8861.44;8940.14;97874300;8940.14
+23.10.2014;8873.54;9068.12;8820.89;9047.31;108376900;9047.31
+24.10.2014;9008.60;9044.85;8955.59;8987.80;98966500;8987.80
+27.10.2014;9080.80;9085.64;8837.66;8902.61;111764500;8902.61
+28.10.2014;8983.06;9077.89;8968.59;9068.19;78580500;9068.19
+29.10.2014;9139.00;9157.63;9072.64;9082.81;89708100;9082.81
+30.10.2014;9091.13;9146.95;8899.90;9114.84;119733200;9114.84
+31.10.2014;9283.40;9339.33;9217.00;9326.87;123211200;9326.87
+03.11.2014;9305.73;9343.64;9236.18;9251.70;79777600;9251.70
+04.11.2014;9244.09;9317.92;9148.78;9166.47;90365900;9166.47
+05.11.2014;9238.07;9329.07;9226.34;9315.48;81034800;9315.48
+06.11.2014;9284.97;9467.36;9268.63;9377.41;124002400;9377.41
+07.11.2014;9406.16;9414.32;9239.11;9291.83;104437000;9291.83
+10.11.2014;9233.87;9351.87;9222.57;9351.87;71162800;9351.87
+11.11.2014;9374.36;9400.90;9324.77;9369.03;79810300;9369.03
+12.11.2014;9339.68;9359.37;9189.63;9210.96;93733900;9210.96
+13.11.2014;9260.53;9311.00;9170.28;9248.51;82312000;9248.51
+14.11.2014;9272.36;9284.13;9184.46;9252.94;76730500;9252.94
+17.11.2014;9162.27;9331.32;9161.60;9306.35;72034400;9306.35
+18.11.2014;9323.75;9461.53;9323.52;9456.53;73982400;9456.53
+19.11.2014;9462.05;9521.73;9439.16;9472.80;73153500;9472.80
+20.11.2014;9460.40;9487.69;9382.23;9483.97;82097800;9483.97
+21.11.2014;9521.24;9736.14;9508.17;9732.55;166634400;9732.55
+24.11.2014;9722.31;9832.41;9711.77;9785.54;97612300;9785.54
+25.11.2014;9790.03;9921.46;9787.26;9861.21;117773900;9861.21
+26.11.2014;9894.60;9942.67;9868.35;9915.56;89124300;9915.56
+27.11.2014;9934.78;9992.67;9920.86;9974.87;84700200;9974.87
+28.11.2014;9990.70;9990.70;9902.40;9980.85;98906800;9980.85
+01.12.2014;9915.74;9979.08;9906.42;9963.51;97092800;9963.51
+02.12.2014;9983.79;10038.21;9910.21;9934.08;86630800;9934.08
+03.12.2014;9978.89;9993.85;9930.53;9971.79;83605000;9971.79
+04.12.2014;9998.85;10083.74;9835.42;9851.35;119705200;9851.35
+05.12.2014;9931.96;10093.03;9929.47;10087.12;93445100;10087.12
+08.12.2014;10060.91;10084.95;10014.99;10014.99;68931200;10014.99
+09.12.2014;9904.58;9951.66;9786.38;9793.71;110063600;9793.71
+10.12.2014;9859.78;9909.39;9775.39;9799.73;88531300;9799.73
+11.12.2014;9770.66;9907.82;9763.41;9862.53;98963300;9862.53
+12.12.2014;9794.20;9799.65;9586.22;9594.73;94544800;9594.73
+15.12.2014;9599.82;9678.26;9330.99;9334.01;112718700;9334.01
+16.12.2014;9366.56;9567.09;9219.05;9563.89;171052400;9563.89
+17.12.2014;9455.74;9589.25;9429.40;9544.43;102078900;9544.43
+18.12.2014;9711.61;9811.06;9671.18;9811.06;121015600;9811.06
+19.12.2014;9901.26;9901.26;9688.66;9786.96;173452900;9786.96
+22.12.2014;9827.26;9924.01;9826.55;9865.76;0;9865.76
+23.12.2014;9887.24;9922.11;9848.06;9922.11;0;9922.11
+29.12.2014;9914.87;9927.85;9775.45;9927.13;0;9927.13
+30.12.2014;9883.10;9886.78;9805.55;9805.55;0;9805.55
diff --git a/src/Numerics/Financial/Bar.cs b/src/Numerics/Financial/Bar.cs
new file mode 100644
index 00000000..6b7f3312
--- /dev/null
+++ b/src/Numerics/Financial/Bar.cs
@@ -0,0 +1,64 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace MathNet.Numerics.Financial
+{
+ ///
+ /// Repressentation of a stock bar
+ ///
+ public struct Bar
+ {
+ private readonly double _high;
+ private readonly double _low;
+ private readonly double _open;
+ private readonly double _close;
+
+ ///
+ /// High of the bar
+ ///
+ public double High
+ {
+ get { return _high; }
+ }
+
+ ///
+ /// Low of the bar
+ ///
+ public double Low
+ {
+ get { return _low; }
+ }
+
+ ///
+ /// Open of the bar
+ ///
+ public double Open
+ {
+ get { return _open; }
+ }
+
+ ///
+ /// Close of the bar
+ ///
+ public double Close
+ {
+ get { return _close; }
+ }
+ ///
+ /// ctor
+ ///
+ /// High of the bar
+ /// Low of the bar
+ /// Open of the bar
+ /// Close of the bar
+ public Bar(double high,double low,double open,double close)
+ {
+ _high = high;
+ _low = low;
+ _open = open;
+ _close = close;
+ }
+ }
+}
diff --git a/src/Numerics/Financial/Indicators.cs b/src/Numerics/Financial/Indicators.cs
new file mode 100644
index 00000000..2635459e
--- /dev/null
+++ b/src/Numerics/Financial/Indicators.cs
@@ -0,0 +1,113 @@
+//
+// Math.NET Numerics, part of the Math.NET Project
+// http://numerics.mathdotnet.com
+// http://github.com/mathnet/mathnet-numerics
+// http://mathnetnumerics.codeplex.com
+//
+// Copyright (c) 2009-2015 Math.NET
+//
+// Permission is hereby granted, free of charge, to any person
+// obtaining a copy of this software and associated documentation
+// files (the "Software"), to deal in the Software without
+// restriction, including without limitation the rights to use,
+// copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following
+// conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+// OTHER DEALINGS IN THE SOFTWARE.
+//
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using MathNet.Numerics.Statistics;
+
+namespace MathNet.Numerics.Financial
+{
+ ///
+ /// Extension methods to calculate basic technical indicators
+ ///
+ public static class Indicators
+ {
+ ///
+ /// Evaluates the sample mean over a moving window, for each samples.
+ /// Returns NaN if no data is empty or if any entry is NaN.
+ ///
+ /// The sample stream to calculate the mean of.
+ /// The number of last samples to consider.
+ /// The SMA for samples
+ public static IEnumerable SMA(this IEnumerable samples, int period)
+ {
+ return samples.MovingAverage(period);
+ }
+ ///
+ /// Calculate the Average True Range (ATR)
+ ///
+ /// Input samples
+ /// Period of calculation
+ ///
+ public static IEnumerable ATR(this IEnumerable samples, int period)
+ {
+ if (period<=0)
+ throw new ArgumentException("period should be greater than 0","period");
+ if(samples==null)
+ throw new ArgumentNullException("samples", "samples should not be null");
+ if (period > (samples.Count() +1))
+ throw new ArgumentException("samples", "samples should be greater than period");
+
+ var trList = new List();
+ var enumerator = samples.GetEnumerator();
+ enumerator.MoveNext();
+ var lastBar = enumerator.Current;
+
+ trList.Add(double.NaN);
+
+ while (enumerator.MoveNext())
+ {
+ var currentBar = enumerator.Current;
+
+ var hl = Math.Round(currentBar.High - currentBar.Low,10);
+ hl = Math.Abs(hl);
+ var pdch = Math.Round(lastBar.Close - currentBar.High,10);
+ pdch = Math.Abs(pdch);
+ var pdcl = Math.Round(lastBar.Close - currentBar.Low,10);
+ pdcl = Math.Abs(pdcl);
+ double tr = Math.Max(hl, Math.Max(pdch, pdcl));
+
+ trList.Add(tr);
+
+ lastBar = currentBar;
+ }
+
+ var atrList = new List();
+
+ for (int i = 0; i < period; i++)
+ atrList.Add(Double.NaN);
+
+ //remove first tr, this is not valid
+ trList.RemoveAt(0);
+
+ while (trList.Count>=period)
+ {
+ var mean = trList.Take(period).Mean();
+ var meanRounded = Math.Round(mean, 2);
+ atrList.Add(meanRounded);
+ trList.RemoveAt(0);
+ }
+
+ return atrList;
+ }
+
+ }
+}
diff --git a/src/Numerics/Numerics.csproj b/src/Numerics/Numerics.csproj
index 941675c9..03139de0 100644
--- a/src/Numerics/Numerics.csproj
+++ b/src/Numerics/Numerics.csproj
@@ -87,6 +87,8 @@
+
+
diff --git a/src/UnitTests/FinancialTests/IndicatorsTests.cs b/src/UnitTests/FinancialTests/IndicatorsTests.cs
new file mode 100644
index 00000000..eb10a02a
--- /dev/null
+++ b/src/UnitTests/FinancialTests/IndicatorsTests.cs
@@ -0,0 +1,99 @@
+//
+// Math.NET Numerics, part of the Math.NET Project
+// http://numerics.mathdotnet.com
+// http://github.com/mathnet/mathnet-numerics
+// http://mathnetnumerics.codeplex.com
+//
+// Copyright (c) 2009-2015 Math.NET
+//
+// Permission is hereby granted, free of charge, to any person
+// obtaining a copy of this software and associated documentation
+// files (the "Software"), to deal in the Software without
+// restriction, including without limitation the rights to use,
+// copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following
+// conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+// OTHER DEALINGS IN THE SOFTWARE.
+//
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using MathNet.Numerics.Financial;
+using NUnit.Framework;
+
+namespace MathNet.Numerics.UnitTests.FinancialTests
+{
+ [TestFixture, Category("Financial")]
+ public class IndicatorsTests
+ {
+ [Test]
+ public void Atr_ShouldReturnValuesWithoutException()
+ {
+ var inputBars = GenerateValidBars();
+ var atr = inputBars.ATR(14);
+ }
+
+ [Test]
+ public void Atr_ShouldReturnValue()
+ {
+ var inputBars = GenerateValidBars();
+ var atr = inputBars.ATR(14);
+
+ var expectedValueAtBar20 = 132.33;
+ var actual = atr.ElementAt(20);
+ Assert.AreEqual(expectedValueAtBar20, actual);
+
+ }
+
+ [Test]
+ public void Atr_ShouldRaiseException_IfPeriodIsZero()
+ {
+ var inputBars = GenerateValidBars();
+ var period = 0;
+
+ Assert.That(() => inputBars.ATR(period), Throws.Exception.TypeOf());
+ }
+
+ [Test]
+ public void Atr_ShouldRaiseException_IfPeriodIsGreaterThanBarCount()
+ {
+ var inputBars = GenerateValidBars();
+ inputBars = inputBars.Take(10);
+ var period = 11;
+
+ Assert.That(() => inputBars.ATR(period), Throws.Exception.TypeOf());
+ }
+
+
+ private IEnumerable GenerateValidBars()
+ {
+ StockDataReader reader = new StockDataReader();
+ var data = reader.ReadFile("./data/Finance/DaxHistoricalData.dat");
+
+ List inputBars = new List();
+
+ foreach (var stockData in data)
+ {
+ var bar = new Bar(stockData.High, stockData.Low, stockData.Open, stockData.Close);
+ inputBars.Add(bar);
+ }
+ return inputBars;
+ }
+ }
+
+}
diff --git a/src/UnitTests/FinancialTests/StockDataReader.cs b/src/UnitTests/FinancialTests/StockDataReader.cs
new file mode 100644
index 00000000..2772067f
--- /dev/null
+++ b/src/UnitTests/FinancialTests/StockDataReader.cs
@@ -0,0 +1,78 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace MathNet.Numerics.UnitTests.FinancialTests
+{
+ internal class StockDataReader
+ {
+
+ public IEnumerable ReadFile(string filePath)
+ {
+ List resultList = new List();
+
+ using (var reader = new StreamReader(filePath))
+ {
+ var firstLine = reader.ReadLine();
+
+ string line = string.Empty;
+
+ while(true)
+ {
+ line = reader.ReadLine();
+ if (line == null)
+ break;
+
+ line = line.Trim();
+ if (line.Equals(string.Empty))
+ continue;
+
+ var stringValues = line.Split(';');
+
+ //first Datetime:
+ DateTime date = DateTime.Parse(stringValues[0]);
+ double open = double.Parse(stringValues[1], CultureInfo.InvariantCulture);
+ double high = double.Parse(stringValues[2], CultureInfo.InvariantCulture);
+ double low = double.Parse(stringValues[3], CultureInfo.InvariantCulture);
+ double close = double.Parse(stringValues[4], CultureInfo.InvariantCulture);
+ int volume = int.Parse(stringValues[5], CultureInfo.InvariantCulture);
+
+ StockData stockData = new StockData(date, open, close, high, low, volume);
+ resultList.Add(stockData);
+ }
+ }
+
+ return resultList;
+ }
+ }
+
+
+
+ internal class StockData
+ {
+ public StockData(DateTime dateTime,double open,double close, double high,double low,int volume)
+ {
+ Date = dateTime;
+ Open = open;
+ Close = close;
+ High = high;
+ Low = low;
+ Volume = volume;
+ }
+
+ public DateTime Date { get; private set; }
+ public double Open { get; private set; }
+ public double Close { get; private set; }
+ public double High { get; private set; }
+ public double Low { get; private set; }
+
+ public int Volume { get; private set; }
+ }
+
+
+}
+
diff --git a/src/UnitTests/UnitTests.csproj b/src/UnitTests/UnitTests.csproj
index 713d8740..ed7cb654 100644
--- a/src/UnitTests/UnitTests.csproj
+++ b/src/UnitTests/UnitTests.csproj
@@ -122,10 +122,12 @@
+
+
@@ -399,6 +401,10 @@
data\Codeplex-5667.csv
PreserveNewest
+
+ data\Finance\DaxHistoricalData.dat
+ PreserveNewest
+
data\Github-Cureos-1.csv
PreserveNewest