public bool downloadAroon(string folderPath, string scriptName, bool bIsTestOn, bool bSaveData)
        {
            string interval = ddlAroon_Interval.SelectedValue;
            string period   = textboxAroon_Period.Text;

            if (StockApi.getAROON(folderPath, scriptName, day_interval: interval, period: period, bIsTestModeOn: bIsTestOn, bSaveData: bSaveData, apiKey: Session["ApiKey"].ToString()) == null)
            {
                Response.Write("<script language=javascript>alert('AROON data not available for selected script.')</script>");
                return(false);
            }
            return(true);
        }
Exemple #2
0
        public void ShowGraph(string scriptName)
        {
            string    folderPath = Server.MapPath("~/scriptdata/");
            bool      bIsTestOn = true;
            DataTable scriptData = null;
            DataTable tempData = null;
            string    expression = "";
            string    interval = "";
            string    period = "";
            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["period"] != null))
                {
                    interval   = Request.QueryString["interval"];
                    period     = Request.QueryString["period"];
                    scriptData = StockApi.getAROON(folderPath, scriptName, day_interval: interval, period: period,
                                                   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
                ///
                (chartAROON.Series["seriesAROON_Down"]).XValueMember  = "Date";
                (chartAROON.Series["seriesAROON_Down"]).XValueType    = ChartValueType.Date;
                (chartAROON.Series["seriesAROON_Down"]).YValueMembers = "Aroon Down";
                //(chartAROON.Series["seriesAROON_Down"]).ToolTip = "AROON Down: Date:#VALX;   Value:#VALY";

                (chartAROON.Series["seriesAROON_Up"]).XValueMember  = "Date";
                (chartAROON.Series["seriesAROON_Up"]).XValueType    = ChartValueType.Date;
                (chartAROON.Series["seriesAROON_Up"]).YValueMembers = "Aroon Up";
                //(chartAROON.Series["seriesAROON_Up"]).ToolTip = "AROON Up: Date:#VALX;   Value:#VALY";

                chartAROON.ChartAreas["chartareaAROON"].AxisX.Title          = "Date";
                chartAROON.ChartAreas["chartareaAROON"].AxisX.TitleAlignment = System.Drawing.StringAlignment.Center;
                chartAROON.ChartAreas["chartareaAROON"].AxisY.Title          = "Value";
                chartAROON.ChartAreas["chartareaAROON"].AxisY.TitleAlignment = System.Drawing.StringAlignment.Center;

                //chartAROON.Titles["titleAROON"].Text = $"{"AROON- "}{scriptName}";

                if (chartAROON.Annotations.Count > 0)
                {
                    chartAROON.Annotations.Clear();
                }

                chartAROON.DataSource = scriptData;
                chartAROON.DataBind();
            }
        }