mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-19 19:18:05 +00:00
138 lines
21 KiB
Plaintext
138 lines
21 KiB
Plaintext
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 1,
|
|
"metadata": {
|
|
"dotnet_interactive": {
|
|
"language": "csharp"
|
|
},
|
|
"vscode": {
|
|
"languageId": "dotnet-interactive.csharp"
|
|
}
|
|
},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/html": [
|
|
"<div><div></div><div></div><div></div></div>"
|
|
]
|
|
},
|
|
"metadata": {},
|
|
"output_type": "display_data"
|
|
},
|
|
{
|
|
"data": {
|
|
"text/plain": [
|
|
"Loading extensions from `C:\\Users\\miha\\.nuget\\packages\\plotly.net.interactive\\3.0.2\\interactive-extensions\\dotnet\\Plotly.NET.Interactive.dll`"
|
|
]
|
|
},
|
|
"metadata": {},
|
|
"output_type": "display_data"
|
|
}
|
|
],
|
|
"source": [
|
|
"//#r \"nuget: QuanTAlib;\"\n",
|
|
"\n",
|
|
"#r \"nuget: Plotly.NET;\"\n",
|
|
"#r \"nuget: Plotly.NET.Interactive;\"\n",
|
|
"#r \"..\\Source\\bin\\Debug\\net6.0\\QuanTAlib.dll\"\n",
|
|
"\n",
|
|
"using QuanTAlib;\n",
|
|
"using Plotly.NET;\n",
|
|
"using Plotly.NET.LayoutObjects;"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 10,
|
|
"metadata": {
|
|
"dotnet_interactive": {
|
|
"language": "csharp"
|
|
},
|
|
"vscode": {
|
|
"languageId": "dotnet-interactive.csharp"
|
|
}
|
|
},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/html": [
|
|
"\n",
|
|
"<div>\n",
|
|
" <div id=\"962c4ba9-2a84-42ad-98c3-703f45d5e121\"><!-- Plotly chart will be drawn inside this DIV --></div>\r\n",
|
|
"<script type=\"text/javascript\">\r\n",
|
|
"\r\n",
|
|
" var renderPlotly_962c4ba92a8442ad98c3703f45d5e121 = function() {\r\n",
|
|
" var fsharpPlotlyRequire = requirejs.config({context:'fsharp-plotly',paths:{plotly:'https://cdn.plot.ly/plotly-2.6.3.min'}}) || require;\r\n",
|
|
" fsharpPlotlyRequire(['plotly'], function(Plotly) {\r\n",
|
|
"\r\n",
|
|
" var data = [{\"type\":\"scatter\",\"name\":\"TSeries\",\"mode\":\"lines\",\"x\":[\"2022-10-02T00:00:00-07:00\",\"2022-10-03T00:00:00-07:00\",\"2022-10-04T00:00:00-07:00\",\"2022-10-05T00:00:00-07:00\",\"2022-10-06T00:00:00-07:00\",\"2022-10-07T00:00:00-07:00\",\"2022-10-08T00:00:00-07:00\",\"2022-10-09T00:00:00-07:00\",\"2022-10-10T00:00:00-07:00\",\"2022-10-11T00:00:00-07:00\",\"2022-10-12T00:00:00-07:00\",\"2022-10-13T00:00:00-07:00\",\"2022-10-14T00:00:00-07:00\",\"2022-10-15T00:00:00-07:00\",\"2022-10-16T00:00:00-07:00\",\"2022-10-17T00:00:00-07:00\",\"2022-10-18T00:00:00-07:00\",\"2022-10-19T00:00:00-07:00\",\"2022-10-20T00:00:00-07:00\",\"2022-10-21T00:00:00-07:00\",\"2022-10-22T00:00:00-07:00\",\"2022-10-23T00:00:00-07:00\",\"2022-10-24T00:00:00-07:00\",\"2022-10-25T00:00:00-07:00\",\"2022-10-26T00:00:00-07:00\",\"2022-10-27T00:00:00-07:00\",\"2022-10-28T00:00:00-07:00\",\"2022-10-29T00:00:00-07:00\",\"2022-10-30T00:00:00-07:00\",\"2022-10-31T00:00:00-07:00\",\"2022-11-01T00:00:00-07:00\",\"2022-11-02T00:00:00-07:00\",\"2022-11-03T00:00:00-07:00\",\"2022-11-04T00:00:00-07:00\",\"2022-11-05T00:00:00-07:00\",\"2022-11-06T00:00:00-07:00\",\"2022-11-07T00:00:00-08:00\",\"2022-11-08T00:00:00-08:00\",\"2022-11-09T00:00:00-08:00\",\"2022-11-10T00:00:00-08:00\",\"2022-11-11T00:00:00-08:00\",\"2022-11-12T00:00:00-08:00\",\"2022-11-13T00:00:00-08:00\",\"2022-11-14T00:00:00-08:00\",\"2022-11-15T00:00:00-08:00\",\"2022-11-16T00:00:00-08:00\",\"2022-11-17T00:00:00-08:00\",\"2022-11-18T00:00:00-08:00\",\"2022-11-19T00:00:00-08:00\",\"2022-11-20T00:00:00-08:00\"],\"y\":[100.32347458435882,101.54156680190876,102.44460177741148,102.68134101395528,102.90703954051875,102.22218974495196,101.43717558102097,101.14339741875722,102.6105272974295,103.65021639595955,103.77244362510633,102.03217071889168,100.95960056905396,101.82716864075812,102.03608780622523,101.89749556240788,102.05027651788346,101.89296662244362,102.71278122024542,103.56689298536428,103.9354438863785,103.24510354729804,102.76477917952552,101.90095530425728,101.47329595293144,102.67539644303456,102.67689188308368,102.07205981055867,101.91579337759124,102.34912306155965,103.80939489667225,105.54575716201366,106.52047349743614,106.82928565900164,107.24070967911489,106.51634155110602,105.58402408515623,105.00786537536857,106.0160312037631,106.96286899929171,106.47676587167781,106.10170572188973,106.96937029511614,107.62634022789082,107.27961111806637,108.41831762658114,107.53735531695195,108.03977481595943,107.54241266929029,107.40686186037536],\"marker\":{},\"line\":{\"color\":\"red\",\"width\":4.0}},{\"type\":\"scatter\",\"name\":\"EMA_SMA\",\"mode\":\"lines\",\"x\":[\"2022-10-02T00:00:00-07:00\",\"2022-10-03T00:00:00-07:00\",\"2022-10-04T00:00:00-07:00\",\"2022-10-05T00:00:00-07:00\",\"2022-10-06T00:00:00-07:00\",\"2022-10-07T00:00:00-07:00\",\"2022-10-08T00:00:00-07:00\",\"2022-10-09T00:00:00-07:00\",\"2022-10-10T00:00:00-07:00\",\"2022-10-11T00:00:00-07:00\",\"2022-10-12T00:00:00-07:00\",\"2022-10-13T00:00:00-07:00\",\"2022-10-14T00:00:00-07:00\",\"2022-10-15T00:00:00-07:00\",\"2022-10-16T00:00:00-07:00\",\"2022-10-17T00:00:00-07:00\",\"2022-10-18T00:00:00-07:00\",\"2022-10-19T00:00:00-07:00\",\"2022-10-20T00:00:00-07:00\",\"2022-10-21T00:00:00-07:00\",\"2022-10-22T00:00:00-07:00\",\"2022-10-23T00:00:00-07:00\",\"2022-10-24T00:00:00-07:00\",\"2022-10-25T00:00:00-07:00\",\"2022-10-26T00:00:00-07:00\",\"2022-10-27T00:00:00-07:00\",\"2022-10-28T00:00:00-07:00\",\"2022-10-29T00:00:00-07:00\",\"2022-10-30T00:00:00-07:00\",\"2022-10-31T00:00:00-07:00\",\"2022-11-01T00:00:00-07:00\",\"2022-11-02T00:00:00-07:00\",\"2022-11-03T00:00:00-07:00\",\"2022-11-04T00:00:00-07:00\",\"2022-11-05T00:00:00-07:00\",\"2022-11-06T00:00:00-07:00\",\"2022-11-07T00:00:00-08:00\",\"2022-11-08T00:00:00-08:00\",\"2022-11-09T00:00:00-08:00\",\"2022-11-10T00:00:00-08:00\",\"2022-11-11T00:00:00-08:00\",\"2022-11-12T00:00:00-08:00\",\"2022-11-13T00:00:00-08:00\",\"2022-11-14T00:00:00-08:00\",\"2022-11-15T00:00:00-08:00\",\"2022-11-16T00:00:00-08:00\",\"2022-11-17T00:00:00-08:00\",\"2022-11-18T00:00:00-08:00\",\"2022-11-19T00:00:00-08:00\",\"2022-11-20T00:00:00-08:00\"],\"y\":[100.32347458435882,100.9325206931338,101.43654772122636,101.74774604440859,101.97960474363063,102.02003557718417,101.93676986344657,101.8375983078604,101.92347930670141,102.09615301562722,102.24854307103442,102.23051204168918,102.13274962071725,102.11092240786301,102.10593343442049,102.0929060674197,102.09039844685876,102.07943001216901,102.1127642862783,102.1854707212326,102.26880277671573,102.31318008446948,102.3328148277328,102.31482068092133,102.28115969180173,102.31148559574272,102.33959377169204,102.31901423622024,102.28799724709494,102.292699232823,102.40936813004217,102.6506288248092,102.94830918424205,103.24684583614663,103.55406613175958,103.78193347170931,103.92055582658985,104.00419502264975,104.15895165196618,104.37463760176045,104.53633977636949,104.6567525414095,104.83464621477155,105.04939190808842,105.2209472319329,105.46689880075199,105.62616468661354,105.81182700425553,105.94494897848898,106.05740381555718],\"marker\":{},\"line\":{\"color\":\"purple\",\"width\":2.0}},{\"type\":\"scatter\",\"name\":\"True EMA\",\"mode\":\"lines\",\"x\":[\"2022-10-02T00:00:00-07:00\",\"2022-10-03T00:00:00-07:00\",\"2022-10-04T00:00:00-07:00\",\"2022-10-05T00:00:00-07:00\",\"2022-10-06T00:00:00-07:00\",\"2022-10-07T00:00:00-07:00\",\"2022-10-08T00:00:00-07:00\",\"2022-10-09T00:00:00-07:00\",\"2022-10-10T00:00:00-07:00\",\"2022-10-11T00:00:00-07:00\",\"2022-10-12T00:00:00-07:00\",\"2022-10-13T00:00:00-07:00\",\"2022-10-14T00:00:00-07:00\",\"2022-10-15T00:00:00-07:00\",\"2022-10-16T00:00:00-07:00\",\"2022-10-17T00:00:00-07:00\",\"2022-10-18T00:00:00-07:00\",\"2022-10-19T00:00:00-07:00\",\"2022-10-20T00:00:00-07:00\",\"2022-10-21T00:00:00-07:00\",\"2022-10-22T00:00:00-07:00\",\"2022-10-23T00:00:00-07:00\",\"2022-10-24T00:00:00-07:00\",\"2022-10-25T00:00:00-07:00\",\"2022-10-26T00:00:00-07:00\",\"2022-10-27T00:00:00-07:00\",\"2022-10-28T00:00:00-07:00\",\"2022-10-29T00:00:00-07:00\",\"2022-10-30T00:00:00-07:00\",\"2022-10-31T00:00:00-07:00\",\"2022-11-01T00:00:00-07:00\",\"2022-11-02T00:00:00-07:00\",\"2022-11-03T00:00:00-07:00\",\"2022-11-04T00:00:00-07:00\",\"2022-11-05T00:00:00-07:00\",\"2022-11-06T00:00:00-07:00\",\"2022-11-07T00:00:00-08:00\",\"2022-11-08T00:00:00-08:00\",\"2022-11-09T00:00:00-08:00\",\"2022-11-10T00:00:00-08:00\",\"2022-11-11T00:00:00-08:00\",\"2022-11-12T00:00:00-08:00\",\"2022-11-13T00:00:00-08:00\",\"2022-11-14T00:00:00-08:00\",\"2022-11-15T00:00:00-08:00\",\"2022-11-16T00:00:00-08:00\",\"2022-11-17T00:00:00-08:00\",\"2022-11-18T00:00:00-08:00\",\"2022-11-19T00:00:00-08:00\",\"2022-11-20T00:00:00-08:00\"],\"y\":[100.32347458435882,100.41717398570881,100.57312996968595,100.73530005001436,100.90235693389933,101.00388253474954,101.03721276907811,101.04538081905343,101.16577670200545,101.35688744769422,101.54269946134131,101.5803510965375,101.53260105596185,101.55526010094619,101.59224684750612,101.61572751788317,101.64915436403705,101.66790915314525,101.74828392753757,101.88817693198578,102.04565900540061,102.13792397016196,102.18614360165148,102.16420604031347,102.11105911051486,102.15446967455483,102.19465599828783,102.18522552230866,102.16449997271502,102.17870174877999,102.30413968323323,102.55349487390865,102.85864707571845,103.1640808128941,103.47766764875725,103.71141179509176,103.8554588943275,103.94410554671528,104.10348444341128,104.32343710155592,104.4890777761807,104.61312607969677,104.79437563472904,105.01221906497226,105.1866338382872,105.43522489892518,105.5969272387734,105.78483859086464,105.92003659689738,106.03440777101108],\"marker\":{},\"line\":{\"color\":\"blue\",\"width\":2.0}}];\r\n",
|
|
" var layout = {\"width\":1200,\"height\":600,\"template\":{\"layout\":{\"title\":{\"x\":0.05},\"font\":{\"color\":\"rgba(42, 63, 95, 1.0)\"},\"paper_bgcolor\":\"rgba(255, 255, 255, 1.0)\",\"plot_bgcolor\":\"rgba(229, 236, 246, 1.0)\",\"autotypenumbers\":\"strict\",\"colorscale\":{\"diverging\":[[0.0,\"#8e0152\"],[0.1,\"#c51b7d\"],[0.2,\"#de77ae\"],[0.3,\"#f1b6da\"],[0.4,\"#fde0ef\"],[0.5,\"#f7f7f7\"],[0.6,\"#e6f5d0\"],[0.7,\"#b8e186\"],[0.8,\"#7fbc41\"],[0.9,\"#4d9221\"],[1.0,\"#276419\"]],\"sequential\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]],\"sequentialminus\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]]},\"hovermode\":\"closest\",\"hoverlabel\":{\"align\":\"left\"},\"coloraxis\":{\"colorbar\":{\"outlinewidth\":0.0,\"ticks\":\"\"}},\"geo\":{\"showland\":true,\"landcolor\":\"rgba(229, 236, 246, 1.0)\",\"showlakes\":true,\"lakecolor\":\"rgba(255, 255, 255, 1.0)\",\"subunitcolor\":\"rgba(255, 255, 255, 1.0)\",\"bgcolor\":\"rgba(255, 255, 255, 1.0)\"},\"mapbox\":{\"style\":\"light\"},\"polar\":{\"bgcolor\":\"rgba(229, 236, 246, 1.0)\",\"radialaxis\":{\"linecolor\":\"rgba(255, 255, 255, 1.0)\",\"gridcolor\":\"rgba(255, 255, 255, 1.0)\",\"ticks\":\"\"},\"angularaxis\":{\"linecolor\":\"rgba(255, 255, 255, 1.0)\",\"gridcolor\":\"rgba(255, 255, 255, 1.0)\",\"ticks\":\"\"}},\"scene\":{\"xaxis\":{\"ticks\":\"\",\"linecolor\":\"rgba(255, 255, 255, 1.0)\",\"gridcolor\":\"rgba(255, 255, 255, 1.0)\",\"gridwidth\":2.0,\"zerolinecolor\":\"rgba(255, 255, 255, 1.0)\",\"backgroundcolor\":\"rgba(229, 236, 246, 1.0)\",\"showbackground\":true},\"yaxis\":{\"ticks\":\"\",\"linecolor\":\"rgba(255, 255, 255, 1.0)\",\"gridcolor\":\"rgba(255, 255, 255, 1.0)\",\"gridwidth\":2.0,\"zerolinecolor\":\"rgba(255, 255, 255, 1.0)\",\"backgroundcolor\":\"rgba(229, 236, 246, 1.0)\",\"showbackground\":true},\"zaxis\":{\"ticks\":\"\",\"linecolor\":\"rgba(255, 255, 255, 1.0)\",\"gridcolor\":\"rgba(255, 255, 255, 1.0)\",\"gridwidth\":2.0,\"zerolinecolor\":\"rgba(255, 255, 255, 1.0)\",\"backgroundcolor\":\"rgba(229, 236, 246, 1.0)\",\"showbackground\":true}},\"ternary\":{\"aaxis\":{\"ticks\":\"\",\"linecolor\":\"rgba(255, 255, 255, 1.0)\",\"gridcolor\":\"rgba(255, 255, 255, 1.0)\"},\"baxis\":{\"ticks\":\"\",\"linecolor\":\"rgba(255, 255, 255, 1.0)\",\"gridcolor\":\"rgba(255, 255, 255, 1.0)\"},\"caxis\":{\"ticks\":\"\",\"linecolor\":\"rgba(255, 255, 255, 1.0)\",\"gridcolor\":\"rgba(255, 255, 255, 1.0)\"},\"bgcolor\":\"rgba(229, 236, 246, 1.0)\"},\"xaxis\":{\"title\":{\"standoff\":15},\"ticks\":\"\",\"automargin\":true,\"linecolor\":\"rgba(255, 255, 255, 1.0)\",\"gridcolor\":\"rgba(255, 255, 255, 1.0)\",\"zerolinecolor\":\"rgba(255, 255, 255, 1.0)\",\"zerolinewidth\":2.0},\"yaxis\":{\"title\":{\"standoff\":15},\"ticks\":\"\",\"automargin\":true,\"linecolor\":\"rgba(255, 255, 255, 1.0)\",\"gridcolor\":\"rgba(255, 255, 255, 1.0)\",\"zerolinecolor\":\"rgba(255, 255, 255, 1.0)\",\"zerolinewidth\":2.0},\"annotationdefaults\":{\"arrowcolor\":\"#2a3f5f\",\"arrowhead\":0,\"arrowwidth\":1},\"shapedefaults\":{\"line\":{\"color\":\"rgba(42, 63, 95, 1.0)\"}},\"colorway\":[\"rgba(99, 110, 250, 1.0)\",\"rgba(239, 85, 59, 1.0)\",\"rgba(0, 204, 150, 1.0)\",\"rgba(171, 99, 250, 1.0)\",\"rgba(255, 161, 90, 1.0)\",\"rgba(25, 211, 243, 1.0)\",\"rgba(255, 102, 146, 1.0)\",\"rgba(182, 232, 128, 1.0)\",\"rgba(255, 151, 255, 1.0)\",\"rgba(254, 203, 82, 1.0)\"]},\"data\":{\"bar\":[{\"marker\":{\"line\":{\"color\":\"rgba(229, 236, 246, 1.0)\",\"width\":0.5},\"pattern\":{\"fillmode\":\"overlay\",\"size\":10,\"solidity\":0.2}},\"error_x\":{\"color\":\"rgba(42, 63, 95, 1.0)\"},\"error_y\":{\"color\":\"rgba(42, 63, 95, 1.0)\"}}],\"barpolar\":[{\"marker\":{\"line\":{\"color\":\"rgba(229, 236, 246, 1.0)\",\"width\":0.5},\"pattern\":{\"fillmode\":\"overlay\",\"size\":10,\"solidity\":0.2}}}],\"carpet\":[{\"aaxis\":{\"linecolor\":\"rgba(255, 255, 255, 1.0)\",\"gridcolor\":\"rgba(255, 255, 255, 1.0)\",\"endlinecolor\":\"rgba(42, 63, 95, 1.0)\",\"minorgridcolor\":\"rgba(255, 255, 255, 1.0)\",\"startlinecolor\":\"rgba(42, 63, 95, 1.0)\"},\"baxis\":{\"linecolor\":\"rgba(255, 255, 255, 1.0)\",\"gridcolor\":\"rgba(255, 255, 255, 1.0)\",\"endlinecolor\":\"rgba(42, 63, 95, 1.0)\",\"minorgridcolor\":\"rgba(255, 255, 255, 1.0)\",\"startlinecolor\":\"rgba(42, 63, 95, 1.0)\"}}],\"choropleth\":[{\"colorbar\":{\"outlinewidth\":0.0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]]}],\"contour\":[{\"colorbar\":{\"outlinewidth\":0.0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]]}],\"contourcarpet\":[{\"colorbar\":{\"outlinewidth\":0.0,\"ticks\":\"\"}}],\"heatmap\":[{\"colorbar\":{\"outlinewidth\":0.0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]]}],\"heatmapgl\":[{\"colorbar\":{\"outlinewidth\":0.0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]]}],\"histogram\":[{\"marker\":{\"pattern\":{\"fillmode\":\"overlay\",\"size\":10,\"solidity\":0.2}}}],\"histogram2d\":[{\"colorbar\":{\"outlinewidth\":0.0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]]}],\"histogram2dcontour\":[{\"colorbar\":{\"outlinewidth\":0.0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]]}],\"mesh3d\":[{\"colorbar\":{\"outlinewidth\":0.0,\"ticks\":\"\"}}],\"parcoords\":[{\"line\":{\"colorbar\":{\"outlinewidth\":0.0,\"ticks\":\"\"}}}],\"pie\":[{\"automargin\":true}],\"scatter\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0.0,\"ticks\":\"\"}}}],\"scatter3d\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0.0,\"ticks\":\"\"}},\"line\":{\"colorbar\":{\"outlinewidth\":0.0,\"ticks\":\"\"}}}],\"scattercarpet\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0.0,\"ticks\":\"\"}}}],\"scattergeo\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0.0,\"ticks\":\"\"}}}],\"scattergl\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0.0,\"ticks\":\"\"}}}],\"scattermapbox\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0.0,\"ticks\":\"\"}}}],\"scatterpolar\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0.0,\"ticks\":\"\"}}}],\"scatterpolargl\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0.0,\"ticks\":\"\"}}}],\"scatterternary\":[{\"marker\":{\"colorbar\":{\"outlinewidth\":0.0,\"ticks\":\"\"}}}],\"surface\":[{\"colorbar\":{\"outlinewidth\":0.0,\"ticks\":\"\"},\"colorscale\":[[0.0,\"#0d0887\"],[0.1111111111111111,\"#46039f\"],[0.2222222222222222,\"#7201a8\"],[0.3333333333333333,\"#9c179e\"],[0.4444444444444444,\"#bd3786\"],[0.5555555555555556,\"#d8576b\"],[0.6666666666666666,\"#ed7953\"],[0.7777777777777778,\"#fb9f3a\"],[0.8888888888888888,\"#fdca26\"],[1.0,\"#f0f921\"]]}],\"table\":[{\"cells\":{\"fill\":{\"color\":\"rgba(235, 240, 248, 1.0)\"},\"line\":{\"color\":\"rgba(255, 255, 255, 1.0)\"}},\"header\":{\"fill\":{\"color\":\"rgba(200, 212, 227, 1.0)\"},\"line\":{\"color\":\"rgba(255, 255, 255, 1.0)\"}}}]}},\"margin\":{\"l\":30,\"r\":10,\"t\":40,\"b\":30,\"pad\":1,\"autoexpand\":false},\"xaxis\":{\"rangeslider\":{\"visible\":false,\"yaxis\":{}}}};\r\n",
|
|
" var config = {\"responsive\":true};\r\n",
|
|
" Plotly.newPlot('962c4ba9-2a84-42ad-98c3-703f45d5e121', data, layout, config);\r\n",
|
|
"});\r\n",
|
|
" };\r\n",
|
|
" if ((typeof(requirejs) !== typeof(Function)) || (typeof(requirejs.config) !== typeof(Function))) {\r\n",
|
|
" var script = document.createElement(\"script\");\r\n",
|
|
" script.setAttribute(\"src\", \"https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js\");\r\n",
|
|
" script.onload = function(){\r\n",
|
|
" renderPlotly_962c4ba92a8442ad98c3703f45d5e121();\r\n",
|
|
" };\r\n",
|
|
" document.getElementsByTagName(\"head\")[0].appendChild(script);\r\n",
|
|
" }\r\n",
|
|
" else {\r\n",
|
|
" renderPlotly_962c4ba92a8442ad98c3703f45d5e121();\r\n",
|
|
" }\r\n",
|
|
"</script>\r\n",
|
|
"\n",
|
|
" \n",
|
|
"</div> \n"
|
|
]
|
|
},
|
|
"metadata": {},
|
|
"output_type": "display_data"
|
|
}
|
|
],
|
|
"source": [
|
|
"int period = 25;\n",
|
|
"GBM_Feed feed = new(50, Volatility: 1);\n",
|
|
"TSeries data = feed.OHLC4;\n",
|
|
"//List<double> raw = new() { 0, 1, 1 ,1 ,1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0}; \n",
|
|
"//TSeries data = new();\n",
|
|
"//for (int i=0; i<raw.Count; i++) { data.Add((DateTime.Today.AddDays(i-raw.Count)),raw[i]); }\n",
|
|
"\n",
|
|
"EMA_Series calc1 = new(data,period);\n",
|
|
"EMA_Series calc2 = new(data,period, useSMA: false);\n",
|
|
"var line0 = Chart2D.Chart.Line<DateTime,double,bool>(data.t, data.v, false, data.GetType().Name).WithLineStyle(Width: 4, Color: Color.fromString(\"red\"));\n",
|
|
"var line1 = Chart2D.Chart.Line<DateTime,double,bool>(calc1.t, calc1.v, false, \"EMA_SMA\").WithLineStyle(Width: 2, Color: Color.fromString(\"purple\"));\n",
|
|
"var line2 = Chart2D.Chart.Line<DateTime,double,bool>(calc2.t, calc2.v, false, \"True EMA\").WithLineStyle(Width: 2, Color: Color.fromString(\"blue\"));\n",
|
|
"\n",
|
|
"var chart = Chart.Combine(new []{line0, line1, line2})\n",
|
|
" .WithSize(1200,600)\n",
|
|
" .WithMargin(Margin.init<int, int, int, int, int, bool>(30,10,40,30,1,false))\n",
|
|
" .WithXAxisRangeSlider(RangeSlider.init(Visible:false));\n",
|
|
"\n",
|
|
"chart"
|
|
]
|
|
}
|
|
],
|
|
"metadata": {
|
|
"kernelspec": {
|
|
"display_name": ".NET (C#)",
|
|
"language": "C#",
|
|
"name": ".net-csharp"
|
|
},
|
|
"language_info": {
|
|
"file_extension": ".cs",
|
|
"mimetype": "text/x-csharp",
|
|
"name": "C#",
|
|
"pygments_lexer": "csharp",
|
|
"version": "9.0"
|
|
},
|
|
"orig_nbformat": 4
|
|
},
|
|
"nbformat": 4,
|
|
"nbformat_minor": 2
|
|
}
|