Пример #1
0
        public static void AddStratgyInfo(string pathName, TradeStrategyInfo strategyInfo)
        {
            if (m_StratgyInfoDic.ContainsKey(pathName))
            {
                m_StratgyInfoDic.Remove(pathName);
            }

            m_StratgyInfoDic.Add(pathName, strategyInfo);
        }
Пример #2
0
        internal void SetExitsData(TradeStrategyInfo info, string pathName)
        {
            //先清空所有的之前的数据
            ClearAndDefult();

            m_pathName = pathName;

            //添加交易的表数据
            foreach (StandardTradingInfo i in info.StrategyTradeInfoList)
            {
                m_tradeList.Add(i);
            }

            //添加回测的数据汇总和MC对照
            if (m_tradeList.Count > 0)
            {
                this.textBox_RenkoHigh.Text    = m_tradeList[0].RenkoHight.ToString();
                this.textBox_allTradeCout.Text = m_tradeList.Count.ToString();

                double yingLiCout   = 0.00;
                double kuiSunCout   = 0.00;
                double needRenkoNum = 0.00;
                foreach (StandardTradingInfo i in m_tradeList)
                {
                    if (i.LastCloseProfit <= 0)
                    {
                        kuiSunCout = kuiSunCout + 1;
                    }
                    else
                    {
                        yingLiCout = yingLiCout + 1;
                    }

                    if (i.RenkoCommision < 0)
                    {
                        needRenkoNum = needRenkoNum + 1;
                    }
                }

                this.textBox_KuiSunCout.Text = kuiSunCout.ToString();
                this.textBox_YingliCout.Text = yingLiCout.ToString();
                this.textBox_LastBarNum.Text = m_tradeList[m_tradeList.Count - 1].BarNum;
                this.textBox_Symbol.Text     = m_tradeList[0].Symbol;

                this.textBox_needRenkoNum.Text = needRenkoNum.ToString();

                this.textBox_InitQuality.Text = info.StrategyMonetSet;
                this.textBox_EvetyLoss.Text   = info.StrategyCommisionSet;
                this.textBox_OpenShares.Text  = info.StrategyOpenShares;
            }
        }
Пример #3
0
        /// <summary>
        /// 生成不加砖的资金曲线(但是加手续费)/生成加砖的资金曲线(也要加上手续费)
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button_Cal_Click(object sender, EventArgs e)
        {
            if (radioButton_MoneyVisual.Checked)
            {
                this.chart1.Series[0].Points.Clear();
                this.chart1.Series[1].Points.Clear();

                double noAddRenkoButAddCommisonQualitySeries = 0.00;
                double.TryParse(this.textBox_InitQuality.Text, out noAddRenkoButAddCommisonQualitySeries);


                double commisionValue = 0.00;
                double.TryParse(this.textBox_EvetyLoss.Text, out commisionValue);

                double openshares = 0.00;
                double.TryParse(this.textBox_OpenShares.Text, out openshares);


                for (int i = 0; i < m_tradeList.Count; i++)
                {
                    noAddRenkoButAddCommisonQualitySeries = noAddRenkoButAddCommisonQualitySeries + ((m_tradeList[i].LastCloseProfit) * m_tradeList[i].BigPointValue - commisionValue) * openshares;
                    this.chart1.Series[0].Points.AddXY(i, noAddRenkoButAddCommisonQualitySeries);
                }

                double addRenkoAddCommisonQualitySeries = 0.00;
                double.TryParse(this.textBox_InitQuality.Text, out addRenkoAddCommisonQualitySeries);

                for (int i = 0; i < m_tradeList.Count; i++)
                {
                    addRenkoAddCommisonQualitySeries = addRenkoAddCommisonQualitySeries + ((m_tradeList[i].LastCloseProfit + m_tradeList[i].RenkoCommision * 2) * m_tradeList[i].BigPointValue - commisionValue) * openshares;
                    this.chart1.Series[1].Points.AddXY(i, addRenkoAddCommisonQualitySeries);
                }
            }

            //保存目前设置的所有数据(每点击一次,清空之前保存的,保留现在最新的)
            TradeStrategyInfo info = new TradeStrategyInfo();

            info.StrategyCommisionSet  = this.textBox_EvetyLoss.Text;
            info.StrategyMonetSet      = this.textBox_InitQuality.Text;
            info.StrategyPathName      = m_pathName;
            info.StrategyTradeInfoList = m_tradeList.ToList();
            info.StrategyOpenShares    = this.textBox_OpenShares.Text;
            StrategyInfo.AddStratgyInfo(m_pathName, info);

            this.Focus();
        }
Пример #4
0
        public void Cal()
        {
            if (m_StrategyList.Count > 0)
            {
                m_StrategyList.Clear();
            }

            Dictionary <string, TradeStrategyInfo> strategyList = StrategyInfo.StrategyInfoDic;

            foreach (KeyValuePair <string, TradeStrategyInfo> kv in strategyList)
            {
                TradeStrategyInfo info = new TradeStrategyInfo()
                {
                    StrategyPathName      = kv.Key,
                    StrategyCommisionSet  = kv.Value.StrategyCommisionSet,
                    StrategyTradeInfoList = kv.Value.StrategyTradeInfoList,
                    StrategyOpenShares    = kv.Value.StrategyOpenShares
                };

                m_StrategyList.Add(info);
            }
        }
Пример #5
0
 private void HoldSingleStrategyDataAndSet(string pathName, TradeStrategyInfo info)
 {
     this.singleProductBackTestControl1.SetExitsData(info, pathName);
 }