Ejemplo n.º 1
0
        void S_OnStatsCaculated(object sender, Statistics.StatsCalculatedEvent e)
        {
            string position = E.A_EMA1 + "-" + E.A_EMA2 + "     " + E.B_EMA1 + "-" + E.B_EMA2 + "      " + E.C_EMA + "\n" + e.SumStats.Total_Avg_PL;

            form.UpdatePos(position);

            if (e.SumStats.Total_Avg_PL > 10 || e.SumStats.Total_Avg_PL < -10)//(e.SumStats.TotalProfit > maxprof)
            {
                //maxprof = e.SumStats.TotalProfit;
                StringBuilder stat = new StringBuilder("");


                Debug.WriteLine("============STATS==============");
                Debug.WriteLine("Total PL " + e.SumStats.TotalProfit);
                Debug.WriteLine("# Trades " + e.SumStats.TradeCount);
                Debug.WriteLine("Tot Avg PL " + e.SumStats.Total_Avg_PL);
                Debug.WriteLine("Prof % " + e.SumStats.Pct_Prof);
                Debug.WriteLine("Loss % " + e.SumStats.Pct_Loss);
                Debug.WriteLine("Take P " + takep);
                Debug.WriteLine("Take L " + takel);

                stat.Append("============STATS==============");
                stat.Append("\nTotal PL " + e.SumStats.TotalProfit);
                stat.Append("\n# Trades " + e.SumStats.TradeCount);
                stat.Append("\nTot Avg PL " + e.SumStats.Total_Avg_PL);
                stat.Append("\nProf % " + e.SumStats.Pct_Prof);
                stat.Append("\nLoss % " + e.SumStats.Pct_Loss);
                stat.Append("\nTake P " + takep);
                stat.Append("\nTake L " + takel);

                form.UpdateDisplay(stat.ToString());

                SimDBDataContext dc  = new SimDBDataContext();
                tbl2Min          tbl = new tbl2Min()
                {
                    Trades      = (int)e.SumStats.TradeCount,
                    TotalPL     = (int)e.SumStats.TotalProfit,
                    AvgPL       = e.SumStats.Total_Avg_PL,
                    Win         = e.SumStats.Pct_Prof,
                    Loose       = e.SumStats.Pct_Loss,
                    E_A1        = E.A_EMA1,
                    E_A2        = E.A_EMA2,
                    E_B1        = E.B_EMA1,
                    E_B2        = E.B_EMA2,
                    E_C         = E.C_EMA,
                    Period      = 2012,
                    CloseEndDay = "True",
                };
                dc.tbl2Mins.InsertOnSubmit(tbl);
                dc.SubmitChanges();
            }
        }
        void S_OnStatsCaculated(object sender, Statistics.StatsCalculatedEvent e)
        {
            string position = E.A_EMA1 + "-" + E.A_EMA2 + "     " + E.B_EMA1 + "-" + E.B_EMA2 + "      " + E.C_EMA + "\n" + e.SumStats.Total_Avg_PL;
            form.UpdatePos(position);

            if (e.SumStats.Total_Avg_PL>10 || e.SumStats.Total_Avg_PL<-10)//(e.SumStats.TotalProfit > maxprof)
            {
                //maxprof = e.SumStats.TotalProfit;
                StringBuilder stat = new StringBuilder("");
              

                Debug.WriteLine("============STATS==============");
                Debug.WriteLine("Total PL " + e.SumStats.TotalProfit);
                Debug.WriteLine("# Trades " + e.SumStats.TradeCount);
                Debug.WriteLine("Tot Avg PL " + e.SumStats.Total_Avg_PL);
                Debug.WriteLine("Prof % " + e.SumStats.Pct_Prof);
                Debug.WriteLine("Loss % " + e.SumStats.Pct_Loss);
                Debug.WriteLine("Take P " + takep);
                Debug.WriteLine("Take L " + takel);

                stat.Append("============STATS==============");
                stat.Append("\nTotal PL " + e.SumStats.TotalProfit);
                stat.Append("\n# Trades " + e.SumStats.TradeCount);
                stat.Append("\nTot Avg PL " + e.SumStats.Total_Avg_PL);
                stat.Append("\nProf % " + e.SumStats.Pct_Prof);
                stat.Append("\nLoss % " + e.SumStats.Pct_Loss);
                stat.Append("\nTake P " + takep);
                stat.Append("\nTake L " + takel);

                form.UpdateDisplay(stat.ToString());

                SimDBDataContext dc = new SimDBDataContext();
                tbl2Min tbl = new tbl2Min()
                {
                    Trades = (int)e.SumStats.TradeCount,
                    TotalPL = (int)e.SumStats.TotalProfit,
                    AvgPL = e.SumStats.Total_Avg_PL,
                    Win = e.SumStats.Pct_Prof,
                    Loose = e.SumStats.Pct_Loss,
                    E_A1 = E.A_EMA1,
                    E_A2 = E.A_EMA2,
                    E_B1 = E.B_EMA1,
                    E_B2 = E.B_EMA2,
                    E_C = E.C_EMA,
                    Period = 2012,
                    CloseEndDay = "True",

                };
                  dc.tbl2Mins.InsertOnSubmit(tbl);
                  dc.SubmitChanges();
            }
        }