Features
Indicators
Indicators
A technical indicator is a set of derived data that is calculated by applying one or more formulas to the original set of data.
Features
Chart Types
Interaction
Settings
Description
A technical indicator is a set of derived data that is calculated by applying one or more formulas to the original set of data. Technical indicators are generally used to forecast the asset's market direction and generally plotted separately from the original data since the Y-axis scales differ.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | using FinancialChartExplorer.Models; using Microsoft.AspNetCore.Mvc; namespace FinancialChartExplorer.Controllers { public partial class HomeController : Controller { public ActionResult Indicators() { var model = BoxData.GetDataFromJson(); return View(model); } } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 | @model List< FinanceData > @ { ViewBag.DemoSettings = true ; var indicators = new List< AnalysisType > { new AnalysisType{Name = Home.Indicators_AnalysisTypeAtr, Abbreviation = "atr" }, new AnalysisType{Name = Home.Indicators_AnalysisTypeRsi, Abbreviation = "rsi" }, new AnalysisType{Name = Home.Indicators_AnalysisTypeCci, Abbreviation = "cci" }, new AnalysisType{Name = Home.Indicators_AnalysisTypeWilliamsR, Abbreviation = "williamsR" }, new AnalysisType{Name = Home.Indicators_AnalysisTypeMacd, Abbreviation = "macd" }, new AnalysisType{Name = Home.Indicators_AnalysisTypeStoch, Abbreviation = "stoch" } }; } <script type="text/javascript"> var indicatorAbbs = [ @Html .Raw( string .Join( "," , indicators.Select(idi => "'" + idi.Abbreviation + "'" )))]; function showOption(indicator) { for ( var i = 0; i < indicatorAbbs.length ; i++) { toggleGroup(indicatorAbbs[i], indicatorAbbs[i] == indicator); } } function toggleGroup(indicator, shown) { var optGroup = wijmo .getElement( '#' + indicator); if (optGroup) { if (shown) { optGroup.style.display = '' ; } else { optGroup.style.display = 'none' ; } } } function updateIndicatorType(combox) { var indicator = combox .selectedValue, index = combox .selectedIndex, indexes = []; if (index == 4) { indexes = [index, index + 1]; } else if (index == 5) { indexes.push(index + 1); } else { indexes.push(index); } showSeries(indexes); showOption(indicator); } function showSeries(indexes) { var chart = wijmo .Control.getControl( '#indicator' ); if (indexes == null || !indexes.length || !chart) { return ; } for ( var i = 0 ; i < chart.series.length; i++) { chart.series[i].visibility = (indexes.indexOf(i) != -1) ? wijmo.chart.SeriesVisibility.Visible : wijmo.chart.SeriesVisibility.Hidden; } } function updateATRPeriod(atrPDNumber) { var chart = wijmo .Control.getControl( '#indicator' ); if (!checkValue(atrPDNumber)) { return ; } if (chart) { chart.series[0] .period = atrPDNumber .value; } } function updateRSIPeriod(rsiPDNumber) { var chart = wijmo .Control.getControl( '#indicator' ); if (!checkValue(rsiPDNumber)) { return ; } if (chart) { chart.series[1] .period = rsiPDNumber .value; } } function updateCCIPeriod(cciPDNumber) { var chart = wijmo .Control.getControl( '#indicator' ); if (!checkValue(cciPDNumber)) { return ; } if (chart) { chart.series[2] .period = cciPDNumber .value; } } function updateWilliamsRPeriod(wrPDNumber) { var chart = wijmo .Control.getControl( '#indicator' ); if (!checkValue(wrPDNumber)) { return ; } if (chart) { chart.series[3] .period = wrPDNumber .value; } } function getDataLength(){ return @ (Model.Count); } function isValidSmoothingPeriod(newValue) { var dataLength = getDataLength (), chart = wijmo .Control.getControl( '#indicator' ), max; if (dataLength <= 0 || !chart) { return false ; } max = Math .max(chart.series[4].fastPeriod, chart.series[4].slowPeriod); return newValue >= 2 && newValue <= Math.abs(dataLength - max); } function isValidPeriod(newValue) { var dataLength = getDataLength(), chart = wijmo.Control.getControl( '#indicator' ), smoothing; if (dataLength <= 0 || !chart) { return false ; } smoothing = chart.series[4].smoothingPeriod; return newValue >= 2 && newValue <= Math.abs(dataLength - smoothing); } function updateFastPeriod(macdFPNumber) { var chart = wijmo.Control.getControl( '#indicator' ), validPeriod = macdFPNumber.value; if (!isValidPeriod(validPeriod)) { return ; } if (chart) { chart.series[4].fastPeriod = validPeriod; chart.series[5].fastPeriod = validPeriod; macdFPNumber.value = validPeriod; } } function updateSlowPeriod(macdSPNumber) { var chart = wijmo.Control.getControl( '#indicator' ), validPeriod = macdSPNumber.value; if (!isValidPeriod(validPeriod)) { return ; } if (chart) { chart.series[4].slowPeriod = validPeriod; chart.series[5].slowPeriod = validPeriod; macdSPNumber.value = validPeriod; } } function updateSmoothingPeriod(macdSPNumber) { var chart = wijmo.Control.getControl( '#indicator' ), validPeriod = macdSPNumber.value; if (!isValidSmoothingPeriod(validPeriod)) { return ; } if (chart) { chart.series[4].smoothingPeriod = validPeriod; chart.series[5].smoothingPeriod = validPeriod; macdSPNumber.value = validPeriod; } } function isValidKPeriod(newValue) { var dataLength = getDataLength(), chart = wijmo.Control.getControl( '#indicator' ), kMax, smoothingPeriod; if (dataLength <= 0 || !chart) { return false ; } kMax = Math.abs(dataLength - chart.series[6].dPeriod); smoothingPeriod = chart.series[6].smoothingPeriod; if (smoothingPeriod > 1) { kMax -= smoothingPeriod; } return newValue >= 2 && newValue <= kMax; } function isValidDPeriod(newValue) { var dataLength = getDataLength(), chart = wijmo.Control.getControl( '#indicator' ), dMax, smoothingPeriod; if (dataLength <= 0 || !chart) { return false ; } dMax = Math.abs(dataLength - chart.series[6].kPeriod); smoothingPeriod = chart.series[6].smoothingPeriod; if (smoothingPeriod > 1) { dMax -= smoothingPeriod; } return newValue >= 2 && newValue <= dMax; } function isValidStochSmoothingPeriod(newValue) { var dataLength = getDataLength(), chart = wijmo.Control.getControl( '#indicator' ), sMax; if (dataLength <= 0 || newValue <= 1) { return false ; } sMax = Math.abs(dataLength - chart.series[6].kPeriod - chart.series[6].dPeriod); sMax = sMax || 1; return newValue >= 1 && newValue <= sMax; } function updateKPeriod(stochKPNumber) { var chart = wijmo.Control.getControl( '#indicator' ), validPeriod = stochKPNumber.value; if (!isValidKPeriod(validPeriod)) { return ; } if (chart) { chart.series[6].kPeriod = validPeriod; stochKPNumber.value = validPeriod; } } function updateDPeriod(stochDPNumber) { var chart = wijmo.Control.getControl( '#indicator' ), validPeriod = stochDPNumber.value; if (!isValidDPeriod(validPeriod)) { return ; } if (chart) { chart.series[6].dPeriod = validPeriod; stochDPNumber.value = validPeriod; } } function updateStochSmoothingPeriod(stochSPNumber) { var chart = wijmo.Control.getControl( '#indicator' ), validPeriod = stochSPNumber.value; if (!isValidStochSmoothingPeriod(validPeriod)) { return ; } if (chart) { chart.series[6].smoothingPeriod = validPeriod; stochSPNumber.value = validPeriod; } } function checkValue(number) { return number.value >= number.min && number.value <= number.max; } c1.documentReady( function () { var combox = wijmo.Control.getControl( '#indicatorSel' ); if (combox) { combox.selectedIndex = 0; updateIndicatorType(combox); } }); function chartRendered(sender, args) { // set min/max for indicator chart to match main chart var indicatorChart = wijmo.Control.getControl( '#indicator' ), chart = wijmo.Control.getControl( '#financeChart' ); if (chart && indicatorChart) { indicatorChart.axisX.min = chart.axisX.actualMin; indicatorChart.axisX.max = chart.axisX.actualMax; } }; </script> < c1-financial-chart id = "financeChart" binding-x = "X" rendered = "chartRendered" legend-position = "Top" > < c1-items-source source-collection = "@Model" ></ c1-items-source > < c1-financial-chart-series binding = "Close" name = "BOX" ></ c1-financial-chart-series > < c1-flex-chart-tooltip content = "tooltip" ></ c1-flex-chart-tooltip > </ c1-financial-chart > < c1-financial-chart id = "indicator" height = "200px" binding-x = "X" rendered = "chartRendered" legend-position = "Bottom" > < c1-items-source source-collection = "@Model" ></ c1-items-source > < c1-flex-chart-atr binding = "High,Low,Open,Close" period = "14" name = "ATR" ></ c1-flex-chart-atr > < c1-flex-chart-rsi binding = "Close" period = "14" name = "RSI" ></ c1-flex-chart-rsi > < c1-flex-chart-cci binding = "High,Low,Open,Close" period = "20" name = "CCI" ></ c1-flex-chart-cci > < c1-flex-chart-williams-r binding = "High,Low,Open,Close" period = "14" name = "Williams %R" ></ c1-flex-chart-williams-r > < c1-flex-chart-macd binding = "Close" fast-period = "12" slow-period = "26" smoothing-period = "9" name = "MACD,Signal" > < c1-flex-chart-line-style c1-property = "macdLine" stroke = "#bfa554" ></ c1-flex-chart-line-style > < c1-flex-chart-line-style c1-property = "signalLine" stroke = "#bf8c54" ></ c1-flex-chart-line-style > </ c1-flex-chart-macd > < c1-flex-chart-macd-histogram binding = "Close" fast-period = "12" slow-period = "26" smoothing-period = "9" name = "MACD Histogram" ></ c1-flex-chart-macd-histogram > < c1-flex-chart-stochastic binding = "High,Low,Open,Close" k-period = "14" d-period = "3" smoothing-period = "1" name = "%K,%D" > < c1-flex-chart-line-style c1-property = "kLine" stroke = "#eddd46" ></ c1-flex-chart-line-style > < c1-flex-chart-line-style c1-property = "dLine" stroke = "#edb747" ></ c1-flex-chart-line-style > </ c1-flex-chart-stochastic > < c1-flex-chart-tooltip content = "tooltip" ></ c1-flex-chart-tooltip > </ c1-financial-chart > @section Settings{ < div class = "panel-body" > <!-- Indicator Selector --> < ul class = "list-inline" > < li > < label > @Html .Raw(Home.Indicators_IndicatorType)</ label > < c1-combo-box id = "indicatorSel" selected-value-path = "Abbreviation" display-member-path = "Name" selected-index-changed = "updateIndicatorType" is-editable = "false" > < c1-items-source source-collection = "indicators" ></ c1-items-source > </ c1-combo-box > </ li > </ ul > <!-- ATR Properties --> < ul class = "list-inline" id = "atr" > < li > < label > @Html .Raw(Home.Indicators_Period)</ label > < c1-input-number min = "2" step = "1" format = "n0" max = "@(Model.Count-1)" value = "14" value-changed = "updateATRPeriod" ></ c1-input-number > </ li > </ ul > <!-- RSI Properties --> < ul class = "list-inline" id = "rsi" > < li > < label > @Html .Raw(Home.Indicators_Period)</ label > < c1-input-number min = "2" step = "1" format = "n0" max = "@(Model.Count-1)" value = "14" value-changed = "updateRSIPeriod" ></ c1-input-number > </ li > </ ul > <!-- CCI Properties --> < ul class = "list-inline" id = "cci" > < li > < label > @Html .Raw(Home.Indicators_Period)</ label > < c1-input-number min = "2" step = "1" format = "n0" max = "@(Model.Count-1)" value = "20" value-changed = "updateCCIPeriod" ></ c1-input-number > </ li > </ ul > <!-- Williams %R Properties --> < ul class = "list-inline" id = "williamsR" > < li > < label > @Html .Raw(Home.Indicators_Period)</ label > < c1-input-number min = "2" step = "1" format = "n0" max = "@(Model.Count-1)" value = "14" value-changed = "updateWilliamsRPeriod" ></ c1-input-number > </ li > </ ul > <!-- MACD & MACD Histogram Properties --> < ul class = "list-inline" id = "macd" > < li > < label > @Html .Raw(Home.Indicators_FastPeriod)</ label > < c1-input-number min = "2" step = "1" format = "n0" max = "@(Model.Count-1)" value = "12" value-changed = "updateFastPeriod" ></ c1-input-number > </ li > < li > < label > @Html .Raw(Home.Indicators_SlowPeriod)</ label > < c1-input-number min = "2" step = "1" format = "n0" max = "@(Model.Count-1)" value = "26" value-changed = "updateSlowPeriod" ></ c1-input-number > </ li > < li > < label > @Html .Raw(Home.Indicators_SignalSmoothingPeriod)</ label > < c1-input-number min = "2" step = "1" format = "n0" max = "@(Model.Count-1)" value = "9" value-changed = "updateSmoothingPeriod" ></ c1-input-number > </ li > </ ul > <!-- Fast Stochastic Properties --> < ul class = "list-inline" id = "stoch" > < li > < label > @Html .Raw(Home.Indicators_KPeriod)</ label > < c1-input-number min = "2" step = "1" format = "n0" max = "@(Model.Count-1)" value = "14" value-changed = "updateKPeriod" ></ c1-input-number > </ li > < li > < label > @Html .Raw(Home.Indicators_DPeriod)</ label > < c1-input-number min = "2" step = "1" format = "n0" max = "@(Model.Count-1)" value = "3" value-changed = "updateDPeriod" ></ c1-input-number > </ li > < li > < label > @Html .Raw(Home.Indicators_SmoothingPeriod)</ label > < c1-input-number min = "1" step = "1" format = "n0" max = "@(Model.Count-1)" value = "1" value-changed = "updateStochSmoothingPeriod" ></ c1-input-number > </ li > </ ul > </ div > } @section Description{ < p > @Html .Raw(Home.Indicators_Text0)</ p > } @section Summary{ < p > @Html .Raw(Home.Indicators_Text1)</ p > } |