公式错误 - 期间没有足够的数据点。 [英] Formula error - There are not enough data points for the Period.
问题描述
我正在尝试使用MA(15)创建每日数据的股票蜡烛。
我可以创建一个带OHLC条的图表,没有任何问题。
但当我开始使用DataManipulator.FinancialFormula作为MA时,我不断收到"公式错误 - 期间没有足够的数据点"的错误。
有人可以帮我解决这个问题吗?谢谢
以下是代码。
DataSet ds = new DataSet();
SqlConnection connection = new SqlConnection();
connection.ConnectionString = @" Data Source = XXX; Database = Stock; Integrated Security = SSPI;" ;;
   connection.Open();
串SQL = QUOT;选择时间戳,highprice,lowprice,openprice,从daymarketdata closeprice其中tickname = 'GS' 和邮戳> '1/1/2011' 由邮戳递增顺序英寸;
System.Data.SqlClient.SqlCommand CMD =新System.Data.SqlClient.SqlCommand(SQL,连接);
         &NBSP ;  cmd.CommandType = CommandType.Text;
$
SqlDataAdapter sa = new SqlDataAdapter();
sa.SelectCommand = cmd;
$
sa.Fill(ds," Cos");
connection.Close();
chart1.Series [" Daily"]。ChartType = SeriesChartType.Candlestick;
chart1.DataSource = sa;
chart1.DataBind();
chart1.Series ["每日和QUOT] XValueMember = QUOT;日期戳英寸;
            chart1.Series ["每日和QUOT]。YValueMembers = QUOT; HighPrice,LowPrice,OpenPrice,ClosePrice英寸;
         &NBSP ;  chart1.Series [" Daily"]。IsXValueIndexed = true;
  chart1.Series [" Daily"] .BorderColor = System.Drawing.Color.Black;
chart1.Series [" Daily"]。Color = System.Drawing.Color.Black;
chart1.Series ["每日和QUOT] CustomProperties来= QUOT。PriceDownColor =绿色,PriceUpColor =红英寸;
         &NBSP ;  chart1.Series [" Daily"]。XValueType = ChartValueType.Date;
chart1.ChartAreas [0] .AxisY.Minimum = 100;
chart1.ChartAreas [0] .AxisY.Maximum = 180;
chart1.DataManipulator.FinancialFormula(FinancialFormula.MovingAverage," 15","每日和QUOT;," MA");
相同的数据是否适用于静态图表?
也可以检查这一点。
chanmm
I am trying to create a stock candle with MA(15) on daily data.
I can create a chart with OHLC bar without any problem.
But when I started usingDataManipulator.FinancialFormula for MA, I keep getting errors of "Formula error - There are not enough data points for the Period."
Can someone help me out on this? Thanks
Here is the code.
DataSet ds = new DataSet();
SqlConnection connection = new SqlConnection();
connection.ConnectionString = @"Data Source=XXX;Database=Stock;Integrated Security=SSPI;";
connection.Open();
string sql = "Select datestamp, highprice, lowprice,openprice, closeprice from daymarketdata where tickname='GS' and datestamp>'1/1/2011' order by datestamp asc";
System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand(sql, connection);
cmd.CommandType = CommandType.Text;
SqlDataAdapter sa = new SqlDataAdapter();
sa.SelectCommand = cmd;
sa.Fill(ds, "Cos");
connection.Close();
chart1.Series["Daily"].ChartType = SeriesChartType.Candlestick;
chart1.DataSource = sa;
chart1.DataBind();
chart1.Series["Daily"].XValueMember = "DateStamp";
chart1.Series["Daily"].YValueMembers = "HighPrice, LowPrice, OpenPrice, ClosePrice";
chart1.Series["Daily"].IsXValueIndexed = true;
chart1.Series["Daily"].BorderColor = System.Drawing.Color.Black;
chart1.Series["Daily"].Color = System.Drawing.Color.Black;
chart1.Series["Daily"].CustomProperties = "PriceDownColor=Green, PriceUpColor=Red";
chart1.Series["Daily"].XValueType = ChartValueType.Date;
chart1.ChartAreas[0].AxisY.Minimum = 100;
chart1.ChartAreas[0].AxisY.Maximum = 180;
chart1.DataManipulator.FinancialFormula(FinancialFormula.MovingAverage, "15", "Daily", "MA");
Does the same data work with static chart?
Check this out as well.
chanmm
这篇关于公式错误 - 期间没有足够的数据点。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!