示例#1
0
        protected override void OnStopExecuted(Stop stop)
        {
            // 再进场原则,止损后条件还是满足开仓条件
            // 1.必须突破前期高低点/低点
            // 2.必须待了足够长时间

            // 记下前期的高点
            TrailingPrice = new TrailingPrice(StrategyHelper.StatisticsHelper.TrailingPrice);

            StopEx s = stop as StopEx;

            //switch (s.Side)
            //{
            //    case PositionSide.Long:
            //        flgLongStopped = true;
            //        break;
            //    case PositionSide.Short:
            //        flgShortStopped = true;
            //        break;
            //    default:
            //        break;
            //}

            // 止损出场
            //StrategyHelper.ClosePosition(Position, "止损");
        }
示例#2
0
 public StatisticsHelper(Framework framework, SmartQuant.Strategy strategy)
 {
     this.framework     = framework;
     this.strategy      = strategy;
     this.TrailingPrice = new TrailingPrice(framework, strategy);
     this.HighLowPrice  = new HighLowPrice(framework, strategy);
 }
示例#3
0
        protected override void OnStrategyStart()
        {
            StrategyHelper = new StrategyHelper(framework, this);

            StrategyHelper.OpenCloseHelper.SeparateOrder = SeparateOrder.SeparateCloseOpen;
            StrategyHelper.OpenCloseHelper.DefaultClose  = DefaultClose.CloseToday;
            StrategyHelper.OpenCloseHelper.SendStyle     = SendStyle.OneByOne;

            if (Instrument != null)
            {
                InstrumentStrategyHelper InstrumentStrategyHelper = StrategyHelper.GetInstrumentStrategyHelper(Instrument, this);
                InstrumentStrategyHelper.MarketOrderType = SmartQuant.OrderType.Limit;
                InstrumentStrategyHelper.Tick            = 10;

                // 看情况是否要修正
                Console.WriteLine(string.Format("{0},{1}", Instrument.Symbol, InstrumentStrategyHelper.PriceHelper));
                // 如果是在模拟测试,需要修正此处理,防止出现需要用到交易所时间的情况下出错
                // 注意时区
                Console.WriteLine(string.Format("{0},{1}", Instrument.Symbol, InstrumentStrategyHelper.TimeHelper));
            }

            TrailingPrice = new TrailingPrice(framework, this);
        }