GetFullPriceHistory(ticker, nDays);
nRows = dtTable.Rows.Count;
double[] nx = new double[nRows-1];
double[] ny = new double[nRows-1];
double[] bbh = new double[nRows-1];
double[] bbl = new double[nRows-1];
double[] pht = new double[20];
int nIndex = 0;
for (int i = nRows-1; i > 0; i--)
{
ny[nIndex] = Convert.ToDouble(dtTable.Rows[i].ItemArray[1]);
XDate tmpDate = new
XDate(Convert.ToDateTime(dtTable.Rows[i].ItemArray[0]));
nx[nIndex] = (double)tmpDate;
if (nIndex > 20)
{
int x = 0;
for (int n = nIndex - 20; n < nIndex; n++)
{
pht[x] = ny[n];
x++;
}
bbh[nIndex] = GetAverage(pht)
+ (2 * GetStandardDeviation(pht));
bbl[nIndex] = GetAverage(pht)
- (2 * GetStandardDeviation(pht));
}
else
{
bbh[nIndex] = ny[nIndex];
bbl[nIndex] = ny[nIndex];
}
CHAPTER 10 ?– BUILDING A SAMPLE APPLICATION USING ASP.NET AJAX 251
nIndex++;
}
pane.XAxis.Type = AxisType.Date;
pane.XAxis.GridDashOff = 0;
pane.AddCurve("Closing Price", nx,
ny, Color.SlateBlue, SymbolType.None);
pane.AddCurve("High BB", nx,
bbh, Color.Red, SymbolType.None);
pane.AddCurve("Low BB", nx,
bbl, Color.
Pages:
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