Example #1
0
 public bool SellAtLimit(WealthLab.Position pos, double limitPrice)
 {
     return SellAtLimit(pos, limitPrice, string.Empty);
 }
Example #2
0
 public bool SellAtLimit(WealthLab.Position pos, double limitPrice, string signalName)
 {
     PrintDebug(Alerts.Count);
     bool result = base.SellAtLimit(bar + 1, pos, limitPrice, signalName);
     PrintDebug(Alerts.Count);
     return result;
 }
        Bars IBars2WLBars(string symbol, WealthLab.BarScale scale, int barInterval, IBars bars, bool includePartialBar)
        {
            l.Debug("IBars2WLBars");
            WealthLab.Bars result = new WealthLab.Bars(symbol, scale, barInterval);

            IBar b = bars.First;

            while (b != bars.Last)
            {
                result.Add(b.GetDateTime(), b.Open, b.High, b.Low, b.Close, b.Volume);
                b = bars.GetNext(b);
            }

            //            bars.NewBarEvent += bars_NewBarEvent;

            if (b != null) // а значит указывает на Last
            {
                if ((!includePartialBar)&&((result.Date[result.Count - 1] + bars.scale.ToTimeSpan()) < (DateTime.Now - sec3)))
                    result.Add(b.GetDateTime(), b.Open, b.High, b.Low, b.Close, b.Volume);
                if (includePartialBar)
                {
                    result.Open.PartialValue = b.Open;;
                    result.Close.PartialValue = b.Close;
                    result.High.PartialValue = b.High;
                    result.Low.PartialValue = b.Low;
                    result.Volume.PartialValue = b.Volume;
                }
            }

            l.Debug("IBars2WLBars result.Count " + result.Count);
            return result;
        }