Using Bollinger bands is considered a useful analytical methodology for assessing
the value of a stock, and as such this application includes a Bollinger band graph.
As for implementation, it??™s identical to that used for the price history graph. A web
form called PHBB.aspx hosts a ZedGraph control. This form accepts the stock ticker and
number of days parameters in the same manner as earlier. Instead of adding a single
curve to the chart, you add three curves: the price history, the upper Bollinger band,
and the lower Bollinger band. Here??™s the code that generates the Bollinger bands:
protected void ZedGraphWeb1_RenderGraph(System.Drawing.Graphics g,
ZedGraph.MasterPane mPane)
{
int nDays = 0;
int nRows = 0;
GraphPane pane = mPane[0];
string days = (string)Page.Request.Params["days"];
string ticker = (string)Page.Request.Params["ticker"];
CHAPTER 10 ?– BUILDING A SAMPLE APPLICATION USING ASP.NET AJAX 250
if (ticker != null)
{
ticker = ticker.Trim();
DataTier theDataTier = new DataTier();
if (days == null)
nDays = 0;
else
nDays = Convert.ToInt32(days);
DataTable dtTable = theDataTier.
Pages:
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