public bool downloadSTOCH(string folderPath, string scriptName, bool bIsTestOn, bool bSaveData) { string interval = ddlSTOCH_Interval.SelectedValue; string Fastkperiod = textboxSTOCH_Fastkperiod.Text; string Slowkperiod = textboxSTOCH_Slowkperiod.Text; string Slowdperiod = textboxSTOCH_Slowdperiod.Text; string Slowkmatype = ddlSTOCH_Slowkmatype.SelectedValue; string Slowdmatype = ddlSTOCH_Slowdmatype.SelectedValue; if (StockApi.getSTOCH(folderPath, scriptName, day_interval: interval, fastkperiod: Fastkperiod, slowkperiod: Slowkperiod, slowdperiod: Slowdperiod, slowkmatype: Slowkmatype, slowdmatype: Slowdmatype, bIsTestModeOn: bIsTestOn, bSaveData: bSaveData, apiKey: Session["ApiKey"].ToString()) == null) { Response.Write("<script language=javascript>alert('STOCH data not available for selected script.')</script>"); return(false); } return(true); }
public void ShowGraph(string scriptName) { string folderPath = Server.MapPath("~/scriptdata/"); bool bIsTestOn = true; DataTable scriptData = null; DataTable tempData = null; string expression = ""; string interval = ""; string fastkperiod = ""; string slowkperiod = ""; string slowdperiod = ""; string slowkmatype = ""; string slowdmatype = ""; string fromDate = "", toDate = ""; DataRow[] filteredRows = null; if (ViewState["FetchedData"] == null) { if (Session["IsTestOn"] != null) { bIsTestOn = System.Convert.ToBoolean(Session["IsTestOn"]); } if (Session["TestDataFolder"] != null) { folderPath = Session["TestDataFolder"].ToString(); } if ((Request.QueryString["interval"] != null) && (Request.QueryString["fastkperiod"] != null) && (Request.QueryString["slowkperiod"] != null) && (Request.QueryString["slowdperiod"] != null) && (Request.QueryString["slowkmatype"] != null) && (Request.QueryString["slowdmatype"] != null)) { interval = Request.QueryString["interval"]; fastkperiod = Request.QueryString["fastkperiod"].ToString(); slowkperiod = Request.QueryString["slowkperiod"].ToString(); slowdperiod = Request.QueryString["slowdperiod"].ToString(); slowkmatype = Request.QueryString["slowkmatype"].ToString(); slowdmatype = Request.QueryString["slowdmatype"].ToString(); scriptData = StockApi.getSTOCH(folderPath, scriptName, day_interval: interval, fastkperiod: fastkperiod, slowkperiod: slowkperiod, slowdperiod: slowdperiod, slowkmatype: slowkmatype, slowdmatype: slowdmatype, bIsTestModeOn: bIsTestOn, bSaveData: false); } ViewState["FetchedData"] = scriptData; } else { if (ViewState["FromDate"] != null) { fromDate = ViewState["FromDate"].ToString(); } if (ViewState["ToDate"] != null) { toDate = ViewState["ToDate"].ToString(); } if ((fromDate.Length > 0) && (toDate.Length > 0)) { tempData = (DataTable)ViewState["FetchedData"]; expression = "Date >= '" + fromDate + "' and Date <= '" + toDate + "'"; filteredRows = tempData.Select(expression); if ((filteredRows != null) && (filteredRows.Length > 0)) { scriptData = filteredRows.CopyToDataTable(); } } else { scriptData = (DataTable)ViewState["FetchedData"]; } } if (scriptData != null) { ////time,Real Lower Band,Real Middle Band,Real Upper Band /// (chartSTOCH.Series["seriesSlowK"]).XValueMember = "Date"; (chartSTOCH.Series["seriesSlowK"]).XValueType = ChartValueType.Date; (chartSTOCH.Series["seriesSlowK"]).YValueMembers = "SlowK"; //(chartSTOCH.Series["seriesSlowK"]).ToolTip = "SlowK: Date:#VALX; Value:#VALY"; chartSTOCH.ChartAreas["chartareaSlowK"].AxisX.Title = "Date"; chartSTOCH.ChartAreas["chartareaSlowK"].AxisX.TitleAlignment = System.Drawing.StringAlignment.Center; chartSTOCH.ChartAreas["chartareaSlowK"].AxisY.Title = "SlowK Value"; chartSTOCH.ChartAreas["chartareaSlowK"].AxisY.TitleAlignment = System.Drawing.StringAlignment.Center; (chartSTOCH.Series["seriesSlowD"]).XValueMember = "Date"; (chartSTOCH.Series["seriesSlowD"]).XValueType = ChartValueType.Date; (chartSTOCH.Series["seriesSlowD"]).YValueMembers = "SlowD"; //(chartSTOCH.Series["seriesSlowD"]).ToolTip = "SlowD: Date:#VALX; Value:#VALY"; chartSTOCH.ChartAreas["chartareaSlowD"].AxisX.Title = "Date"; chartSTOCH.ChartAreas["chartareaSlowD"].AxisX.TitleAlignment = System.Drawing.StringAlignment.Center; chartSTOCH.ChartAreas["chartareaSlowD"].AxisY.Title = "SlowD Value"; chartSTOCH.ChartAreas["chartareaSlowD"].AxisY.TitleAlignment = System.Drawing.StringAlignment.Center; //chartSTOCH.Titles["titleSTOCH"].Text = $"{"Stochastic Oscillator- "}{scriptName}"; if (chartSTOCH.Annotations.Count > 0) { chartSTOCH.Annotations.Clear(); } chartSTOCH.DataSource = scriptData; chartSTOCH.DataBind(); } }