从逗号文本文件计算指数移动平均值 [英] Calculating Exponential Moving Average from comma text file

查看:77
本文介绍了从逗号文本文件计算指数移动平均值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要获得指数移动平均线并在datagridview中显示

所有索引和单个索引



谢谢

解决方案

主要问题是你操作DataGridViewCells而不是数据。我建议从UI中分离计算代码。



步骤:



  1. 创建自定义类 [ ^ ],假设: CEM with公共字段(项目数据关闭 Sma Ema )。
  2. 创建列表< CEM> [ ^ ]并提供将数据加载到其中的方法。
  3. 排序 [ ^ ] List< CEM> on 日期字段
  4. 计算 Sma Ema 字段。使用列表< CEM> 索引 [ ^ ]用于计算或使用 Linq [ ^ ]方法。
  5. 最后,加载数据到DataGridView





这就是全部。试试!

I need to get Exponential Moving Average and show it in datagridview
by all index and by single index

thank you

解决方案

The main problem is that you operate on DataGridViewCells instead of data. I'd suggest to separate code for calculations from UI.

Steps to do:


  1. Create custom class[^], let's say: CEM with public fields (Item, Data, Close, Sma, Ema).
  2. Create List<CEM>[^] and provide method to load data into it.
  3. Sort[^] List<CEM> on Date field
  4. Calculate Sma and Ema fields. Use List<CEM> index[^] for calculations or use Linq[^] methods.
  5. Finally, load data into DataGridView



That's all. Try!


这篇关于从逗号文本文件计算指数移动平均值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆