/// <summary>
        /// Called whenever we got a trade signal
        /// </summary>
        /// <param name="f"></param>
        public override void GotFill(Trade fill)
        {
            // make sure every fill is tracked against a position
            int sizebefore = _pt[fill.symbol].Size;

            _pt.Adjust(fill);
            if (_pt.Count > 0 && _pt[0].Size < 0)
            {
                Console.WriteLine("yo");
            }
            bool isclosing = (sizebefore) * fill.xsize < 0;

            if (isclosing)
            {
                decimal pl = Calc.Sum(Calc.AbsoluteReturn(_pt));
                TotalProfit = pl;
            }
            // get index for this symbol
            int idx = _wait.getindex(fill.symbol);

            // ignore unknown symbols
            if (idx < 0)
            {
                return;
            }
            // stop waiting
            _wait[fill.symbol] = false;
            //Console.WriteLine(_pt[0]);
#if DEBUG
            FormatLog(_pt[0].ToString());
            //debugWriter.WriteLine(line);
#endif
            if (TotalProfit > 10)
            {
                Console.WriteLine(fill.xdate.ToString() + " " + TotalProfit.ToString());
            }
        }
Пример #2
0
 public string DisplayLine()
 {
     return(Description.PadRight(nameColumnWidth) + "|" + TradeCount.ToString().PadRight(columnWidth) + "|" + ProfitFactor.ToString("0.00").PadRight(columnWidth) + "|$" +
            TotalProfit.ToString("0.00").PadRight(columnWidth) + "|$" + SpreadCost.ToString("0.00").PadRight(columnWidth) + "|" +
            WinPercent.ToString("0.00").PadRight(columnWidth) + "%");
 }