Beispiel #1
0
        public override void ProcessSignal(List <ISignal> signalList)
        {
            var cl = signalList.Where(v => v.Name.EndsWith("RecentHighPriceCondition")).ToList();

            if (cl == null || cl.Count() == 0)
            {
                return;
            }

            cl.ForEach(v =>
            {
                var info = CurrentPortfolio.PositionList.FirstOrDefault(i => i.InstrumentTicker == v.Ticker);

                if (info != null && info.Shares == 0)
                {
                    var o = CurrentPortfolio.GenerateOrderByPercent(v.Ticker, v.Price, percent, OrderType.Buy);
                    if (o != null)
                    {
                        o.OrderTime = v.Time;
                        //info.ProcessOrder(o);
                        OrderList.Add(o);
                    }
                }
            });
        }
Beispiel #2
0
        IOrder Judgement()
        {
            var inst  = GetInstrumentList().FirstOrDefault(v => v.Ticker == CurrentTicker);
            var price = 0d;

            if (inst != null)
            {
                price = inst.CurrentPrice;
            }

            if (IsSlowOverFast && LastSlowValue < LastFastValue)
            {
                IsSlowOverFast = false;
                return(CurrentPortfolio.GenerateOrder(inst.Ticker, price, Order.MinOperationShares, OrderType.Buy));
            }

            if (!IsSlowOverFast && LastSlowValue < LastFastValue)
            {
                IsSlowOverFast = true;
                return(CurrentPortfolio.GenerateOrder(inst.Ticker, price, Order.MinOperationShares, OrderType.Sell));
            }
            return(null);
        }
 protected virtual void OnApplySetting()
 {
     CurrentPortfolio.ApplyStrategySettings(Settings);
     IsDirty = false;
 }