public bool downloadRSI(string folderPath, string scriptName, bool bIsTestOn, bool bSaveData) { string interval = ddlRSI_Interval.SelectedValue; string period = textboxRSI_Period.Text; string series = ddlRSI_Series.SelectedValue; if (StockApi.getRSI(folderPath, scriptName, day_interval: interval, period: period, seriestype: series, bIsTestModeOn: bIsTestOn, bSaveData: bSaveData, apiKey: Session["ApiKey"].ToString()) == null) { Response.Write("<script language=javascript>alert('RSI 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 period = ""; string seriestype = ""; string interval = ""; 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["period"] != null) && (Request.QueryString["interval"] != null) && (Request.QueryString["seriestype"] != null)) { interval = Request.QueryString["interval"]; period = Request.QueryString["period"].ToString(); seriestype = Request.QueryString["seriestype"].ToString(); scriptData = StockApi.getRSI(folderPath, scriptName, day_interval: interval, period: period, seriestype: seriestype, 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 /// (chartRSI.Series["seriesRSI"]).XValueMember = "Date"; (chartRSI.Series["seriesRSI"]).XValueType = ChartValueType.Date; (chartRSI.Series["seriesRSI"]).YValueMembers = "RSI"; //(chartRSI.Series["seriesRSI"]).ToolTip = "RSI: Date:#VALX; Value:#VALY"; chartRSI.ChartAreas["chartareaRSI"].AxisX.Title = "Date"; chartRSI.ChartAreas["chartareaRSI"].AxisX.TitleAlignment = System.Drawing.StringAlignment.Center; chartRSI.ChartAreas["chartareaRSI"].AxisY.Title = "Value"; chartRSI.ChartAreas["chartareaRSI"].AxisY.TitleAlignment = System.Drawing.StringAlignment.Center; //chartRSI.Titles["titleRSI"].Text = $"{"Relative Strength Index- "}{scriptName}"; if (chartRSI.Annotations.Count > 0) { chartRSI.Annotations.Clear(); } chartRSI.DataSource = scriptData; chartRSI.DataBind(); } }